Skip to content

Commit

Permalink
Uses positive sign for motor and load torques. Added Modelica model f…
Browse files Browse the repository at this point in the history
…or complete drive.
  • Loading branch information
Dag Brück committed Feb 21, 2024
1 parent c8d39b8 commit 2761bde
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 10 deletions.
Binary file modified examples/DC-Motor2023.ssp
Binary file not shown.
18 changes: 15 additions & 3 deletions examples/DC-Motor2023/models/sse_edrive/emachine.mo
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ model emachine "DC-Motor for a mild hybrid application"
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
Modelica.Blocks.Math.Gain M_gain(k=-1) annotation (Placement(transformation(
extent={{-7,-7},{7,7}},
rotation=90,
origin={75,33})));
equation
connect(currentSensor.i, I)
annotation (Line(points={{-71,0},{-88,0},{-88,-60},{-110,-60}}, color={0,0,127}));
connect(angleToTorqueAdaptor.flange, emf.flange)
annotation (Line(points={{58,0},{50,0}}, color={0,0,0}));
connect(angleToTorqueAdaptor.w, w)
annotation (Line(points={{63,-5},{83,-5},{83,-20},{120,-20}}, color={0,0,127}));
connect(angleToTorqueAdaptor.tau, M)
annotation (Line(points={{63,8},{76,8},{76,60},{110,60}}, color={0,0,127}));
connect(phi, angleToTorqueAdaptor.phi)
annotation (Line(points={{120,-60},{76,-60},{76,-8},{63,-8}}, color={0,0,127}));
connect(resistor.n, inductor.p) annotation (Line(points={{0,60},{40,60},{40,50}}, color={0,0,255}));
Expand All @@ -74,8 +76,18 @@ equation
annotation (Line(points={{-60,50},{-60,60},{-20,60}}, color={0,0,255}));
connect(signalVoltage.n, currentSensor.n)
annotation (Line(points={{-60,30},{-60,10}}, color={0,0,255}));
connect(angleToTorqueAdaptor.tau, M_gain.u)
annotation (Line(points={{63,8},{75,8},{75,24.6}},
color={0,0,127}));
connect(M_gain.y, M) annotation (Line(points={{75,40.7},{75,60},{110,60}},
color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(
preserveAspectRatio=false)),
preserveAspectRatio=false), graphics={Text(
extent={{56,74},{96,64}},
textColor={0,0,0},
textString="Note: interface is defined to use a
positive sign of the torque.",
horizontalAlignment=TextAlignment.Left)}),
__Dymola_UserMetaData(MetaData(category="DC-Motor-el Meta-Data (DC-Motor-el.srmd)", value={{
"Type: de.setlevel.srmd.model-meta-data=",""},{"model.type","physical principle"},{
"physical-principle.family","ex: Electrical"},{"physical-principle.name","ex: motor"},{
Expand Down
96 changes: 96 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/emech.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
within sse_edrive;
model emech "Native Modelica model of emachine and load"
Modelica.Electrical.Analog.Basic.Ground ground
annotation (Placement(transformation(extent={{-60,-60},{-40,-40}})));
Modelica.Electrical.Analog.Basic.Resistor resistor(
R=1,
T_ref=300.15,
alpha=0,
T=300.15) annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=180,
origin={-50,60})));
Modelica.Electrical.Analog.Basic.Inductor inductor(L=0.001, i(start=0)) annotation (Placement(
transformation(
extent={{10,-10},{-10,10}},
rotation=90,
origin={-20,40})));
Modelica.Electrical.Analog.Basic.RotationalEMF emf(k=0.01) annotation (Placement(transformation(
extent={{10,10},{-10,-10}},
rotation=180,
origin={-20,0})));
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=270,
origin={-70,-10})));
Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=90,
origin={-70,30})));
Modelica.Blocks.Interfaces.RealOutput I(unit="A") annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-110,-60})));
Modelica.Blocks.Interfaces.RealInput U(unit="V") annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-120,60})));
Modelica.Mechanics.Rotational.Components.TorqueToAngleAdaptor torqueToAngleAdaptor1(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={50,0})));
Modelica.Mechanics.Rotational.Components.Inertia inertia(
J=0.002,
phi(start=0),
w(start=0),
a(start=0)) annotation (Placement(transformation(extent={{10,-10},{30,10}})));
Modelica.Mechanics.Rotational.Components.Damper damper(d=0.001)
annotation (Placement(transformation(extent={{10,-50},{30,-30}})));
Modelica.Mechanics.Rotational.Components.Fixed fixed
annotation (Placement(transformation(extent={{40,-50},{60,-30}})));
Modelica.Blocks.Interfaces.RealInput M_B(unit="N.m") annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=180,
origin={120,-60})));
Modelica.Blocks.Interfaces.RealOutput wB(unit="rad/s") annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={110,20})));
Modelica.Blocks.Interfaces.RealOutput phiB(unit="rad") annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={110,60})));
equation
connect(currentSensor.i,I)
annotation (Line(points={{-81,-10},{-88,-10},{-88,-60},{-110,-60}},
color={0,0,127}));
connect(resistor.n,inductor. p) annotation (Line(points={{-40,60},{-20,60},{-20,50}},
color={0,0,255}));
connect(emf.p,inductor. n) annotation (Line(points={{-20,10},{-20,30}},
color={0,0,255}));
connect(emf.n,ground. p) annotation (Line(points={{-20,-10},{-20,-40},{-50,-40}},
color={0,0,255}));
connect(ground.p,currentSensor. p)
annotation (Line(points={{-50,-40},{-70,-40},{-70,-20}},color={0,0,255}));
connect(signalVoltage.v,U)
annotation (Line(points={{-82,30},{-90,30},{-90,60},{-120,60}}, color={0,0,127}));
connect(signalVoltage.p,resistor. p)
annotation (Line(points={{-70,40},{-70,60},{-60,60}}, color={0,0,255}));
connect(signalVoltage.n,currentSensor. n)
annotation (Line(points={{-70,20},{-70,0}}, color={0,0,255}));
connect(inertia.flange_b,torqueToAngleAdaptor1. flange)
annotation (Line(points={{30,0},{48,0}}, color={0,0,0}));
connect(torqueToAngleAdaptor1.phi,phiB)
annotation (Line(points={{53,8},{70,8},{70,60},{110,60}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.w,wB)
annotation (Line(points={{53,5},{80,5},{80,20},{110,20}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.tau,M_B)
annotation (Line(points={{53,-8},{80,-8},{80,-60},{120,-60}}, color={0,0,127}));
connect(fixed.flange,damper. flange_b) annotation (Line(points={{50,-40},{30,-40}}, color={0,0,0}));
connect(inertia.flange_a,damper. flange_a)
annotation (Line(points={{10,0},{0,0},{0,-40},{10,-40}}, color={0,0,0}));
connect(emf.flange, inertia.flange_a) annotation (Line(points={{-10,0},{10,0}}, color={0,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(
preserveAspectRatio=false)));
end emech;
32 changes: 27 additions & 5 deletions examples/DC-Motor2023/models/sse_edrive/mass.mo
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ model mass "Rotational mass (load)"
extent={{-10,-10},{10,10}},
rotation=0,
origin={110,60})));
Modelica.Blocks.Math.Gain M_gain(k=-1) annotation (Placement(transformation(
extent={{-5,-5},{5,5}},
rotation=-90,
origin={-80,25})));
Modelica.Blocks.Math.Gain M_gain1(k=-1)
annotation (Placement(transformation(
extent={{5,-5},{-5,5}},
rotation=-90,
origin={80,-30})));
equation
connect(inertia.flange_a, torqueToAngleAdaptor.flange)
annotation (Line(points={{-10,0},{-48,0}}, color={0,0,0}));
connect(inertia.flange_b, torqueToAngleAdaptor1.flange)
annotation (Line(points={{10,0},{48,0}}, color={0,0,0}));
connect(torqueToAngleAdaptor.tau, M_A)
annotation (Line(points={{-53,8},{-80,8},{-80,60},{-120,60}}, color={0,0,127}));
connect(torqueToAngleAdaptor.w, wA)
annotation (Line(points={{-53,-5},{-80.5,-5},{-80.5,-20},{-110,-20}}, color={0,0,127}));
connect(torqueToAngleAdaptor.phi, phiA)
Expand All @@ -52,8 +59,23 @@ equation
annotation (Line(points={{53,8},{70,8},{70,60},{110,60}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.w, wB)
annotation (Line(points={{53,5},{80,5},{80,20},{110,20}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.tau, M_B)
annotation (Line(points={{53,-8},{80,-8},{80,-60},{120,-60}}, color={0,0,127}));
connect(torqueToAngleAdaptor.tau, M_gain.y)
annotation (Line(points={{-53,8},{-80,8},{-80,19.5}},
color={0,0,127}));
connect(M_gain.u, M_A) annotation (Line(points={{-80,31},{-80,60},{-120,60}}, color={0,0,127}));
connect(M_B, M_gain1.u) annotation (Line(points={{120,-60},{80,-60},{80,-36}}, color={0,0,127}));
connect(M_gain1.y, torqueToAngleAdaptor1.tau)
annotation (Line(points={{80,-24.5},{80,-8},{53,-8}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(
preserveAspectRatio=false)));
preserveAspectRatio=false), graphics={Text(
extent={{-94,72},{-54,62}},
textColor={0,0,0},
textString="Note: interface is defined to use a
positive sign of the torque.",
horizontalAlignment=TextAlignment.Left), Text(
extent={{58,-62},{98,-72}},
textColor={0,0,0},
textString="Note: interface is defined to use a
positive sign of the torque.",
horizontalAlignment=TextAlignment.Left)}));
end mass;
1 change: 1 addition & 0 deletions examples/DC-Motor2023/models/sse_edrive/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ emachine
mass
mass_damper
spring_mass
emech
stimuli
test_spring_mass
test
4 changes: 2 additions & 2 deletions examples/DC-Motor2023/models/sse_edrive/test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ model test "Test model for DC-Motor e-machine with load"
emachine my_emachine(emf(k=0.03), resistor(R=0.1))
annotation (Placement(transformation(extent={{-30,-20},{10,20}})));
mass_damper my_mass annotation (Placement(transformation(extent={{40,-20},{80,20}})));
sse_edrive.stimuli stimuli(MLoad(k=1.0), Voltage_step(height=48.0))
sse_edrive.stimuli stimuli(MLoad(k=-1.0),Voltage_step(height=48.0))
annotation (Placement(transformation(rotation=0, extent={{-100,-20},{-60,20}})));
equation
connect(my_emachine.M, my_mass.M_A) annotation (Line(points={{12,12},{36,12}}, color={0,0,127}));
Expand Down Expand Up @@ -74,5 +74,5 @@ equation
timeUnit="s",
displayUnits={"N.m"})} "Plot KPI", file(description="Export FMUs for SSP") =
"Export FMUs.mos" "Export FMUs"),
experiment(StopTime=1, __Dymola_Algorithm="Dassl"));
experiment(StopTime=1.5, __Dymola_Algorithm="Dassl"));
end test;
Binary file modified examples/DC-Motor2023/resources/edrive_mass.fmu
Binary file not shown.
Binary file modified examples/DC-Motor2023/resources/emachine_model.fmu
Binary file not shown.
Binary file modified examples/DC-Motor2023/resources/stimuli_model.fmu
Binary file not shown.

0 comments on commit 2761bde

Please sign in to comment.