From 1fb3559a757614e8bdba687e80fe0fde4a8484d1 Mon Sep 17 00:00:00 2001 From: Raphael Gebhart Date: Mon, 14 Oct 2024 17:59:50 +0200 Subject: [PATCH] New version of IntertedCranCrab and Ideas for Step1-3 --- Tutorial2024/AuxiliaryComponents/CraneCrab.mo | 87 +++++++++++ .../AuxiliaryComponents/CraneCrab2.mo | 46 ++++++ .../AuxiliaryComponents/DryFriction.bak-mo | 5 - .../AuxiliaryComponents/package.order | 2 + .../AuxiliaryComponents/DryFriction.mo | 5 - .../AuxiliaryComponents/ThermalCollector.mo | 5 - .../AuxiliaryComponents/package.bak-mo | 4 - .../AuxiliaryComponents/package.order | 2 - Tutorial2024/StepByStep/Step1_FreeBody2.mo | 13 ++ Tutorial2024/StepByStep/Step2_FixedBody2.mo | 24 ++++ Tutorial2024/StepByStep/Step3_Pendulum2.mo | 77 ++++++++++ .../StepByStep/Step5_ActuatedCraneCrab.bak-mo | 53 ------- .../StepByStep/Step7_InvertedCraneCrab2.mo | 30 ++++ .../StepByStep/Step7_InvertedCraneCrab3.mo | 40 ++++++ .../StepByStep/Step9_PositionControl.bak-mo | 135 ------------------ Tutorial2024/StepByStep/package.order | 5 + 16 files changed, 324 insertions(+), 209 deletions(-) create mode 100644 Tutorial2024/AuxiliaryComponents/CraneCrab.mo create mode 100644 Tutorial2024/AuxiliaryComponents/CraneCrab2.mo delete mode 100644 Tutorial2024/AuxiliaryComponents/DryFriction.bak-mo delete mode 100644 Tutorial2024/StepByStep/AuxiliaryComponents/DryFriction.mo delete mode 100644 Tutorial2024/StepByStep/AuxiliaryComponents/ThermalCollector.mo delete mode 100644 Tutorial2024/StepByStep/AuxiliaryComponents/package.bak-mo delete mode 100644 Tutorial2024/StepByStep/AuxiliaryComponents/package.order create mode 100644 Tutorial2024/StepByStep/Step1_FreeBody2.mo create mode 100644 Tutorial2024/StepByStep/Step2_FixedBody2.mo create mode 100644 Tutorial2024/StepByStep/Step3_Pendulum2.mo delete mode 100644 Tutorial2024/StepByStep/Step5_ActuatedCraneCrab.bak-mo create mode 100644 Tutorial2024/StepByStep/Step7_InvertedCraneCrab2.mo create mode 100644 Tutorial2024/StepByStep/Step7_InvertedCraneCrab3.mo delete mode 100644 Tutorial2024/StepByStep/Step9_PositionControl.bak-mo diff --git a/Tutorial2024/AuxiliaryComponents/CraneCrab.mo b/Tutorial2024/AuxiliaryComponents/CraneCrab.mo new file mode 100644 index 0000000..57cab87 --- /dev/null +++ b/Tutorial2024/AuxiliaryComponents/CraneCrab.mo @@ -0,0 +1,87 @@ +within Tutorial2024.AuxiliaryComponents; +model CraneCrab + extends Modelica.Blocks.Icons.Block; + Modelica.Mechanics.MultiBody.Parts.Body body(r_CM={0,0,0}, + m=1) annotation (Placement(transformation(extent={{12,12},{32,32}}))); + Modelica.Mechanics.MultiBody.Parts.Body body1(r_CM={0,0,0}, + m=1) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-60}))); + Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation(r={1,0,0}) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-26}))); + Modelica.Mechanics.MultiBody.Parts.Fixed fixed annotation (Placement(transformation(extent={{-64,12},{-44,32}}))); + Modelica.Mechanics.MultiBody.Joints.Prismatic x(useAxisFlange=true, + s(fixed=true), + v(fixed=true)) annotation (Placement(transformation(extent={{-30,12}, + {-10,32}}))); + Modelica.Mechanics.MultiBody.Joints.Revolute revolute(useAxisFlange=true, + phi(fixed=true, start=1.3962634015955), + w(fixed=true)) annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270))); + Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation (Placement(transformation(extent={{30,-10},{ + 50,10}}))); + Modelica.Mechanics.Translational.Sources.Force force annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=0, + origin={-40,50}))); + Modelica.Blocks.Interfaces.RealInput f "Force" annotation (Placement(transformation(extent={{-140,-20},{-100,20}}), + iconTransformation(extent={{-140,-20},{-100,20}}))); + Modelica.Blocks.Interfaces.RealOutput phi "Angle" annotation (Placement(transformation(extent={{100,-10},{120,10}}), + iconTransformation(extent={{100,-10},{120,10}}))); +equation + connect(fixed.frame_b, x.frame_a) annotation (Line( + points={{-44,22},{-30,22}}, + color={95,95,95}, + thickness=0.5)); + connect(x.frame_b, body.frame_a) annotation (Line( + points={{-10,22},{12,22}}, + color={95,95,95}, + thickness=0.5)); + connect(body.frame_a, revolute.frame_a) annotation (Line( + points={{12,22},{0,22},{0,10}}, + color={95,95,95}, + thickness=0.5)); + connect(revolute.frame_b, fixedTranslation.frame_a) annotation (Line( + points={{0,-10},{0,-16}}, + color={95,95,95}, + thickness=0.5)); + connect(fixedTranslation.frame_b, body1.frame_a) annotation (Line( + points={{0,-36},{0,-50}}, + color={95,95,95}, + thickness=0.5)); + connect(force.flange, x.axis) annotation (Line(points={{-30,50},{-12,50},{-12,28}}, + color={0,127,0})); + connect(f, force.f) annotation (Line(points={{-120,0},{-70,0},{-70,50},{-52,50}}, color={0,0,127})); + connect(angleSensor.phi, phi) annotation (Line(points={{51,0},{110,0}}, color={0,0,127})); + connect(revolute.axis, angleSensor.flange) annotation (Line(points={{10,0},{30,0}}, color={0,0,0})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Rectangle( + extent={{-44,-18},{46,-62}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Line( + points={{20,58},{-2,-40}}, + color={0,0,0}, + thickness=1), + Ellipse( + extent={{8,78},{36,48}}, + lineColor={28,108,200}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Line(points={{-72,-66},{78,-66}}, color={0,0,0}), + Line(points={{-84,-86},{-56,-70}}, color={0,0,0}), + Line(points={{-46,-86},{-18,-70}}, color={0,0,0}), + Line(points={{-4,-86},{24,-70}}, color={0,0,0}), + Line(points={{38,-86},{66,-70}}, color={0,0,0})}), Diagram(coordinateSystem(preserveAspectRatio=false)), + experiment(__Dymola_NumberOfIntervals=5000, __Dymola_Algorithm="Dassl"), + Documentation(info=" +

+Model of an inverse pendulum. +

+")); +end CraneCrab; diff --git a/Tutorial2024/AuxiliaryComponents/CraneCrab2.mo b/Tutorial2024/AuxiliaryComponents/CraneCrab2.mo new file mode 100644 index 0000000..81c1fb8 --- /dev/null +++ b/Tutorial2024/AuxiliaryComponents/CraneCrab2.mo @@ -0,0 +1,46 @@ +within Tutorial2024.AuxiliaryComponents; + +model CraneCrab2 + extends Modelica.Blocks.Icons.Block; + PlanarMechanics.Parts.Fixed fixed annotation( + Placement(transformation(origin = {-70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180))); + PlanarMechanics.Parts.Body carriage(I = 0.001, m = 1) annotation( + Placement(transformation(origin = {10, 0}, extent = {{0, -10}, {20, 10}}))); + Modelica.Mechanics.Translational.Sources.Force force(useSupport = false) annotation( + Placement(transformation(origin = {-80, 0}, extent = {{20, 30}, {40, 50}}, rotation = -0))); + PlanarMechanics.Joints.Prismatic prismatic(r = {1, 0}, useFlange = true) annotation( + Placement(transformation(origin = {10, 0}, extent = {{-54, 10}, {-34, -10}}))); + PlanarMechanics.Parts.FixedTranslation rod(r = {0, 0.5}) annotation( + Placement(transformation(origin = {10, 0}, extent = {{-10, -60}, {10, -40}}))); + PlanarMechanics.Parts.Body pendulum(I = 0.001, m = 0.5) annotation( + Placement(transformation(origin = {10, 0}, extent = {{20, -60}, {40, -40}}))); + Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation( + Placement(transformation(origin = {10, 0}, extent = {{-4, -40}, {16, -20}}))); + PlanarMechanics.Joints.Revolute revolute1(useFlange = true, phi(start = 0.1745329251994329, fixed = true), w(start = 0, fixed = true)) annotation( + Placement(transformation(origin = {-10, -30}, extent = {{-10, 10}, {10, -10}}, rotation = 270))); + Modelica.Blocks.Interfaces.RealInput u annotation( + Placement(transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}), iconTransformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}))); + Modelica.Blocks.Interfaces.RealOutput y annotation( + Placement(transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {110, -2}, extent = {{-10, -10}, {10, 10}}))); +equation + connect(prismatic.frame_b, carriage.frame_a) annotation( + Line(points = {{-24, 0}, {10, 0}}, color = {95, 95, 95})); + connect(revolute1.frame_b, rod.frame_a) annotation( + Line(points = {{-10, -40}, {-10, -50}, {0, -50}}, color = {95, 95, 95})); + connect(fixed.frame, prismatic.frame_a) annotation( + Line(points = {{-60, 0}, {-44, 0}}, color = {95, 95, 95})); + connect(revolute1.frame_a, carriage.frame_a) annotation( + Line(points = {{-10, -20}, {-10, 0}, {10, 0}}, color = {95, 95, 95})); + connect(force.flange, prismatic.flange_a) annotation( + Line(points = {{-40, 40}, {-34, 40}, {-34, 10}}, color = {0, 127, 0})); + connect(revolute1.flange_a, angleSensor.flange) annotation( + Line(points = {{0, -30}, {6, -30}})); + connect(rod.frame_b, pendulum.frame_a) annotation( + Line(points = {{20, -50}, {30, -50}}, color = {95, 95, 95})); + connect(u, force.f) annotation( + Line(points = {{-120, 0}, {-92, 0}, {-92, 40}, {-62, 40}}, color = {0, 0, 127})); + connect(angleSensor.phi, y) annotation( + Line(points = {{28, -30}, {60, -30}, {60, 0}, {110, 0}}, color = {0, 0, 127})); +annotation( + Icon(graphics = {Line(points = {{-4, -86}, {24, -70}}), Line(points = {{-46, -86}, {-18, -70}}), Line(points = {{20, 58}, {-2, -40}}), Line(points = {{38, -86}, {66, -70}}), Line(points = {{-72, -66}, {78, -66}}), Rectangle(lineColor = {28, 108, 200}, fillPattern = FillPattern.Solid, extent = {{-44, -18}, {46, -62}}), Line(points = {{-84, -86}, {-56, -70}}), Ellipse(lineColor = {28, 108, 200}, fillPattern = FillPattern.Solid, extent = {{8, 78}, {36, 48}})})); +end CraneCrab2; diff --git a/Tutorial2024/AuxiliaryComponents/DryFriction.bak-mo b/Tutorial2024/AuxiliaryComponents/DryFriction.bak-mo deleted file mode 100644 index 21bb25d..0000000 --- a/Tutorial2024/AuxiliaryComponents/DryFriction.bak-mo +++ /dev/null @@ -1,5 +0,0 @@ -within Tutorial2024.AuxiliaryComponents; -model DryFriction "discrete event dry friction model" - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); -end DryFriction; diff --git a/Tutorial2024/AuxiliaryComponents/package.order b/Tutorial2024/AuxiliaryComponents/package.order index 2eb8a24..2a66400 100644 --- a/Tutorial2024/AuxiliaryComponents/package.order +++ b/Tutorial2024/AuxiliaryComponents/package.order @@ -1,2 +1,4 @@ IdealDryFriction ThermalCollector +CraneCrab +CraneCrab2 diff --git a/Tutorial2024/StepByStep/AuxiliaryComponents/DryFriction.mo b/Tutorial2024/StepByStep/AuxiliaryComponents/DryFriction.mo deleted file mode 100644 index 13d5084..0000000 --- a/Tutorial2024/StepByStep/AuxiliaryComponents/DryFriction.mo +++ /dev/null @@ -1,5 +0,0 @@ -within Tutorial2024.StepByStep.AuxiliaryComponents; -model DryFriction "discrete event dry friction model" - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); -end DryFriction; diff --git a/Tutorial2024/StepByStep/AuxiliaryComponents/ThermalCollector.mo b/Tutorial2024/StepByStep/AuxiliaryComponents/ThermalCollector.mo deleted file mode 100644 index abafca1..0000000 --- a/Tutorial2024/StepByStep/AuxiliaryComponents/ThermalCollector.mo +++ /dev/null @@ -1,5 +0,0 @@ -within Tutorial2024.StepByStep.AuxiliaryComponents; -model ThermalCollector "collect all loads from a dc machine" - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); -end ThermalCollector; diff --git a/Tutorial2024/StepByStep/AuxiliaryComponents/package.bak-mo b/Tutorial2024/StepByStep/AuxiliaryComponents/package.bak-mo deleted file mode 100644 index 9ebf966..0000000 --- a/Tutorial2024/StepByStep/AuxiliaryComponents/package.bak-mo +++ /dev/null @@ -1,4 +0,0 @@ -within Tutorial2024.StepByStep; -package AuxiliaryComponents "auxiliary components" - extends Modelica.Icons.UtilitiesPackage; -end AuxiliaryComponents; diff --git a/Tutorial2024/StepByStep/AuxiliaryComponents/package.order b/Tutorial2024/StepByStep/AuxiliaryComponents/package.order deleted file mode 100644 index de61c43..0000000 --- a/Tutorial2024/StepByStep/AuxiliaryComponents/package.order +++ /dev/null @@ -1,2 +0,0 @@ -DryFriction -ThermalCollector diff --git a/Tutorial2024/StepByStep/Step1_FreeBody2.mo b/Tutorial2024/StepByStep/Step1_FreeBody2.mo new file mode 100644 index 0000000..f5286ea --- /dev/null +++ b/Tutorial2024/StepByStep/Step1_FreeBody2.mo @@ -0,0 +1,13 @@ +within Tutorial2024.StepByStep; +model Step1_FreeBody2 "free falling body" + extends Modelica.Icons.Example; + + inner PlanarMechanics.PlanarWorld planarWorld + annotation (Placement(transformation(extent={{-80,-80},{-60,-60}}))); + PlanarMechanics.Parts.Body body(m=1, I=0.001, r(start = {0, 0}), v(start = {5, 5})) + annotation (Placement(transformation(extent={{-8,-10},{12,10}}))); + annotation (experiment( + StopTime=1, + __Dymola_NumberOfIntervals=1500, + __Dymola_Algorithm="Dassl")); +end Step1_FreeBody2; diff --git a/Tutorial2024/StepByStep/Step2_FixedBody2.mo b/Tutorial2024/StepByStep/Step2_FixedBody2.mo new file mode 100644 index 0000000..a67ff25 --- /dev/null +++ b/Tutorial2024/StepByStep/Step2_FixedBody2.mo @@ -0,0 +1,24 @@ +within Tutorial2024.StepByStep; +model Step2_FixedBody2 "fixated body" + extends Modelica.Icons.Example; + + inner PlanarMechanics.PlanarWorld planarWorld + annotation (Placement(transformation(extent={{-80,-80},{-60,-60}}))); + PlanarMechanics.Parts.Body body(m=1, I=0.001, r(start = {0, 0})) + annotation (Placement(transformation(extent={{20,-10},{40,10}}))); + PlanarMechanics.Parts.Fixed fixed annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-30,0}))); + PlanarMechanics.Parts.SpringDamper springDamper(c_y = 10, d_y = 2*sqrt(10)/2) annotation ( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); +equation + connect(fixed.frame, springDamper.frame_a) annotation ( + Line(points = {{-20, 0}, {-10, 0}}, color = {95, 95, 95})); + connect(springDamper.frame_b, body.frame_a) annotation ( + Line(points = {{10, 0}, {20, 0}}, color = {95, 95, 95})); + annotation (experiment( + StopTime=5, + __Dymola_NumberOfIntervals=1500, + __Dymola_Algorithm="Dassl")); +end Step2_FixedBody2; diff --git a/Tutorial2024/StepByStep/Step3_Pendulum2.mo b/Tutorial2024/StepByStep/Step3_Pendulum2.mo new file mode 100644 index 0000000..849c064 --- /dev/null +++ b/Tutorial2024/StepByStep/Step3_Pendulum2.mo @@ -0,0 +1,77 @@ +within Tutorial2024.StepByStep; +model Step3_Pendulum2 "Pendulum" + extends Modelica.Icons.Example; + inner PlanarMechanics.PlanarWorld planarWorld annotation ( + Placement(transformation(origin = {240, -20}, extent = {{-160, -60}, {-140, -40}}))); + PlanarMechanics.Parts.Body body(m = 1, I = 0.001) annotation ( + Placement(transformation(origin = {40, 30}, extent = {{20, -10}, {40, 10}}))); + PlanarMechanics.Parts.Fixed fixed annotation ( + Placement(transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 180))); + PlanarMechanics.Parts.FixedTranslation rod(r = {2, 0}) annotation ( + Placement(transformation(origin = {10, 30}, extent = {{-10, -10}, {10, 10}}))); + PlanarMechanics.Joints.Revolute revolute(phi(start = 0, fixed = true)) annotation ( + Placement(transformation(origin = {10, 30}, extent = {{-40, -10}, {-20, 10}}))); + PlanarMechanics.Parts.Fixed fixed1 annotation ( + Placement(transformation(origin = {-50, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 180))); + PlanarMechanics.Joints.Revolute revolute1 annotation ( + Placement(transformation(origin = {10, 70}, extent = {{-40, -10}, {-20, 10}}))); + PlanarMechanics.Parts.FixedTranslation fixedTranslation(r = {1, 0}) annotation ( + Placement(transformation(origin = {10, 70}, extent = {{-10, -10}, {10, 10}}))); + PlanarMechanics.Parts.Body body1(I = 0.001, m = 1) annotation ( + Placement(transformation(origin = {12, 70}, extent = {{20, -10}, {40, 10}}))); + PlanarMechanics.Joints.Prismatic prismatic1(r = {0, -1}, useFlange = false) annotation ( + Placement(transformation(origin = {-36, 4}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); + Modelica.Mechanics.Translational.Components.Spring spring(c = 100) annotation ( + Placement(transformation(origin = {-10, -40}, extent = {{-10, -10}, {10, 10}}))); + PlanarMechanics.Joints.Prismatic prismatic(useFlange = true, r = {1, 0}) annotation ( + Placement(transformation(origin = {-10, -10}, extent = {{-10, -10}, {10, 10}}))); + PlanarMechanics.Joints.Revolute revolute2(phi(fixed = false)) annotation ( + Placement(transformation(origin = {0, 30}, extent = {{20, -50}, {40, -30}}))); + PlanarMechanics.Parts.Spring spring1(c_x = 100, c_y = 1e-9, c_phi = 1e-9) annotation ( + Placement(transformation(origin = {20, 60}, extent = {{-40, -160}, {-20, -140}}))); + PlanarMechanics.Parts.Body body2(m = 1, I = 0.001) annotation ( + Placement(transformation(origin = {20, -70}, extent = {{20, -10}, {40, 10}}))); + PlanarMechanics.Parts.Fixed fixed2 annotation ( + Placement(transformation(origin = {-70, -70}, extent = {{-10, -10}, {10, 10}}, rotation = 180))); + PlanarMechanics.Parts.FixedTranslation rod1(r = {2, 0}) annotation ( + Placement(transformation(origin = {10, 40}, extent = {{-30, -120}, {-10, -100}}))); + PlanarMechanics.Joints.Revolute revolute3(phi(start = 0, fixed = true)) annotation ( + Placement(transformation(origin = {10, 40}, extent = {{-60, -120}, {-40, -100}}))); +equation + connect(rod.frame_b, body.frame_a) annotation ( + Line(points = {{20, 30}, {60, 30}}, color = {95, 95, 95})); + connect(fixed.frame, revolute.frame_a) annotation ( + Line(points = {{-40, 30}, {-30, 30}}, color = {95, 95, 95})); + connect(revolute.frame_b, rod.frame_a) annotation ( + Line(points = {{-10, 30}, {0, 30}}, color = {95, 95, 95})); + connect(fixed1.frame, revolute1.frame_a) annotation ( + Line(points = {{-40, 70}, {-30, 70}}, color = {95, 95, 95})); + connect(fixedTranslation.frame_b, body1.frame_a) annotation ( + Line(points = {{20, 70}, {32, 70}}, color = {95, 95, 95})); + connect(revolute1.frame_b, fixedTranslation.frame_a) annotation ( + Line(points = {{-10, 70}, {0, 70}}, color = {95, 95, 95})); + connect(fixed.frame, prismatic1.frame_a) annotation ( + Line(points = {{-40, 30}, {-36, 30}, {-36, 14}}, color = {95, 95, 95})); + connect(prismatic1.frame_b, prismatic.frame_a) annotation ( + Line(points = {{-36, -6}, {-35.5, -6}, {-35.5, -4}, {-37, -4}, {-37, -10}, {-20, -10}}, color = {95, 95, 95})); + connect(prismatic.support, spring.flange_a) annotation ( + Line(points = {{-16, -20}, {-16, -30}, {-20, -30}, {-20, -40}}, color = {0, 127, 0})); + connect(prismatic.flange_a, spring.flange_b) annotation ( + Line(points = {{-10, -20}, {0, -20}, {0, -40}}, color = {0, 127, 0})); + connect(prismatic.frame_b, revolute2.frame_a) annotation ( + Line(points = {{0, -10}, {20, -10}}, color = {95, 95, 95})); + connect(revolute2.frame_b, body.frame_a) annotation ( + Line(points = {{40, -10}, {54, -10}, {54, 30}, {60, 30}}, color = {95, 95, 95})); + connect(rod1.frame_b, body2.frame_a) annotation ( + Line(points = {{0, -70}, {40, -70}}, color = {95, 95, 95})); + connect(fixed2.frame, revolute3.frame_a) annotation ( + Line(points = {{-60, -70}, {-50, -70}}, color = {95, 95, 95})); + connect(revolute3.frame_b, rod1.frame_a) annotation ( + Line(points = {{-30, -70}, {-20, -70}}, color = {95, 95, 95})); + connect(spring1.frame_b, body2.frame_a) annotation ( + Line(points = {{0, -90}, {20, -90}, {20, -70}, {40, -70}}, color = {95, 95, 95})); + connect(fixed2.frame, spring1.frame_a) annotation ( + Line(points = {{-60, -70}, {-60, -90}, {-20, -90}}, color = {95, 95, 95})); + annotation ( + experiment(StopTime = 5, Tolerance = 1e-09, __Dymola_Algorithm = "Dassl")); +end Step3_Pendulum2; diff --git a/Tutorial2024/StepByStep/Step5_ActuatedCraneCrab.bak-mo b/Tutorial2024/StepByStep/Step5_ActuatedCraneCrab.bak-mo deleted file mode 100644 index 9015e49..0000000 --- a/Tutorial2024/StepByStep/Step5_ActuatedCraneCrab.bak-mo +++ /dev/null @@ -1,53 +0,0 @@ -within Tutorial2024.StepByStep; -model Step5_ActuatedCraneCrab "Actuated Crane Crab" - extends Modelica.Icons.Example; - - inner PlanarMechanics.PlanarWorld planarWorld - annotation (Placement(transformation(extent={{-80,-80},{-60,-60}}))); - PlanarMechanics.Parts.Body carriage(m=1, I=0.001) - annotation (Placement(transformation(extent={{20,-10},{40,10}}))); - PlanarMechanics.Parts.Fixed fixed annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=180, - origin={-60,0}))); - PlanarMechanics.Parts.Body pendulum(m=0.5, I=0.001) - annotation (Placement(transformation(extent={{40,-60},{60,-40}}))); - PlanarMechanics.Parts.FixedTranslation rod(r={0.5,0}) - annotation (Placement(transformation(extent={{10,-60},{30,-40}}))); - PlanarMechanics.Joints.Revolute revolute1 - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, - rotation=270, - origin={0,-30}))); - PlanarMechanics.Joints.Prismatic prismatic(useFlange=true, r={1,0}) - annotation (Placement(transformation(extent={{-34,10},{-14,-10}}))); - Modelica.Mechanics.Translational.Sources.ConstantForce constantForce( - f_constant=2) - annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); -equation - connect(rod.frame_b, pendulum.frame_a) annotation (Line( - points={{30,-50},{40,-50}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute1.frame_b, rod.frame_a) annotation (Line( - points={{0,-40},{0,-50},{10,-50}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute1.frame_a, carriage.frame_a) annotation (Line( - points={{0,-20},{0,0},{20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(fixed.frame, prismatic.frame_a) annotation (Line( - points={{-50,0},{-34,0}}, - color={95,95,95}, - thickness=0.5)); - connect(prismatic.frame_b, carriage.frame_a) annotation (Line( - points={{-14,0},{20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(constantForce.flange, prismatic.flange_a) - annotation (Line(points={{-40,30},{-24,30},{-24,10}}, color={0,127,0})); - annotation (experiment( - StopTime=5, - __Dymola_NumberOfIntervals=1500, - __Dymola_Algorithm="Dassl")); -end Step5_ActuatedCraneCrab; diff --git a/Tutorial2024/StepByStep/Step7_InvertedCraneCrab2.mo b/Tutorial2024/StepByStep/Step7_InvertedCraneCrab2.mo new file mode 100644 index 0000000..a3fdf96 --- /dev/null +++ b/Tutorial2024/StepByStep/Step7_InvertedCraneCrab2.mo @@ -0,0 +1,30 @@ +within Tutorial2024.StepByStep; +model Step7_InvertedCraneCrab2 + extends Modelica.Icons.Example; + inner Modelica.Mechanics.MultiBody.World world annotation (Placement(transformation(extent={{-88,-80},{-68,-60}}))); + Modelica.Blocks.Continuous.SecondOrder secondOrder(w=10, D=1) + annotation (Placement(transformation(origin = {8, 0}, extent = {{-80, -10}, {-60, 10}}))); + Modelica.Blocks.Sources.RealExpression angle(y=90) annotation (Placement(transformation(origin = {10, 0}, extent = {{-110, -10}, {-90, 10}}))); + AuxiliaryComponents.CraneCrab craneCrab1 annotation (Placement(transformation(origin = {-6, 0}, extent = {{18, -10}, {-2, 10}}))); + Modelica.Blocks.Math.InverseBlockConstraints inverseBlockConstraints + annotation (Placement(transformation(origin = {-6, 0}, extent = {{-12, -10}, {28, 10}}))); + Modelica.Blocks.Math.UnitConversions.From_deg from_deg + annotation (Placement(transformation(origin = {6, 0}, extent = {{-50, -10}, {-30, 10}}))); + AuxiliaryComponents.CraneCrab craneCrab(revolute(w(fixed=true))) + annotation (Placement(transformation(origin = {-20, 0}, extent = {{60, -10}, {80, 10}}))); +equation + connect(inverseBlockConstraints.u2, craneCrab1.phi) annotation (Line(points={{-14, 0},{-9,0}}, color={0,0,127})); + connect(craneCrab1.f, inverseBlockConstraints.y2) annotation (Line(points={{14,0},{19, 0}}, color={0,0,127})); + connect(angle.y, secondOrder.u) annotation (Line(points={{-79,0},{-74,0}}, color={0,0,127})); + connect(secondOrder.y, from_deg.u) annotation (Line(points={{-51,0},{-46,0}}, color={0,0,127})); + connect(from_deg.y, inverseBlockConstraints.u1) annotation (Line(points={{-23,0},{-20, 0}}, + color={0,0,127})); + connect(inverseBlockConstraints.y1, craneCrab.f) annotation (Line(points={{23, 0},{38,0}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)), + experiment(__Dymola_NumberOfIntervals=5000, __Dymola_Algorithm="Dassl"), + Documentation(info=" +

+Example from Dirk's lecture. It does not make sense tho. +

+")); +end Step7_InvertedCraneCrab2; diff --git a/Tutorial2024/StepByStep/Step7_InvertedCraneCrab3.mo b/Tutorial2024/StepByStep/Step7_InvertedCraneCrab3.mo new file mode 100644 index 0000000..19bd8bd --- /dev/null +++ b/Tutorial2024/StepByStep/Step7_InvertedCraneCrab3.mo @@ -0,0 +1,40 @@ +within Tutorial2024.StepByStep; +model Step7_InvertedCraneCrab3 + extends Modelica.Icons.Example; + inner Modelica.Mechanics.MultiBody.World world annotation ( + Placement(transformation(extent = {{-88, -80}, {-68, -60}}))); + Modelica.Blocks.Continuous.SecondOrder secondOrder(w = 10, D = 1) annotation ( + Placement(transformation(extent = {{-80, -10}, {-60, 10}}))); + Modelica.Blocks.Sources.RealExpression angle(y = 0) annotation ( + Placement(transformation(extent = {{-110, -10}, {-90, 10}}))); + Modelica.Blocks.Math.InverseBlockConstraints inverseBlockConstraints annotation ( + Placement(transformation(origin = {-8, 0}, extent = {{-12, -10}, {28, 10}}))); + Modelica.Blocks.Math.UnitConversions.From_deg from_deg annotation ( + Placement(transformation(extent = {{-50, -10}, {-30, 10}}))); + AuxiliaryComponents.CraneCrab2 craneCrab1 annotation ( + Placement(transformation( extent = {{10, -10}, {-10, 10}}, rotation = -0))); + AuxiliaryComponents.CraneCrab2 craneCrab annotation ( + Placement(transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}))); +equation + connect(secondOrder.y, from_deg.u) annotation ( + Line(points = {{-59, 0}, {-52, 0}}, color = {0, 0, 127})); + connect(from_deg.y, inverseBlockConstraints.u1) annotation ( + Line(points = {{-29, 0}, {-22, 0}}, color = {0, 0, 127})); + connect(inverseBlockConstraints.u2, craneCrab1.y) annotation ( + Line(points = {{-16, 0}, {-11, 0}}, color = {0, 0, 127})); + connect(inverseBlockConstraints.y2, craneCrab1.u) annotation ( + Line(points = {{17, 0}, {12, 0}}, color = {0, 0, 127})); + connect(inverseBlockConstraints.y1, craneCrab.u) annotation ( + Line(points = {{21, 0}, {38, 0}}, color = {0, 0, 127})); + connect(angle.y, secondOrder.u) annotation ( + Line(points = {{-88, 0}, {-82, 0}}, color = {0, 0, 127})); + annotation ( + Icon(coordinateSystem(preserveAspectRatio = false)), + Diagram(coordinateSystem(preserveAspectRatio = false)), + experiment(__Dymola_NumberOfIntervals = 5000, __Dymola_Algorithm = "Dassl"), + Documentation(info = " +

+Example from Dirk's lecture. It does not make sense tho. +

+")); +end Step7_InvertedCraneCrab3; diff --git a/Tutorial2024/StepByStep/Step9_PositionControl.bak-mo b/Tutorial2024/StepByStep/Step9_PositionControl.bak-mo deleted file mode 100644 index 4b4525b..0000000 --- a/Tutorial2024/StepByStep/Step9_PositionControl.bak-mo +++ /dev/null @@ -1,135 +0,0 @@ -within Tutorial2024.StepByStep; -model Step9_PositionControl - "Electrically Actuated Crane Crab with Angle Control" - extends Modelica.Icons.Example; - - inner PlanarMechanics.PlanarWorld planarWorld - annotation (Placement(transformation(extent={{-122,-80},{-102,-60}}))); - PlanarMechanics.Parts.Body carriage(m=1, I=0.001) - annotation (Placement(transformation(extent={{-22,-30},{-2,-10}}))); - PlanarMechanics.Parts.Fixed fixed annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=180, - origin={-102,-20}))); - PlanarMechanics.Parts.Body pendulum(m=0.5, I=0.001) - annotation (Placement(transformation(extent={{12,-80},{32,-60}}))); - PlanarMechanics.Parts.FixedTranslation rod(r={0,0.5}) - annotation (Placement(transformation(extent={{-32,-80},{-12,-60}}))); - PlanarMechanics.Joints.Revolute revolute1(useFlange=true, phi(start= - 0.26179938779915, fixed=true)) - annotation (Placement(transformation(extent={{-10,10},{10,-10}}, - rotation=270, - origin={-42,-50}))); - PlanarMechanics.Joints.Prismatic prismatic(useFlange=true, r={1,0}) - annotation (Placement(transformation(extent={{-62,-10},{-42,-30}}))); - Modelica.Electrical.Machines.BasicMachines.DCMachines.DC_PermanentMagnet dcpm( - Jr=0, - VaNominal=12, - useThermalPort=false, - Ra=0.05, - alpha20a(displayUnit="1/K") = 0, - La=0.0015, - useSupport=false, - Js=0, - TaOperational=293.15, - IaNominal=1, - wNominal(displayUnit="rad/s") = 100, - TaNominal=293.15, - TaRef=293.15) - annotation (Placement(transformation(extent={{-102,10},{-82,30}}))); - Modelica.Electrical.Analog.Basic.Ground ground - annotation (Placement(transformation(extent={{-130,10},{-110,30}}))); - Modelica.Mechanics.Translational.Components.IdealGearR2T idealGearR2T(ratio=100) - annotation (Placement(transformation(extent={{-82,10},{-62,30}}))); - Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor - annotation (Placement(transformation(extent={{-22,-60},{-2,-40}}))); - Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent - annotation (Placement(transformation(extent={{-112,40},{-92,60}}))); - Modelica.Blocks.Continuous.PID PID_phi( - k=-5, - Ti=1e10, - Td=0.2) annotation (Placement(transformation( - extent={{10,-10},{-10,10}}, - rotation=0, - origin={106,84}))); - Modelica.Blocks.Continuous.PID PID_s( - k=1, - Ti=1e10, - Td=0.8) annotation (Placement(transformation( - extent={{10,10},{-10,-10}}, - rotation=180, - origin={70,20}))); - Modelica.Blocks.Math.Feedback feedback - annotation (Placement(transformation(extent={{18,30},{38,10}}))); - Modelica.Blocks.Math.Add add annotation (Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=180, - origin={-40,78}))); - Modelica.Mechanics.Translational.Sensors.PositionSensor positionSensor - annotation (Placement(transformation(extent={{-40,10},{-20,30}}))); - Modelica.Blocks.Sources.Ramp ramp( - height=1, - duration=1, - offset=0, - startTime=7) - annotation (Placement(transformation(extent={{-26,40},{-6,60}}))); -equation - connect(rod.frame_b, pendulum.frame_a) annotation (Line( - points={{-12,-70},{12,-70}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute1.frame_b, rod.frame_a) annotation (Line( - points={{-42,-60},{-42,-70},{-32,-70}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute1.frame_a, carriage.frame_a) annotation (Line( - points={{-42,-40},{-42,-20},{-22,-20}}, - color={95,95,95}, - thickness=0.5)); - connect(fixed.frame, prismatic.frame_a) annotation (Line( - points={{-92,-20},{-62,-20}}, - color={95,95,95}, - thickness=0.5)); - connect(prismatic.frame_b, carriage.frame_a) annotation (Line( - points={{-42,-20},{-22,-20}}, - color={95,95,95}, - thickness=0.5)); - connect(ground.p, dcpm.pin_an) - annotation (Line(points={{-120,30},{-98,30}},color={0,0,255})); - connect(revolute1.frame_a, prismatic.frame_b) annotation (Line( - points={{-42,-40},{-42,-20}}, - color={95,95,95}, - thickness=0.5)); - connect(dcpm.flange, idealGearR2T.flangeR) - annotation (Line(points={{-82,20},{-82,20}}, color={0,0,0})); - connect(idealGearR2T.flangeT, prismatic.flange_a) annotation (Line(points={{-62,20}, - {-52,20},{-52,-10}}, color={0,127,0})); - connect(ground.p, signalCurrent.p) - annotation (Line(points={{-120,30},{-120,50},{-112,50}}, color={0,0,255})); - connect(signalCurrent.n, dcpm.pin_ap) - annotation (Line(points={{-92,50},{-86,50},{-86,30}}, color={0,0,255})); - connect(angleSensor.flange, revolute1.flange_a) - annotation (Line(points={{-22,-50},{-32,-50}}, color={0,0,0})); - connect(angleSensor.phi, PID_phi.u) annotation (Line(points={{-1,-50},{128, - -50},{128,84},{118,84}}, color={0,0,127})); - connect(add.u2, PID_phi.y) - annotation (Line(points={{-28,84},{95,84}}, color={0,0,127})); - connect(add.u1, PID_s.y) annotation (Line(points={{-28,72},{90,72},{90,20},{ - 81,20}}, color={0,0,127})); - connect(add.y, signalCurrent.i) - annotation (Line(points={{-51,78},{-102,78},{-102,62}}, color={0,0,127})); - connect(idealGearR2T.flangeT, positionSensor.flange) - annotation (Line(points={{-62,20},{-40,20}}, color={0,127,0})); - connect(PID_s.u, feedback.y) - annotation (Line(points={{58,20},{37,20}}, color={0,0,127})); - connect(positionSensor.s, feedback.u1) - annotation (Line(points={{-19,20},{20,20}}, color={0,0,127})); - connect(ramp.y, feedback.u2) - annotation (Line(points={{-5,50},{28,50},{28,28}}, color={0,0,127})); - annotation (experiment( - StopTime=5, - __Dymola_NumberOfIntervals=1500, - __Dymola_Algorithm="Dassl"), - Diagram(coordinateSystem(extent={{-140,-100},{140,100}})), - Icon(coordinateSystem(extent={{-140,-100},{140,100}}))); -end Step9_PositionControl; diff --git a/Tutorial2024/StepByStep/package.order b/Tutorial2024/StepByStep/package.order index 5358c95..bbdba38 100644 --- a/Tutorial2024/StepByStep/package.order +++ b/Tutorial2024/StepByStep/package.order @@ -1,10 +1,15 @@ Step1_FreeBody +Step1_FreeBody2 Step2_FixedBody +Step2_FixedBody2 Step3_Pendulum +Step3_Pendulum2 Step4_DoublePendulum Step5_CraneCrab Step6_ActuatedCraneCrab Step7_InvertedCraneCrab +Step7_InvertedCraneCrab2 +Step7_InvertedCraneCrab3 Step8_ElectricCraneCrab Step9_AngleControl Step10_PositionControl