Skip to content

Commit

Permalink
Initial version of the example, date 22 October 2021.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Brück committed Feb 6, 2024
1 parent d32a14f commit 7337767
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/DC-Motor2023/models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Models

These are the Modelica source models used to generate the FMUs of this example.
95 changes: 95 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/emachine.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
within sse_edrive;
model emachine
Modelica.Electrical.Analog.Basic.Ground ground
annotation (Placement(transformation(extent={{4,-44},{24,-24}})));
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={-40,68})));

Modelica.Electrical.Analog.Basic.Inductor inductor( L=0.001, i(start=
0))
annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=90,
origin={36,50})));
Modelica.Electrical.Analog.Basic.RotationalEMF emf(k=0.01) annotation (
Placement(transformation(
extent={{10,10},{-10,-10}},
rotation=180,
origin={36,10})));
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation (
Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=270,
origin={-76,18})));
Modelica.Blocks.Interfaces.RealOutput I(unit="A")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-106,-62})));
Modelica.Mechanics.Rotational.Components.AngleToTorqueAdaptor
angleToTorqueAdaptor(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={56,10})));
Modelica.Blocks.Interfaces.RealInput w(unit="rad/s")
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=180,
origin={102,-22})));
Modelica.Blocks.Interfaces.RealInput phi(unit="rad")
annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=180,
origin={102,-62})));
Modelica.Blocks.Interfaces.RealOutput tau(unit="N.m")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={92,60})));
Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-76,54})));
Modelica.Blocks.Interfaces.RealInput U(unit="V") annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-112,54})));
equation
connect(currentSensor.i,I) annotation (Line(points={{-87,18},{-88,18},{-88,-62},{-106,-62}},
color={0,0,127}));
connect(angleToTorqueAdaptor.flange, emf.flange)
annotation (Line(points={{54,10},{46,10}}, color={0,0,0}));
connect(angleToTorqueAdaptor.w, w) annotation (Line(points={{59,5},{79,5},{79,-22},{102,-22}},
color={0,0,127}));
connect(angleToTorqueAdaptor.tau, tau) annotation (Line(points={{59,18},{72,
18},{72,60},{92,60}}, color={0,0,127}));
connect(phi, angleToTorqueAdaptor.phi) annotation (Line(points={{102,-62},{72,-62},{72,2},{59,2}},
color={0,0,127}));
connect(resistor.n, inductor.p)
annotation (Line(points={{-30,68},{36,68},{36,60}}, color={0,0,255}));
connect(emf.p, inductor.n)
annotation (Line(points={{36,20},{36,40}}, color={0,0,255}));
connect(emf.n, ground.p)
annotation (Line(points={{36,0},{36,-24},{14,-24}}, color={0,0,255}));
connect(ground.p, currentSensor.p)
annotation (Line(points={{14,-24},{-76,-24},{-76,8}}, color={0,0,255}));
connect(signalVoltage.n, resistor.p) annotation (Line(points={{-76,64},{-64,
64},{-64,68},{-50,68}}, color={0,0,255}));
connect(signalVoltage.p, currentSensor.n)
annotation (Line(points={{-76,44},{-76,28}}, color={0,0,255}));
connect(signalVoltage.v, U)
annotation (Line(points={{-88,54},{-112,54}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end emachine;
71 changes: 71 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/mass.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
within sse_edrive;
model mass
Modelica.Mechanics.Rotational.Components.TorqueToAngleAdaptor
torqueToAngleAdaptor(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-60,28})));
Modelica.Mechanics.Rotational.Components.TorqueToAngleAdaptor
torqueToAngleAdaptor1(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={74,26})));
Modelica.Mechanics.Rotational.Components.Inertia inertia(J=1e-5,
phi(start=0),
w(start=0),
a(start=0))
annotation (Placement(transformation(extent={{-2,18},{18,38}})));
Modelica.Blocks.Interfaces.RealInput tauA(unit="N.m")
annotation (Placement(transformation(extent={{-126,40},{-86,80}})));
Modelica.Blocks.Interfaces.RealOutput wA(unit="rad/s")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-106,-40})));
Modelica.Blocks.Interfaces.RealOutput phiA(unit="rad")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-108,-68})));
Modelica.Blocks.Interfaces.RealInput tauB(unit="N.m")
annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=180,
origin={104,-64})));
Modelica.Blocks.Interfaces.RealOutput wB(unit="rad/s")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={106,30})));
Modelica.Blocks.Interfaces.RealOutput phiB(unit="rad")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={106,68})));
equation
connect(inertia.flange_a, torqueToAngleAdaptor.flange)
annotation (Line(points={{-2,28},{-58,28}}, color={0,0,0}));
connect(inertia.flange_b, torqueToAngleAdaptor1.flange) annotation (Line(
points={{18,28},{46,28},{46,26},{72,26}}, color={0,0,0}));
connect(torqueToAngleAdaptor.tau, tauA) annotation (Line(points={{-63,36},{-86,36},{-86,60},{-106,60}},
color={0,0,127}));
connect(torqueToAngleAdaptor.w, wA) annotation (Line(points={{-63,23},{-80.5,23},{-80.5,-40},{-106,-40}},
color={0,0,127}));
connect(torqueToAngleAdaptor.phi, phiA) annotation (Line(points={{-63,20},{
-76,20},{-76,-68},{-108,-68}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.phi, phiB) annotation (Line(points={{77,34},{
88,34},{88,68},{106,68}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.w, wB) annotation (Line(points={{77,31},{89.5,31},{89.5,30},{106,30}},
color={0,0,127}));
connect(torqueToAngleAdaptor1.tau, tauB) annotation (Line(points={{77,18},{86,18},{86,-64},{104,-64}},
color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end mass;
7 changes: 7 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
within ;
package sse_edrive "ProSTEP Smart System Engineering DCMmotor example"

annotation (uses(Modelica(version="4.0.0")),
version="1.0.0",
conversion(noneFromVersion=""));
end sse_edrive;
6 changes: 6 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
emachine
mass
spring_mass
stimuli
test_spring_mass
test
84 changes: 84 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/spring_mass.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
within sse_edrive;
model spring_mass
Modelica.Mechanics.Rotational.Components.TorqueToAngleAdaptor
torqueToAngleAdaptor1(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={74,26})));
Modelica.Mechanics.Rotational.Components.Inertia inertia(J=1)
annotation (Placement(transformation(extent={{30,16},{50,36}})));
Modelica.Blocks.Interfaces.RealInput tauB(unit="N.m")
annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=180,
origin={106,-56})));
Modelica.Blocks.Interfaces.RealOutput wB(unit="rad/s")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={106,30})));
Modelica.Blocks.Interfaces.RealOutput phiB(unit="rad")
annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={106,64})));
Modelica.Mechanics.Rotational.Components.AngleToTorqueAdaptor
angleToTorqueAdaptor(use_a=false)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-32,24})));
Modelica.Blocks.Interfaces.RealInput wA(unit="rad/s") annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-110,22})));
Modelica.Blocks.Interfaces.RealInput phiA(unit="rad") annotation (Placement(
transformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-110,58})));
Modelica.Blocks.Interfaces.RealOutput tauA(unit="N.m") annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-106,-60})));
Modelica.Mechanics.Rotational.Components.SpringDamper springDamper(
c=1,
d=1,
phi_rel0=0)
annotation (Placement(transformation(extent={{-6,18},{14,38}})));
Modelica.Mechanics.Rotational.Components.Damper damper(d=1)
annotation (Placement(transformation(extent={{30,-16},{50,4}})));
Modelica.Mechanics.Rotational.Components.Fixed fixed
annotation (Placement(transformation(extent={{58,-18},{78,2}})));
equation
connect(inertia.flange_b, torqueToAngleAdaptor1.flange)
annotation (Line(points={{50,26},{72,26}}, color={0,0,0}));
connect(torqueToAngleAdaptor1.phi, phiB) annotation (Line(points={{77,34},{
88,34},{88,64},{106,64}}, color={0,0,127}));
connect(torqueToAngleAdaptor1.w, wB) annotation (Line(points={{77,31},{89.5,31},{89.5,30},{106,30}},
color={0,0,127}));
connect(torqueToAngleAdaptor1.tau, tauB) annotation (Line(points={{77,18},{86,18},{86,-56},{106,-56}},
color={0,0,127}));
connect(angleToTorqueAdaptor.tau, tauA) annotation (Line(points={{-35,16},{
-42,16},{-42,-60},{-106,-60}}, color={0,0,127}));
connect(phiA, angleToTorqueAdaptor.phi) annotation (Line(points={{-110,58},{-50,58},{-50,32},{-35,32}},
color={0,0,127}));
connect(angleToTorqueAdaptor.w, wA) annotation (Line(points={{-35,29},{-72,29},{-72,22},{-110,22}},
color={0,0,127}));
connect(inertia.flange_a, springDamper.flange_b) annotation (Line(points={{
30,26},{22,26},{22,28},{14,28}}, color={0,0,0}));
connect(springDamper.flange_a, angleToTorqueAdaptor.flange) annotation (
Line(points={{-6,28},{-18,28},{-18,24},{-30,24}}, color={0,0,0}));
connect(damper.flange_a, inertia.flange_a)
annotation (Line(points={{30,-6},{30,26}}, color={0,0,0}));
connect(fixed.flange, damper.flange_b) annotation (Line(points={{68,-8},{60,
-8},{60,-6},{50,-6}}, color={0,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end spring_mass;
20 changes: 20 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/stimuli.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
within sse_edrive;
model stimuli
Modelica.Blocks.Sources.Step Voltage_step(startTime=0, height=12)
annotation (Placement(transformation(extent={{-54,20},{-34,40}})));
Modelica.Blocks.Sources.Constant MLoad(k=0.05)
annotation (Placement(transformation(extent={{-50,-34},{-30,-14}})));
Modelica.Blocks.Interfaces.RealOutput tau_load(unit="N.m") annotation (
Placement(transformation(rotation=0, extent={{90,-90},{110,-70}})));
Modelica.Blocks.Interfaces.RealOutput U(unit="V") annotation (Placement(
transformation(rotation=0, extent={{90,50},{110,70}})));
Modelica.Blocks.Math.Gain gain(k=-1)
annotation (Placement(transformation(extent={{-14,20},{6,40}})));
equation
connect(tau_load, MLoad.y) annotation (Line(points={{100,-80},{46,-80},{46,
-24},{-29,-24}}, color={0,0,127}));
connect(U, gain.y) annotation (Line(points={{100,60},{70,60},{70,30},{7,30}},
color={0,0,127}));
connect(gain.u, Voltage_step.y)
annotation (Line(points={{-16,30},{-33,30}}, color={0,0,127}));
end stimuli;
22 changes: 22 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/test.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
within sse_edrive;
model test
emachine my_emachine
annotation (Placement(transformation(extent={{-28,16},{30,76}})));
mass my_mass
annotation (Placement(transformation(extent={{58,18},{90,74}})));
sse_edrive.stimuli stimuli annotation (Placement(transformation(rotation=0, extent={{-112,28},{-70,70}})));
equation
connect(my_emachine.tau, my_mass.tauA) annotation (Line(points={{27.68,64},
{50.72,64},{50.72,62.8},{57.04,62.8}}, color={0,0,127}));
connect(my_mass.wA, my_emachine.w) annotation (Line(points={{57.04,34.8},{
50.55,34.8},{50.55,39.4},{30.58,39.4}}, color={0,0,127}));
connect(my_mass.phiA, my_emachine.phi) annotation (Line(points={{56.72,
26.96},{51.85,26.96},{51.85,27.4},{30.58,27.4}}, color={0,0,127}));
connect(stimuli.tau_load, my_mass.tauB) annotation (Line(points={{-70,32.2},
{-56,32.2},{-56,-4},{112,-4},{112,28},{102,28},{102,28.08},{90.64,
28.08}}, color={0,0,127}));
connect(stimuli.U, my_emachine.U) annotation (Line(points={{-70,61.6},{-52,
61.6},{-52,62.2},{-31.48,62.2}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end test;
30 changes: 30 additions & 0 deletions examples/DC-Motor2023/models/sse_edrive/test_spring_mass.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
within sse_edrive;
model test_spring_mass
emachine my_emachine
annotation (Placement(transformation(extent={{-104,24},{-28,82}})));
mass mass1 annotation (Placement(transformation(extent={{14,30},{44,78}})));
spring_mass spring_mass1
annotation (Placement(transformation(extent={{78,28},{118,82}})));
Modelica.Blocks.Sources.Step step(height=100)
annotation (Placement(transformation(extent={{-142,68},{-122,88}})));
Modelica.Blocks.Sources.Constant const
annotation (Placement(transformation(extent={{154,24},{174,44}})));
equation
connect(my_emachine.tau, mass1.tauA) annotation (Line(points={{-31.04,70.4},
{-7.28,70.4},{-7.28,68.4},{13.1,68.4}}, color={0,0,127}));
connect(mass1.wA, my_emachine.w) annotation (Line(points={{13.1,44.4},{
-7.45,44.4},{-7.45,46.62},{-27.24,46.62}}, color={0,0,127}));
connect(mass1.phiA, my_emachine.phi) annotation (Line(points={{12.8,37.68},
{-6.15,37.68},{-6.15,35.02},{-27.24,35.02}}, color={0,0,127}));
connect(spring_mass1.tauA, mass1.tauB) annotation (Line(points={{76.8,38.8},
{62.4,38.8},{62.4,38.64},{44.6,38.64}}, color={0,0,127}));
connect(spring_mass1.wA, mass1.wB) annotation (Line(points={{76,60.94},{59,
60.94},{59,61.2},{44.9,61.2}}, color={0,0,127}));
connect(spring_mass1.phiA, mass1.phiB) annotation (Line(points={{76,70.66},
{59,70.66},{59,70.32},{44.9,70.32}}, color={0,0,127}));
connect(const.y, spring_mass1.tauB) annotation (Line(points={{175,34},{148,
34},{148,39.88},{119.2,39.88}}, color={0,0,127}));
connect(step.y, my_emachine.U) annotation (Line(points={{-121,78},{-116,78},{-116,68.66},{-108.56,68.66}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end test_spring_mass;

0 comments on commit 7337767

Please sign in to comment.