1 | within ; |
---|
2 | package Test0 |
---|
3 | model FullRecovery "Minimize mechanical energy in a simple path" |
---|
4 | parameter Real m=1000 "1000 kg of vehicle mass"; |
---|
5 | parameter Real p=1 "needed for final constraints"; |
---|
6 | parameter Real fGrip=0.02; |
---|
7 | parameter Real S=2 "superficie frontale in m^2"; |
---|
8 | parameter Real Cx=0.4; |
---|
9 | constant Real rho=1.226 "densit� aria kg/m^3"; |
---|
10 | constant Real g=9.81; |
---|
11 | Real a( |
---|
12 | min=-1, |
---|
13 | max=1, |
---|
14 | nominal=0) annotation (isConstraint=true); |
---|
15 | Real v(start=0); |
---|
16 | Real pos(start=0); |
---|
17 | Real pow=f*v "Mechanical power"; |
---|
18 | Real fResis "Motion resistance"; |
---|
19 | Real Energy "Energy to minimize"; |
---|
20 | input Real f(min=-1e9, max=1e9); |
---|
21 | Real constEn(nominal=1) = Energy "minimize Energy(tf)" |
---|
22 | annotation (isMayer=true); |
---|
23 | Real constSpeed( |
---|
24 | min=0, |
---|
25 | max=0) = p*v " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
26 | Real constSpace( |
---|
27 | min=1000, |
---|
28 | max=1000) = p*pos " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
29 | equation |
---|
30 | der(Energy) = pow; |
---|
31 | der(pos) = v; |
---|
32 | der(v) = a; |
---|
33 | fResis = fGrip*m*g + 0.5*Cx*rho*S*v^2; |
---|
34 | f - fResis = m*a; |
---|
35 | annotation (Documentation(info="<html> |
---|
36 | <p>train movement optimization.</p> |
---|
37 | </html>"), experiment( |
---|
38 | StartTime=0, |
---|
39 | StopTime=100, |
---|
40 | Tolerance=1e-08, |
---|
41 | Interval=0.333333)); |
---|
42 | end FullRecovery; |
---|
43 | |
---|
44 | model DOcoasting1 "Minimize mechanical energy in a simple path" |
---|
45 | // Prova con selezione automatica del coasting. |
---|
46 | // Contiene un trucco per evitare variabili booleane o intere per simulare il coasting: |
---|
47 | // quando la forza motrice scende sotto soglia threas, s'intende che siamo in coasting |
---|
48 | // e la potenza al pantografo si annulla |
---|
49 | parameter Real m=1000 "1000 kg of vehicle mass"; |
---|
50 | parameter Real p=1 "needed for final constraints"; |
---|
51 | parameter Real fGrip=0.02; |
---|
52 | parameter Real S=2 "superficie frontale in m^2"; |
---|
53 | parameter Real Cx=0.4; |
---|
54 | parameter Real iLoss=200 "iron losses, W, when no coasting"; |
---|
55 | constant Real rho=1.226 "densità aria kg/m^3"; |
---|
56 | constant Real g=9.81; |
---|
57 | Real a( |
---|
58 | min=-1, |
---|
59 | max=1, |
---|
60 | nominal=0) annotation (isConstraint=true); |
---|
61 | Real v(start=0); |
---|
62 | Real pos(start=0); |
---|
63 | Real elePow, ironLoss; |
---|
64 | Real fResis "Motion resistance"; |
---|
65 | Real Energy "Energy to minimize"; |
---|
66 | input Real f(min=-1e9, max=1e9); |
---|
67 | Real constEn(nominal=1e8) = Energy "minimize Energy(tf)" |
---|
68 | annotation (isMayer=true); |
---|
69 | Real constSpeed( |
---|
70 | min=0, |
---|
71 | max=0) = p*v " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
72 | Real constSpace( |
---|
73 | min=1000, |
---|
74 | max=1000) = p*pos " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
75 | equation |
---|
76 | ironLoss = iLoss*(1 - exp(-f^2/1e4)); |
---|
77 | //ironLoss=100; |
---|
78 | elePow = f*v + ironLoss; |
---|
79 | der(Energy) = elePow; |
---|
80 | der(pos) = v; |
---|
81 | der(v) = a; |
---|
82 | fResis = fGrip*m*g + 0.5*Cx*rho*S*v^2; |
---|
83 | f - fResis = m*a; |
---|
84 | annotation (Documentation(info="<html> |
---|
85 | <p>train movement optimization.</p> |
---|
86 | </html>"), experiment( |
---|
87 | StartTime=0, |
---|
88 | StopTime=100, |
---|
89 | Tolerance=1e-08, |
---|
90 | Interval=1)); |
---|
91 | end DOcoasting1; |
---|
92 | |
---|
93 | model DOminEnPant "Minimize mechanical Pantograph energy in a simple path" |
---|
94 | parameter Real m=1000 "1000 kg of vehicle mass"; |
---|
95 | parameter Real p=1 "needed for final constraints"; |
---|
96 | parameter Real fGrip=0.02; |
---|
97 | parameter Real S=2 "superficie frontale in m^2"; |
---|
98 | parameter Real Cx=0.4; |
---|
99 | constant Real rho=1.226 "densità aria kg/m^3"; |
---|
100 | constant Real g=9.81; |
---|
101 | Real a( |
---|
102 | min=-1, |
---|
103 | max=1, |
---|
104 | nominal=0) annotation (isConstraint=true); |
---|
105 | Real v(start=0); |
---|
106 | Real pos(start=0); |
---|
107 | Real mechPow=f*v "Mechanical power"; |
---|
108 | Real fResis "Motion resistance"; |
---|
109 | Real mechEnergy; |
---|
110 | Real energy "Energy to minimize"; |
---|
111 | input Real f(min=-1e9, max=1e9); |
---|
112 | Real constEn(nominal=1) = energy "minimize energy(tf)" |
---|
113 | annotation (isMayer=true); |
---|
114 | Real constSpeed( |
---|
115 | min=0, |
---|
116 | max=0) = p*v " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
117 | Real constSpace( |
---|
118 | min=1000, |
---|
119 | max=1000) = p*pos " 0<= p*v(tf) <=0 " annotation (isFinalConstraint=true); |
---|
120 | equation |
---|
121 | der(mechEnergy) = mechPow; |
---|
122 | der(pos) = v; |
---|
123 | der(v) = a; |
---|
124 | energy = mechEnergy; |
---|
125 | fResis = fGrip*m*g + 0.5*Cx*rho*S*v^2; |
---|
126 | f - fResis = m*a; |
---|
127 | annotation (Documentation(info="<html> |
---|
128 | <p>train movement optimization.</p> |
---|
129 | </html>"), experiment( |
---|
130 | StartTime=0, |
---|
131 | StopTime=100, |
---|
132 | Tolerance=1e-08, |
---|
133 | Interval=0.333333)); |
---|
134 | end DOminEnPant; |
---|
135 | |
---|
136 | |
---|
137 | annotation ( |
---|
138 | Icon(graphics, coordinateSystem( |
---|
139 | extent={{-100,-80},{100,80}}, |
---|
140 | preserveAspectRatio=true, |
---|
141 | initialScale=0.1, |
---|
142 | grid={2,2})), |
---|
143 | Diagram(graphics, coordinateSystem( |
---|
144 | extent={{-100,-100},{100,100}}, |
---|
145 | preserveAspectRatio=true, |
---|
146 | initialScale=0.1, |
---|
147 | grid={2,2})), |
---|
148 | uses(Modelica(version="3.2.1")), |
---|
149 | version="1", |
---|
150 | conversion(from(version="", script="ConvertFromDOtrainPkg_.mos"))); |
---|
151 | end Test0; |
---|