|
1 |
| -within PlanarMechanics.Examples; |
2 |
| -model ControlledCraneCrab "A controlled crane crab" |
3 |
| - extends Modelica.Icons.Example; |
4 |
| - |
5 |
| - Parts.Body body( |
6 |
| - m=70, |
7 |
| - I=0) annotation (Placement(transformation( |
8 |
| - extent={{-10,-10},{10,10}}, |
9 |
| - rotation=270, |
10 |
| - origin={-10,-60}))); |
11 |
| - Parts.FixedTranslation fixedTranslation(r={0,2.5}) |
12 |
| - annotation ( |
13 |
| - Placement(transformation( |
14 |
| - extent={{-10,-10},{10,10}}, |
15 |
| - rotation=270, |
16 |
| - origin={-10,-30}))); |
17 |
| - Parts.Fixed fixed annotation (Placement(transformation( |
18 |
| - extent={{-10,-10},{10,10}}, |
19 |
| - rotation=180, |
20 |
| - origin={-70,30}))); |
21 |
| - Parts.Body body1( |
22 |
| - m=250, |
23 |
| - I=0, |
24 |
| - a(start={1,0})) |
25 |
| - annotation (Placement(transformation(extent={{0,20},{20,40}}))); |
26 |
| - Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor |
27 |
| - annotation (Placement(transformation(extent={{20,-10},{40,10}}))); |
28 |
| - Modelica.Mechanics.Translational.Sources.Force force annotation ( |
29 |
| - Placement(transformation( |
30 |
| - extent={{-10,-10},{10,10}}, |
31 |
| - rotation=180, |
32 |
| - origin={-10,70}))); |
33 |
| - Modelica.Blocks.Continuous.PID PID( |
34 |
| - Td=0.2, |
35 |
| - k=-320*9.81*5, |
36 |
| - initType=Modelica.Blocks.Types.InitPID.InitialState, |
37 |
| - xi_start=0, |
38 |
| - Ti=1e9) annotation (Placement(transformation(extent={{40,60},{20,80}}))); |
39 |
| - inner PlanarWorld planarWorld |
40 |
| - annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); |
41 |
| - Joints.Prismatic prismatic(r={1,0}, useFlange=true, |
42 |
| - s(fixed=true), |
43 |
| - v(fixed=true)) |
44 |
| - annotation (Placement(transformation(extent={{-40,20},{-20,40}}))); |
45 |
| - Joints.Revolute revolute(useFlange=true, |
46 |
| - w(fixed=true), |
47 |
| - phi(fixed=true, start=-0.34906585039887)) |
48 |
| - annotation (Placement(transformation( |
49 |
| - extent={{-10,-10},{10,10}}, |
50 |
| - rotation=270, |
51 |
| - origin={-10,0}))); |
52 |
| -equation |
53 |
| - connect(fixedTranslation.frame_b, body.frame_a) annotation (Line( |
54 |
| - points={{-10,-40},{-10,-45},{-10,-50}}, |
55 |
| - color={95,95,95}, |
56 |
| - thickness=0.5)); |
57 |
| - connect(force.f, PID.y) annotation (Line( |
58 |
| - points={{2,70},{2,70},{19,70}}, |
59 |
| - color={0,0,127})); |
60 |
| - connect(angleSensor.phi, PID.u) annotation (Line( |
61 |
| - points={{41,0},{70,0},{70,70},{42,70}}, |
62 |
| - color={0,0,127})); |
63 |
| - |
64 |
| - connect(fixed.frame, prismatic.frame_a) annotation (Line( |
65 |
| - points={{-60,30},{-40,30}}, |
66 |
| - color={95,95,95}, |
67 |
| - thickness=0.5)); |
68 |
| - connect(prismatic.frame_b, body1.frame_a) annotation (Line( |
69 |
| - points={{-20,30},{0,30}}, |
70 |
| - color={95,95,95}, |
71 |
| - thickness=0.5)); |
72 |
| - connect(prismatic.flange_a, force.flange) annotation (Line( |
73 |
| - points={{-30,39},{-30,50},{-30,70},{-20,70}}, |
74 |
| - color={0,127,0})); |
75 |
| - connect(prismatic.frame_b, revolute.frame_a) annotation (Line( |
76 |
| - points={{-20,30},{-10,30},{-10,10}}, |
77 |
| - color={95,95,95}, |
78 |
| - thickness=0.5)); |
79 |
| - connect(revolute.frame_b, fixedTranslation.frame_a) annotation (Line( |
80 |
| - points={{-10,-10},{-10,-20}}, |
81 |
| - color={95,95,95}, |
82 |
| - thickness=0.5)); |
83 |
| - connect(revolute.flange_a, angleSensor.flange) annotation (Line( |
84 |
| - points={{0,0},{10,0},{10,0},{20,0}})); |
85 |
| - annotation (experiment(StopTime=3), |
86 |
| - Documentation(revisions="<html><p><img src=\"modelica://PlanarMechanics/Resources/Images/dlr_logo.png\"/> <b>Developed 2010-2014 at the DLR Institute of System Dynamics and Control</b></p></html>", info="<html> |
87 |
| -<p>A simple PID (actually PD) controlles the pendulum into upright position.</p> |
88 |
| -<p><img src=\"modelica://PlanarMechanics/Resources/Images/ControlledCraneCrab_1.png\"/></p> |
89 |
| -<p><img src=\"modelica://PlanarMechanics/Resources/Images/ControlledCraneCrab_2.png\"/></p> |
90 |
| -<p>Selected continuous time states</p> |
91 |
| -<ul> |
92 |
| -<li>actuatedPrismatic.s</li> |
93 |
| -<li>actuatedPrismatic.v</li> |
94 |
| -<li>actuatedRevolute.phi</li> |
95 |
| -<li>actuatedRevolute.w</li> |
96 |
| -<li>PID.D.x</li> |
97 |
| -<li>PID.I.y</li> |
98 |
| -</ul> |
99 |
| -</html>")); |
100 |
| -end ControlledCraneCrab; |
| 1 | +within PlanarMechanics.Examples; |
| 2 | +model ControlledCraneCrab "A controlled crane crab" |
| 3 | + extends Modelica.Icons.Example; |
| 4 | + |
| 5 | + Parts.Body body( |
| 6 | + m=70, |
| 7 | + I=0) annotation (Placement(transformation( |
| 8 | + extent={{-10,-10},{10,10}}, |
| 9 | + rotation=270, |
| 10 | + origin={-10,-60}))); |
| 11 | + Parts.FixedTranslation fixedTranslation(r={0,2.5}) |
| 12 | + annotation ( |
| 13 | + Placement(transformation( |
| 14 | + extent={{-10,-10},{10,10}}, |
| 15 | + rotation=270, |
| 16 | + origin={-10,-30}))); |
| 17 | + Parts.Fixed fixed annotation (Placement(transformation( |
| 18 | + extent={{-10,-10},{10,10}}, |
| 19 | + rotation=180, |
| 20 | + origin={-70,30}))); |
| 21 | + Parts.Body body1( |
| 22 | + m=250, |
| 23 | + I=0, |
| 24 | + a(start={1,0})) |
| 25 | + annotation (Placement(transformation(extent={{0,20},{20,40}}))); |
| 26 | + Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor |
| 27 | + annotation (Placement(transformation(extent={{20,-10},{40,10}}))); |
| 28 | + Modelica.Mechanics.Translational.Sources.Force force annotation ( |
| 29 | + Placement(transformation( |
| 30 | + extent={{-10,10},{10,-10}}, |
| 31 | + rotation=180, |
| 32 | + origin={-10,70}))); |
| 33 | + Modelica.Blocks.Continuous.PID PID( |
| 34 | + Td=0.2, |
| 35 | + k=-320*9.81*5, |
| 36 | + initType=Modelica.Blocks.Types.InitPID.InitialState, |
| 37 | + xi_start=0, |
| 38 | + Ti=1e9) annotation (Placement(transformation(extent={{40,60},{20,80}}))); |
| 39 | + inner PlanarWorld planarWorld |
| 40 | + annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); |
| 41 | + Joints.Prismatic prismatic(r={1,0}, useFlange=true, |
| 42 | + s(fixed=true), |
| 43 | + v(fixed=true)) |
| 44 | + annotation (Placement(transformation(extent={{-40,40},{-20,20}}))); |
| 45 | + Joints.Revolute revolute(useFlange=true, |
| 46 | + w(fixed=true), |
| 47 | + phi(fixed=true, start=-0.34906585039887)) |
| 48 | + annotation (Placement(transformation( |
| 49 | + extent={{-10,10},{10,-10}}, |
| 50 | + rotation=270, |
| 51 | + origin={-10,0}))); |
| 52 | +equation |
| 53 | + connect(fixedTranslation.frame_b, body.frame_a) annotation (Line( |
| 54 | + points={{-10,-40},{-10,-45},{-10,-50}}, |
| 55 | + color={95,95,95}, |
| 56 | + thickness=0.5)); |
| 57 | + connect(force.f, PID.y) annotation (Line( |
| 58 | + points={{2,70},{2,70},{19,70}}, |
| 59 | + color={0,0,127})); |
| 60 | + connect(angleSensor.phi, PID.u) annotation (Line( |
| 61 | + points={{41,0},{70,0},{70,70},{42,70}}, |
| 62 | + color={0,0,127})); |
| 63 | + |
| 64 | + connect(fixed.frame, prismatic.frame_a) annotation (Line( |
| 65 | + points={{-60,30},{-40,30}}, |
| 66 | + color={95,95,95}, |
| 67 | + thickness=0.5)); |
| 68 | + connect(prismatic.frame_b, body1.frame_a) annotation (Line( |
| 69 | + points={{-20,30},{0,30}}, |
| 70 | + color={95,95,95}, |
| 71 | + thickness=0.5)); |
| 72 | + connect(prismatic.flange_a, force.flange) annotation (Line( |
| 73 | + points={{-30,39},{-30,39},{-30,70},{-20,70}}, |
| 74 | + color={0,127,0})); |
| 75 | + connect(prismatic.frame_b, revolute.frame_a) annotation (Line( |
| 76 | + points={{-20,30},{-10,30},{-10,10}}, |
| 77 | + color={95,95,95}, |
| 78 | + thickness=0.5)); |
| 79 | + connect(revolute.frame_b, fixedTranslation.frame_a) annotation (Line( |
| 80 | + points={{-10,-10},{-10,-20}}, |
| 81 | + color={95,95,95}, |
| 82 | + thickness=0.5)); |
| 83 | + connect(revolute.flange_a, angleSensor.flange) annotation (Line( |
| 84 | + points={{0,0},{0,0},{20,0}})); |
| 85 | + annotation (experiment(StopTime=3), |
| 86 | + Documentation(revisions="<html><p><img src=\"modelica://PlanarMechanics/Resources/Images/dlr_logo.png\"/> <b>Developed 2010-2014 at the DLR Institute of System Dynamics and Control</b></p></html>", info="<html> |
| 87 | +<p>A simple PID (actually PD) controlles the pendulum into upright position.</p> |
| 88 | +<p><img src=\"modelica://PlanarMechanics/Resources/Images/ControlledCraneCrab_1.png\"/></p> |
| 89 | +<p><img src=\"modelica://PlanarMechanics/Resources/Images/ControlledCraneCrab_2.png\"/></p> |
| 90 | +<p>Selected continuous time states</p> |
| 91 | +<ul> |
| 92 | +<li>actuatedPrismatic.s</li> |
| 93 | +<li>actuatedPrismatic.v</li> |
| 94 | +<li>actuatedRevolute.phi</li> |
| 95 | +<li>actuatedRevolute.w</li> |
| 96 | +<li>PID.D.x</li> |
| 97 | +<li>PID.I.y</li> |
| 98 | +</ul> |
| 99 | +</html>")); |
| 100 | +end ControlledCraneCrab; |
0 commit comments