Ticket #3656: Elevator.mo

File Elevator.mo, 12.8 KB (added by Christian Kral <dr.christian.kral@…>, 9 years ago)

Example to demonstrate bug

Line 
1within ;
2package Elevator
3 model Elevator
4 extends Modelica.Icons.Example;
5 parameter Integer nPas = 2 "Number of passengers";
6 parameter Modelica.SIunits.Mass mPas = 80 "Mass of one passenger";
7 parameter Modelica.SIunits.Mass mCab = 250 "Mass of cabin";
8 parameter Modelica.SIunits.Mass mCou = 410 "Mass of counterweight";
9 parameter Modelica.SIunits.Length DP = 0.8 "Diameter of drive pulley";
10 parameter Modelica.SIunits.Inertia JP = 15 "Inertia of drive pulley";
11 parameter Real EtaP = 0.96 "Efficiency of drive pulley";
12 parameter Real iG = 55 "Ratio of gearbox";
13 parameter Real EtaG = 0.80 "Efficiency of gearbox";
14 parameter Modelica.SIunits.Inertia JMG = 0.03 "Inertia of gearbox + motor";
15 parameter Modelica.SIunits.Velocity vMax = 2 "Max. speed of cabin";
16 final parameter Modelica.SIunits.Length R2T=(DP/2)/iG
17 "Transmission rotational -> translational";
18 parameter Modelica.SIunits.Length s0 = 0 "Initial position of cabin";
19 parameter Modelica.SIunits.Velocity v0 = 0 "Initial velocity of cabin";
20 Modelica.Blocks.Sources.Trapezoid trapezoid(
21 rising=2.5,
22 width=5,
23 falling=2.5,
24 period=10,
25 nperiod=1,
26 offset=0,
27 startTime=0.5,
28 amplitude=vMax/R2T)
29 annotation (Placement(transformation(extent={{-10,-10},{10,10}},
30 rotation=0,
31 origin={-60,50})));
32 Modelica.Mechanics.Rotational.Sources.Speed speed(exact = true) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation=0, origin={-30,50})));
33 Modelica.Mechanics.Rotational.Components.IdealGear gearBox(ratio=iG,
34 useSupport=false)
35 annotation (Placement(transformation(extent={{-10,40},{10,60}})));
36 IdealDrivePulley drivePulley(useTranslationalSupport=false, radius=DP/2)
37 annotation (Placement(transformation(
38 extent={{-10,-10},{10,10}},
39 rotation=270,
40 origin={30,50})));
41 MassGravitation cabin(
42 s(start=s0),
43 v(start=v0),
44 m=mCab + nPas*mPas)
45 annotation (Placement(transformation(extent={{10,0},{30,20}})));
46 MassGravitation counterweight(m=mCou)
47 annotation (Placement(transformation(extent={{30,0},{50,20}})));
48 equation
49 connect(drivePulley.flange_a, cabin.flange) annotation(Line(points={{20,40},
50 {20,20}}, color = {0, 127, 0}));
51 connect(drivePulley.flange_b, counterweight.flange) annotation(Line(points={{40,40},
52 {40,20}}, color = {0, 127, 0}));
53 connect(speed.flange, gearBox.flange_a)
54 annotation (Line(points={{-20,50},{-14,50},{-10,50}}, color={0,0,0}));
55 connect(gearBox.flange_b, drivePulley.flange)
56 annotation (Line(points={{10,50},{15,50},{20,50}}, color={0,0,0}));
57 connect(trapezoid.y, speed.w_ref)
58 annotation (Line(points={{-49,50},{-42,50}}, color={0,0,127}));
59 annotation(Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})), experiment(StopTime=12, Interval=0.01),
60 Documentation(info="<html>
61<p>
62This example of an elevator demonstrates the usage of a <a href=\"modelica://ModelicaAdditions/Mechanics/Rotational/Components/GearConstantEfficiency\">gearbox with constant efficiency</a> and
63a <a href=\"modelica:/ModelicaAdditions/Mechanics.Rotational/Components/DrivePulleyConstantEfficiency\">drive pulley with constant efficiency</a>.
64</p>
65<p>
66The flange_a of the gearbox is driven by a prescribed speed, flange_b of the gearbox drives the rotational flange of the drive pulley.
67At the two ends of a rope through translational flanges flange_a and flange_b of the drive pulley the cabin (with passengers) and a counterweight are hanging.
68</p>
69<p>
70Speed rises linearly between 0 and 2.5 seconds from to 2 m/s, then remains constant for 4.5 seconds and during the following 2.5 seconds speed is reduced linearly to 0.
71This results in lifting the cabin by 14 m and in turn lowering the counterweight by 14 m.
72</p>
73</html>"),
74 __Dymola_experimentSetupOutput);
75 end Elevator;
76
77 model IdealDrivePulley "1-dim. model of ideal drive pulley"
78 import Modelica.Constants.eps;
79 parameter Modelica.SIunits.Distance radius(final min = eps) "Wheel radius";
80 parameter Boolean useTranslationalSupport = false
81 "= true, if Translational support flange enabled, otherwise implicitly grounded"
82 annotation(Evaluate = true, HideResult = true, choices(checkBox = true));
83 Modelica.SIunits.Torque tau "Torque at rotational flange";
84 Modelica.SIunits.Force f_a "Force at translational flange a";
85 Modelica.SIunits.Force f_b "Force at translational flange b";
86 Modelica.Mechanics.Rotational.Interfaces.Flange_a flange "Flange of shaft" annotation(Placement(transformation(extent = {{-10, -110}, {10, -90}}, rotation = 0)));
87 Modelica.Mechanics.Translational.Interfaces.Flange_a flange_a annotation(Placement(transformation(extent = {{90, -110}, {110, -90}}), iconTransformation(extent = {{90, -110}, {110, -90}})));
88 Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b annotation(Placement(transformation(extent = {{90, 110}, {110, 90}}), iconTransformation(extent = {{90, 90}, {110, 110}})));
89 Modelica.Mechanics.Translational.Interfaces.Support translationalSupport(s = s_support, f = -(f_a + f_b)) if useTranslationalSupport
90 "Translational support of component" annotation(Placement(transformation(extent = {{-110, -10}, {-90, 10}})));
91 protected
92 Modelica.SIunits.Angle phi "Angle of rotational flange";
93 Modelica.SIunits.Position s_a
94 "Relative position of translational flange a w.r.t. support";
95 Modelica.SIunits.Position s_b
96 "Relative position of translational flange b w.r.t. support";
97 Modelica.SIunits.Position s_support
98 "Absolute position of translational support flange";
99 equation
100 if not useTranslationalSupport then
101 s_support = 0;
102 end if;
103 phi = flange.phi;
104 tau = flange.tau;
105 s_a = flange_a.s - s_support;
106 s_b = flange_b.s - s_support;
107 f_a = flange_a.f;
108 f_b = flange_b.f;
109 s_a + s_b = 0;
110 phi * radius = s_a;
111 tau + (f_a - f_b) * radius = 0;
112 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics={
113 Rectangle(extent={{-100,-12},{-10,-16}}, lineColor={0,0,0}, fillColor={95,95,95},
114 fillPattern = FillPattern.Solid),
115 Polygon(points = {{57, -85}, {37, -85}, {-57, 85}, {-37, 85}, {57, -85}}, lineColor = {95, 95, 95}, fillColor = {175, 175, 175},
116 fillPattern = FillPattern.Forward, origin={5,
117 53}, rotation = 90),
118 Rectangle(lineColor = {64, 64, 64}, fillColor = {192, 192, 192},
119 fillPattern = FillPattern.HorizontalCylinder, extent = {{-27, -10}, {27, 10}}, origin = {0, -72}, rotation = 90),
120 Ellipse(lineColor = {64, 64, 64}, fillColor = {255, 255, 255},
121 fillPattern = FillPattern.HorizontalCylinder, extent = {{-30, -80}, {30, 80}}, origin = {0, -18}, rotation = 90),
122 Rectangle(lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, pattern = LinePattern.None,
123 fillPattern = FillPattern.HorizontalCylinder, extent = {{-16, -80}, {16, 80}}, origin = {0, -4}, rotation = 90),
124 Ellipse(lineColor = {64, 64, 64}, fillColor = {128, 128, 128},
125 fillPattern = FillPattern.Solid, extent = {{-30, -80}, {30, 80}}, origin = {0, 14}, rotation = 90),
126 Ellipse(lineColor = {64, 64, 64}, fillColor = {192, 192, 192},
127 fillPattern = FillPattern.HorizontalCylinder, extent = {{-4, -10}, {4, 10}}, origin = {0, 14}, rotation = 90),
128 Text(lineColor={0,0,255}, extent = {{-100, 120}, {100, 140}}, textString = "%name"),
129 Polygon(points = {{-57, -85}, {-37, -85}, {57, 85}, {37, 85}, {-57, -85}}, lineColor = {95, 95, 95}, fillColor = {175, 175, 175},
130 fillPattern = FillPattern.Backward, origin = {5, -53}, rotation = 90),
131 Line(visible = not useTranslationalSupport, points = {{-10, -10}, {10, 10}}, color = {0, 0, 0}, origin = {-110, -20}, rotation = 270),
132 Line(visible = not useTranslationalSupport, points = {{-10, -10}, {10, 10}}, color = {0, 0, 0}, origin = {-110, 0}, rotation = 270),
133 Line(visible = not useTranslationalSupport, points = {{-10, -10}, {10, 10}}, color = {0, 0, 0}, origin = {-110, 20}, rotation = 270),
134 Line(visible = not useTranslationalSupport, points = {{-10, -10}, {10, 10}}, color = {0, 0, 0}, origin = {-110, 40}, rotation = 270),
135 Line(visible = not useTranslationalSupport, points = {{-30, 0}, {30, 0}}, color = {0, 0, 0}, origin = {-100, 0}, rotation = 270),
136 Rectangle(extent={{-100,16},{-10,12}}, lineColor={0,0,0}, fillColor={95,95,95},
137 fillPattern = FillPattern.Solid)}),
138 Documentation(info = "<html>
139<p>
140This is a simple model of a drive pulley without losses and without inertia.<br>
141It is assumed that the two rotational flanges flange_a and flange_b are connected by a rope.
142The rope moving into flange_a moves out from flange b.<br>
143The relationship between the rotational flange and the two translational flanges flange_a and flange_b is defined by:
144</p>
145<pre>
146 flange_a.s + flange_b.s = 0;
147 flange.phi*radius = flange_a.s;
148 flange.tau + (flange_a.f - flange_b.f)*radius = 0;
149</pre>
150<p>
151Note, there is a balance between torque and the difference of forces * radius, a rotational support is not present.<br>
152The sum of the two forces appears at the optional translational support.
153</p>
154</html>"));
155 end IdealDrivePulley;
156
157 model MassGravitation "Mass with gravitational force"
158 parameter Modelica.SIunits.Mass m(final min = 0) "Mass";
159 parameter Modelica.SIunits.Acceleration g = Modelica.Constants.g_n
160 "Gravitation";
161 Modelica.SIunits.Position s(start = 0) "Position of flange";
162 Modelica.SIunits.Velocity v(start = 0) "Velocity of flange";
163 Modelica.SIunits.Acceleration a(start = 0) "Acceleration of flange";
164 Modelica.Mechanics.Translational.Interfaces.Flange_a flange annotation(Placement(transformation(extent = {{-10, 110}, {10, 90}})));
165 equation
166 s = flange.s;
167 v = der(s);
168 a = der(v);
169 m * a = flange.f - m * g;
170 annotation(Icon(coordinateSystem(preserveAspectRatio = false), graphics={
171 Rectangle(extent = {{-55, -30}, {55, 30}}, lineColor = {0, 0, 0},
172 fillPattern = FillPattern.Sphere, fillColor = {255, 255, 255}, origin = {0, 25}, rotation = 90),
173 Line(points = {{2.62459e-031, -4.28629e-015}, {20, 0}}, color = {0, 127, 0}, origin = {0, 80}, rotation = 90),
174 Text(extent = {{-100, 20}, {100, -20}}, lineColor={0,0,255}, origin = {-80, 0}, rotation = 90, textString = "%name"),
175 Text(extent = {{-100, 10}, {100, -10}}, lineColor={0,0,255}, origin = {90, 0}, rotation = 90, textString = "m=%m"),
176 Line(points = {{-70, -7.71773e-015}, {60, 0}}, color = {0, 0, 0}, origin = {60, -10}, rotation = 90),
177 Polygon(points = {{15, 0}, {-15, 10}, {-15, -10}, {15, 0}}, lineColor = {0, 0, 0}, fillColor = {128, 128, 128},
178 fillPattern = FillPattern.Solid, origin = {60, 65}, rotation = 90),
179 Polygon(points = {{-10, -30}, {10, -30}, {10, -60}, {20, -60}, {0, -80}, {-20, -60}, {-10, -60}, {-10, -30}}, lineColor = {0, 127, 0}, fillColor = {0, 127, 0},
180 fillPattern = FillPattern.Solid)}),
181 Diagram(coordinateSystem(preserveAspectRatio = false)), Documentation(info = "<html>
182<p>
183This is a simple model of a mass either hanging on a rope or lying on an eleveating platform.<br>
184Both inertia and gravitional force is modelled.
185</p>
186</html>"));
187 end MassGravitation;
188 annotation (uses(Modelica(version="3.2.1")));
189end Elevator;