Ticket #2538: tfm.mo

File tfm.mo, 289.5 KB (added by Adrian Pop, 11 years ago)
Line 
1package ThermoPower "Open library for thermal power plant simulation"
2 extends Modelica.Icons.Package;
3
4 model System "System wide properties"
5 parameter Boolean allowFlowReversal = true "= false to restrict to design flow direction (flangeA -> flangeB)" annotation(Evaluate = true);
6 parameter ThermoPower.Choices.System.Dynamics Dynamics = Choices.System.Dynamics.DynamicFreeInitial;
7 annotation(defaultComponentName = "system", defaultComponentPrefixes = "inner", Icon(graphics = {Polygon(points = {{-100, 60}, {-60, 100}, {60, 100}, {100, 60}, {100, -60}, {60, -100}, {-60, -100}, {-100, -60}, {-100, 60}}, lineColor = {0, 0, 255}, smooth = Smooth.None, fillColor = {170, 213, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-80, 40}, {80, -20}}, lineColor = {0, 0, 255}, textString = "system")}));
8 end System;
9
10 package Icons "Icons for ThermoPower library"
11 extends Modelica.Icons.Package;
12
13 package Gas "Icons for component using water/steam as working fluid"
14 extends Modelica.Icons.Package;
15
16 partial model SourceP annotation(Icon(graphics = {Ellipse(extent = {{-80, 80}, {80, -80}}, lineColor = {128, 128, 128}, fillColor = {159, 159, 223}, fillPattern = FillPattern.Solid), Text(extent = {{-20, 34}, {28, -26}}, lineColor = {255, 255, 255}, textString = "P"), Text(extent = {{-100, -78}, {100, -106}}, textString = "%name")})); end SourceP;
17
18 partial model Tube annotation(Icon(graphics = {Rectangle(extent = {{-80, 40}, {80, -40}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {159, 159, 223})}), Diagram()); end Tube;
19
20 partial model Fan annotation(Icon(graphics = {Polygon(points = {{-38, -24}, {-58, -60}, {62, -60}, {42, -24}, {-38, -24}}, lineColor = {95, 95, 95}, lineThickness = 1, fillColor = {170, 170, 255}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-60, 80}, {60, -40}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.Sphere, fillColor = {170, 170, 255}), Polygon(points = {{-30, 52}, {-30, -8}, {48, 20}, {-30, 52}}, lineColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.HorizontalCylinder, fillColor = {255, 255, 255}), Text(extent = {{-100, -64}, {100, -90}}, lineColor = {95, 95, 95}, textString = "%name")})); end Fan;
21 end Gas;
22 end Icons;
23
24 package Functions "Miscellaneous functions"
25 extends Modelica.Icons.Package;
26
27 function squareReg "Anti-symmetric square approximation with non-zero derivative in the origin"
28 extends Modelica.Icons.Function;
29 input Real x;
30 input Real delta = 0.01 "Range of significant deviation from x^2*sgn(x)";
31 output Real y;
32 algorithm
33 y := x * sqrt(x * x + delta * delta);
34 annotation(Documentation(info = "<html>
35 This function approximates x^2*sgn(x), such that the derivative is non-zero in x=0.
36 </p>
37 <p>
38 <table border=1 cellspacing=0 cellpadding=2>
39 <tr><th>Function</th><th>Approximation</th><th>Range</th></tr>
40 <tr><td>y = regSquare(x)</td><td>y ~= x^2*sgn(x)</td><td>abs(x) &gt;&gt delta</td></tr>
41 <tr><td>y = regSquare(x)</td><td>y ~= x*delta</td><td>abs(x) &lt;&lt delta</td></tr>
42 </table>
43 <p>
44 With the default value of delta=0.01, the difference between x^2 and regSquare(x) is 41% around x=0.01, 0.4% around x=0.1 and 0.005% around x=1.
45 </p>
46 </p>
47 </html>", revisions = "<html>
48 <ul>
49 <li><i>15 Mar 2005</i>
50 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
51 Created. </li>
52 </ul>
53 </html>"));
54 end squareReg;
55
56 package FanCharacteristics "Functions for fan characteristics"
57 partial function baseFlow "Base class for fan flow characteristics"
58 extends Modelica.Icons.Function;
59 input .Modelica.SIunits.VolumeFlowRate q_flow "Volumetric flow rate";
60 input Real bladePos = 1 "Blade position";
61 output .Modelica.SIunits.SpecificEnergy H "Specific Energy";
62 end baseFlow;
63
64 partial function basePower "Base class for fan power consumption characteristics"
65 extends Modelica.Icons.Function;
66 input Modelica.SIunits.VolumeFlowRate q_flow "Volumetric flow rate";
67 input Real bladePos = 1 "Blade position";
68 output Modelica.SIunits.Power consumption "Power consumption";
69 end basePower;
70
71 partial function baseEfficiency "Base class for efficiency characteristics"
72 extends Modelica.Icons.Function;
73 input Modelica.SIunits.VolumeFlowRate q_flow "Volumetric flow rate";
74 input Real bladePos = 1 "Blade position";
75 output Real eta "Efficiency";
76 end baseEfficiency;
77
78 function quadraticFlow "Quadratic flow characteristic, fixed blades"
79 extends baseFlow;
80 input Modelica.SIunits.VolumeFlowRate[3] q_nom "Volume flow rate for three operating points (single fan)" annotation();
81 input Modelica.SIunits.Height[3] H_nom "Specific work for three operating points" annotation();
82 protected
83 parameter Real[3] q_nom2 = {q_nom[1] ^ 2, q_nom[2] ^ 2, q_nom[3] ^ 2} "Squared nominal flow rates";
84 parameter Real[3] c = Modelica.Math.Matrices.solve([ones(3), q_nom, q_nom2], H_nom) "Coefficients of quadratic specific work characteristic";
85 algorithm
86 H := c[1] + q_flow * c[2] + q_flow ^ 2 * c[3];
87 end quadraticFlow;
88
89 function quadraticFlowBlades "Quadratic flow characteristic, movable blades"
90 extends baseFlow;
91 input Real[:] bladePos_nom;
92 input Modelica.SIunits.VolumeFlowRate[3, :] q_nom "Volume flow rate for three operating points at N_pos blade positionings" annotation();
93 input Modelica.SIunits.Height[3, :] H_nom "Specific work for three operating points at N_pos blade positionings" annotation();
94 input Real slope_s(unit = "(J/kg)/(m3/s)", max = 0) = 0 "Slope of flow characteristic at stalling conditions (must be negative)" annotation();
95 algorithm
96 H := Utilities.quadraticFlowBlades(q_flow, bladePos, bladePos_nom, Utilities.quadraticFlowBladesCoeff(bladePos_nom, q_nom, H_nom), slope_s);
97 end quadraticFlowBlades;
98
99 function constantEfficiency "Constant efficiency characteristic"
100 extends baseEfficiency;
101 input Real eta_nom "Nominal efficiency" annotation();
102 algorithm
103 eta := eta_nom;
104 end constantEfficiency;
105
106 function constantPower "Constant power consumption characteristic"
107 extends FanCharacteristics.basePower;
108 input Modelica.SIunits.Power power = 0 "Constant power consumption" annotation();
109 algorithm
110 consumption := power;
111 end constantPower;
112
113 package Utilities
114 function quadraticFlowBlades "Quadratic flow characteristic, movable blades"
115 extends Modelica.Icons.Function;
116 input Modelica.SIunits.VolumeFlowRate q_flow;
117 input Real bladePos;
118 input Real[:] bladePos_nom;
119 input Real[:, :] c "Coefficients of quadratic specific work characteristic";
120 input Real slope_s(unit = "(J/kg)/(m3/s)", max = 0) = 0 "Slope of flow characteristic at stalling conditions (must be negative)";
121 output .Modelica.SIunits.SpecificEnergy H "Specific Energy";
122 protected
123 Integer N_pos = size(bladePos_nom, 1);
124 Integer i;
125 Real alpha;
126 Real q_s "Volume flow rate at stalling conditions";
127 algorithm
128 i := N_pos - 1;
129 while bladePos <= bladePos_nom[i] and i > 1 loop
130 i := i - 1;
131 end while;
132 alpha := (bladePos - bladePos_nom[i]) / (bladePos_nom[i + 1] - bladePos_nom[i]);
133 q_s := (slope_s - ((1 - alpha) * c[2, i] + alpha * c[2, i + 1])) / (2 * ((1 - alpha) * c[3, i] + alpha * c[3, i + 1]));
134 H := if q_flow > q_s then (1 - alpha) * c[1, i] + alpha * c[1, i + 1] + ((1 - alpha) * c[2, i] + alpha * c[2, i + 1]) * q_flow + ((1 - alpha) * c[3, i] + alpha * c[3, i + 1]) * q_flow ^ 2 else (1 - alpha) * c[1, i] + alpha * c[1, i + 1] + ((1 - alpha) * c[2, i] + alpha * c[2, i + 1]) * q_s + ((1 - alpha) * c[3, i] + alpha * c[3, i + 1]) * q_s ^ 2 + (q_flow - q_s) * slope_s;
135 end quadraticFlowBlades;
136
137 function quadraticFlowBladesCoeff
138 extends Modelica.Icons.Function;
139 input Real[:] bladePos_nom;
140 input Modelica.SIunits.VolumeFlowRate[3, :] q_nom "Volume flow rate for three operating points at N_pos blade positionings";
141 input Modelica.SIunits.Height[3, :] H_nom "Specific work for three operating points at N_pos blade positionings";
142 output Real[3, size(bladePos_nom, 1)] c "Coefficients of quadratic specific work characteristic";
143 protected
144 Integer N_pos = size(bladePos_nom, 1);
145 Real[3] q_nom2;
146 algorithm
147 for j in 1:N_pos loop
148 q_nom2 := {q_nom[1, j] ^ 2, q_nom[2, j] ^ 2, q_nom[3, j] ^ 2};
149 c[:, j] := Modelica.Math.Matrices.solve([ones(3), q_nom[:, j], q_nom2], H_nom[:, j]);
150 end for;
151 end quadraticFlowBladesCoeff;
152 end Utilities;
153 end FanCharacteristics;
154 annotation(Documentation(info = "<HTML>
155 This package contains general-purpose functions and models
156 </HTML>"));
157 end Functions;
158
159 package Choices "Choice enumerations for ThermoPower models"
160 extends Modelica.Icons.Package;
161
162 package PressDrop
163 type FFtypes = enumeration(Kf "Kf friction factor", OpPoint "Friction factor defined by operating point", Kinetic "Kinetic friction factor") "Type, constants and menu choices to select the friction factor";
164 end PressDrop;
165
166 package Init "Options for initialisation"
167 type Options = enumeration(noInit "No initial equations", steadyState "Steady-state initialisation", steadyStateNoP "Steady-state initialisation except pressures", steadyStateNoT "Steady-state initialisation except temperatures", steadyStateNoPT "Steady-state initialisation except pressures and temperatures") "Type, constants and menu choices to select the initialisation options";
168 end Init;
169
170 package System
171 type Dynamics = enumeration(DynamicFreeInitial "DynamicFreeInitial -- Dynamic balance, Initial guess value", FixedInitial "FixedInitial -- Dynamic balance, Initial value fixed", SteadyStateInitial "SteadyStateInitial -- Dynamic balance, Steady state initial with guess value", SteadyState "SteadyState -- Steady state balance, Initial guess value") "Enumeration to define definition of balance equations";
172 end System;
173 end Choices;
174
175 package Gas "Models of components with ideal gases as working fluid"
176 connector Flange "Flange connector for gas flows"
177 replaceable package Medium = Modelica.Media.Interfaces.PartialMedium;
178 flow Medium.MassFlowRate m_flow "Mass flow rate from the connection point into the component";
179 Medium.AbsolutePressure p "Thermodynamic pressure in the connection point";
180 stream Medium.SpecificEnthalpy h_outflow "Specific thermodynamic enthalpy close to the connection point if m_flow < 0";
181 stream Medium.MassFraction[Medium.nXi] Xi_outflow "Independent mixture mass fractions m_i/m close to the connection point if m_flow < 0";
182 stream Medium.ExtraProperty[Medium.nC] C_outflow "Properties c_i/m close to the connection point if m_flow < 0";
183 annotation(Icon(), Documentation(info = "<HTML>
184 </HTML>", revisions = "<html>
185 <ul>
186 <li><i>20 Dec 2004</i>
187 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
188 Adapted to Modelica.Media.</li>
189 <li><i>5 Mar 2004</i>
190 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
191 First release.</li>
192 </ul>
193 </html>"));
194 end Flange;
195
196 connector FlangeA "A-type flange connector for gas flows"
197 extends Flange;
198 annotation(Icon(graphics = {Ellipse(extent = {{-100, 100}, {100, -100}}, lineColor = {159, 159, 223}, fillColor = {159, 159, 223}, fillPattern = FillPattern.Solid)}));
199 end FlangeA;
200
201 connector FlangeB "B-type flange connector for gas flows"
202 extends Flange;
203 annotation(Icon(graphics = {Ellipse(extent = {{-100, 100}, {100, -100}}, lineColor = {159, 159, 223}, fillColor = {159, 159, 223}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-40, 40}, {40, -40}}, lineColor = {159, 159, 223}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid)}));
204 end FlangeB;
205
206 extends Modelica.Icons.Package;
207
208 model SourcePressure "Pressure source for gas flows"
209 extends Icons.Gas.SourceP;
210 replaceable package Medium = Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true);
211 Medium.BaseProperties gas(p(start = p0), T(start = T), Xi(start = Xnom[1:Medium.nXi]));
212 parameter .Modelica.SIunits.Pressure p0 = 101325 "Nominal pressure";
213 parameter HydraulicResistance R = 0 "Hydraulic resistance";
214 parameter AbsoluteTemperature T = 300 "Nominal temperature";
215 parameter .Modelica.SIunits.MassFraction[Medium.nX] Xnom = Medium.reference_X "Nominal gas composition";
216 parameter Boolean allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
217 parameter Boolean use_in_p0 = false "Use connector input for the pressure" annotation(Dialog(group = "External inputs"));
218 parameter Boolean use_in_T = false "Use connector input for the temperature" annotation(Dialog(group = "External inputs"));
219 parameter Boolean use_in_X = false "Use connector input for the composition" annotation(Dialog(group = "External inputs"));
220 outer ThermoPower.System system "System wide properties";
221 FlangeB flange(redeclare package Medium = Medium, m_flow(max = if allowFlowReversal then +Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{80, -20}, {120, 20}}, rotation = 0)));
222 Modelica.Blocks.Interfaces.RealInput in_p0 if use_in_p0 annotation(Placement(transformation(origin = {-60, 64}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
223 Modelica.Blocks.Interfaces.RealInput in_T if use_in_T annotation(Placement(transformation(origin = {0, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
224 Modelica.Blocks.Interfaces.RealInput[Medium.nX] in_X if use_in_X annotation(Placement(transformation(origin = {60, 62}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
225 protected
226 Modelica.Blocks.Interfaces.RealInput in_p0_internal;
227 Modelica.Blocks.Interfaces.RealInput in_T_internal;
228 Modelica.Blocks.Interfaces.RealInput[Medium.nX] in_X_internal;
229 equation
230 if R == 0 then
231 flange.p = gas.p;
232 else
233 flange.p = gas.p + flange.m_flow * R;
234 end if;
235 gas.p = in_p0_internal;
236 if not use_in_p0 then
237 in_p0_internal = p0 "Pressure set by parameter";
238 end if;
239 gas.T = in_T_internal;
240 if not use_in_T then
241 in_T_internal = T "Temperature set by parameter";
242 end if;
243 gas.Xi = in_X_internal[1:Medium.nXi];
244 if not use_in_X then
245 in_X_internal = Xnom "Composition set by parameter";
246 end if;
247 flange.h_outflow = gas.h;
248 flange.Xi_outflow = gas.Xi;
249 connect(in_p0, in_p0_internal);
250 connect(in_T, in_T_internal);
251 connect(in_X, in_X_internal);
252 annotation(Icon(), Diagram(), Documentation(info = "<html>
253 <p><b>Modelling options</b></p>
254 <p>The actual gas used in the component is determined by the replaceable <tt>Medium</tt> package.In the case of multiple componet, variable composition gases, the nominal gas composition is given by <tt>Xnom</tt>, whose default value is <tt>Medium.reference_X</tt> .
255 <p>If <tt>R</tt> is set to zero, the pressure source is ideal; otherwise, the outlet pressure decreases proportionally to the outgoing flowrate.</p>
256 <p>If the <tt>in_p</tt> connector is wired, then the source pressure is given by the corresponding signal, otherwise it is fixed to <tt>p0</tt>.</p>
257 <p>If the <tt>in_T</tt> connector is wired, then the source temperature is given by the corresponding signal, otherwise it is fixed to <tt>T</tt>.</p>
258 <p>If the <tt>in_X</tt> connector is wired, then the source massfraction is given by the corresponding signal, otherwise it is fixed to <tt>Xnom</tt>.</p>
259 </html>", revisions = "<html>
260 <ul>
261 <li><i>19 Nov 2004</i>
262 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
263 Removed <tt>p0fix</tt> and <tt>Tfix</tt> and <tt>Xfix</tt>; the connection of external signals is now detected automatically.</li> <br> Adapted to Modelica.Media
264 <li><i>1 Oct 2003</i>
265 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
266 First release.</li>
267 </ul>
268 </html>
269 "));
270 end SourcePressure;
271
272 model SinkPressure "Pressure sink for gas flows"
273 extends Icons.Gas.SourceP;
274 replaceable package Medium = Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true);
275 Medium.BaseProperties gas(p(start = p0), T(start = T), Xi(start = Xnom[1:Medium.nXi]));
276 parameter .Modelica.SIunits.Pressure p0 = 101325 "Nominal pressure";
277 parameter AbsoluteTemperature T = 300 "Nominal temperature";
278 parameter .Modelica.SIunits.MassFraction[Medium.nX] Xnom = Medium.reference_X "Nominal gas composition";
279 parameter HydraulicResistance R = 0 "Hydraulic Resistance";
280 parameter Boolean allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
281 parameter Boolean use_in_p0 = false "Use connector input for the pressure" annotation(Dialog(group = "External inputs"));
282 parameter Boolean use_in_T = false "Use connector input for the temperature" annotation(Dialog(group = "External inputs"));
283 parameter Boolean use_in_X = false "Use connector input for the composition" annotation(Dialog(group = "External inputs"));
284 outer ThermoPower.System system "System wide properties";
285 FlangeA flange(redeclare package Medium = Medium, m_flow(min = if allowFlowReversal then -Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{-120, -20}, {-80, 20}}, rotation = 0)));
286 Modelica.Blocks.Interfaces.RealInput in_p0 if use_in_p0 annotation(Placement(transformation(origin = {-64.5, 59.5}, extent = {{-12.5, -12.5}, {12.5, 12.5}}, rotation = 270)));
287 Modelica.Blocks.Interfaces.RealInput in_T if use_in_T annotation(Placement(transformation(origin = {0, 90}, extent = {{-10, -12}, {10, 12}}, rotation = 270)));
288 Modelica.Blocks.Interfaces.RealInput[Medium.nX] in_X if use_in_X annotation(Placement(transformation(origin = {66, 59}, extent = {{-13, -14}, {13, 14}}, rotation = 270)));
289 protected
290 Modelica.Blocks.Interfaces.RealInput in_p0_internal;
291 Modelica.Blocks.Interfaces.RealInput in_T_internal;
292 Modelica.Blocks.Interfaces.RealInput[Medium.nX] in_X_internal;
293 equation
294 if R == 0 then
295 flange.p = gas.p;
296 else
297 flange.p = gas.p + flange.m_flow * R;
298 end if;
299 gas.p = in_p0_internal;
300 if not use_in_p0 then
301 in_p0_internal = p0 "Pressure set by parameter";
302 end if;
303 gas.T = in_T_internal;
304 if not use_in_T then
305 in_T_internal = T "Temperature set by parameter";
306 end if;
307 gas.Xi = in_X_internal[1:Medium.nXi];
308 if not use_in_X then
309 in_X_internal = Xnom "Composition set by parameter";
310 end if;
311 flange.h_outflow = gas.h;
312 flange.Xi_outflow = gas.Xi;
313 connect(in_p0, in_p0_internal);
314 connect(in_T, in_T_internal);
315 connect(in_X, in_X_internal);
316 annotation(Documentation(info = "<html>
317 <p><b>Modelling options</b></p>
318 <p>The actual gas used in the component is determined by the replaceable <tt>Medium</tt> package. In the case of multiple component, variable composition gases, the nominal gas composition is given by <tt>Xnom</tt>, whose default value is <tt>Medium.reference_X</tt> .
319 <p>If <tt>R</tt> is set to zero, the pressure sink is ideal; otherwise, the inlet pressure increases proportionally to the outgoing flowrate.</p>
320 <p>If the <tt>in_p</tt> connector is wired, then the source pressure is given by the corresponding signal, otherwise it is fixed to <tt>p0</tt>.</p>
321 <p>If the <tt>in_T</tt> connector is wired, then the source temperature is given by the corresponding signal, otherwise it is fixed to <tt>T</tt>.</p>
322 <p>If the <tt>in_X</tt> connector is wired, then the source massfraction is given by the corresponding signal, otherwise it is fixed to <tt>Xnom</tt>.</p>
323 </html>", revisions = "<html>
324 <ul>
325 <li><i>19 Nov 2004</i>
326 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
327 Removed <tt>p0fix</tt> and <tt>Tfix</tt> and <tt>Xfix</tt>; the connection of external signals is now detected automatically.</li>
328 <br> Adapted to Modelica.Media
329 <li><i>1 Oct 2003</i>
330 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
331 First release.</li>
332 </ul>
333 </html>"));
334 end SinkPressure;
335
336 model PressDrop "Pressure drop for gas flows"
337 extends Icons.Gas.Tube;
338 replaceable package Medium = Modelica.Media.Interfaces.PartialMedium annotation(choicesAllMatching = true);
339 Medium.BaseProperties gas(p(start = pstart), T(start = Tstart), Xi(start = Xstart[1:Medium.nXi]));
340 parameter .Modelica.SIunits.MassFlowRate wnom "Nominal mass flowrate";
341 parameter .ThermoPower.Choices.PressDrop.FFtypes FFtype = .ThermoPower.Choices.PressDrop.FFtypes.Kf "Friction factor type";
342 parameter Real Kf(fixed = if FFtype == .ThermoPower.Choices.PressDrop.FFtypes.Kf then true else false, unit = "Pa.kg/(m3.kg2/s2)") "Hydraulic resistance coefficient";
343 parameter .Modelica.SIunits.Pressure dpnom = 0 "Nominal pressure drop";
344 parameter Density rhonom = 0 "Nominal density";
345 parameter Real K = 0 "Kinetic resistance coefficient (DP=K*rho*velocity^2/2)";
346 parameter .Modelica.SIunits.Area A = 0 "Cross-section";
347 parameter Real wnf = 0.01 "Fraction of nominal flow rate at which linear friction equals turbulent friction";
348 parameter Real Kfc = 1 "Friction factor correction coefficient";
349 parameter Boolean allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
350 outer ThermoPower.System system "System wide properties";
351 parameter .Modelica.SIunits.Pressure pstart = 101325 "Start pressure value" annotation(Dialog(tab = "Initialisation"));
352 parameter AbsoluteTemperature Tstart = 300 "Start temperature value" annotation(Dialog(tab = "Initialisation"));
353 parameter .Modelica.SIunits.MassFraction[Medium.nX] Xstart = Medium.reference_X "Start gas composition" annotation(Dialog(tab = "Initialisation"));
354 function squareReg = ThermoPower.Functions.squareReg;
355 protected
356 parameter Real Kfl(fixed = false) "Linear friction coefficient";
357 public
358 .Modelica.SIunits.MassFlowRate w "Mass flow rate in the inlet";
359 .Modelica.SIunits.Pressure pin "Inlet pressure";
360 .Modelica.SIunits.Pressure pout "Outlet pressure";
361 .Modelica.SIunits.Pressure dp "Pressure drop";
362 FlangeA inlet(redeclare package Medium = Medium, m_flow(start = wnom, min = if allowFlowReversal then -Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{-120, -20}, {-80, 20}}, rotation = 0)));
363 FlangeB outlet(redeclare package Medium = Medium, m_flow(start = -wnom, max = if allowFlowReversal then +Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{80, -20}, {120, 20}}, rotation = 0)));
364 initial equation
365 if FFtype == .ThermoPower.Choices.PressDrop.FFtypes.OpPoint then
366 Kf = dpnom * rhonom / wnom ^ 2 * Kfc;
367 elseif FFtype == .ThermoPower.Choices.PressDrop.FFtypes.Kinetic then
368 Kf = K / (2 * A ^ 2) * Kfc;
369 end if;
370 Kfl = wnom * wnf * Kf "Linear friction factor";
371 assert(Kf >= 0, "Negative friction coefficient");
372 equation
373 assert(dpnom > 0, "dpnom=0 not supported, it is also used in the homotopy trasformation during the inizialization");
374 gas.p = homotopy(if not allowFlowReversal then pin else if inlet.m_flow >= 0 then pin else pout, pin);
375 gas.h = homotopy(if not allowFlowReversal then inStream(inlet.h_outflow) else actualStream(inlet.h_outflow), inStream(inlet.h_outflow));
376 gas.Xi = homotopy(if not allowFlowReversal then inStream(inlet.Xi_outflow) else actualStream(inlet.Xi_outflow), inStream(inlet.Xi_outflow));
377 pin - pout = homotopy(smooth(1, Kf * squareReg(w, wnom * wnf)) / gas.d, dpnom / wnom * w) "Flow characteristics";
378 w = inlet.m_flow;
379 pin = inlet.p;
380 pout = outlet.p;
381 dp = pin - pout;
382 inlet.m_flow + outlet.m_flow = 0;
383 inlet.h_outflow = inStream(outlet.h_outflow);
384 inStream(inlet.h_outflow) = outlet.h_outflow;
385 inlet.Xi_outflow = inStream(outlet.Xi_outflow);
386 inStream(inlet.Xi_outflow) = outlet.Xi_outflow;
387 annotation(Icon(graphics = {Text(extent = {{-100, -40}, {100, -80}}, textString = "%name")}), Diagram(), Documentation(info = "<html>
388 <p>The pressure drop across the inlet and outlet connectors is computed according to a turbulent friction model, i.e. is proportional to the squared velocity of the fluid. The friction coefficient can be specified directly, or by giving an operating point, or as a multiple of the kinetic pressure. The correction coefficient <tt>Kfc</tt> can be used to modify the friction coefficient, e.g. to fit some experimental operating point.</p>
389 <p>A small linear pressure drop is added to avoid numerical singularities at low or zero flowrate. The <tt>wnom</tt> parameter must be always specified; the additional linear pressure drop is such that it is equal to the turbulent pressure drop when the flowrate is equal to <tt>wnf*wnom</tt> (the default value is 1% of the nominal flowrate).
390 <p><b>Modelling options</b></p>
391 <p>The actual gas used in the component is determined by the replaceable <tt>Medium</tt> package. In the case of multiple component, variable composition gases, the start composition is given by <tt>Xstart</tt>, whose default value is <tt>Medium.reference_X</tt>.
392 <p>The following options are available to specify the friction coefficient:
393 <ul><li><tt>FFtype = 0</tt>: the hydraulic friction coefficient <tt>Kf</tt> is used directly.</li>
394 <li><tt>FFtype = 1</tt>: the hydraulic friction coefficient is specified by the nominal operating point (<tt>wnom</tt>,<tt>dpnom</tt>, <tt>rhonom</tt>).</li>
395 <li><tt>FFtype = 2</tt>: the pressure drop is <tt>K</tt> times the kinetic pressure.</li></ul>
396 </html>", revisions = "<html>
397 <ul>
398 <li><i>19 Nov 2004</i>
399 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
400 Adapted to Modelica.Media.</li>
401 <br> <tt>Kfnom</tt> removed, <tt>Kf</tt> can now be set directly.</li>
402 <li><i>5 Mar 2004</i>
403 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
404 First release.</li>
405 </ul>
406 </html>"));
407 end PressDrop;
408
409 partial model FanBase "Base model for fans"
410 extends Icons.Gas.Fan;
411 replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model" annotation(choicesAllMatching = true);
412 Medium.BaseProperties inletFluid(h(start = hstart)) "Fluid properties at the inlet";
413 replaceable function flowCharacteristic = Functions.FanCharacteristics.quadraticFlow "Head vs. q_flow characteristic at nominal speed and density" annotation(Dialog(group = "Characteristics"), choicesAllMatching = true);
414 parameter Boolean usePowerCharacteristic = false "Use powerCharacteristic (vs. efficiencyCharacteristic)" annotation(Dialog(group = "Characteristics"));
415 replaceable function powerCharacteristic = Functions.FanCharacteristics.constantPower constrainedby Functions.FanCharacteristics.basePower;
416 replaceable function efficiencyCharacteristic = Functions.FanCharacteristics.constantEfficiency(eta_nom = 0.8) constrainedby Functions.PumpCharacteristics.baseEfficiency;
417 parameter Integer Np0(min = 1) = 1 "Nominal number of fans in parallel";
418 parameter Real bladePos0 = 1 "Nominal blade position";
419 parameter Density rho0 = 1.229 "Nominal Gas Density" annotation(Dialog(group = "Characteristics"));
420 parameter .Modelica.SIunits.Conversions.NonSIunits.AngularVelocity_rpm n0 = 1500 "Nominal rotational speed" annotation(Dialog(group = "Characteristics"));
421 parameter .Modelica.SIunits.Volume V = 0 "Fan Internal Volume" annotation(Evaluate = true);
422 parameter Boolean CheckValve = false "Reverse flow stopped";
423 parameter Boolean allowFlowReversal = system.allowFlowReversal "= true to allow flow reversal, false restricts to design direction";
424 outer ThermoPower.System system "System wide properties";
425 parameter .Modelica.SIunits.VolumeFlowRate q_single_start = q_single0 "Volume Flow Rate Start Value (single pump)" annotation(Dialog(tab = "Initialisation"));
426 parameter .Modelica.SIunits.SpecificEnthalpy hstart = 100000.0 "Fluid Specific Enthalpy Start Value" annotation(Dialog(tab = "Initialisation"));
427 parameter Density rho_start = rho0 "Inlet Density start value" annotation(Dialog(tab = "Initialisation"));
428 parameter Choices.Init.Options initOpt = Choices.Init.Options.noInit "Initialisation option" annotation(Dialog(tab = "Initialisation"));
429 parameter .Modelica.SIunits.MassFlowRate w0 "Nominal mass flow rate" annotation(Dialog(group = "Characteristics"));
430 parameter .Modelica.SIunits.Pressure dp0 "Nominal pressure increase" annotation(Dialog(group = "Characteristics"));
431 final parameter .Modelica.SIunits.VolumeFlowRate q_single0 = w0 / (Np0 * rho0) "Nominal volume flow rate (single pump)";
432 final parameter .Modelica.SIunits.SpecificEnergy H0 = dp0 / rho0 "Nominal specific energy";
433 protected
434 function df_dqflow = der(flowCharacteristic, q_flow);
435 public
436 .Modelica.SIunits.MassFlowRate w_single(start = q_single_start * rho_start) "Mass flow rate (single fan)";
437 .Modelica.SIunits.MassFlowRate w = Np * w_single "Mass flow rate (total)";
438 .Modelica.SIunits.VolumeFlowRate q_single "Volume flow rate (single fan)";
439 .Modelica.SIunits.VolumeFlowRate q = Np * q_single "Volume flow rate (totale)";
440 .Modelica.SIunits.Pressure dp "Outlet pressure minus inlet pressure";
441 .Modelica.SIunits.SpecificEnergy H "Specific energy";
442 Medium.SpecificEnthalpy h(start = hstart) "Fluid specific enthalpy";
443 Medium.SpecificEnthalpy hin(start = hstart) "Enthalpy of entering fluid";
444 Medium.SpecificEnthalpy hout(start = hstart) "Enthalpy of outgoing fluid";
445 LiquidDensity rho "Gas density";
446 Medium.Temperature Tin "Gas inlet temperature";
447 .Modelica.SIunits.Conversions.NonSIunits.AngularVelocity_rpm n "Shaft r.p.m.";
448 Real bladePos "Blade position";
449 Integer Np(min = 1) "Number of fans in parallel";
450 .Modelica.SIunits.Power W_single "Power Consumption (single fan)";
451 .Modelica.SIunits.Power W = Np * W_single "Power Consumption (total)";
452 constant .Modelica.SIunits.Power W_eps = 1e-008 "Small coefficient to avoid numerical singularities";
453 constant .Modelica.SIunits.Conversions.NonSIunits.AngularVelocity_rpm n_eps = 1e-006;
454 Real eta "Fan efficiency";
455 Real s "Auxiliary Variable";
456 FlangeA infl(h_outflow(start = hstart), redeclare package Medium = Medium, m_flow(min = if allowFlowReversal then -Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{-100, 2}, {-60, 42}}, rotation = 0)));
457 FlangeB outfl(h_outflow(start = hstart), redeclare package Medium = Medium, m_flow(max = if allowFlowReversal then +Modelica.Constants.inf else 0)) annotation(Placement(transformation(extent = {{40, 52}, {80, 92}}, rotation = 0)));
458 Modelica.Blocks.Interfaces.IntegerInput in_Np "Number of parallel pumps" annotation(Placement(transformation(origin = {28, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
459 Modelica.Blocks.Interfaces.RealInput in_bladePos annotation(Placement(transformation(origin = {-40, 76}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
460 initial equation
461 if initOpt == Choices.Init.Options.noInit then
462 elseif initOpt == Choices.Init.Options.steadyState then
463 if V > 0 then
464 der(h) = 0;
465 end if;
466 else
467 assert(false, "Unsupported initialisation option");
468 end if;
469 equation
470 Np = in_Np;
471 if cardinality(in_Np) == 0 then
472 in_Np = Np0 "Number of fans selected by parameter";
473 end if;
474 bladePos = in_bladePos;
475 if cardinality(in_bladePos) == 0 then
476 in_bladePos = bladePos0 "Blade position selected by parameter";
477 end if;
478 inletFluid.p = infl.p;
479 inletFluid.h = inStream(infl.h_outflow);
480 rho = inletFluid.d;
481 Tin = inletFluid.T;
482 q_single = w_single / homotopy(rho, rho0);
483 H = dp / homotopy(rho, rho0);
484 if noEvent(s > 0 or not CheckValve) then
485 q_single = s;
486 H = homotopy((n / n0) ^ 2 * flowCharacteristic(q_single * n0 / (n + n_eps), bladePos), df_dqflow(q_single0) * (q_single - q_single0) + (2 / n0 * flowCharacteristic(q_single0) - q_single0 / n0 * df_dqflow(q_single0)) * (n - n0) + H0);
487 else
488 H = homotopy((n / n0) ^ 2 * flowCharacteristic(0) - s, df_dqflow(q_single0) * (q_single - q_single0) + (2 / n0 * flowCharacteristic(q_single0) - q_single0 / n0 * df_dqflow(q_single0)) * (n - n0) + H0);
489 q_single = 0;
490 end if;
491 if usePowerCharacteristic then
492 W_single = (n / n0) ^ 3 * rho / rho0 * powerCharacteristic(q_single * n0 / (n + n_eps), bladePos) "Power consumption (single fan)";
493 eta = dp * q_single / (W_single + W_eps) "Hydraulic efficiency";
494 else
495 eta = efficiencyCharacteristic(q_single * n0 / (n + n_eps), bladePos);
496 W_single = dp * q_single / eta;
497 end if;
498 dp = outfl.p - infl.p;
499 w = infl.m_flow "Fan total flow rate";
500 hin = homotopy(if not allowFlowReversal then inStream(infl.h_outflow) else if w >= 0 then inStream(infl.h_outflow) else h, inStream(infl.h_outflow));
501 hout = homotopy(if not allowFlowReversal then h else if w >= 0 then h else inStream(outfl.h_outflow), h);
502 infl.m_flow + outfl.m_flow = 0 "Mass balance";
503 if V > 0 then
504 rho * V * der(h) = outfl.m_flow / Np * hout + infl.m_flow / Np * hin + W_single "Dynamic energy balance (single fan)";
505 outfl.h_outflow = h;
506 infl.h_outflow = h;
507 else
508 outfl.h_outflow = inStream(infl.h_outflow) + W_single / w "Energy balance for w > 0";
509 infl.h_outflow = inStream(outfl.h_outflow) + W_single / w "Energy balance for w < 0";
510 h = homotopy(if not allowFlowReversal then outfl.h_outflow else if w >= 0 then outfl.h_outflow else infl.h_outflow, outfl.h_outflow) "Definition of h";
511 end if;
512 annotation(Icon(), Diagram(), Documentation(info = "<HTML>
513 <p>This is the base model for the <tt>FanMech</tt> fan model.
514 <p>The model describes a fan, or a group of <tt>Np</tt> identical fans, with optional blade angle regulation. The fan model is based on the theory of kinematic similarity: the fan characteristics are given for nominal operating conditions (rotational speed and fluid density), and then adapted to actual operating condition, according to the similarity equations.
515 <p>In order to avoid singularities in the computation of the outlet enthalpy at zero flowrate, the thermal capacity of the fluid inside the fan body can be taken into account.
516 <p>The model can either support reverse flow conditions or include a built-in check valve to avoid flow reversal.
517 <p><b>Modelling options</b></p>
518 <p> The nominal flow characteristic (specific energy vs. volume flow rate) is given by the the replaceable function <tt>flowCharacteristic</tt>. If the blade angles are fixed, it is possible to use implementations which ignore the <tt>bladePos</tt> input.
519 <p> The fan energy balance can be specified in two alternative ways:
520 <ul>
521 <li><tt>usePowerCharacteristic = false</tt> (default option): the replaceable function <tt>efficiencyCharacteristic</tt> (efficiency vs. volume flow rate in nominal conditions) is used to determine the efficiency, and then the power consumption. The default is a constant efficiency of 0.8.
522 <li><tt>usePowerCharacteristic = true</tt>: the replaceable function <tt>powerCharacteristic</tt> (power consumption vs. volume flow rate in nominal conditions) is used to determine the power consumption, and then the efficiency.
523 </ul>
524 <p>
525 Several functions are provided in the package <tt>Functions.FanCharacteristics</tt> to specify the characteristics as a function of some operating points at nominal conditions.
526 <p>Depending on the value of the <tt>checkValve</tt> parameter, the model either supports reverse flow conditions, or includes a built-in check valve to avoid flow reversal.
527 <p>If the <tt>in_Np</tt> input connector is wired, it provides the number of fans in parallel; otherwise, <tt>Np0</tt> parallel fans are assumed.</p>
528 <p>It is possible to take into account the heat capacity of the fluid inside the fan by specifying its volume <tt>V</tt> at nominal conditions; this is necessary to avoid singularities in the computation of the outlet enthalpy in case of zero flow rate. If zero flow rate conditions are always avoided, this dynamic effect can be neglected by leaving the default value <tt>V = 0</tt>, thus avoiding a fast state variable in the model.
529 <p>The <tt>CheckValve</tt> parameter determines whether the fan has a built-in check valve or not.
530 </HTML>", revisions = "<html>
531 <ul>
532 <li><i>10 Nov 2005</i>
533 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
534 Adapted from the <tt>Water.PumpBase</tt> model.</li>
535 </ul>
536 </html>"));
537 end FanBase;
538
539 model FanMech
540 extends FanBase;
541 .Modelica.SIunits.Angle phi "Shaft angle";
542 .Modelica.SIunits.AngularVelocity omega "Shaft angular velocity";
543 Modelica.Mechanics.Rotational.Interfaces.Flange_a MechPort annotation(Placement(transformation(extent = {{78, 6}, {108, 36}}, rotation = 0)));
544 equation
545 n = Modelica.SIunits.Conversions.to_rpm(omega) "Rotational speed";
546 phi = MechPort.phi;
547 omega = der(phi);
548 W_single = omega * MechPort.tau;
549 annotation(Diagram(), Icon(graphics = {Rectangle(extent = {{60, 28}, {86, 12}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {160, 160, 164})}), Documentation(info = "<HTML>
550 <p>This model describes a fan (or a group of <tt>Np</tt> fans in parallel) with a mechanical rotational connector for the shaft, to be used when the pump drive has to be modelled explicitly. In the case of <tt>Np</tt> fans in parallel, the mechanical connector is relative to a single fan.
551 <p>The model extends <tt>FanBase</tt>
552 </HTML>", revisions = "<html>
553 <ul>
554 <li><i>10 Nov 2005</i>
555 by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
556 Adapted from the <tt>Water.PumpBase</tt> model.</li>
557 </ul>
558 </html>"));
559 end FanMech;
560 annotation(Documentation(info = "<HTML>
561 This package contains models of physical processes and components using ideal gases as working fluid.
562 <p>All models with dynamic equations provide initialisation support. Set the <tt>initOpt</tt> parameter to the appropriate value:
563 <ul>
564 <li><tt>Choices.Init.Options.noInit</tt>: no initialisation
565 <li><tt>Choices.Init.Options.steadyState</tt>: full steady-state initialisation
566 <li><tt>Choices.Init.Options.steadyStateNoP</tt>: steady-state initialisation (except pressure)
567 <li><tt>Choices.Init.Options.steadyStateNoT</tt>: steady-state initialisation (except temperature)
568 </ul>
569 The latter options can be useful when two or more components are connected directly so that they will have the same pressure or temperature, to avoid over-specified systems of initial equations.
570 </HTML>"));
571 end Gas;
572
573 package Test "Test cases for the ThermoPower models"
574 extends Modelica.Icons.Package;
575
576 package GasComponents "Tests for lumped-parameters Gas package components"
577 model TestFanMech
578 Gas.FanMech FanMech1(redeclare package Medium = Modelica.Media.Air.SimpleAir, rho0 = 1.23, n0 = 590, bladePos0 = 0.8, redeclare function flowCharacteristic = flowChar, q_single_start = 144, w0 = 144, dp0 = 6000) annotation(Placement(transformation(extent = {{-70, -24}, {-30, 16}}, rotation = 0)));
579 Gas.SinkPressure SinkP1(redeclare package Medium = Modelica.Media.Air.SimpleAir) annotation(Placement(transformation(extent = {{0, 20}, {20, 40}}, rotation = 0)));
580 Gas.SourcePressure SourceP1(redeclare package Medium = Modelica.Media.Air.SimpleAir) annotation(Placement(transformation(extent = {{-98, -10}, {-78, 10}}, rotation = 0)));
581 Modelica.Mechanics.Rotational.Sources.ConstantSpeed ConstantSpeed1(w_fixed = Modelica.SIunits.Conversions.from_rpm(590), useSupport = false) annotation(Placement(transformation(extent = {{90, -10}, {70, 10}}, rotation = 0)));
582 function flowChar = Functions.FanCharacteristics.quadraticFlowBlades(bladePos_nom = {0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85}, q_nom = [0, 0, 100, 300, 470, 620, 760, 900, 1000, 1100, 1300, 1500; 70, 125, 310, 470, 640, 820, 1000, 1200, 1400, 1570, 1700, 1900; 100, 200, 370, 530, 700, 900, 1100, 1300, 1500, 1750, 2000, 2300], H_nom = [3100, 3800, 3700, 3850, 4200, 4350, 4700, 4900, 5300, 5600, 5850, 6200; 2000, 3000, 3000, 3000, 3000, 3200, 3200, 3300, 3600, 4200, 5000, 5500; 1000, 2000, 2000, 2000, 2000, 1750, 1750, 2000, 2350, 2500, 2850, 3200]);
583 Modelica.Blocks.Sources.Ramp Ramp1(startTime = 1, height = 0.55, duration = 9, offset = 0.3) annotation(Placement(transformation(extent = {{-100, 40}, {-80, 60}}, rotation = 0)));
584 Modelica.Blocks.Sources.Step Step1(startTime = 15, height = -1, offset = 1) annotation(Placement(transformation(extent = {{-30, 54}, {-10, 74}}, rotation = 0)));
585 Modelica.Mechanics.Rotational.Components.Inertia Inertia1(w(start = Modelica.SIunits.Conversions.from_rpm(590)), J = 10000) annotation(Placement(transformation(extent = {{-20, -10}, {0, 10}}, rotation = 0)));
586 Gas.PressDrop PressDrop1(wnom = 2000 * 1.229, FFtype = ThermoPower.Choices.PressDrop.FFtypes.OpPoint, rhonom = 1.229, redeclare package Medium = Modelica.Media.Air.SimpleAir, dpnom = 6000) annotation(Placement(transformation(extent = {{-30, 20}, {-10, 40}}, rotation = 0)));
587 Modelica.Mechanics.Rotational.Components.Clutch Clutch1(fn_max = 1000000.0) annotation(Placement(transformation(extent = {{30, -10}, {50, 10}}, rotation = 0)));
588 inner System system annotation(Placement(transformation(extent = {{80, 80}, {100, 100}})));
589 equation
590 connect(SourceP1.flange, FanMech1.infl) annotation(Line(points = {{-78, 0}, {-78, 0.4}, {-66, 0.4}}, color = {159, 159, 223}, thickness = 0.5));
591 connect(Ramp1.y, FanMech1.in_bladePos) annotation(Line(points = {{-79, 50}, {-58, 50}, {-58, 11.2}}, color = {0, 0, 127}));
592 connect(FanMech1.MechPort, Inertia1.flange_a) annotation(Line(points = {{-31.4, 0.2}, {-26.425, 0.2}, {-26.425, 0}, {-20, 0}}, color = {0, 0, 0}, thickness = 0.5));
593 connect(PressDrop1.outlet, SinkP1.flange) annotation(Line(points = {{-10, 30}, {0, 30}}, color = {159, 159, 223}, thickness = 0.5));
594 connect(FanMech1.outfl, PressDrop1.inlet) annotation(Line(points = {{-38, 10.4}, {-40.4, 10.4}, {-40.4, 30}, {-30, 30}}, color = {159, 159, 223}, thickness = 0.5));
595 connect(Inertia1.flange_b, Clutch1.flange_a) annotation(Line(points = {{0, 0}, {30, 0}}, color = {0, 0, 0}, thickness = 0.5));
596 connect(Clutch1.flange_b, ConstantSpeed1.flange) annotation(Line(points = {{50, 0}, {70, 0}}, color = {0, 0, 0}, thickness = 0.5));
597 connect(Step1.y, Clutch1.f_normalized) annotation(Line(points = {{-9, 64}, {40, 64}, {40, 11}}, color = {0, 0, 127}));
598 annotation(Diagram(), experiment(StopTime = 50, Algorithm = "Dassl"), experimentSetupOutput(equdistant = false));
599 end TestFanMech;
600 end GasComponents;
601 annotation(Documentation(info = "<HTML>
602 This package contains test cases for the ThermoPower library.
603 </HTML>"));
604 end Test;
605
606 type HydraulicResistance = Real(final quantity = "HydraulicResistance", final unit = "Pa/(kg/s)");
607 type Density = Modelica.SIunits.Density(start = 40) "generic start value";
608 type LiquidDensity = Density(start = 1000) "start value for liquids";
609 type AbsoluteTemperature = .Modelica.SIunits.Temperature(start = 300, nominal = 500) "generic temperature";
610 annotation(Documentation(info = "<html>
611 <b>General Information</b>
612 <p>The ThermoPower library is an open-source <a href=\"http://www.modelica.org/libraries\">Modelica library</a>for the dynamic modelling of thermal power plants and energy conversion systems. It provides basic components for system-level modelling, in particular for the study of control systems in traditional and innovative power plants and energy conversion systems.</p>
613 <p>The library is hosted by <a href=\"http://sourceforge.net/projects/thermopower/\">sourceforge.net</a> and has been under continuous development at Politecnico di Milano since 2002. It has been applied to the dynamic modelling of steam generators, combined-cycle power plants, III- and IV-generation nuclear power plants, direct steam generation solar plants, organic Rankine cycle plants, and cryogenic circuits for nuclear fusion applications. The main author is Francesco Casella, with contributions from Alberto Leva, Matilde Ratti, Luca Savoldelli, Roberto Bonifetto, Stefano Boni, and many others. The library is licensed under the <b><a href=\"http://www.modelica.org/licenses/ModelicaLicense2\">Modelica License 2</a></b>. The library has been developed as a tool for research in the field of energy system control at the Dipartimento di Elettronica, Informazione e Bioingegneria of Politecnico di Milano and progressively enhanced as new projects were undertaken there. It has been released as open source for the benefit of the community, but without any guarantee of support or completeness of documentation.</p>
614 <p>The latest official release of the library is ThermoPower 2.1, which is compatible with Modelica 2.2 and Modelica Standard Library 2.2.x. This release is now quite old. From 2009 to 2012, the development of the library focused on: </p>
615 <ul>
616 <li>Conversion to Modelica 3.x (new graphical annotations, use of enumerations) </li>
617 <li>Use of stream connectors, compatible with the Modelica.Fluid library, allowing multiple-way connections (see <a href=\"http://dx.doi.org/10.3384/ecp09430078\">paper</a>) </li>
618 <li>Use of the homotopy operator for improved initialization (see <a href=\"https://www.modelica.org/events/modelica2011/Proceedings/pages/papers/04_2_ID_131_a_fv.pdf\">paper</a>) </li>
619 <li>Bugfixing</li>
620 </ul>
621 <p>Until 2012, the library was developed using the tool <a href=\"http://www.3ds.com/products/catia/portfolio/dymola\">Dymola</a>, and could only be used within that tool, due to limitations of other Modelica tools available at the time. An official version was never released during that period, because we kept on experimenting new features, some of them experimental (e.g., homotopy-based initialization), so the library never reached a stable state. The plan is to release a revision 3.0, which will run in Dymola, and will incorporate all these changes. In the meantime, you can obtain this version of the library by anonymous SVN checkout from this URL:<br><br><a href=\"svn://svn.code.sf.net/p/thermopower/svn/branches/release.3.0\">svn://svn.code.sf.net/p/thermopower/svn/branches/release.3.0</a><br><br>
622 If you are running Windows, we recommend using the excellent <a href=\"http://tortoisesvn.net/\">TortoiseSVN</a> client to checkout the library.</p>
623 <p>Since 2013, the development started focusing on three main lines.
624 <ol>
625 <li>We are working towards making the library fully compliant to Modelica 3.2rev2 and to the Modelica Standard Library 3.2.1, in order to be usable with other Modelica tools. The library is currently being tested with OpenModelica, and is expected to run satisfactorily in that tool within the year 2013. </li>
626 <li>The second development line is to improve the structure of the Flow1D models, for greater flexibility and ease of use. In particular, we are changing the design of the distributed heat ports, which had several shortcomings in the original design, and adding replaceable models for the heat transfer and friction models. The new Flow1D models will be incompatible with the old ones, which will be kept (but deprecated) for backwards compatibility. </li>
627 <li>The last development is to change the way initial conditions are specified. The current design relies on initial equations being automatically generated by the tool, based on start attributes, which has several problems if you want to use the library with different Modelica tools and get the same results everywhere. Doing this right might eventually lead to a library which is not backwards-compatible with earlier versions.</li>
628 </ol></p>
629 <p>Eventually, these improvements will be incorporated in the 3.1 release. You can have a look at the work in progress by anonymous SVN checkout from this URL:<br><br><a href=\"svn://svn.code.sf.net/p/thermopower/svn/trunk\">svn://svn.code.sf.net/p/thermopower/svn/trunk</a></p>
630 <p>To give you an idea on the structure and content of the library, the automatically generated&nbsp;documentation of the 2.1 release can be browsed on-line <a href=\"http://thermopower.sourceforge.net/help/ThermoPower.html\">here</a>.</p>
631 <p>If you want to get involved in the development, or you need some information, please contact the main developer <a href=\"mailto://francesco.casella@polimi.it\">francesco.casella@polimi.it</a>.</p>
632 <p><b>References</b></p>
633 <p>A general description of the library and on the modelling principles can be found in the papers: </p>
634 <p><ul>
635 <li>F. Casella, A. Leva, &QUOT;Modelling of distributed thermo-hydraulic processes using Modelica&QUOT;, <i>Proceedings of the MathMod &apos;03 Conference</i>, Wien , Austria, February 2003. </li>
636 <li>F. Casella, A. Leva, &QUOT;Modelica open library for power plant simulation: design and experimental validation&QUOT;, <i>Proceedings of the 2003 Modelica Conference</i>, Link&ouml;ping, Sweden, November 2003, pp. 41-50. (<a href=\"http://www.modelica.org/Conference2003/papers/h08_Leva.pdf\">Available online</a>) </li>
637 <li>F. Casella, A. Leva, &QUOT;Simulazione di impianti termoidraulici con strumenti object-oriented&QUOT;, <i>Atti convegno ANIPLA Enersis 2004,</i> Milano, Italy, April 2004 (in Italian). </li>
638 <li>F. Casella, A. Leva, &QUOT;Object-oriented library for thermal power plant simulation&QUOT;, <i>Proceedings of the Eurosis Industrial Simulation Conference 2004 (ISC-2004)</i>, Malaga, Spain, June 2004. </li>
639 <li>F. Casella, A. Leva, &QUOT;Simulazione object-oriented di impianti di generazione termoidraulici per studi di sistema&QUOT;, <i>Atti convegno nazionale ANIPLA 2004</i>, Milano, Italy, September 2004 (in Italian).</li>
640 <li>Francesco Casella and Alberto Leva, &ldquo;Modelling of Thermo-Hydraulic Power Generation Processes Using Modelica&rdquo;. <i>Mathematical and Computer Modeling of Dynamical Systems</i>, vol. 12, n. 1, pp. 19-33, Feb. 2006. <a href=\"http://dx.doi.org/10.1080/13873950500071082\">Online</a>. </li>
641 <li>Francesco Casella, J. G. van Putten and Piero Colonna, &ldquo;Dynamic Simulation of a Biomass-Fired Power Plant: a Comparison Between Causal and A-Causal Modular Modeling&rdquo;. In <i>Proceedings of 2007 ASME International Mechanical Engineering Congress and Exposition</i>, Seattle, Washington, USA, Nov. 11-15, 2007, paper IMECE2007-41091 (Best paper award). </li>
642 </ul></p>
643 <p><br/>Other papers about the library and its applications:</p>
644 <p><ul>
645 <li>F. Casella, F. Schiavo, &QUOT;Modelling and Simulation of Heat Exchangers in Modelica with Finite Element Methods&QUOT;, <i>Proceedings of the 2003 Modelica Conference</i>, Link&ouml;ping, Sweden, 2003, pp. 343-352. (<a href=\"http://www.modelica.org/Conference2003/papers/h22_Schiavo.pdf\">Available online</a>) </li>
646 <li>A. Cammi, M.E. Ricotti, F. Casella, F. Schiavo, &QUOT;New modelling strategy for IRIS dynamic response simulation&QUOT;, <i>Proc. 5th International Conference on Nuclear Option in Countries with Small and Medium Electricity Grids</i>, Dubrovnik, Croatia, May 2004.</li>
647 <li>A. Cammi, F. Casella, M.E. Ricotti, F. Schiavo, &QUOT;Object-oriented Modelling for Integral Nuclear Reactors Dynamic Dimulation&QUOT;, <i>Proceedings of the International Conference on Integrated Modeling &AMP; Analysis in Applied Control &AMP; Automation</i>, Genova, Italy, October 2004. </li>
648 <li>Antonio Cammi, Francesco Casella, Marco Ricotti and Francesco Schiavo, &ldquo;Object-Oriented Modeling, Simulation and Control of the IRIS Nuclear Power Plant with Modelica&rdquo;. In <i>Proceedings 4th International Modelica Conference</i>, Hamburg, Germany,Mar. 7-8, 2005, pp. 423-432. <a href=\"http://www.modelica.org/events/Conference2005/online_proceedings/Session5/Session5b3.pdf\">Online</a>. </li>
649 <li>A. Cammi, F. Casella, M. E. Ricotti, F. Schiavo, G. D. Storrick, &QUOT;Object-oriented Simulation for the Control of the IRIS Nuclear Power Plant&QUOT;, <i>Proceedings of the IFAC World Congress, </i>Prague, Czech Republic, July 2005 </li>
650 <li>Francesco Casella and Francesco Pretolani, &ldquo;Fast Start-up of a Combined-Cycle Power Plant: a Simulation Study with Modelica&rdquo;. In <i>Proceedings 5th International Modelica Conference</i>, Vienna, Austria, Sep. 6-8, 2006, pp. 3-10. <a href=\"http://www.modelica.org/events/modelica2006/Proceedings/sessions/Session1a1.pdf\">Online</a>. </li>
651 <li>Francesco Casella, &ldquo;Object-Oriented Modelling of Two-Phase Fluid Flows by the Finite Volume Method&rdquo;. In <i>Proceedings 5th Mathmod Vienna</i>, Vienna, Austria, Feb. 8-10, 2006. </li>
652 <li>Andrea Bartolini, Francesco Casella, Alberto Leva and Valeria Motterle, &ldquo;A Simulation Study of the Flue Gas Path Control System in a Coal-Fired Power Plant&rdquo;. In <i>Proceedings ANIPLA International Congress 2006</i>, Rome, Italy,vNov. 13-15, 2006. </li>
653 <li>Francesco Schiavo and Francesco Casella, &ldquo;Object-oriented modelling and simulation of heat exchangers with finite element methods&rdquo;. <i>Mathematical and Computer Modeling of Dynamical Sytems</i>, vol. 13, n. 3, pp. 211-235, Jun. 2007. <a href=\"http://dx.doi.org/10.1080/13873950600821766\">Online</a>. </li>
654 <li>Laura Savoldi Richard, Francesco Casella, Barbara Fiori and Roberto Zanino, &ldquo;Development of the Cryogenic Circuit Conductor and Coil (4C) Code for thermal-hydraulic modelling of ITER superconducting coils&rdquo;. In <i>Presented at the 22nd International Cryogenic Engineering Conference ICEC22</i>, Seoul, Korea, July 21-25, 2008. </li>
655 <li>Francesco Casella, &ldquo;Object-Oriented Modelling of Power Plants: a Structured Approach&rdquo;. In <i>Proceedings of the IFAC Symposium on Power Plants and Power Systems Control</i>, Tampere, Finland, July 5-8, 2009. </li>
656 <li>Laura Savoldi Richard, Francesco Casella, Barbara Fiori and Roberto Zanino, &ldquo;The 4C code for the cryogenic circuit conductor and coil modeling in ITER&rdquo;. <i>Cryogenics</i>, vol. 50, n. 3, pp. 167-176, Mar 2010. <a href=\"http://dx.doi.org/10.1016/j.cryogenics.2009.07.008\">Online</a>. </li>
657 <li>Antonio Cammi, Francesco Casella, Marco Enrico Ricotti and Francesco Schiavo, &ldquo;An object-oriented approach to simulation of IRIS dynamic response&rdquo;. <i>Progress in Nuclear Energy</i>, vol. 53, n. 1, pp. 48-58, Jan. 2011. <a href=\"http://dx.doi.org/10.1016/j.pnucene.2010.09.004\">Online</a>. </li>
658 <li>Francesco Casella and Piero Colonna, &ldquo;Development of a Modelica dynamic model of solar supercritical CO2 Brayton cycle power plants for control studies&rdquo;. In <i>Proceedings of the Supercritical CO2 Power Cycle Symposium</i>, Boulder, Colorado, USA, May 24-25, 2011, pp. 1-7. <a href=\"http://www.sco2powercyclesymposium.org/resource_center/system_modeling_control\">Online</a>. </li>
659 <li>Roberto Bonifetto, Francesco Casella, Laura Savoldi Richard and Roberto Zanino, &ldquo;Dynamic modeling of a SHe closed loop with the 4C code&rdquo;. In <i>Transactions of the Cryogenic Engineering Conference - CEC: Advances in Cryogenic Engineering</i>, Spokane, Washington, USA, Jun. 13-17, 2011, pp. 1-8. </li>
660 <li>Roberto Zanino, Roberto Bonifetto, Francesco Casella and Laura Savoldi Richard, &ldquo;Validation of the 4C code against data from the HELIOS loop at CEA Grenoble&rdquo;. <i>Cryogenics</i>, vol. 0, pp. 1-6, 2012. In press; available online 6 May 2012. <a href=\"http://dx.doi.org/10.1016/j.cryogenics.2012.04.010\">Online</a>. </li>
661 <li>Francesco Casella and Piero Colonna, &ldquo;Dynamic modelling of IGCC power plants&rdquo;. <i>Applied Thermal Engineering</i>, vol. 35, pp. 91-111, 2012. <a href=\"http://dx.doi.org/10.1016/j.applthermaleng.2011.10.011\">Online</a>. </li>
662 </ul></p>
663
664 <b>Release notes:</b>
665 <p><b></font><font style=\"font-size: 10pt; \">Version 2.1 (<i>6 Jul 2009</i>)</b></p>
666 <p>The 2.1 release of ThermoPower contains several additions and a few bug fixes with respect to version 2.0. We tried to keep the new version backwards-compatible with the old one, but there might be a few cases where small adaptations could be required.</p><p>ThermoPower 2.1 requires the Modelica Standard Library version 2.2.1 or 2.2.2. It has been tested with Dymola 6.1 (using MSL 2.2.1) and with Dymola 7.1 (using MSL 2.2.2). It is planned to be usable also with other tools, in particular OpenModelica, MathModelica and SimulationX, but this is not possible with the currently released versions of those tools. It is expected that this should become at least partially possible within the year 2009. </p><p>ThermoPower 2.1 is the last major revision compatible with Modelica 2.1 and the Modelica Standard Library 2.2.x. The next version is planned to use Modelica 3.1 and the Modelica Standard Library 3.1. It will use use stream connectors, which generalize the concept of Flange connectors, lifting the restrictions that only two complementary connectors can be bound.</p><p>This is a list of the main changes with respect to v. 2.0</p>
667 <li><ul>
668 <li>New PowerPlants package, containing a library of high-level reusable components for the modelling of combined-cycle power plants, including full models that can be simulated. </li>
669 <li>New examples cases in the Examples package. </li>
670 <li>New components in the Electrical package, to model the generator-grid connection by the swing equation </li>
671 <li>Three-way junctions (FlowJoin and FlowSplit) now have an option to describe unidirectional flow at each flange. This feature can substantially enhance numerical robustness and simulation performance in all cases when it is known a priori that no flow reversal will occur. </li>
672 <li>The Flow1D and Flow1D2ph models are now restricted to positive flow direction, since it was found that it is not possible to describe flow reversal consistently with the average-density approach adopted in this library. For full flow reversal support please use the Flow1Dfem model, which does not have any restriction in this respect. </li>
673 <li>A bug in Flow1D and Flow1D2ph has been corrected, which caused significant errors in the mass balance under dynamic conditions; this was potentially critical in closed-loop models, but has now been resolved.&nbsp; </li>
674 <li>The connectors for lumped- and distribute-parameters heat transfer with variable heat transfer coefficients have been split: HThtc and DHThtc now have an output qualifier on the h.t.c., while HThtc_in and DHThtc_in have an input qualifier. This was necessary to avoid incorrect connections, and is also required by tools to correctly checked if a model is balanced. This change should have no impact on most user-developed models. </li>
675 </ul></li>
676 </ul></p>
677 <p><b>Version 2.0 (<i>10 Jun 2005</i>)</b></p>
678 <li><ul>
679 <li>The new Modelica 2.2 standard library is used. </li>
680 <li>The ThermoPower library is now based on the Modelica.Media standard library for fluid property calculations. All the component models use a Modelica.Media compliant interface to specify the medium model. Standard water and gas models from the Modelica.Media library can be used, as well as custom-built water and gas models, compliant with the Modelica.Media interfaces. </li>
681 <li>Fully functional gas components are now available, including model for gas compressors and turbines, as well as compact gas turbine unit models. </li>
682 <li>Steady-state initialisation support has been added to all dynamic models. </li>
683 <li>Some components are still under development, and could be changed in the final 2.0 release: </li>
684 <li><ul>
685 <li>Moving boundary model for two-phase flow in once-through evaporators. </li>
686 <li>Stress models for headers and turbines. </li>
687 </ul></li>
688 </ul></li>
689 </ul></p>
690 <p><b>Version 1.2 (<i>18 Nov 2004</i>)</b></p>
691 <li><ul>
692 <li>Valve and pump models restructured using inheritance. </li>
693 <li>Simple model of a steam turbine unit added (requires the Modelica.Media library). </li>
694 <li>CISE example restructured and moved to the <code>Examples</code> package. </li>
695 <li>Preliminary version of gas components added in the <code>Gas</code> package. </li>
696 <li>Finite element model of thermohydraulic two-phase flow added. </li>
697 <li>Simplified models for the connection to the power system added in the <code>Electrical</code> package. </li>
698 </ul></li>
699 </ul></p>
700 <p><b>Version 1.1 (<i>15 Feb 2004</i>)</b></p>
701 <li><ul>
702 <li>No default values for parameters whose values must be set explicitly by the user. </li>
703 <li>Description of the meaning of the model variables added. </li>
704 <li><code>Pump</code>, <code>PumpMech</code>, <code>Accumulator</code> models added. </li>
705 <li>More rational geometric parameters for <code>Flow1D*</code> models. </li>
706 <li><code>Flow1D</code> model corrected to avoid numerical problems when the phase transition boundaries cross the nodes. </li>
707 <li><code>Flow1D2phDB</code> model updated. </li>
708 <li><code>Flow1D2phChen</code> models with two-phase heat transfer added. </li>
709 </ul></li>
710 </ul></p>
711 <p><b>Version 1.0 (<i>20 Oct 2003</i>)</b></p>
712 <li><ul>
713 <li>First release in the public domain</li>
714 </ul></li>
715 </ul></p>
716 <p><b></font><font style=\"font-size: 12pt; \">License agreement</b></p>
717 <p>The ThermoPower package is licensed by Politecnico di Milano under the <b><a href=\"http://www.modelica.org/licenses/ModelicaLicense2\">Modelica License 2</a></b>. </p>
718 <p><h4>Copyright &copy; 2002-2013, Politecnico di Milano.</h4></p>
719 </html>"), uses(Modelica(version = "3.2.1")), version = "3.1");
720end ThermoPower;
721
722package ModelicaServices "ModelicaServices (OpenModelica implementation) - Models and functions used in the Modelica Standard Library requiring a tool specific implementation"
723 extends Modelica.Icons.Package;
724
725 package Machine
726 extends Modelica.Icons.Package;
727 final constant Real eps = 1e-015 "Biggest number such that 1.0 + eps = 1.0";
728 final constant Real small = 1e-060 "Smallest number such that small and -small are representable on the machine";
729 final constant Real inf = 9.999999999999999e+059 "Biggest Real number such that inf and -inf are representable on the machine";
730 final constant Integer Integer_inf = OpenModelica.Internal.Architecture.integerMax() "Biggest Integer number such that Integer_inf and -Integer_inf are representable on the machine";
731 annotation(Documentation(info = "<html>
732 <p>
733 Package in which processor specific constants are defined that are needed
734 by numerical algorithms. Typically these constants are not directly used,
735 but indirectly via the alias definition in
736 <a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.
737 </p>
738 </html>"));
739 end Machine;
740 annotation(Protection(access = Access.hide), preferredView = "info", version = "3.2.1", versionBuild = 2, versionDate = "2013-08-14", dateModified = "2013-08-14 08:44:41Z", revisionId = "$Id:: package.mo 6931 2013-08-14 11:38:51Z #$", uses(Modelica(version = "3.2.1")), conversion(noneFromVersion = "1.0", noneFromVersion = "1.1", noneFromVersion = "1.2"), Documentation(info = "<html>
741 <p>
742 This package contains a set of functions and models to be used in the
743 Modelica Standard Library that requires a tool specific implementation.
744 These are:
745 </p>
746
747 <ul>
748 <li> <a href=\"modelica://ModelicaServices.Animation.Shape\">Shape</a>
749 provides a 3-dim. visualization of elementary
750 mechanical objects. It is used in
751 <a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape</a>
752 via inheritance.</li>
753
754 <li> <a href=\"modelica://ModelicaServices.Animation.Surface\">Surface</a>
755 provides a 3-dim. visualization of
756 moveable parameterized surface. It is used in
757 <a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface</a>
758 via inheritance.</li>
759
760 <li> <a href=\"modelica://ModelicaServices.ExternalReferences.loadResource\">loadResource</a>
761 provides a function to return the absolute path name of an URI or a local file name. It is used in
762 <a href=\"modelica://Modelica.Utilities.Files.loadResource\">Modelica.Utilities.Files.loadResource</a>
763 via inheritance.</li>
764
765 <li> <a href=\"modelica://ModelicaServices.Machine\">ModelicaServices.Machine</a>
766 provides a package of machine constants. It is used in
767 <a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.</li>
768
769 <li> <a href=\"modelica://ModelicaServices.Types.SolverMethod\">Types.SolverMethod</a>
770 provides a string defining the integration method to solve differential equations in
771 a clocked discretized continuous-time partition (see Modelica 3.3 language specification).
772 It is not yet used in the Modelica Standard Library, but in the Modelica_Synchronous library
773 that provides convenience blocks for the clock operators of Modelica version &ge; 3.3.</li>
774 </ul>
775
776 <p>
777 This is the default implementation, if no tool-specific implementation is available.
778 This ModelicaServices package provides only \"dummy\" models that do nothing.
779 </p>
780
781 <p>
782 <b>Licensed by DLR and Dassault Syst&egrave;mes AB under the Modelica License 2</b><br>
783 Copyright &copy; 2009-2013, DLR and Dassault Syst&egrave;mes AB.
784 </p>
785
786 <p>
787 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
788 </p>
789
790 </html>"));
791end ModelicaServices;
792
793package Modelica "Modelica Standard Library - Version 3.2.1 (Build 2)"
794 extends Modelica.Icons.Package;
795
796 package Blocks "Library of basic input/output control blocks (continuous, discrete, logical, table blocks)"
797 extends Modelica.Icons.Package;
798
799 package Interfaces "Library of connectors and partial models for input/output blocks"
800 extends Modelica.Icons.InterfacesPackage;
801 connector RealInput = input Real "'input Real' as connector" annotation(defaultComponentName = "u", Icon(graphics = {Polygon(lineColor = {0, 0, 127}, fillColor = {0, 0, 127}, fillPattern = FillPattern.Solid, points = {{-100.0, 100.0}, {100.0, 0.0}, {-100.0, -100.0}})}, coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}, preserveAspectRatio = true, initialScale = 0.2)), Diagram(coordinateSystem(preserveAspectRatio = true, initialScale = 0.2, extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(lineColor = {0, 0, 127}, fillColor = {0, 0, 127}, fillPattern = FillPattern.Solid, points = {{0.0, 50.0}, {100.0, 0.0}, {0.0, -50.0}, {0.0, 50.0}}), Text(lineColor = {0, 0, 127}, extent = {{-10.0, 60.0}, {-10.0, 85.0}}, textString = "%name")}), Documentation(info = "<html>
802 <p>
803 Connector with one input signal of type Real.
804 </p>
805 </html>"));
806 connector RealOutput = output Real "'output Real' as connector" annotation(defaultComponentName = "y", Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Polygon(lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{-100.0, 100.0}, {100.0, 0.0}, {-100.0, -100.0}})}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Polygon(lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{-100.0, 50.0}, {0.0, 0.0}, {-100.0, -50.0}}), Text(lineColor = {0, 0, 127}, extent = {{30.0, 60.0}, {30.0, 110.0}}, textString = "%name")}), Documentation(info = "<html>
807 <p>
808 Connector with one output signal of type Real.
809 </p>
810 </html>"));
811 connector IntegerInput = input Integer "'input Integer' as connector" annotation(defaultComponentName = "u", Icon(graphics = {Polygon(points = {{-100, 100}, {100, 0}, {-100, -100}, {-100, 100}}, lineColor = {255, 127, 0}, fillColor = {255, 127, 0}, fillPattern = FillPattern.Solid)}, coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.2)), Diagram(coordinateSystem(preserveAspectRatio = true, initialScale = 0.2, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, lineColor = {255, 127, 0}, fillColor = {255, 127, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-10, 85}, {-10, 60}}, lineColor = {255, 127, 0}, textString = "%name")}), Documentation(info = "<html>
812 <p>
813 Connector with one input signal of type Integer.
814 </p>
815 </html>"));
816
817 partial block SO "Single Output continuous control block"
818 extends Modelica.Blocks.Icons.Block;
819 RealOutput y "Connector of Real output signal" annotation(Placement(transformation(extent = {{100, -10}, {120, 10}}, rotation = 0)));
820 annotation(Documentation(info = "<html>
821 <p>
822 Block has one continuous Real output signal.
823 </p>
824 </html>"));
825 end SO;
826
827 partial block SignalSource "Base class for continuous signal source"
828 extends SO;
829 parameter Real offset = 0 "Offset of output signal y";
830 parameter .Modelica.SIunits.Time startTime = 0 "Output y = offset for time < startTime";
831 annotation(Documentation(info = "<html>
832 <p>
833 Basic block for Real sources of package Blocks.Sources.
834 This component has one continuous Real output signal y
835 and two parameters (offset, startTime) to shift the
836 generated signal.
837 </p>
838 </html>"));
839 end SignalSource;
840 annotation(Documentation(info = "<HTML>
841 <p>
842 This package contains interface definitions for
843 <b>continuous</b> input/output blocks with Real,
844 Integer and Boolean signals. Furthermore, it contains
845 partial models for continuous and discrete blocks.
846 </p>
847
848 </html>", revisions = "<html>
849 <ul>
850 <li><i>Oct. 21, 2002</i>
851 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
852 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
853 Added several new interfaces.
854 <li><i>Oct. 24, 1999</i>
855 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
856 RealInputSignal renamed to RealInput. RealOutputSignal renamed to
857 output RealOutput. GraphBlock renamed to BlockIcon. SISOreal renamed to
858 SISO. SOreal renamed to SO. I2SOreal renamed to M2SO.
859 SignalGenerator renamed to SignalSource. Introduced the following
860 new models: MIMO, MIMOs, SVcontrol, MVcontrol, DiscreteBlockIcon,
861 DiscreteBlock, DiscreteSISO, DiscreteMIMO, DiscreteMIMOs,
862 BooleanBlockIcon, BooleanSISO, BooleanSignalSource, MI2BooleanMOs.</li>
863 <li><i>June 30, 1999</i>
864 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
865 Realized a first version, based on an existing Dymola library
866 of Dieter Moormann and Hilding Elmqvist.</li>
867 </ul>
868 </html>"));
869 end Interfaces;
870
871 package Sources "Library of signal source blocks generating Real and Boolean signals"
872 extends Modelica.Icons.SourcesPackage;
873
874 block Step "Generate step signal of type Real"
875 parameter Real height = 1 "Height of step";
876 extends .Modelica.Blocks.Interfaces.SignalSource;
877 equation
878 y = offset + (if time < startTime then 0 else height);
879 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 68}, {-80, -80}}, color = {192, 192, 192}), Polygon(points = {{-80, 90}, {-88, 68}, {-72, 68}, {-80, 90}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-90, -70}, {82, -70}}, color = {192, 192, 192}), Polygon(points = {{90, -70}, {68, -62}, {68, -78}, {90, -70}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -70}, {0, -70}, {0, 50}, {80, 50}}, color = {0, 0, 0}), Text(extent = {{-150, -150}, {150, -110}}, lineColor = {0, 0, 0}, textString = "startTime=%startTime")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-80, 90}, {-86, 68}, {-74, 68}, {-80, 90}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, 68}, {-80, -80}}, color = {95, 95, 95}), Line(points = {{-80, -18}, {0, -18}, {0, 50}, {80, 50}}, color = {0, 0, 255}, thickness = 0.5), Line(points = {{-90, -70}, {82, -70}}, color = {95, 95, 95}), Polygon(points = {{90, -70}, {68, -64}, {68, -76}, {90, -70}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Text(extent = {{70, -80}, {94, -100}}, lineColor = {0, 0, 0}, textString = "time"), Text(extent = {{-21, -72}, {25, -90}}, lineColor = {0, 0, 0}, textString = "startTime"), Line(points = {{0, -18}, {0, -70}}, color = {95, 95, 95}), Text(extent = {{-68, -36}, {-22, -54}}, lineColor = {0, 0, 0}, textString = "offset"), Line(points = {{-13, 50}, {-13, -17}}, color = {95, 95, 95}), Polygon(points = {{0, 50}, {-21, 50}, {0, 50}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{-13, -18}, {-16, -5}, {-10, -5}, {-13, -18}, {-13, -18}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{-13, 50}, {-16, 37}, {-10, 37}, {-13, 50}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Text(extent = {{-68, 26}, {-22, 8}}, lineColor = {0, 0, 0}, textString = "height"), Polygon(points = {{-13, -70}, {-16, -57}, {-10, -57}, {-13, -70}, {-13, -70}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-13, -18}, {-13, -70}}, color = {95, 95, 95}), Polygon(points = {{-13, -18}, {-16, -31}, {-10, -31}, {-13, -18}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Text(extent = {{-72, 100}, {-31, 80}}, lineColor = {0, 0, 0}, textString = "y")}), Documentation(info = "<html>
880 <p>
881 The Real output y is a step signal:
882 </p>
883
884 <p>
885 <img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Step.png\"
886 alt=\"Step.png\">
887 </p>
888
889 </html>"));
890 end Step;
891
892 block Ramp "Generate ramp signal"
893 parameter Real height = 1 "Height of ramps";
894 parameter Modelica.SIunits.Time duration(min = 0.0, start = 2) "Duration of ramp (= 0.0 gives a Step)";
895 parameter Real offset = 0 "Offset of output signal";
896 parameter Modelica.SIunits.Time startTime = 0 "Output = offset for time < startTime";
897 extends .Modelica.Blocks.Interfaces.SO;
898 equation
899 y = offset + (if time < startTime then 0 else if time < startTime + duration then (time - startTime) * height / duration else height);
900 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 68}, {-80, -80}}, color = {192, 192, 192}), Polygon(points = {{-80, 90}, {-88, 68}, {-72, 68}, {-80, 90}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-90, -70}, {82, -70}}, color = {192, 192, 192}), Polygon(points = {{90, -70}, {68, -62}, {68, -78}, {90, -70}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -70}, {-40, -70}, {31, 38}}, color = {0, 0, 0}), Text(extent = {{-150, -150}, {150, -110}}, lineColor = {0, 0, 0}, textString = "duration=%duration"), Line(points = {{31, 38}, {86, 38}}, color = {0, 0, 0})}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-80, 90}, {-86, 68}, {-74, 68}, {-80, 90}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, 68}, {-80, -80}}, color = {95, 95, 95}), Line(points = {{-80, -20}, {-20, -20}, {50, 50}}, color = {0, 0, 255}, thickness = 0.5), Line(points = {{-90, -70}, {82, -70}}, color = {95, 95, 95}), Polygon(points = {{90, -70}, {68, -64}, {68, -76}, {90, -70}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{-40, -20}, {-42, -30}, {-38, -30}, {-40, -20}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-40, -20}, {-40, -70}}, color = {95, 95, 95}, thickness = 0.25, arrow = {Arrow.None, Arrow.None}), Polygon(points = {{-40, -70}, {-42, -60}, {-38, -60}, {-40, -70}, {-40, -70}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Text(extent = {{-72, -39}, {-34, -50}}, lineColor = {0, 0, 0}, textString = "offset"), Text(extent = {{-38, -72}, {6, -83}}, lineColor = {0, 0, 0}, textString = "startTime"), Text(extent = {{-78, 92}, {-37, 72}}, lineColor = {0, 0, 0}, textString = "y"), Text(extent = {{70, -80}, {94, -91}}, lineColor = {0, 0, 0}, textString = "time"), Line(points = {{-20, -20}, {-20, -70}}, color = {95, 95, 95}), Line(points = {{-19, -20}, {50, -20}}, color = {95, 95, 95}, thickness = 0.25, arrow = {Arrow.None, Arrow.None}), Line(points = {{50, 50}, {101, 50}}, color = {0, 0, 255}, thickness = 0.5), Line(points = {{50, 50}, {50, -20}}, color = {95, 95, 95}, thickness = 0.25, arrow = {Arrow.None, Arrow.None}), Polygon(points = {{50, -20}, {42, -18}, {42, -22}, {50, -20}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{-20, -20}, {-11, -18}, {-11, -22}, {-20, -20}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{50, 50}, {48, 40}, {52, 40}, {50, 50}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{50, -20}, {48, -10}, {52, -10}, {50, -20}, {50, -20}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Text(extent = {{53, 23}, {82, 10}}, lineColor = {0, 0, 0}, textString = "height"), Text(extent = {{-2, -21}, {37, -33}}, lineColor = {0, 0, 0}, textString = "duration")}), Documentation(info = "<html>
901 <p>
902 The Real output y is a ramp signal:
903 </p>
904
905 <p>
906 <img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Ramp.png\"
907 alt=\"Ramp.png\">
908 </p>
909
910 <p>
911 If parameter duration is set to 0.0, the limiting case of a Step signal is achieved.
912 </p>
913 </html>"));
914 end Ramp;
915 annotation(Documentation(info = "<HTML>
916 <p>
917 This package contains <b>source</b> components, i.e., blocks which
918 have only output signals. These blocks are used as signal generators
919 for Real, Integer and Boolean signals.
920 </p>
921
922 <p>
923 All Real source signals (with the exception of the Constant source)
924 have at least the following two parameters:
925 </p>
926
927 <table border=1 cellspacing=0 cellpadding=2>
928 <tr><td valign=\"top\"><b>offset</b></td>
929 <td valign=\"top\">Value which is added to the signal</td>
930 </tr>
931 <tr><td valign=\"top\"><b>startTime</b></td>
932 <td valign=\"top\">Start time of signal. For time &lt; startTime,
933 the output y is set to offset.</td>
934 </tr>
935 </table>
936
937 <p>
938 The <b>offset</b> parameter is especially useful in order to shift
939 the corresponding source, such that at initial time the system
940 is stationary. To determine the corresponding value of offset,
941 usually requires a trimming calculation.
942 </p>
943 </html>", revisions = "<html>
944 <ul>
945 <li><i>October 21, 2002</i>
946 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
947 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
948 Integer sources added. Step, TimeTable and BooleanStep slightly changed.</li>
949 <li><i>Nov. 8, 1999</i>
950 by <a href=\"mailto:clauss@eas.iis.fhg.de\">Christoph Clau&szlig;</a>,
951 <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
952 <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
953 New sources: Exponentials, TimeTable. Trapezoid slightly enhanced
954 (nperiod=-1 is an infinite number of periods).</li>
955 <li><i>Oct. 31, 1999</i>
956 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
957 <a href=\"mailto:clauss@eas.iis.fhg.de\">Christoph Clau&szlig;</a>,
958 <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
959 All sources vectorized. New sources: ExpSine, Trapezoid,
960 BooleanConstant, BooleanStep, BooleanPulse, SampleTrigger.
961 Improved documentation, especially detailed description of
962 signals in diagram layer.</li>
963 <li><i>June 29, 1999</i>
964 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
965 Realized a first version, based on an existing Dymola library
966 of Dieter Moormann and Hilding Elmqvist.</li>
967 </ul>
968 </html>"));
969 end Sources;
970
971 package Icons "Icons for Blocks"
972 extends Modelica.Icons.IconsPackage;
973
974 partial block Block "Basic graphical layout of input/output block" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, -100}, {100, 100}}, lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-150, 150}, {150, 110}}, textString = "%name", lineColor = {0, 0, 255})}), Documentation(info = "<html>
975 <p>
976 Block that has only the basic icon for an input/output
977 block (no declarations, no equations). Most blocks
978 of package Modelica.Blocks inherit directly or indirectly
979 from this block.
980 </p>
981 </html>")); end Block;
982 end Icons;
983 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Rectangle(origin = {0.0, 35.1488}, fillColor = {255, 255, 255}, extent = {{-30.0, -20.1488}, {30.0, 20.1488}}), Rectangle(origin = {0.0, -34.8512}, fillColor = {255, 255, 255}, extent = {{-30.0, -20.1488}, {30.0, 20.1488}}), Line(origin = {-51.25, 0.0}, points = {{21.25, -35.0}, {-13.75, -35.0}, {-13.75, 35.0}, {6.25, 35.0}}), Polygon(origin = {-40.0, 35.0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{10.0, 0.0}, {-5.0, 5.0}, {-5.0, -5.0}}), Line(origin = {51.25, 0.0}, points = {{-21.25, 35.0}, {13.75, 35.0}, {13.75, -35.0}, {-6.25, -35.0}}), Polygon(origin = {40.0, -35.0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-10.0, 0.0}, {5.0, 5.0}, {5.0, -5.0}})}), Documentation(info = "<html>
984 <p>
985 This library contains input/output blocks to build up block diagrams.
986 </p>
987
988 <dl>
989 <dt><b>Main Author:</b>
990 <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
991 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
992 Oberpfaffenhofen<br>
993 Postfach 1116<br>
994 D-82230 Wessling<br>
995 email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
996 </dl>
997 <p>
998 Copyright &copy; 1998-2013, Modelica Association and DLR.
999 </p>
1000 <p>
1001 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
1002 </p>
1003 </html>", revisions = "<html>
1004 <ul>
1005 <li><i>June 23, 2004</i>
1006 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
1007 Introduced new block connectors and adapted all blocks to the new connectors.
1008 Included subpackages Continuous, Discrete, Logical, Nonlinear from
1009 package ModelicaAdditions.Blocks.
1010 Included subpackage ModelicaAdditions.Table in Modelica.Blocks.Sources
1011 and in the new package Modelica.Blocks.Tables.
1012 Added new blocks to Blocks.Sources and Blocks.Logical.
1013 </li>
1014 <li><i>October 21, 2002</i>
1015 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
1016 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
1017 New subpackage Examples, additional components.
1018 </li>
1019 <li><i>June 20, 2000</i>
1020 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
1021 Michael Tiller:<br>
1022 Introduced a replaceable signal type into
1023 Blocks.Interfaces.RealInput/RealOutput:
1024 <pre>
1025 replaceable type SignalType = Real
1026 </pre>
1027 in order that the type of the signal of an input/output block
1028 can be changed to a physical type, for example:
1029 <pre>
1030 Sine sin1(outPort(redeclare type SignalType=Modelica.SIunits.Torque))
1031 </pre>
1032 </li>
1033 <li><i>Sept. 18, 1999</i>
1034 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
1035 Renamed to Blocks. New subpackages Math, Nonlinear.
1036 Additional components in subpackages Interfaces, Continuous
1037 and Sources. </li>
1038 <li><i>June 30, 1999</i>
1039 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
1040 Realized a first version, based on an existing Dymola library
1041 of Dieter Moormann and Hilding Elmqvist.</li>
1042 </ul>
1043 </html>"));
1044 end Blocks;
1045
1046 package Mechanics "Library of 1-dim. and 3-dim. mechanical components (multi-body, rotational, translational)"
1047 extends Modelica.Icons.Package;
1048
1049 package Rotational "Library to model 1-dimensional, rotational mechanical systems"
1050 extends Modelica.Icons.Package;
1051
1052 package Components "Components for 1D rotational mechanical drive trains"
1053 extends Modelica.Icons.Package;
1054
1055 model Inertia "1D-rotational component with inertia"
1056 Rotational.Interfaces.Flange_a flange_a "Left flange of shaft" annotation(Placement(transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0)));
1057 Rotational.Interfaces.Flange_b flange_b "Right flange of shaft" annotation(Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
1058 parameter .Modelica.SIunits.Inertia J(min = 0, start = 1) "Moment of inertia";
1059 parameter StateSelect stateSelect = StateSelect.default "Priority to use phi and w as states" annotation(HideResult = true, Dialog(tab = "Advanced"));
1060 .Modelica.SIunits.Angle phi(stateSelect = stateSelect) "Absolute rotation angle of component" annotation(Dialog(group = "Initialization", showStartAttribute = true));
1061 .Modelica.SIunits.AngularVelocity w(stateSelect = stateSelect) "Absolute angular velocity of component (= der(phi))" annotation(Dialog(group = "Initialization", showStartAttribute = true));
1062 .Modelica.SIunits.AngularAcceleration a "Absolute angular acceleration of component (= der(w))" annotation(Dialog(group = "Initialization", showStartAttribute = true));
1063 equation
1064 phi = flange_a.phi;
1065 phi = flange_b.phi;
1066 w = der(phi);
1067 a = der(w);
1068 J * a = flange_a.tau + flange_b.tau;
1069 annotation(Documentation(info = "<html>
1070 <p>
1071 Rotational component with <b>inertia</b> and two rigidly connected flanges.
1072 </p>
1073
1074 </html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Rectangle(lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -10.0}, {-50.0, 10.0}}), Rectangle(lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{50.0, -10.0}, {100.0, 10.0}}), Line(points = {{-80.0, -25.0}, {-60.0, -25.0}}), Line(points = {{60.0, -25.0}, {80.0, -25.0}}), Line(points = {{-70.0, -25.0}, {-70.0, -70.0}}), Line(points = {{70.0, -25.0}, {70.0, -70.0}}), Line(points = {{-80.0, 25.0}, {-60.0, 25.0}}), Line(points = {{60.0, 25.0}, {80.0, 25.0}}), Line(points = {{-70.0, 45.0}, {-70.0, 25.0}}), Line(points = {{70.0, 45.0}, {70.0, 25.0}}), Line(points = {{-70.0, -70.0}, {70.0, -70.0}}), Rectangle(lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-50.0, -50.0}, {50.0, 50.0}}, radius = 10.0), Text(lineColor = {0, 0, 255}, extent = {{-150.0, 60.0}, {150.0, 100.0}}, textString = "%name"), Text(extent = {{-150.0, -120.0}, {150.0, -80.0}}, textString = "J=%J"), Rectangle(lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, extent = {{-50, -50}, {50, 50}}, radius = 10)}));
1075 end Inertia;
1076
1077 model Clutch "Clutch based on Coulomb friction"
1078 extends Modelica.Mechanics.Rotational.Icons.Clutch;
1079 extends Modelica.Mechanics.Rotational.Interfaces.PartialCompliantWithRelativeStates;
1080 parameter Real[:, 2] mue_pos = [0, 0.5] "[w,mue] positive sliding friction coefficient (w_rel>=0)";
1081 parameter Real peak(final min = 1) = 1 "peak*mue_pos[1,2] = maximum value of mue for w_rel==0";
1082 parameter Real cgeo(final min = 0) = 1 "Geometry constant containing friction distribution assumption";
1083 parameter .Modelica.SIunits.Force fn_max(final min = 0, start = 1) "Maximum normal force";
1084 extends Rotational.Interfaces.PartialFriction;
1085 extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT;
1086 Real mue0 "Friction coefficient for w=0 and forward sliding";
1087 .Modelica.SIunits.Force fn "Normal force (fn=fn_max*f_normalized)";
1088 Modelica.Blocks.Interfaces.RealInput f_normalized "Normalized force signal 0..1 (normal force = fn_max*f_normalized; clutch is engaged if > 0)" annotation(Placement(transformation(origin = {0, 110}, extent = {{20, -20}, {-20, 20}}, rotation = 90)));
1089 equation
1090 mue0 = Modelica.Math.tempInterpol1(0, mue_pos, 2);
1091 w_relfric = w_rel;
1092 a_relfric = a_rel;
1093 fn = fn_max * f_normalized;
1094 free = fn <= 0;
1095 tau0 = mue0 * cgeo * fn;
1096 tau0_max = peak * tau0;
1097 tau = if locked then sa * unitTorque else if free then 0 else cgeo * fn * (if startForward then Modelica.Math.tempInterpol1(w_rel, mue_pos, 2) else if startBackward then -Modelica.Math.tempInterpol1(-w_rel, mue_pos, 2) else if pre(mode) == Forward then Modelica.Math.tempInterpol1(w_rel, mue_pos, 2) else -Modelica.Math.tempInterpol1(-w_rel, mue_pos, 2));
1098 lossPower = tau * w_relfric;
1099 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-150, -110}, {150, -70}}, textString = "%name", lineColor = {0, 0, 255}), Line(visible = useHeatPort, points = {{-100, -100}, {-100, -40}, {0, -40}}, color = {191, 0, 0}, pattern = LinePattern.Dot, smooth = Smooth.None)}), Documentation(info = "<html>
1100 <p>
1101 This component models a <b>clutch</b>, i.e., a component with
1102 two flanges where friction is present between the two flanges
1103 and these flanges are pressed together via a normal force.
1104 The normal force fn has to be provided as input signal f_normalized in a normalized form
1105 (0 &le; f_normalized &le; 1),
1106 fn = fn_max*f_normalized, where fn_max has to be provided as parameter. Friction in the
1107 clutch is modelled in the following way:
1108 </p>
1109 <p>
1110 When the relative angular velocity is not zero, the friction torque is a
1111 function of the velocity dependent friction coefficient mue(w_rel) , of
1112 the normal force \"fn\", and of a geometry constant \"cgeo\" which takes into
1113 account the geometry of the device and the assumptions on the friction
1114 distributions:
1115 </p>
1116 <pre>
1117 frictional_torque = <b>cgeo</b> * <b>mue</b>(w_rel) * <b>fn</b>
1118 </pre>
1119 <p>
1120 Typical values of coefficients of friction:
1121 </p>
1122 <pre>
1123 dry operation : <b>mue</b> = 0.2 .. 0.4
1124 operating in oil: <b>mue</b> = 0.05 .. 0.1
1125 </pre>
1126 <p>
1127 When plates are pressed together, where <b>ri</b> is the inner radius,
1128 <b>ro</b> is the outer radius and <b>N</b> is the number of friction interfaces,
1129 the geometry constant is calculated in the following way under the
1130 assumption of a uniform rate of wear at the interfaces:
1131 </p>
1132 <pre>
1133 <b>cgeo</b> = <b>N</b>*(<b>r0</b> + <b>ri</b>)/2
1134 </pre>
1135 <p>
1136 The positive part of the friction characteristic <b>mue</b>(w_rel),
1137 w_rel >= 0, is defined via table mue_pos (first column = w_rel,
1138 second column = mue). Currently, only linear interpolation in
1139 the table is supported.
1140 </p>
1141 <p>
1142 When the relative angular velocity becomes zero, the elements
1143 connected by the friction element become stuck, i.e., the relative
1144 angle remains constant. In this phase the friction torque is
1145 calculated from a torque balance due to the requirement, that
1146 the relative acceleration shall be zero. The elements begin
1147 to slide when the friction torque exceeds a threshold value,
1148 called the maximum static friction torque, computed via:
1149 </p>
1150 <pre>
1151 frictional_torque = <b>peak</b> * <b>cgeo</b> * <b>mue</b>(w_rel=0) * <b>fn</b> (<b>peak</b> >= 1)
1152 </pre>
1153 <p>
1154 This procedure is implemented in a \"clean\" way by state events and
1155 leads to continuous/discrete systems of equations if friction elements
1156 are dynamically coupled. The method is described in:
1157 </p>
1158 <dl>
1159 <dt>Otter M., Elmqvist H., and Mattsson S.E. (1999):
1160 <dd><b>Hybrid Modeling in Modelica based on the Synchronous
1161 Data Flow Principle</b>. CACSD'99, Aug. 22.-26, Hawaii.
1162 </dl>
1163 <p>
1164 More precise friction models take into account the elasticity of the
1165 material when the two elements are \"stuck\", as well as other effects,
1166 like hysteresis. This has the advantage that the friction element can
1167 be completely described by a differential equation without events. The
1168 drawback is that the system becomes stiff (about 10-20 times slower
1169 simulation) and that more material constants have to be supplied which
1170 requires more sophisticated identification. For more details, see the
1171 following references, especially (Armstrong and Canudas de Witt 1996):
1172 </p>
1173 <dl>
1174 <dt>Armstrong B. (1991):</dt>
1175 <dd><b>Control of Machines with Friction</b>. Kluwer Academic
1176 Press, Boston MA.<br></dd>
1177 <dt>Armstrong B., and Canudas de Wit C. (1996):</dt>
1178 <dd><b>Friction Modeling and Compensation.</b>
1179 The Control Handbook, edited by W.S.Levine, CRC Press,
1180 pp. 1369-1382.<br></dd>
1181 <dt>Canudas de Wit C., Olsson H., Astroem K.J., and Lischinsky P. (1995):</dt>
1182 <dd><b>A new model for control of systems with friction.</b>
1183 IEEE Transactions on Automatic Control, Vol. 40, No. 3, pp. 419-425.</dd>
1184 </dl>
1185
1186 <p>
1187 See also the discussion
1188 <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.StateSelection\">State Selection</a>
1189 in the User's Guide of the Rotational library.
1190 </p>
1191 </html>"));
1192 end Clutch;
1193 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Rectangle(origin = {13.5135, 76.9841}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-63.5135, -126.9841}, {36.4865, -26.9841}}, radius = 10.0), Rectangle(origin = {13.5135, 76.9841}, lineColor = {64, 64, 64}, fillPattern = FillPattern.None, extent = {{-63.5135, -126.9841}, {36.4865, -26.9841}}, radius = 10.0), Rectangle(origin = {-3.0, 73.07689999999999}, lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-87.0, -83.07689999999999}, {-47.0, -63.0769}}), Rectangle(origin = {22.3077, 70.0}, lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{27.6923, -80.0}, {67.6923, -60.0}})}), Documentation(info = "<html>
1194 <p>
1195 This package contains basic components 1D mechanical rotational drive trains.
1196 </p>
1197 </html>"));
1198 end Components;
1199
1200 package Sources "Sources to drive 1D rotational mechanical components"
1201 extends Modelica.Icons.SourcesPackage;
1202
1203 model ConstantSpeed "Constant speed, not dependent on torque"
1204 extends Modelica.Mechanics.Rotational.Interfaces.PartialTorque;
1205 Modelica.SIunits.AngularVelocity w "Angular velocity of flange with respect to support (= der(phi))";
1206 parameter Modelica.SIunits.AngularVelocity w_fixed "Fixed speed";
1207 equation
1208 w = der(phi);
1209 w = w_fixed;
1210 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1), graphics = {Line(points = {{0, -100}, {0, 100}}, color = {0, 0, 127}), Text(extent = {{-116.0, -40.0}, {128.0, -16.0}}, textString = "%w_fixed")}), Documentation(info = "<HTML>
1211 <p>
1212 Model of <b>fixed</b> angular velocity of flange, not dependent on torque.
1213 </p>
1214 </HTML>"));
1215 end ConstantSpeed;
1216 annotation(Documentation(info = "<html>
1217 <p>
1218 This package contains ideal sources to drive 1D mechanical rotational drive trains.
1219 </p>
1220 </html>"));
1221 end Sources;
1222
1223 package Interfaces "Connectors and partial models for 1D rotational mechanical components"
1224 extends Modelica.Icons.InterfacesPackage;
1225
1226 connector Flange_a "1-dim. rotational flange of a shaft (filled square icon)"
1227 .Modelica.SIunits.Angle phi "Absolute rotation angle of flange";
1228 flow .Modelica.SIunits.Torque tau "Cut torque in the flange";
1229 annotation(defaultComponentName = "flange_a", Documentation(info = "<html>
1230 <p>
1231 This is a connector for 1-dim. rotational mechanical systems and models
1232 the mechanical flange of a shaft. The following variables are defined in this connector:
1233 </p>
1234
1235 <table border=1 cellspacing=0 cellpadding=2>
1236 <tr><td valign=\"top\"> <b>phi</b></td>
1237 <td valign=\"top\"> Absolute rotation angle of the shaft flange in [rad] </td>
1238 </tr>
1239 <tr><td valign=\"top\"> <b>tau</b></td>
1240 <td valign=\"top\"> Cut-torque in the shaft flange in [Nm] </td>
1241 </tr>
1242 </table>
1243
1244 <p>
1245 There is a second connector for flanges: Flange_b. The connectors
1246 Flange_a and Flange_b are completely identical. There is only a difference
1247 in the icons, in order to easier identify a flange variable in a diagram.
1248 For a discussion on the actual direction of the cut-torque tau and
1249 of the rotation angle, see section
1250 <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SignConventions\">Sign Conventions</a>
1251 in the user's guide of Rotational.
1252 </p>
1253
1254 <p>
1255 If needed, the absolute angular velocity w and the
1256 absolute angular acceleration a of the flange can be determined by
1257 differentiation of the flange angle phi:
1258 </p>
1259 <pre>
1260 w = der(phi); a = der(w)
1261 </pre>
1262 </html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-160, 90}, {40, 50}}, lineColor = {0, 0, 0}, textString = "%name"), Ellipse(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid)}));
1263 end Flange_a;
1264
1265 connector Flange_b "1-dim. rotational flange of a shaft (non-filled square icon)"
1266 .Modelica.SIunits.Angle phi "Absolute rotation angle of flange";
1267 flow .Modelica.SIunits.Torque tau "Cut torque in the flange";
1268 annotation(defaultComponentName = "flange_b", Documentation(info = "<html>
1269 <p>
1270 This is a connector for 1-dim. rotational mechanical systems and models
1271 the mechanical flange of a shaft. The following variables are defined in this connector:
1272 </p>
1273
1274 <table border=1 cellspacing=0 cellpadding=2>
1275 <tr><td valign=\"top\"> <b>phi</b></td>
1276 <td valign=\"top\"> Absolute rotation angle of the shaft flange in [rad] </td>
1277 </tr>
1278 <tr><td valign=\"top\"> <b>tau</b></td>
1279 <td valign=\"top\"> Cut-torque in the shaft flange in [Nm] </td>
1280 </tr>
1281 </table>
1282
1283 <p>
1284 There is a second connector for flanges: Flange_a. The connectors
1285 Flange_a and Flange_b are completely identical. There is only a difference
1286 in the icons, in order to easier identify a flange variable in a diagram.
1287 For a discussion on the actual direction of the cut-torque tau and
1288 of the rotation angle, see section
1289 <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SignConventions\">Sign Conventions</a>
1290 in the user's guide of Rotational.
1291 </p>
1292
1293 <p>
1294 If needed, the absolute angular velocity w and the
1295 absolute angular acceleration a of the flange can be determined by
1296 differentiation of the flange angle phi:
1297 </p>
1298 <pre>
1299 w = der(phi); a = der(w)
1300 </pre>
1301 </html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(extent = {{-98, 100}, {102, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-40, 90}, {160, 50}}, lineColor = {0, 0, 0}, textString = "%name")}));
1302 end Flange_b;
1303
1304 connector Support "Support/housing of a 1-dim. rotational shaft"
1305 .Modelica.SIunits.Angle phi "Absolute rotation angle of the support/housing";
1306 flow .Modelica.SIunits.Torque tau "Reaction torque in the support/housing";
1307 annotation(Documentation(info = "<html>
1308 <p>
1309 This is a connector for 1-dim. rotational mechanical systems and models
1310 the support or housing of a shaft. The following variables are defined in this connector:
1311 </p>
1312
1313 <table border=1 cellspacing=0 cellpadding=2>
1314 <tr><td valign=\"top\"> <b>phi</b></td>
1315 <td valign=\"top\"> Absolute rotation angle of the support/housing in [rad] </td>
1316 </tr>
1317 <tr><td valign=\"top\"> <b>tau</b></td>
1318 <td valign=\"top\"> Reaction torque in the support/housing in [Nm] </td>
1319 </tr>
1320 </table>
1321
1322 <p>
1323 The support connector is usually defined as conditional connector.
1324 It is most convenient to utilize it
1325 </p>
1326
1327 <ul>
1328 <li> For models to be build graphically (i.e., the model is build up by drag-and-drop
1329 from elementary components):<br>
1330 <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialOneFlangeAndSupport\">PartialOneFlangeAndSupport</a>,<br>
1331 <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialTwoFlangesAndSupport\">PartialTwoFlangesAndSupport</a>, <br> &nbsp; </li>
1332
1333 <li> For models to be build textually (i.e., elementary models):<br>
1334 <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport\">PartialElementaryOneFlangeAndSupport</a>,<br>
1335 <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialElementaryTwoFlangesAndSupport\">PartialElementaryTwoFlangesAndSupport</a>,<br>
1336 <a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialElementaryRotationalToTranslational\">PartialElementaryRotationalToTranslational</a>.</li>
1337 </ul>
1338 </html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1), graphics = {Ellipse(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-150, 150}, {150, -150}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, initialScale = 0.1), graphics = {Rectangle(extent = {{-60, 60}, {60, -60}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Text(extent = {{-160, 100}, {40, 60}}, lineColor = {0, 0, 0}, textString = "%name"), Ellipse(extent = {{-40, 40}, {40, -40}}, lineColor = {0, 0, 0}, fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid)}));
1339 end Support;
1340
1341 partial model PartialCompliantWithRelativeStates "Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states"
1342 Modelica.SIunits.Angle phi_rel(start = 0, stateSelect = stateSelect, nominal = if phi_nominal >= Modelica.Constants.eps then phi_nominal else 1) "Relative rotation angle (= flange_b.phi - flange_a.phi)";
1343 Modelica.SIunits.AngularVelocity w_rel(start = 0, stateSelect = stateSelect) "Relative angular velocity (= der(phi_rel))";
1344 Modelica.SIunits.AngularAcceleration a_rel(start = 0) "Relative angular acceleration (= der(w_rel))";
1345 Modelica.SIunits.Torque tau "Torque between flanges (= flange_b.tau)";
1346 Flange_a flange_a "Left flange of compliant 1-dim. rotational component" annotation(Placement(transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0)));
1347 Flange_b flange_b "Right flange of compliant 1-dim. rotational component" annotation(Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
1348 parameter .Modelica.SIunits.Angle phi_nominal(displayUnit = "rad", min = 0.0) = 0.0001 "Nominal value of phi_rel (used for scaling)" annotation(Dialog(tab = "Advanced"));
1349 parameter StateSelect stateSelect = StateSelect.prefer "Priority to use phi_rel and w_rel as states" annotation(HideResult = true, Dialog(tab = "Advanced"));
1350 equation
1351 phi_rel = flange_b.phi - flange_a.phi;
1352 w_rel = der(phi_rel);
1353 a_rel = der(w_rel);
1354 flange_b.tau = tau;
1355 flange_a.tau = -tau;
1356 annotation(Documentation(info = "<html>
1357 <p>
1358 This is a 1-dim. rotational component with a compliant connection of two
1359 rotational 1-dim. flanges where inertial effects between the two
1360 flanges are neglected. The basic assumption is that the cut-torques
1361 of the two flanges sum-up to zero, i.e., they have the same absolute value
1362 but opposite sign: flange_a.tau + flange_b.tau = 0. This base class
1363 is used to built up force elements such as springs, dampers, friction.
1364 </p>
1365
1366 <p>
1367 The relative angle and the relative speed are defined as preferred states.
1368 The reason is that for some drive trains, such as drive
1369 trains in vehicles, the absolute angle is quickly increasing during operation.
1370 Numerically, it is better to use relative angles between drive train components
1371 because they remain in a limited size. For this reason, StateSelect.prefer
1372 is set for the relative angle of this component.
1373 </p>
1374
1375 <p>
1376 In order to improve the numerics, a nominal value for the relative angle
1377 can be provided via parameter <b>phi_nominal</b> in the Advanced menu.
1378 The default is 1e-4 rad since relative angles are usually
1379 in this order and the step size control of an integrator would be
1380 practically switched off, if a default of 1 rad would be used.
1381 This nominal value might also be computed from other values, such
1382 as \"phi_nominal = tau_nominal / c\" for a rotational spring, if tau_nominal
1383 and c are more meaningful for the user.
1384 </p>
1385
1386 <p>
1387 See also the discussion
1388 <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.StateSelection\">State Selection</a>
1389 in the User's Guide of the Rotational library.
1390 </p>
1391 </html>"));
1392 end PartialCompliantWithRelativeStates;
1393
1394 partial model PartialElementaryOneFlangeAndSupport2 "Partial model for a component with one rotational 1-dim. shaft flange and a support used for textual modeling, i.e., for elementary models"
1395 parameter Boolean useSupport = false "= true, if support flange enabled, otherwise implicitly grounded" annotation(Evaluate = true, HideResult = true, choices(checkBox = true));
1396 Flange_b flange "Flange of shaft" annotation(Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
1397 Support support(phi = phi_support, tau = -flange.tau) if useSupport "Support/housing of component" annotation(Placement(transformation(extent = {{-10, -110}, {10, -90}})));
1398 protected
1399 Modelica.SIunits.Angle phi_support "Absolute angle of support flange";
1400 equation
1401 if not useSupport then
1402 phi_support = 0;
1403 end if;
1404 annotation(Documentation(info = "<html>
1405 <p>
1406 This is a 1-dim. rotational component with one flange and a support/housing.
1407 It is used to build up elementary components of a drive train with
1408 equations in the text layer.
1409 </p>
1410
1411 <p>
1412 If <i>useSupport=true</i>, the support connector is conditionally enabled
1413 and needs to be connected.<br>
1414 If <i>useSupport=false</i>, the support connector is conditionally disabled
1415 and instead the component is internally fixed to ground.
1416 </p>
1417 </html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(visible = not useSupport, points = {{-50, -120}, {-30, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-30, -120}, {-10, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-10, -120}, {10, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{10, -120}, {30, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-30, -100}, {30, -100}}, color = {0, 0, 0})}));
1418 end PartialElementaryOneFlangeAndSupport2;
1419
1420 partial model PartialTorque "Partial model of a torque acting at the flange (accelerates the flange)"
1421 extends Modelica.Mechanics.Rotational.Interfaces.PartialElementaryOneFlangeAndSupport2;
1422 Modelica.SIunits.Angle phi "Angle of flange with respect to support (= flange.phi - support.phi)";
1423 equation
1424 phi = flange.phi - phi_support;
1425 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-96, 96}, {96, -96}}, lineColor = {255, 255, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{0, -62}, {0, -100}}, color = {0, 0, 0}), Line(points = {{-92, 0}, {-76, 36}, {-54, 62}, {-30, 80}, {-14, 88}, {10, 92}, {26, 90}, {46, 80}, {64, 62}}, color = {0, 0, 0}, smooth = Smooth.Bezier), Text(extent = {{-150, 140}, {150, 100}}, lineColor = {0, 0, 255}, textString = "%name"), Polygon(points = {{94, 16}, {80, 74}, {50, 52}, {94, 16}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Line(points = {{-58, -82}, {-42, -68}, {-20, -56}, {0, -54}, {18, -56}, {34, -62}, {44, -72}, {54, -82}, {60, -94}}, color = {0, 0, 0}, smooth = Smooth.Bezier), Polygon(points = {{-65, -98}, {-46, -80}, {-58, -72}, {-65, -98}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Line(visible = not useSupport, points = {{-50, -120}, {-30, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-30, -120}, {-10, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-10, -120}, {10, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{10, -120}, {30, -100}}, color = {0, 0, 0}), Line(visible = not useSupport, points = {{-30, -100}, {30, -100}}, color = {0, 0, 0})}), Documentation(info = "<HTML>
1426 <p>
1427 Partial model of torque that accelerates the flange.
1428 </p>
1429
1430 <p>
1431 If <i>useSupport=true</i>, the support connector is conditionally enabled
1432 and needs to be connected.<br>
1433 If <i>useSupport=false</i>, the support connector is conditionally disabled
1434 and instead the component is internally fixed to ground.
1435 </p>
1436 </html>"));
1437 end PartialTorque;
1438
1439 partial model PartialFriction "Partial model of Coulomb friction elements"
1440 parameter .Modelica.SIunits.AngularVelocity w_small = 10000000000.0 "Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)" annotation(Dialog(tab = "Advanced"));
1441 .Modelica.SIunits.AngularVelocity w_relfric "Relative angular velocity between frictional surfaces";
1442 .Modelica.SIunits.AngularAcceleration a_relfric "Relative angular acceleration between frictional surfaces";
1443 .Modelica.SIunits.Torque tau0 "Friction torque for w=0 and forward sliding";
1444 .Modelica.SIunits.Torque tau0_max "Maximum friction torque for w=0 and locked";
1445 Boolean free "true, if frictional element is not active";
1446 Real sa(final unit = "1") "Path parameter of friction characteristic tau = f(a_relfric)";
1447 Boolean startForward(start = false, fixed = true) "true, if w_rel=0 and start of forward sliding";
1448 Boolean startBackward(start = false, fixed = true) "true, if w_rel=0 and start of backward sliding";
1449 Boolean locked(start = false) "true, if w_rel=0 and not sliding";
1450 constant Integer Unknown = 3 "Value of mode is not known";
1451 constant Integer Free = 2 "Element is not active";
1452 constant Integer Forward = 1 "w_rel > 0 (forward sliding)";
1453 constant Integer Stuck = 0 "w_rel = 0 (forward sliding, locked or backward sliding)";
1454 constant Integer Backward = -1 "w_rel < 0 (backward sliding)";
1455 Integer mode(final min = Backward, final max = Unknown, start = Unknown, fixed = true);
1456 protected
1457 constant .Modelica.SIunits.AngularAcceleration unitAngularAcceleration = 1 annotation(HideResult = true);
1458 constant .Modelica.SIunits.Torque unitTorque = 1 annotation(HideResult = true);
1459 equation
1460 startForward = pre(mode) == Stuck and (sa > tau0_max / unitTorque or pre(startForward) and sa > tau0 / unitTorque) or pre(mode) == Backward and w_relfric > w_small or initial() and w_relfric > 0;
1461 startBackward = pre(mode) == Stuck and (sa < -tau0_max / unitTorque or pre(startBackward) and sa < -tau0 / unitTorque) or pre(mode) == Forward and w_relfric < -w_small or initial() and w_relfric < 0;
1462 locked = not free and not (pre(mode) == Forward or startForward or pre(mode) == Backward or startBackward);
1463 a_relfric / unitAngularAcceleration = if locked then 0 else if free then sa else if startForward then sa - tau0_max / unitTorque else if startBackward then sa + tau0_max / unitTorque else if pre(mode) == Forward then sa - tau0_max / unitTorque else sa + tau0_max / unitTorque;
1464 mode = if free then Free else if (pre(mode) == Forward or pre(mode) == Free or startForward) and w_relfric > 0 then Forward else if (pre(mode) == Backward or pre(mode) == Free or startBackward) and w_relfric < 0 then Backward else Stuck;
1465 annotation(Documentation(info = "<html>
1466 <p>
1467 Basic model for Coulomb friction that models the stuck phase in a reliable way.
1468 </p>
1469 </html>"));
1470 end PartialFriction;
1471 annotation(Documentation(info = "<html>
1472 <p>
1473 This package contains connectors and partial models for 1-dim.
1474 rotational mechanical components. The components of this package can
1475 only be used as basic building elements for models.
1476 </p>
1477 </html>"));
1478 end Interfaces;
1479
1480 package Icons "Icons for Rotational package"
1481 extends Modelica.Icons.IconsPackage;
1482
1483 model Clutch "Icon of a clutch" annotation(Icon(graphics = {Rectangle(lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -10.0}, {-30.0, 10.0}}), Rectangle(lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-30.0, -60.0}, {-10.0, 60.0}}), Rectangle(lineColor = {64, 64, 64}, fillPattern = FillPattern.None, extent = {{-30.0, -60.0}, {-10.0, 60.0}}), Rectangle(lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{10.0, -60.0}, {30.0, 60.0}}), Rectangle(lineColor = {64, 64, 64}, fillPattern = FillPattern.None, extent = {{10.0, -60.0}, {30.0, 60.0}}), Rectangle(lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{30.0, -10.0}, {100.0, 10.0}}), Polygon(lineColor = {0, 0, 127}, fillColor = {0, 0, 127}, fillPattern = FillPattern.Solid, points = {{-30.0, 40.0}, {-60.0, 50.0}, {-60.0, 30.0}, {-30.0, 40.0}}), Polygon(lineColor = {0, 0, 127}, fillColor = {0, 0, 127}, fillPattern = FillPattern.Solid, points = {{30.0, 40.0}, {60.0, 50.0}, {60.0, 30.0}, {30.0, 40.0}}), Line(points = {{0.0, 90.0}, {90.0, 70.0}, {90.0, 40.0}, {30.0, 40.0}}, color = {0, 0, 127}), Line(points = {{0.0, 90.0}, {-90.0, 70.0}, {-90.0, 40.0}, {-30.0, 40.0}}, color = {0, 0, 127})}, coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}, preserveAspectRatio = true, initialScale = 0.1)), Documentation(info = "<html>
1484 <p>
1485 This is the icon of a clutch from the rotational package.
1486 </p>
1487 </html>")); end Clutch;
1488 annotation(Documentation(info = "<html>
1489 <p>
1490 This package contains icons for the Rotational library
1491 (that is, all the components have only graphical annotations
1492 without any equations).
1493 </p>
1494 </html>"));
1495 end Icons;
1496 annotation(Documentation(info = "<html>
1497
1498 <p>
1499 Library <b>Rotational</b> is a <b>free</b> Modelica package providing
1500 1-dimensional, rotational mechanical components to model in a convenient way
1501 drive trains with frictional losses. A typical, simple example is shown
1502 in the next figure:
1503 </p>
1504
1505 <img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveExample.png\">
1506
1507 <p>
1508 For an introduction, have especially a look at:
1509 </p>
1510 <ul>
1511 <li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide\">Rotational.UsersGuide</a>
1512 discusses the most important aspects how to use this library.</li>
1513 <li> <a href=\"modelica://Modelica.Mechanics.Rotational.Examples\">Rotational.Examples</a>
1514 contains examples that demonstrate the usage of this library.</li>
1515 </ul>
1516
1517 <p>
1518 In version 3.0 of the Modelica Standard Library, the basic design of the
1519 library has changed: Previously, bearing connectors could or could not be connected.
1520 In 3.0, the bearing connector is renamed to \"<b>support</b>\" and this connector
1521 is enabled via parameter \"useSupport\". If the support connector is enabled,
1522 it must be connected, and if it is not enabled, it must not be connected.
1523 </p>
1524
1525 <p>
1526 In version 3.2 of the Modelica Standard Library, all <b>dissipative</b> components
1527 of the Rotational library got an optional <b>heatPort</b> connector to which the
1528 dissipated energy is transported in form of heat. This connector is enabled
1529 via parameter \"useHeatPort\". If the heatPort connector is enabled,
1530 it must be connected, and if it is not enabled, it must not be connected.
1531 Independently, whether the heatPort is enabled or not,
1532 the dissipated power is available from the new variable \"<b>lossPower</b>\" (which is
1533 positive if heat is flowing out of the heatPort). For an example, see
1534 <a href=\"modelica://Modelica.Mechanics.Rotational.Examples.HeatLosses\">Examples.HeatLosses</a>.
1535 </p>
1536
1537 <p>
1538 Copyright &copy; 1998-2013, Modelica Association and DLR.
1539 </p>
1540 <p>
1541 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
1542 </p>
1543 </html>", revisions = ""), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Line(visible = true, origin = {-2.0, 46.0}, points = {{-83.0, -66.0}, {-63.0, -66.0}}), Line(visible = true, origin = {29.0, 48.0}, points = {{36.0, -68.0}, {56.0, -68.0}}), Line(visible = true, origin = {-2.0, 49.0}, points = {{-83.0, -29.0}, {-63.0, -29.0}}), Line(visible = true, origin = {29.0, 52.0}, points = {{36.0, -32.0}, {56.0, -32.0}}), Line(visible = true, origin = {-2.0, 49.0}, points = {{-73.0, -9.0}, {-73.0, -29.0}}), Line(visible = true, origin = {29.0, 52.0}, points = {{46.0, -12.0}, {46.0, -32.0}}), Line(visible = true, origin = {-0.0, -47.5}, points = {{-75.0, 27.5}, {-75.0, -27.5}, {75.0, -27.5}, {75.0, 27.5}}), Rectangle(visible = true, origin = {13.5135, 76.9841}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-63.5135, -126.9841}, {36.4865, -26.9841}}, radius = 10.0), Rectangle(visible = true, origin = {13.5135, 76.9841}, lineColor = {64, 64, 64}, fillPattern = FillPattern.None, extent = {{-63.5135, -126.9841}, {36.4865, -26.9841}}, radius = 10.0), Rectangle(visible = true, origin = {-3.0, 73.07689999999999}, lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-87.0, -83.07689999999999}, {-47.0, -63.0769}}), Rectangle(visible = true, origin = {22.3077, 70.0}, lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{27.6923, -80.0}, {67.6923, -60.0}})}));
1544 end Rotational;
1545 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100.0, -100.0}, {100.0, 100.0}}, initialScale = 0.1), graphics = {Rectangle(origin = {8.6, 63.3333}, lineColor = {64, 64, 64}, fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-4.6, -93.33329999999999}, {41.4, -53.3333}}), Ellipse(origin = {9.0, 46.0}, extent = {{-90.0, -60.0}, {-80.0, -50.0}}), Line(origin = {9.0, 46.0}, points = {{-85.0, -55.0}, {-60.0, -21.0}}, thickness = 0.5), Ellipse(origin = {9.0, 46.0}, extent = {{-65.0, -26.0}, {-55.0, -16.0}}), Line(origin = {9.0, 46.0}, points = {{-60.0, -21.0}, {9.0, -55.0}}, thickness = 0.5), Ellipse(origin = {9.0, 46.0}, fillPattern = FillPattern.Solid, extent = {{4.0, -60.0}, {14.0, -50.0}}), Line(origin = {9.0, 46.0}, points = {{-10.0, -26.0}, {72.0, -26.0}, {72.0, -86.0}, {-10.0, -86.0}})}), Documentation(info = "<HTML>
1546 <p>
1547 This package contains components to model the movement
1548 of 1-dim. rotational, 1-dim. translational, and
1549 3-dim. <b>mechanical systems</b>.
1550 </p>
1551
1552 <p>
1553 Note, all <b>dissipative</b> components of the Modelica.Mechanics library have
1554 an optional <b>heatPort</b> connector to which the
1555 dissipated energy is transported in form of heat. This connector is enabled
1556 via parameter \"useHeatPort\". If the heatPort connector is enabled,
1557 it must be connected, and if it is not enabled, it must not be connected.
1558 Independently, whether the heatPort is enabled or not,
1559 the dissipated power is available from variable \"<b>lossPower</b>\" (which is
1560 positive if heat is flowing out of the heatPort).
1561 </p>
1562 </html>"));
1563 end Mechanics;
1564
1565 package Media "Library of media property models"
1566 extends Modelica.Icons.Package;
1567
1568 package Interfaces "Interfaces for media models"
1569 extends Modelica.Icons.InterfacesPackage;
1570
1571 partial package PartialMedium "Partial medium properties (base package of all media packages)"
1572 extends Modelica.Media.Interfaces.Types;
1573 extends Modelica.Icons.MaterialPropertiesPackage;
1574 constant Modelica.Media.Interfaces.Choices.IndependentVariables ThermoStates "Enumeration type for independent variables";
1575 constant String mediumName = "unusablePartialMedium" "Name of the medium";
1576 constant String[:] substanceNames = {mediumName} "Names of the mixture substances. Set substanceNames={mediumName} if only one substance.";
1577 constant String[:] extraPropertiesNames = fill("", 0) "Names of the additional (extra) transported properties. Set extraPropertiesNames=fill(\"\",0) if unused";
1578 constant Boolean singleState "= true, if u and d are not a function of pressure";
1579 constant Boolean reducedX = true "= true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details)";
1580 constant Boolean fixedX = false "= true if medium contains the equation X = reference_X";
1581 constant AbsolutePressure reference_p = 101325 "Reference pressure of Medium: default 1 atmosphere";
1582 constant Temperature reference_T = 298.15 "Reference temperature of Medium: default 25 deg Celsius";
1583 constant MassFraction[nX] reference_X = fill(1 / nX, nX) "Default mass fractions of medium";
1584 constant AbsolutePressure p_default = 101325 "Default value for pressure of medium (for initialization)";
1585 constant Temperature T_default = Modelica.SIunits.Conversions.from_degC(20) "Default value for temperature of medium (for initialization)";
1586 constant MassFraction[nX] X_default = reference_X "Default value for mass fractions of medium (for initialization)";
1587 final constant Integer nS = size(substanceNames, 1) "Number of substances" annotation(Evaluate = true);
1588 constant Integer nX = nS "Number of mass fractions" annotation(Evaluate = true);
1589 constant Integer nXi = if fixedX then 0 else if reducedX then nS - 1 else nS "Number of structurally independent mass fractions (see docu for details)" annotation(Evaluate = true);
1590 final constant Integer nC = size(extraPropertiesNames, 1) "Number of extra (outside of standard mass-balance) transported properties" annotation(Evaluate = true);
1591 replaceable record FluidConstants = Modelica.Media.Interfaces.Types.Basic.FluidConstants "Critical, triple, molecular and other standard data of fluid";
1592
1593 replaceable record ThermodynamicState "Minimal variable set that is available as input argument to every medium function"
1594 extends Modelica.Icons.Record;
1595 end ThermodynamicState;
1596
1597 replaceable partial model BaseProperties "Base properties (p, d, T, h, u, R, MM and, if applicable, X and Xi) of a medium"
1598 InputAbsolutePressure p "Absolute pressure of medium";
1599 InputMassFraction[nXi] Xi(start = reference_X[1:nXi]) "Structurally independent mass fractions";
1600 InputSpecificEnthalpy h "Specific enthalpy of medium";
1601 Density d "Density of medium";
1602 Temperature T "Temperature of medium";
1603 MassFraction[nX] X(start = reference_X) "Mass fractions (= (component mass)/total mass m_i/m)";
1604 SpecificInternalEnergy u "Specific internal energy of medium";
1605 SpecificHeatCapacity R "Gas constant (of mixture if applicable)";
1606 MolarMass MM "Molar mass (of mixture or single fluid)";
1607 ThermodynamicState state "Thermodynamic state record for optional functions";
1608 parameter Boolean preferredMediumStates = false "= true if StateSelect.prefer shall be used for the independent property variables of the medium" annotation(Evaluate = true, Dialog(tab = "Advanced"));
1609 parameter Boolean standardOrderComponents = true "If true, and reducedX = true, the last element of X will be computed from the other ones";
1610 .Modelica.SIunits.Conversions.NonSIunits.Temperature_degC T_degC = Modelica.SIunits.Conversions.to_degC(T) "Temperature of medium in [degC]";
1611 .Modelica.SIunits.Conversions.NonSIunits.Pressure_bar p_bar = Modelica.SIunits.Conversions.to_bar(p) "Absolute pressure of medium in [bar]";
1612 connector InputAbsolutePressure = input .Modelica.SIunits.AbsolutePressure "Pressure as input signal connector";
1613 connector InputSpecificEnthalpy = input .Modelica.SIunits.SpecificEnthalpy "Specific enthalpy as input signal connector";
1614 connector InputMassFraction = input .Modelica.SIunits.MassFraction "Mass fraction as input signal connector";
1615 equation
1616 if standardOrderComponents then
1617 Xi = X[1:nXi];
1618 if fixedX then
1619 X = reference_X;
1620 end if;
1621 if reducedX and not fixedX then
1622 X[nX] = 1 - sum(Xi);
1623 end if;
1624 for i in 1:nX loop
1625 assert(X[i] >= -1e-005 and X[i] <= 1 + 1e-005, "Mass fraction X[" + String(i) + "] = " + String(X[i]) + "of substance " + substanceNames[i] + "\nof medium " + mediumName + " is not in the range 0..1");
1626 end for;
1627 end if;
1628 assert(p >= 0.0, "Pressure (= " + String(p) + " Pa) of medium \"" + mediumName + "\" is negative\n(Temperature = " + String(T) + " K)");
1629 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, lineColor = {0, 0, 255}), Text(extent = {{-152, 164}, {152, 102}}, textString = "%name", lineColor = {0, 0, 255})}), Documentation(info = "<html>
1630 <p>
1631 Model <b>BaseProperties</b> is a model within package <b>PartialMedium</b>
1632 and contains the <b>declarations</b> of the minimum number of
1633 variables that every medium model is supposed to support.
1634 A specific medium inherits from model <b>BaseProperties</b> and provides
1635 the equations for the basic properties.</p>
1636 <p>
1637 The BaseProperties model contains the following <b>7+nXi variables</b>
1638 (nXi is the number of independent mass fractions defined in package
1639 PartialMedium):
1640 </p>
1641 <table border=1 cellspacing=0 cellpadding=2>
1642 <tr><td valign=\"top\"><b>Variable</b></td>
1643 <td valign=\"top\"><b>Unit</b></td>
1644 <td valign=\"top\"><b>Description</b></td></tr>
1645 <tr><td valign=\"top\">T</td>
1646 <td valign=\"top\">K</td>
1647 <td valign=\"top\">temperature</td></tr>
1648 <tr><td valign=\"top\">p</td>
1649 <td valign=\"top\">Pa</td>
1650 <td valign=\"top\">absolute pressure</td></tr>
1651 <tr><td valign=\"top\">d</td>
1652 <td valign=\"top\">kg/m3</td>
1653 <td valign=\"top\">density</td></tr>
1654 <tr><td valign=\"top\">h</td>
1655 <td valign=\"top\">J/kg</td>
1656 <td valign=\"top\">specific enthalpy</td></tr>
1657 <tr><td valign=\"top\">u</td>
1658 <td valign=\"top\">J/kg</td>
1659 <td valign=\"top\">specific internal energy</td></tr>
1660 <tr><td valign=\"top\">Xi[nXi]</td>
1661 <td valign=\"top\">kg/kg</td>
1662 <td valign=\"top\">independent mass fractions m_i/m</td></tr>
1663 <tr><td valign=\"top\">R</td>
1664 <td valign=\"top\">J/kg.K</td>
1665 <td valign=\"top\">gas constant</td></tr>
1666 <tr><td valign=\"top\">M</td>
1667 <td valign=\"top\">kg/mol</td>
1668 <td valign=\"top\">molar mass</td></tr>
1669 </table>
1670 <p>
1671 In order to implement an actual medium model, one can extend from this
1672 base model and add <b>5 equations</b> that provide relations among
1673 these variables. Equations will also have to be added in order to
1674 set all the variables within the ThermodynamicState record state.</p>
1675 <p>
1676 If standardOrderComponents=true, the full composition vector X[nX]
1677 is determined by the equations contained in this base class, depending
1678 on the independent mass fraction vector Xi[nXi].</p>
1679 <p>Additional <b>2 + nXi</b> equations will have to be provided
1680 when using the BaseProperties model, in order to fully specify the
1681 thermodynamic conditions. The input connector qualifier applied to
1682 p, h, and nXi indirectly declares the number of missing equations,
1683 permitting advanced equation balance checking by Modelica tools.
1684 Please note that this doesn't mean that the additional equations
1685 should be connection equations, nor that exactly those variables
1686 should be supplied, in order to complete the model.
1687 For further information, see the Modelica.Media User's guide, and
1688 Section 4.7 (Balanced Models) of the Modelica 3.0 specification.</p>
1689 </html>"));
1690 end BaseProperties;
1691
1692 replaceable partial function setState_pTX "Return thermodynamic state as function of p, T and composition X or Xi"
1693 extends Modelica.Icons.Function;
1694 input AbsolutePressure p "Pressure";
1695 input Temperature T "Temperature";
1696 input MassFraction[:] X = reference_X "Mass fractions";
1697 output ThermodynamicState state "Thermodynamic state record";
1698 end setState_pTX;
1699
1700 replaceable partial function setSmoothState "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b"
1701 extends Modelica.Icons.Function;
1702 input Real x "m_flow or dp";
1703 input ThermodynamicState state_a "Thermodynamic state if x > 0";
1704 input ThermodynamicState state_b "Thermodynamic state if x < 0";
1705 input Real x_small(min = 0) "Smooth transition in the region -x_small < x < x_small";
1706 output ThermodynamicState state "Smooth thermodynamic state for all x (continuous and differentiable)";
1707 annotation(Documentation(info = "<html>
1708 <p>
1709 This function is used to approximate the equation
1710 </p>
1711 <pre>
1712 state = <b>if</b> x &gt; 0 <b>then</b> state_a <b>else</b> state_b;
1713 </pre>
1714
1715 <p>
1716 by a smooth characteristic, so that the expression is continuous and differentiable:
1717 </p>
1718
1719 <pre>
1720 state := <b>smooth</b>(1, <b>if</b> x &gt; x_small <b>then</b> state_a <b>else</b>
1721 <b>if</b> x &lt; -x_small <b>then</b> state_b <b>else</b> f(state_a, state_b));
1722 </pre>
1723
1724 <p>
1725 This is performed by applying function <b>Media.Common.smoothStep</b>(..)
1726 on every element of the thermodynamic state record.
1727 </p>
1728
1729 <p>
1730 If <b>mass fractions</b> X[:] are approximated with this function then this can be performed
1731 for all <b>nX</b> mass fractions, instead of applying it for nX-1 mass fractions and computing
1732 the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the
1733 property that sum(state.X) = 1, provided sum(state_a.X) = sum(state_b.X) = 1.
1734 This can be shown by evaluating the approximating function in the abs(x) &lt; x_small
1735 region (otherwise state.X is either state_a.X or state_b.X):
1736 </p>
1737
1738 <pre>
1739 X[1] = smoothStep(x, X_a[1] , X_b[1] , x_small);
1740 X[2] = smoothStep(x, X_a[2] , X_b[2] , x_small);
1741 ...
1742 X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);
1743 </pre>
1744
1745 <p>
1746 or
1747 </p>
1748
1749 <pre>
1750 X[1] = c*(X_a[1] - X_b[1]) + (X_a[1] + X_b[1])/2
1751 X[2] = c*(X_a[2] - X_b[2]) + (X_a[2] + X_b[2])/2;
1752 ...
1753 X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2;
1754 c = (x/x_small)*((x/x_small)^2 - 3)/4
1755 </pre>
1756
1757 <p>
1758 Summing all mass fractions together results in
1759 </p>
1760
1761 <pre>
1762 sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2
1763 = c*(1 - 1) + (1 + 1)/2
1764 = 1
1765 </pre>
1766
1767 </html>"));
1768 end setSmoothState;
1769
1770 replaceable partial function dynamicViscosity "Return dynamic viscosity"
1771 extends Modelica.Icons.Function;
1772 input ThermodynamicState state "Thermodynamic state record";
1773 output DynamicViscosity eta "Dynamic viscosity";
1774 end dynamicViscosity;
1775
1776 replaceable partial function thermalConductivity "Return thermal conductivity"
1777 extends Modelica.Icons.Function;
1778 input ThermodynamicState state "Thermodynamic state record";
1779 output ThermalConductivity lambda "Thermal conductivity";
1780 end thermalConductivity;
1781
1782 replaceable partial function pressure "Return pressure"
1783 extends Modelica.Icons.Function;
1784 input ThermodynamicState state "Thermodynamic state record";
1785 output AbsolutePressure p "Pressure";
1786 end pressure;
1787
1788 replaceable partial function temperature "Return temperature"
1789 extends Modelica.Icons.Function;
1790 input ThermodynamicState state "Thermodynamic state record";
1791 output Temperature T "Temperature";
1792 end temperature;
1793
1794 replaceable partial function density "Return density"
1795 extends Modelica.Icons.Function;
1796 input ThermodynamicState state "Thermodynamic state record";
1797 output Density d "Density";
1798 end density;
1799
1800 replaceable partial function specificEnthalpy "Return specific enthalpy"
1801 extends Modelica.Icons.Function;
1802 input ThermodynamicState state "Thermodynamic state record";
1803 output SpecificEnthalpy h "Specific enthalpy";
1804 end specificEnthalpy;
1805
1806 replaceable partial function specificInternalEnergy "Return specific internal energy"
1807 extends Modelica.Icons.Function;
1808 input ThermodynamicState state "Thermodynamic state record";
1809 output SpecificEnergy u "Specific internal energy";
1810 end specificInternalEnergy;
1811
1812 replaceable partial function specificEntropy "Return specific entropy"
1813 extends Modelica.Icons.Function;
1814 input ThermodynamicState state "Thermodynamic state record";
1815 output SpecificEntropy s "Specific entropy";
1816 end specificEntropy;
1817
1818 replaceable partial function specificGibbsEnergy "Return specific Gibbs energy"
1819 extends Modelica.Icons.Function;
1820 input ThermodynamicState state "Thermodynamic state record";
1821 output SpecificEnergy g "Specific Gibbs energy";
1822 end specificGibbsEnergy;
1823
1824 replaceable partial function specificHelmholtzEnergy "Return specific Helmholtz energy"
1825 extends Modelica.Icons.Function;
1826 input ThermodynamicState state "Thermodynamic state record";
1827 output SpecificEnergy f "Specific Helmholtz energy";
1828 end specificHelmholtzEnergy;
1829
1830 replaceable partial function specificHeatCapacityCp "Return specific heat capacity at constant pressure"
1831 extends Modelica.Icons.Function;
1832 input ThermodynamicState state "Thermodynamic state record";
1833 output SpecificHeatCapacity cp "Specific heat capacity at constant pressure";
1834 end specificHeatCapacityCp;
1835
1836 replaceable partial function specificHeatCapacityCv "Return specific heat capacity at constant volume"
1837 extends Modelica.Icons.Function;
1838 input ThermodynamicState state "Thermodynamic state record";
1839 output SpecificHeatCapacity cv "Specific heat capacity at constant volume";
1840 end specificHeatCapacityCv;
1841
1842 replaceable partial function isentropicExponent "Return isentropic exponent"
1843 extends Modelica.Icons.Function;
1844 input ThermodynamicState state "Thermodynamic state record";
1845 output IsentropicExponent gamma "Isentropic exponent";
1846 end isentropicExponent;
1847
1848 replaceable partial function isentropicEnthalpy "Return isentropic enthalpy"
1849 extends Modelica.Icons.Function;
1850 input AbsolutePressure p_downstream "Downstream pressure";
1851 input ThermodynamicState refState "Reference state for entropy";
1852 output SpecificEnthalpy h_is "Isentropic enthalpy";
1853 annotation(Documentation(info = "<html>
1854 <p>
1855 This function computes an isentropic state transformation:
1856 </p>
1857 <ol>
1858 <li> A medium is in a particular state, refState.</li>
1859 <li> The enthalpy at another state (h_is) shall be computed
1860 under the assumption that the state transformation from refState to h_is
1861 is performed with a change of specific entropy ds = 0 and the pressure of state h_is
1862 is p_downstream and the composition X upstream and downstream is assumed to be the same.</li>
1863 </ol>
1864
1865 </html>"));
1866 end isentropicEnthalpy;
1867
1868 replaceable partial function velocityOfSound "Return velocity of sound"
1869 extends Modelica.Icons.Function;
1870 input ThermodynamicState state "Thermodynamic state record";
1871 output VelocityOfSound a "Velocity of sound";
1872 end velocityOfSound;
1873
1874 replaceable partial function isobaricExpansionCoefficient "Return overall the isobaric expansion coefficient beta"
1875 extends Modelica.Icons.Function;
1876 input ThermodynamicState state "Thermodynamic state record";
1877 output IsobaricExpansionCoefficient beta "Isobaric expansion coefficient";
1878 annotation(Documentation(info = "<html>
1879 <pre>
1880 beta is defined as 1/v * der(v,T), with v = 1/d, at constant pressure p.
1881 </pre>
1882 </html>"));
1883 end isobaricExpansionCoefficient;
1884
1885 replaceable partial function isothermalCompressibility "Return overall the isothermal compressibility factor"
1886 extends Modelica.Icons.Function;
1887 input ThermodynamicState state "Thermodynamic state record";
1888 output .Modelica.SIunits.IsothermalCompressibility kappa "Isothermal compressibility";
1889 annotation(Documentation(info = "<html>
1890 <pre>
1891
1892 kappa is defined as - 1/v * der(v,p), with v = 1/d at constant temperature T.
1893
1894 </pre>
1895 </html>"));
1896 end isothermalCompressibility;
1897
1898 replaceable partial function density_derp_T "Return density derivative w.r.t. pressure at const temperature"
1899 extends Modelica.Icons.Function;
1900 input ThermodynamicState state "Thermodynamic state record";
1901 output DerDensityByPressure ddpT "Density derivative w.r.t. pressure";
1902 end density_derp_T;
1903
1904 replaceable partial function density_derT_p "Return density derivative w.r.t. temperature at constant pressure"
1905 extends Modelica.Icons.Function;
1906 input ThermodynamicState state "Thermodynamic state record";
1907 output DerDensityByTemperature ddTp "Density derivative w.r.t. temperature";
1908 end density_derT_p;
1909
1910 replaceable partial function density_derX "Return density derivative w.r.t. mass fraction"
1911 extends Modelica.Icons.Function;
1912 input ThermodynamicState state "Thermodynamic state record";
1913 output Density[nX] dddX "Derivative of density w.r.t. mass fraction";
1914 end density_derX;
1915
1916 replaceable partial function molarMass "Return the molar mass of the medium"
1917 extends Modelica.Icons.Function;
1918 input ThermodynamicState state "Thermodynamic state record";
1919 output MolarMass MM "Mixture molar mass";
1920 end molarMass;
1921
1922 replaceable function specificEnthalpy_pTX "Return specific enthalpy from p, T, and X or Xi"
1923 extends Modelica.Icons.Function;
1924 input AbsolutePressure p "Pressure";
1925 input Temperature T "Temperature";
1926 input MassFraction[:] X = reference_X "Mass fractions";
1927 output SpecificEnthalpy h "Specific enthalpy";
1928 algorithm
1929 h := specificEnthalpy(setState_pTX(p, T, X));
1930 annotation(inverse(T = temperature_phX(p, h, X)));
1931 end specificEnthalpy_pTX;
1932
1933 type MassFlowRate = .Modelica.SIunits.MassFlowRate(quantity = "MassFlowRate." + mediumName, min = -100000.0, max = 100000.0) "Type for mass flow rate with medium specific attributes";
1934 annotation(Documentation(info = "<html>
1935 <p>
1936 <b>PartialMedium</b> is a package and contains all <b>declarations</b> for
1937 a medium. This means that constants, models, and functions
1938 are defined that every medium is supposed to support
1939 (some of them are optional). A medium package
1940 inherits from <b>PartialMedium</b> and provides the
1941 equations for the medium. The details of this package
1942 are described in
1943 <a href=\"modelica://Modelica.Media.UsersGuide\">Modelica.Media.UsersGuide</a>.
1944 </p>
1945 </html>", revisions = "<html>
1946
1947 </html>"));
1948 end PartialMedium;
1949
1950 partial package PartialPureSubstance "Base class for pure substances of one chemical substance"
1951 extends PartialMedium(final reducedX = true, final fixedX = true);
1952
1953 redeclare replaceable partial model extends BaseProperties end BaseProperties;
1954 end PartialPureSubstance;
1955
1956 partial package PartialSimpleIdealGasMedium "Medium model of Ideal gas with constant cp and cv. All other quantities, e.g., transport properties, are constant."
1957 extends Interfaces.PartialPureSubstance(redeclare replaceable record FluidConstants = Modelica.Media.Interfaces.Types.Basic.FluidConstants, ThermoStates = Choices.IndependentVariables.pT, final singleState = false);
1958 constant SpecificHeatCapacity cp_const "Constant specific heat capacity at constant pressure";
1959 constant SpecificHeatCapacity cv_const = cp_const - R_gas "Constant specific heat capacity at constant volume";
1960 constant SpecificHeatCapacity R_gas "Medium specific gas constant";
1961 constant MolarMass MM_const "Molar mass";
1962 constant DynamicViscosity eta_const "Constant dynamic viscosity";
1963 constant ThermalConductivity lambda_const "Constant thermal conductivity";
1964 constant Temperature T_min "Minimum temperature valid for medium model";
1965 constant Temperature T_max "Maximum temperature valid for medium model";
1966 constant Temperature T0 = reference_T "Zero enthalpy temperature";
1967 constant FluidConstants[nS] fluidConstants "Fluid constants";
1968
1969 redeclare record extends ThermodynamicState "Thermodynamic state of ideal gas"
1970 AbsolutePressure p "Absolute pressure of medium";
1971 Temperature T "Temperature of medium";
1972 end ThermodynamicState;
1973
1974 redeclare replaceable model extends BaseProperties "Base properties of ideal gas"
1975 equation
1976 assert(T >= T_min and T <= T_max, "
1977 Temperature T (= " + String(T) + " K) is not
1978 in the allowed range (" + String(T_min) + " K <= T <= " + String(T_max) + " K)
1979 required from medium model \"" + mediumName + "\".
1980 ");
1981 h = specificEnthalpy_pTX(p, T, X);
1982 u = h - R * T;
1983 R = R_gas;
1984 d = p / (R * T);
1985 MM = MM_const;
1986 state.T = T;
1987 state.p = p;
1988 annotation(Documentation(info = "<HTML>
1989 <p>
1990 This is the most simple incompressible medium model, where
1991 specific enthalpy h and specific internal energy u are only
1992 a function of temperature T and all other provided medium
1993 quantities are assumed to be constant.
1994 </p>
1995 </HTML>"));
1996 end BaseProperties;
1997
1998 redeclare function setState_pTX "Return thermodynamic state from p, T, and X or Xi"
1999 extends Modelica.Icons.Function;
2000 input AbsolutePressure p "Pressure";
2001 input Temperature T "Temperature";
2002 input MassFraction[:] X = reference_X "Mass fractions";
2003 output ThermodynamicState state "Thermodynamic state record";
2004 algorithm
2005 state := ThermodynamicState(p = p, T = T);
2006 end setState_pTX;
2007
2008 redeclare function extends setSmoothState "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b"
2009 algorithm
2010 state := ThermodynamicState(p = Media.Common.smoothStep(x, state_a.p, state_b.p, x_small), T = Media.Common.smoothStep(x, state_a.T, state_b.T, x_small));
2011 end setSmoothState;
2012
2013 redeclare function extends pressure "Return pressure of ideal gas"
2014 algorithm
2015 p := state.p;
2016 end pressure;
2017
2018 redeclare function extends temperature "Return temperature of ideal gas"
2019 algorithm
2020 T := state.T;
2021 end temperature;
2022
2023 redeclare function extends density "Return density of ideal gas"
2024 algorithm
2025 d := state.p / (R_gas * state.T);
2026 end density;
2027
2028 redeclare function extends specificEnthalpy "Return specific enthalpy"
2029 extends Modelica.Icons.Function;
2030 algorithm
2031 h := cp_const * (state.T - T0);
2032 end specificEnthalpy;
2033
2034 redeclare function extends specificInternalEnergy "Return specific internal energy"
2035 extends Modelica.Icons.Function;
2036 algorithm
2037 u := (cp_const - R_gas) * (state.T - T0);
2038 end specificInternalEnergy;
2039
2040 redeclare function extends specificEntropy "Return specific entropy"
2041 extends Modelica.Icons.Function;
2042 algorithm
2043 s := cp_const * Modelica.Math.log(state.T / T0) - R_gas * Modelica.Math.log(state.p / reference_p);
2044 end specificEntropy;
2045
2046 redeclare function extends specificGibbsEnergy "Return specific Gibbs energy"
2047 extends Modelica.Icons.Function;
2048 algorithm
2049 g := cp_const * (state.T - T0) - state.T * specificEntropy(state);
2050 end specificGibbsEnergy;
2051
2052 redeclare function extends specificHelmholtzEnergy "Return specific Helmholtz energy"
2053 extends Modelica.Icons.Function;
2054 algorithm
2055 f := (cp_const - R_gas) * (state.T - T0) - state.T * specificEntropy(state);
2056 end specificHelmholtzEnergy;
2057
2058 redeclare function extends dynamicViscosity "Return dynamic viscosity"
2059 algorithm
2060 eta := eta_const;
2061 end dynamicViscosity;
2062
2063 redeclare function extends thermalConductivity "Return thermal conductivity"
2064 algorithm
2065 lambda := lambda_const;
2066 end thermalConductivity;
2067
2068 redeclare function extends specificHeatCapacityCp "Return specific heat capacity at constant pressure"
2069 algorithm
2070 cp := cp_const;
2071 end specificHeatCapacityCp;
2072
2073 redeclare function extends specificHeatCapacityCv "Return specific heat capacity at constant volume"
2074 algorithm
2075 cv := cv_const;
2076 end specificHeatCapacityCv;
2077
2078 redeclare function extends isentropicExponent "Return isentropic exponent"
2079 algorithm
2080 gamma := cp_const / cv_const;
2081 end isentropicExponent;
2082
2083 redeclare function extends velocityOfSound "Return velocity of sound"
2084 algorithm
2085 a := sqrt(cp_const / cv_const * R_gas * state.T);
2086 end velocityOfSound;
2087
2088 redeclare function specificEnthalpy_pTX "Return specific enthalpy from p, T, and X or Xi"
2089 extends Modelica.Icons.Function;
2090 input AbsolutePressure p "Pressure";
2091 input Temperature T "Temperature";
2092 input MassFraction[nX] X "Mass fractions";
2093 output SpecificEnthalpy h "Specific enthalpy at p, T, X";
2094 algorithm
2095 h := cp_const * (T - T0);
2096 end specificEnthalpy_pTX;
2097
2098 redeclare function extends isentropicEnthalpy "Return isentropic enthalpy"
2099 algorithm
2100 h_is := cp_const * (refState.T * (p_downstream / refState.p) ^ (R_gas / cp_const) - T0);
2101 end isentropicEnthalpy;
2102
2103 redeclare function extends isobaricExpansionCoefficient "Returns overall the isobaric expansion coefficient beta"
2104 algorithm
2105 beta := 1 / state.T;
2106 end isobaricExpansionCoefficient;
2107
2108 redeclare function extends isothermalCompressibility "Returns overall the isothermal compressibility factor"
2109 algorithm
2110 kappa := 1 / state.p;
2111 end isothermalCompressibility;
2112
2113 redeclare function extends density_derp_T "Returns the partial derivative of density with respect to pressure at constant temperature"
2114 algorithm
2115 ddpT := 1 / (R_gas * state.T);
2116 end density_derp_T;
2117
2118 redeclare function extends density_derT_p "Returns the partial derivative of density with respect to temperature at constant pressure"
2119 algorithm
2120 ddTp := -state.p / (R_gas * state.T * state.T);
2121 end density_derT_p;
2122
2123 redeclare function extends density_derX "Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature"
2124 algorithm
2125 dddX := fill(0, nX);
2126 end density_derX;
2127
2128 redeclare function extends molarMass "Returns the molar mass of the medium"
2129 algorithm
2130 MM := MM_const;
2131 end molarMass;
2132 end PartialSimpleIdealGasMedium;
2133
2134 package Choices "Types, constants to define menu choices"
2135 extends Modelica.Icons.Package;
2136 type IndependentVariables = enumeration(T "Temperature", pT "Pressure, Temperature", ph "Pressure, Specific Enthalpy", phX "Pressure, Specific Enthalpy, Mass Fraction", pTX "Pressure, Temperature, Mass Fractions", dTX "Density, Temperature, Mass Fractions") "Enumeration defining the independent variables of a medium";
2137 annotation(Documentation(info = "<html>
2138 <p>
2139 Enumerations and data types for all types of fluids
2140 </p>
2141
2142 <p>
2143 Note: Reference enthalpy might have to be extended with enthalpy of formation.
2144 </p>
2145 </html>"));
2146 end Choices;
2147
2148 package Types "Types to be used in fluid models"
2149 extends Modelica.Icons.Package;
2150 type AbsolutePressure = .Modelica.SIunits.AbsolutePressure(min = 0, max = 100000000.0, nominal = 100000.0, start = 100000.0) "Type for absolute pressure with medium specific attributes";
2151 type Density = .Modelica.SIunits.Density(min = 0, max = 100000.0, nominal = 1, start = 1) "Type for density with medium specific attributes";
2152 type DynamicViscosity = .Modelica.SIunits.DynamicViscosity(min = 0, max = 100000000.0, nominal = 0.001, start = 0.001) "Type for dynamic viscosity with medium specific attributes";
2153 type MassFraction = Real(quantity = "MassFraction", final unit = "kg/kg", min = 0, max = 1, nominal = 0.1) "Type for mass fraction with medium specific attributes";
2154 type MolarMass = .Modelica.SIunits.MolarMass(min = 0.001, max = 0.25, nominal = 0.032) "Type for molar mass with medium specific attributes";
2155 type IsentropicExponent = .Modelica.SIunits.RatioOfSpecificHeatCapacities(min = 1, max = 500000, nominal = 1.2, start = 1.2) "Type for isentropic exponent with medium specific attributes";
2156 type SpecificEnergy = .Modelica.SIunits.SpecificEnergy(min = -100000000.0, max = 100000000.0, nominal = 1000000.0) "Type for specific energy with medium specific attributes";
2157 type SpecificInternalEnergy = SpecificEnergy "Type for specific internal energy with medium specific attributes";
2158 type SpecificEnthalpy = .Modelica.SIunits.SpecificEnthalpy(min = -10000000000.0, max = 10000000000.0, nominal = 1000000.0) "Type for specific enthalpy with medium specific attributes";
2159 type SpecificEntropy = .Modelica.SIunits.SpecificEntropy(min = -10000000.0, max = 10000000.0, nominal = 1000.0) "Type for specific entropy with medium specific attributes";
2160 type SpecificHeatCapacity = .Modelica.SIunits.SpecificHeatCapacity(min = 0, max = 10000000.0, nominal = 1000.0, start = 1000.0) "Type for specific heat capacity with medium specific attributes";
2161 type Temperature = .Modelica.SIunits.Temperature(min = 1, max = 10000.0, nominal = 300, start = 300) "Type for temperature with medium specific attributes";
2162 type ThermalConductivity = .Modelica.SIunits.ThermalConductivity(min = 0, max = 500, nominal = 1, start = 1) "Type for thermal conductivity with medium specific attributes";
2163 type VelocityOfSound = .Modelica.SIunits.Velocity(min = 0, max = 100000.0, nominal = 1000, start = 1000) "Type for velocity of sound with medium specific attributes";
2164 type ExtraProperty = Real(min = 0.0, start = 1.0) "Type for unspecified, mass-specific property transported by flow";
2165 type IsobaricExpansionCoefficient = Real(min = 0, max = 100000000.0, unit = "1/K") "Type for isobaric expansion coefficient with medium specific attributes";
2166 type DerDensityByPressure = .Modelica.SIunits.DerDensityByPressure "Type for partial derivative of density with respect to pressure with medium specific attributes";
2167 type DerDensityByTemperature = .Modelica.SIunits.DerDensityByTemperature "Type for partial derivative of density with respect to temperature with medium specific attributes";
2168
2169 package Basic "The most basic version of a record used in several degrees of detail"
2170 extends Icons.Package;
2171
2172 record FluidConstants "Critical, triple, molecular and other standard data of fluid"
2173 extends Modelica.Icons.Record;
2174 String iupacName "Complete IUPAC name (or common name, if non-existent)";
2175 String casRegistryNumber "Chemical abstracts sequencing number (if it exists)";
2176 String chemicalFormula "Chemical formula, (brutto, nomenclature according to Hill";
2177 String structureFormula "Chemical structure formula";
2178 MolarMass molarMass "Molar mass";
2179 end FluidConstants;
2180 end Basic;
2181 end Types;
2182 annotation(Documentation(info = "<HTML>
2183 <p>
2184 This package provides basic interfaces definitions of media models for different
2185 kind of media.
2186 </p>
2187 </HTML>"));
2188 end Interfaces;
2189
2190 package Common "Data structures and fundamental functions for fluid properties"
2191 extends Modelica.Icons.Package;
2192 constant Real MINPOS = 1e-009 "Minimal value for physical variables which are always > 0.0";
2193
2194 function smoothStep "Approximation of a general step, such that the characteristic is continuous and differentiable"
2195 extends Modelica.Icons.Function;
2196 input Real x "Abscissa value";
2197 input Real y1 "Ordinate value for x > 0";
2198 input Real y2 "Ordinate value for x < 0";
2199 input Real x_small(min = 0) = 1e-005 "Approximation of step for -x_small <= x <= x_small; x_small > 0 required";
2200 output Real y "Ordinate value to approximate y = if x > 0 then y1 else y2";
2201 algorithm
2202 y := smooth(1, if x > x_small then y1 else if x < -x_small then y2 else if abs(x_small) > 0 then x / x_small * ((x / x_small) ^ 2 - 3) * (y2 - y1) / 4 + (y1 + y2) / 2 else (y1 + y2) / 2);
2203 annotation(Inline = true, smoothOrder = 1, Documentation(revisions = "<html>
2204 <ul>
2205 <li><i>April 29, 2008</i>
2206 by <a href=\"mailto:Martin.Otter@DLR.de\">Martin Otter</a>:<br>
2207 Designed and implemented.</li>
2208 <li><i>August 12, 2008</i>
2209 by <a href=\"mailto:Michael.Sielemann@dlr.de\">Michael Sielemann</a>:<br>
2210 Minor modification to cover the limit case <code>x_small -> 0</code> without division by zero.</li>
2211 </ul>
2212 </html>", info = "<html>
2213 <p>
2214 This function is used to approximate the equation
2215 </p>
2216 <pre>
2217 y = <b>if</b> x &gt; 0 <b>then</b> y1 <b>else</b> y2;
2218 </pre>
2219
2220 <p>
2221 by a smooth characteristic, so that the expression is continuous and differentiable:
2222 </p>
2223
2224 <pre>
2225 y = <b>smooth</b>(1, <b>if</b> x &gt; x_small <b>then</b> y1 <b>else</b>
2226 <b>if</b> x &lt; -x_small <b>then</b> y2 <b>else</b> f(y1, y2));
2227 </pre>
2228
2229 <p>
2230 In the region -x_small &lt; x &lt; x_small a 2nd order polynomial is used
2231 for a smooth transition from y1 to y2.
2232 </p>
2233
2234 <p>
2235 If <b>mass fractions</b> X[:] are approximated with this function then this can be performed
2236 for all <b>nX</b> mass fractions, instead of applying it for nX-1 mass fractions and computing
2237 the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the
2238 property that sum(X) = 1, provided sum(X_a) = sum(X_b) = 1
2239 (and y1=X_a[i], y2=X_b[i]).
2240 This can be shown by evaluating the approximating function in the abs(x) &lt; x_small
2241 region (otherwise X is either X_a or X_b):
2242 </p>
2243
2244 <pre>
2245 X[1] = smoothStep(x, X_a[1] , X_b[1] , x_small);
2246 X[2] = smoothStep(x, X_a[2] , X_b[2] , x_small);
2247 ...
2248 X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);
2249 </pre>
2250
2251 <p>
2252 or
2253 </p>
2254
2255 <pre>
2256 X[1] = c*(X_a[1] - X_b[1]) + (X_a[1] + X_b[1])/2
2257 X[2] = c*(X_a[2] - X_b[2]) + (X_a[2] + X_b[2])/2;
2258 ...
2259 X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2;
2260 c = (x/x_small)*((x/x_small)^2 - 3)/4
2261 </pre>
2262
2263 <p>
2264 Summing all mass fractions together results in
2265 </p>
2266
2267 <pre>
2268 sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2
2269 = c*(1 - 1) + (1 + 1)/2
2270 = 1
2271 </pre>
2272 </html>"));
2273 end smoothStep;
2274 annotation(Documentation(info = "<HTML><h4>Package description</h4>
2275 <p>Package Modelica.Media.Common provides records and functions shared by many of the property sub-packages.
2276 High accuracy fluid property models share a lot of common structure, even if the actual models are different.
2277 Common data structures and computations shared by these property models are collected in this library.
2278 </p>
2279
2280 </html>", revisions = "<html>
2281 <ul>
2282 <li>First implemented: <i>July, 2000</i>
2283 by <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>
2284 for the ThermoFluid Library with help from Jonas Eborn and Falko Jens Wagner
2285 </li>
2286 <li>Code reorganization, enhanced documentation, additional functions: <i>December, 2002</i>
2287 by <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a> and move to Modelica
2288 properties library.</li>
2289 <li>Inclusion into Modelica.Media: September 2003 </li>
2290 </ul>
2291
2292 <address>Author: Hubertus Tummescheit, <br>
2293 Lund University<br>
2294 Department of Automatic Control<br>
2295 Box 118, 22100 Lund, Sweden<br>
2296 email: hubertus@control.lth.se
2297 </address>
2298 </html>"));
2299 end Common;
2300
2301 package Air "Medium models for air"
2302 extends Modelica.Icons.VariantsPackage;
2303
2304 package SimpleAir "Air: Simple dry air model (0..100 degC)"
2305 extends Modelica.Icons.MaterialProperty;
2306 extends Interfaces.PartialSimpleIdealGasMedium(mediumName = "SimpleAir", cp_const = 1005.45, MM_const = 0.0289651159, R_gas = .Modelica.Constants.R / 0.0289651159, eta_const = 1.82e-005, lambda_const = 0.026, T_min = .Modelica.SIunits.Conversions.from_degC(0), T_max = .Modelica.SIunits.Conversions.from_degC(100), fluidConstants = airConstants, Temperature(min = Modelica.SIunits.Conversions.from_degC(0), max = Modelica.SIunits.Conversions.from_degC(100)));
2307 constant Modelica.Media.Interfaces.Types.Basic.FluidConstants[nS] airConstants = {Modelica.Media.Interfaces.Types.Basic.FluidConstants(iupacName = "simple air", casRegistryNumber = "not a real substance", chemicalFormula = "N2, O2", structureFormula = "N2, O2", molarMass = Modelica.Media.IdealGases.Common.SingleGasesData.N2.MM)} "Constant data for the fluid";
2308 annotation(Documentation(info = "<html>
2309 <h4>Simple Ideal gas air model for low temperatures</h4>
2310 <p>This model demonstrates how to use the PartialSimpleIdealGas base class to build a
2311 simple ideal gas model with a limited temperature validity range.</p>
2312 </html>"));
2313 end SimpleAir;
2314 annotation(Documentation(info = "<html>
2315 <p>This package contains different medium models for air:</p>
2316 <ul>
2317 <li><b>SimpleAir</b><br>
2318 Simple dry air medium in a limited temperature range.</li>
2319 <li><b>DryAirNasa</b><br>
2320 Dry air as an ideal gas from Media.IdealGases.MixtureGases.Air.</li>
2321 <li><b>MoistAir</b><br>
2322 Moist air as an ideal gas mixture of steam and dry air with fog below and above the triple point temperature.</li>
2323 </ul>
2324 </html>"));
2325 end Air;
2326
2327 package IdealGases "Data and models of ideal gases (single, fixed and dynamic mixtures) from NASA source"
2328 extends Modelica.Icons.VariantsPackage;
2329
2330 package Common "Common packages and data for the ideal gas models"
2331 extends Modelica.Icons.Package;
2332
2333 record DataRecord "Coefficient data record for properties of ideal gases based on NASA source"
2334 extends Modelica.Icons.Record;
2335 String name "Name of ideal gas";
2336 .Modelica.SIunits.MolarMass MM "Molar mass";
2337 .Modelica.SIunits.SpecificEnthalpy Hf "Enthalpy of formation at 298.15K";
2338 .Modelica.SIunits.SpecificEnthalpy H0 "H0(298.15K) - H0(0K)";
2339 .Modelica.SIunits.Temperature Tlimit "Temperature limit between low and high data sets";
2340 Real[7] alow "Low temperature coefficients a";
2341 Real[2] blow "Low temperature constants b";
2342 Real[7] ahigh "High temperature coefficients a";
2343 Real[2] bhigh "High temperature constants b";
2344 .Modelica.SIunits.SpecificHeatCapacity R "Gas constant";
2345 annotation(Documentation(info = "<HTML>
2346 <p>
2347 This data record contains the coefficients for the
2348 ideal gas equations according to:
2349 </p>
2350 <blockquote>
2351 <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
2352 for Calculating Thermodynamic Properties of Individual Species</b>. NASA
2353 report TP-2002-211556</p>
2354 </blockquote>
2355 <p>
2356 The equations have the following structure:
2357 </p>
2358 <IMG src=\"modelica://Modelica/Resources/Images/Media/IdealGases/singleEquations.png\">
2359 <p>
2360 The polynomials for h(T) and s0(T) are derived via integration from the one for cp(T) and contain the integration constants b1, b2 that define the reference specific enthalpy and entropy. For entropy differences the reference pressure p0 is arbitrary, but not for absolute entropies. It is chosen as 1 standard atmosphere (101325 Pa).
2361 </p>
2362 <p>
2363 For most gases, the region of validity is from 200 K to 6000 K.
2364 The equations are split into two regions that are separated
2365 by Tlimit (usually 1000 K). In both regions the gas is described
2366 by the data above. The two branches are continuous and in most
2367 gases also differentiable at Tlimit.
2368 </p>
2369 </HTML>"));
2370 end DataRecord;
2371
2372 package SingleGasesData "Ideal gas data based on the NASA Glenn coefficients"
2373 extends Modelica.Icons.Package;
2374 constant IdealGases.Common.DataRecord N2(name = "N2", MM = 0.0280134, Hf = 0, H0 = 309498.4543111511, Tlimit = 1000, alow = {22103.71497, -381.846182, 6.08273836, -0.00853091441, 1.384646189e-005, -9.62579362e-009, 2.519705809e-012}, blow = {710.846086, -10.76003744}, ahigh = {587712.406, -2239.249073, 6.06694922, -0.00061396855, 1.491806679e-007, -1.923105485e-011, 1.061954386e-015}, bhigh = {12832.10415, -15.86640027}, R = 296.8033869505308);
2375 annotation(Documentation(info = "<HTML>
2376 <p>This package contains ideal gas models for the 1241 ideal gases from</p>
2377 <blockquote>
2378 <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
2379 for Calculating Thermodynamic Properties of Individual Species</b>. NASA
2380 report TP-2002-211556</p>
2381 </blockquote>
2382
2383 <pre>
2384 Ag BaOH+ C2H4O_ethylen_o DF In2I4 Nb ScO2
2385 Ag+ Ba_OH_2 CH3CHO_ethanal DOCl In2I6 Nb+ Sc2O
2386 Ag- BaS CH3COOH DO2 In2O Nb- Sc2O2
2387 Air Ba2 OHCH2COOH DO2- K NbCl5 Si
2388 Al Be C2H5 D2 K+ NbO Si+
2389 Al+ Be+ C2H5Br D2+ K- NbOCl3 Si-
2390 Al- Be++ C2H6 D2- KAlF4 NbO2 SiBr
2391 AlBr BeBr CH3N2CH3 D2O KBO2 Ne SiBr2
2392 AlBr2 BeBr2 C2H5OH D2O2 KBr Ne+ SiBr3
2393 AlBr3 BeCl CH3OCH3 D2S KCN Ni SiBr4
2394 AlC BeCl2 CH3O2CH3 e- KCl Ni+ SiC
2395 AlC2 BeF CCN F KF Ni- SiC2
2396 AlCl BeF2 CNC F+ KH NiCl SiCl
2397 AlCl+ BeH OCCN F- KI NiCl2 SiCl2
2398 AlCl2 BeH+ C2N2 FCN Kli NiO SiCl3
2399 AlCl3 BeH2 C2O FCO KNO2 NiS SiCl4
2400 AlF BeI C3 FO KNO3 O SiF
2401 AlF+ BeI2 C3H3_1_propynl FO2_FOO KNa O+ SiFCl
2402 AlFCl BeN C3H3_2_propynl FO2_OFO KO O- SiF2
2403 AlFCl2 BeO C3H4_allene F2 KOH OD SiF3
2404 AlF2 BeOH C3H4_propyne F2O K2 OD- SiF4
2405 AlF2- BeOH+ C3H4_cyclo F2O2 K2+ OH SiH
2406 AlF2Cl Be_OH_2 C3H5_allyl FS2F K2Br2 OH+ SiH+
2407 AlF3 BeS C3H6_propylene Fe K2CO3 OH- SiHBr3
2408 AlF4- Be2 C3H6_cyclo Fe+ K2C2N2 O2 SiHCl
2409 AlH Be2Cl4 C3H6O_propylox Fe_CO_5 K2Cl2 O2+ SiHCl3
2410 AlHCl Be2F4 C3H6O_acetone FeCl K2F2 O2- SiHF
2411 AlHCl2 Be2O C3H6O_propanal FeCl2 K2I2 O3 SiHF3
2412 AlHF Be2OF2 C3H7_n_propyl FeCl3 K2O P SiHI3
2413 AlHFCl Be2O2 C3H7_i_propyl FeO K2O+ P+ SiH2
2414 AlHF2 Be3O3 C3H8 Fe_OH_2 K2O2 P- SiH2Br2
2415 AlH2 Be4O4 C3H8O_1propanol Fe2Cl4 K2O2H2 PCl SiH2Cl2
2416 AlH2Cl Br C3H8O_2propanol Fe2Cl6 K2SO4 PCl2 SiH2F2
2417 AlH2F Br+ CNCOCN Ga Kr PCl2- SiH2I2
2418 AlH3 Br- C3O2 Ga+ Kr+ PCl3 SiH3
2419 AlI BrCl C4 GaBr li PCl5 SiH3Br
2420 AlI2 BrF C4H2_butadiyne GaBr2 li+ PF SiH3Cl
2421 AlI3 BrF3 C4H4_1_3-cyclo GaBr3 li- PF+ SiH3F
2422 AlN BrF5 C4H6_butadiene GaCl liAlF4 PF- SiH3I
2423 AlO BrO C4H6_1butyne GaCl2 liBO2 PFCl SiH4
2424 AlO+ OBrO C4H6_2butyne GaCl3 liBr PFCl- SiI
2425 AlO- BrOO C4H6_cyclo GaF liCl PFCl2 SiI2
2426 AlOCl BrO3 C4H8_1_butene GaF2 liF PFCl4 SiN
2427 AlOCl2 Br2 C4H8_cis2_buten GaF3 liH PF2 SiO
2428 AlOF BrBrO C4H8_isobutene GaH liI PF2- SiO2
2429 AlOF2 BrOBr C4H8_cyclo GaI liN PF2Cl SiS
2430 AlOF2- C C4H9_n_butyl GaI2 liNO2 PF2Cl3 SiS2
2431 AlOH C+ C4H9_i_butyl GaI3 liNO3 PF3 Si2
2432 AlOHCl C- C4H9_s_butyl GaO liO PF3Cl2 Si2C
2433 AlOHCl2 CBr C4H9_t_butyl GaOH liOF PF4Cl Si2F6
2434 AlOHF CBr2 C4H10_n_butane Ga2Br2 liOH PF5 Si2N
2435 AlOHF2 CBr3 C4H10_isobutane Ga2Br4 liON PH Si3
2436 AlO2 CBr4 C4N2 Ga2Br6 li2 PH2 Sn
2437 AlO2- CCl C5 Ga2Cl2 li2+ PH2- Sn+
2438 Al_OH_2 CCl2 C5H6_1_3cyclo Ga2Cl4 li2Br2 PH3 Sn-
2439 Al_OH_2Cl CCl2Br2 C5H8_cyclo Ga2Cl6 li2F2 PN SnBr
2440 Al_OH_2F CCl3 C5H10_1_pentene Ga2F2 li2I2 PO SnBr2
2441 Al_OH_3 CCl3Br C5H10_cyclo Ga2F4 li2O PO- SnBr3
2442 AlS CCl4 C5H11_pentyl Ga2F6 li2O+ POCl3 SnBr4
2443 AlS2 CF C5H11_t_pentyl Ga2I2 li2O2 POFCl2 SnCl
2444 Al2 CF+ C5H12_n_pentane Ga2I4 li2O2H2 POF2Cl SnCl2
2445 Al2Br6 CFBr3 C5H12_i_pentane Ga2I6 li2SO4 POF3 SnCl3
2446 Al2C2 CFCl CH3C_CH3_2CH3 Ga2O li3+ PO2 SnCl4
2447 Al2Cl6 CFClBr2 C6D5_phenyl Ge li3Br3 PO2- SnF
2448 Al2F6 CFCl2 C6D6 Ge+ li3Cl3 PS SnF2
2449 Al2I6 CFCl2Br C6H2 Ge- li3F3 P2 SnF3
2450 Al2O CFCl3 C6H5_phenyl GeBr li3I3 P2O3 SnF4
2451 Al2O+ CF2 C6H5O_phenoxy GeBr2 Mg P2O4 SnI
2452 Al2O2 CF2+ C6H6 GeBr3 Mg+ P2O5 SnI2
2453 Al2O2+ CF2Br2 C6H5OH_phenol GeBr4 MgBr P3 SnI3
2454 Al2O3 CF2Cl C6H10_cyclo GeCl MgBr2 P3O6 SnI4
2455 Al2S CF2ClBr C6H12_1_hexene GeCl2 MgCl P4 SnO
2456 Al2S2 CF2Cl2 C6H12_cyclo GeCl3 MgCl+ P4O6 SnO2
2457 Ar CF3 C6H13_n_hexyl GeCl4 MgCl2 P4O7 SnS
2458 Ar+ CF3+ C6H14_n_hexane GeF MgF P4O8 SnS2
2459 B CF3Br C7H7_benzyl GeF2 MgF+ P4O9 Sn2
2460 B+ CF3Cl C7H8 GeF3 MgF2 P4O10 Sr
2461 B- CF4 C7H8O_cresol_mx GeF4 MgF2+ Pb Sr+
2462 BBr CH+ C7H14_1_heptene GeH4 MgH Pb+ SrBr
2463 BBr2 CHBr3 C7H15_n_heptyl GeI MgI Pb- SrBr2
2464 BBr3 CHCl C7H16_n_heptane GeO MgI2 PbBr SrCl
2465 BC CHClBr2 C7H16_2_methylh GeO2 MgN PbBr2 SrCl+
2466 BC2 CHCl2 C8H8_styrene GeS MgO PbBr3 SrCl2
2467 BCl CHCl2Br C8H10_ethylbenz GeS2 MgOH PbBr4 SrF
2468 BCl+ CHCl3 C8H16_1_octene Ge2 MgOH+ PbCl SrF+
2469 BClOH CHF C8H17_n_octyl H Mg_OH_2 PbCl2 SrF2
2470 BCl_OH_2 CHFBr2 C8H18_n_octane H+ MgS PbCl3 SrH
2471 BCl2 CHFCl C8H18_isooctane H- Mg2 PbCl4 SrI
2472 BCl2+ CHFClBr C9H19_n_nonyl HAlO Mg2F4 PbF SrI2
2473 BCl2OH CHFCl2 C10H8_naphthale HAlO2 Mn PbF2 SrO
2474 BF CHF2 C10H21_n_decyl HBO Mn+ PbF3 SrOH
2475 BFCl CHF2Br C12H9_o_bipheny HBO+ Mo PbF4 SrOH+
2476 BFCl2 CHF2Cl C12H10_biphenyl HBO2 Mo+ PbI Sr_OH_2
2477 BFOH CHF3 Ca HBS Mo- PbI2 SrS
2478 BF_OH_2 CHI3 Ca+ HBS+ MoO PbI3 Sr2
2479 BF2 CH2 CaBr HCN MoO2 PbI4 Ta
2480 BF2+ CH2Br2 CaBr2 HCO MoO3 PbO Ta+
2481 BF2- CH2Cl CaCl HCO+ MoO3- PbO2 Ta-
2482 BF2Cl CH2ClBr CaCl+ HCCN Mo2O6 PbS TaCl5
2483 BF2OH CH2Cl2 CaCl2 HCCO Mo3O9 PbS2 TaO
2484 BF3 CH2F CaF HCl Mo4O12 Rb TaO2
2485 BF4- CH2FBr CaF+ HD Mo5O15 Rb+ Ti
2486 BH CH2FCl CaF2 HD+ N Rb- Ti+
2487 BHCl CH2F2 CaH HDO N+ RbBO2 Ti-
2488 BHCl2 CH2I2 CaI HDO2 N- RbBr TiCl
2489 BHF CH3 CaI2 HF NCO RbCl TiCl2
2490 BHFCl CH3Br CaO HI ND RbF TiCl3
2491 BHF2 CH3Cl CaO+ HNC ND2 RbH TiCl4
2492 BH2 CH3F CaOH HNCO ND3 RbI TiO
2493 BH2Cl CH3I CaOH+ HNO NF RbK TiO+
2494 BH2F CH2OH Ca_OH_2 HNO2 NF2 Rbli TiOCl
2495 BH3 CH2OH+ CaS HNO3 NF3 RbNO2 TiOCl2
2496 BH3NH3 CH3O Ca2 HOCl NH RbNO3 TiO2
2497 BH4 CH4 Cd HOF NH+ RbNa U
2498 BI CH3OH Cd+ HO2 NHF RbO UF
2499 BI2 CH3OOH Cl HO2- NHF2 RbOH UF+
2500 BI3 CI Cl+ HPO NH2 Rb2Br2 UF-
2501 BN CI2 Cl- HSO3F NH2F Rb2Cl2 UF2
2502 BO CI3 ClCN H2 NH3 Rb2F2 UF2+
2503 BO- CI4 ClF H2+ NH2OH Rb2I2 UF2-
2504 BOCl CN ClF3 H2- NH4+ Rb2O UF3
2505 BOCl2 CN+ ClF5 HBOH NO Rb2O2 UF3+
2506 BOF CN- ClO HCOOH NOCl Rb2O2H2 UF3-
2507 BOF2 CNN ClO2 H2F2 NOF Rb2SO4 UF4
2508 BOH CO Cl2 H2O NOF3 Rn UF4+
2509 BO2 CO+ Cl2O H2O+ NO2 Rn+ UF4-
2510 BO2- COCl Co H2O2 NO2- S UF5
2511 B_OH_2 COCl2 Co+ H2S NO2Cl S+ UF5+
2512 BS COFCl Co- H2SO4 NO2F S- UF5-
2513 BS2 COF2 Cr H2BOH NO3 SCl UF6
2514 B2 COHCl Cr+ HB_OH_2 NO3- SCl2 UF6-
2515 B2C COHF Cr- H3BO3 NO3F SCl2+ UO
2516 B2Cl4 COS CrN H3B3O3 N2 SD UO+
2517 B2F4 CO2 CrO H3B3O6 N2+ SF UOF
2518 B2H CO2+ CrO2 H3F3 N2- SF+ UOF2
2519 B2H2 COOH CrO3 H3O+ NCN SF- UOF3
2520 B2H3 CP CrO3- H4F4 N2D2_cis SF2 UOF4
2521 B2H3_db CS Cs H5F5 N2F2 SF2+ UO2
2522 B2H4 CS2 Cs+ H6F6 N2F4 SF2- UO2+
2523 B2H4_db C2 Cs- H7F7 N2H2 SF3 UO2-
2524 B2H5 C2+ CsBO2 He NH2NO2 SF3+ UO2F
2525 B2H5_db C2- CsBr He+ N2H4 SF3- UO2F2
2526 B2H6 C2Cl CsCl Hg N2O SF4 UO3
2527 B2O C2Cl2 CsF Hg+ N2O+ SF4+ UO3-
2528 B2O2 C2Cl3 CsH HgBr2 N2O3 SF4- V
2529 B2O3 C2Cl4 CsI I N2O4 SF5 V+
2530 B2_OH_4 C2Cl6 Csli I+ N2O5 SF5+ V-
2531 B2S C2F CsNO2 I- N3 SF5- VCl4
2532 B2S2 C2FCl CsNO3 IF5 N3H SF6 VN
2533 B2S3 C2FCl3 CsNa IF7 Na SF6- VO
2534 B3H7_C2v C2F2 CsO I2 Na+ SH VO2
2535 B3H7_Cs C2F2Cl2 CsOH In Na- SH- V4O10
2536 B3H9 C2F3 CsRb In+ NaAlF4 SN W
2537 B3N3H6 C2F3Cl Cs2 InBr NaBO2 SO W+
2538 B3O3Cl3 C2F4 Cs2Br2 InBr2 NaBr SO- W-
2539 B3O3FCl2 C2F6 Cs2CO3 InBr3 NaCN SOF2 WCl6
2540 B3O3F2Cl C2H Cs2Cl2 InCl NaCl SO2 WO
2541 B3O3F3 C2HCl Cs2F2 InCl2 NaF SO2- WOCl4
2542 B4H4 C2HCl3 Cs2I2 InCl3 NaH SO2Cl2 WO2
2543 B4H10 C2HF Cs2O InF NaI SO2FCl WO2Cl2
2544 B4H12 C2HFCl2 Cs2O+ InF2 Nali SO2F2 WO3
2545 B5H9 C2HF2Cl Cs2O2 InF3 NaNO2 SO3 WO3-
2546 Ba C2HF3 Cs2O2H2 InH NaNO3 S2 Xe
2547 Ba+ C2H2_vinylidene Cs2SO4 InI NaO S2- Xe+
2548 BaBr C2H2Cl2 Cu InI2 NaOH S2Cl2 Zn
2549 BaBr2 C2H2FCl Cu+ InI3 NaOH+ S2F2 Zn+
2550 BaCl C2H2F2 Cu- InO Na2 S2O Zr
2551 BaCl+ CH2CO_ketene CuCl InOH Na2Br2 S3 Zr+
2552 BaCl2 O_CH_2O CuF In2Br2 Na2Cl2 S4 Zr-
2553 BaF HO_CO_2OH CuF2 In2Br4 Na2F2 S5 ZrN
2554 BaF+ C2H3_vinyl CuO In2Br6 Na2I2 S6 ZrO
2555 BaF2 CH2Br-COOH Cu2 In2Cl2 Na2O S7 ZrO+
2556 BaH C2H3Cl Cu3Cl3 In2Cl4 Na2O+ S8 ZrO2
2557 BaI CH2Cl-COOH D In2Cl6 Na2O2 Sc
2558 BaI2 C2H3F D+ In2F2 Na2O2H2 Sc+
2559 BaO CH3CN D- In2F4 Na2SO4 Sc-
2560 BaO+ CH3CO_acetyl DBr In2F6 Na3Cl3 ScO
2561 BaOH C2H4 DCl In2I2 Na3F3 ScO+
2562 </pre>
2563 </HTML>"));
2564 end SingleGasesData;
2565 annotation(Documentation(info = "<html>
2566
2567 </html>"));
2568 end Common;
2569 annotation(Documentation(info = "<HTML>
2570 <p>This package contains data for the 1241 ideal gases from</p>
2571 <blockquote>
2572 <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
2573 for Calculating Thermodynamic Properties of Individual Species</b>. NASA
2574 report TP-2002-211556</p>
2575 </blockquote>
2576 <p>Medium models for some of these gases are available in package
2577 <a href=\"modelica://Modelica.Media.IdealGases.SingleGases\">IdealGases.SingleGases</a>
2578 and some examples for mixtures are available in package <a href=\"modelica://Modelica.Media.IdealGases.MixtureGases\">IdealGases.MixtureGases</a>
2579 </p>
2580 <h4>Using and Adapting Medium Models</h4>
2581 <p>
2582 The data records allow computing the ideal gas specific enthalpy, specific entropy and heat capacity of the substances listed below. From them, even the Gibbs energy and equilibrium constants for reactions can be computed. Critical data that is needed for computing the viscosity and thermal conductivity is not included. In order to add mixtures or single substance medium packages that are
2583 subtypes of
2584 <a href=\"modelica://Modelica.Media.Interfaces.PartialMedium\">Interfaces.PartialMedium</a>
2585 (i.e., can be utilized at all places where PartialMedium is defined),
2586 a few additional steps have to be performed:
2587 </p>
2588 <ol>
2589 <li>
2590 All single gas media need to define a constant instance of record
2591 <a href=\"modelica://Modelica.Media.Interfaces.PartialMedium.FluidConstants\">IdealGases.Common.SingleGasNasa.FluidConstants</a>.
2592 For 37 ideal gases such records are provided in package
2593 <a href=\"modelica://Modelica.Media.IdealGases.Common.FluidData\">IdealGases.Common.FluidData</a>.
2594 For the other gases, such a record instance has to be provided by the user, e.g., by getting
2595 the data from a commercial or public data base. A public source of the needed data is for example the <a href=\"http://webbook.nist.gov/chemistry/\"> NIST Chemistry WebBook</a></li>
2596
2597 <li>When the data is available, and a user has an instance of a
2598 <a href=\"modelica://Modelica.Media.Interfaces.PartialMedium.FluidConstants\">FluidConstants</a> record filled with data, a medium package has to be written. Note that only the dipole moment, the accentric factor and critical data are necessary for the viscosity and thermal conductivity functions.</li>
2599 <li><ul>
2600 <li>For single components, a new package following the pattern in
2601 <a href=\"modelica://Modelica.Media.IdealGases.SingleGases\">IdealGases.SingleGases</a> has to be created, pointing both to a data record for cp and to a user-defined fluidContants record.</li>
2602 <li>For mixtures of several components, a new package following the pattern in
2603 <a href=\"modelica://Modelica.Media.IdealGases.MixtureGases\">IdealGases.MixtureGases</a> has to be created, building an array of data records for cp and an array of (partly) user-defined fluidContants records.</li>
2604 </ul></li>
2605 </ol>
2606 <p>Note that many properties can computed for the full set of 1241 gases listed below, but due to the missing viscosity and thermal conductivity functions, no fully Modelica.Media-compliant media can be defined.</p>
2607 <p>
2608 Data records for heat capacity, specific enthalpy and specific entropy exist for the following substances and ions:
2609 </p>
2610 <pre>
2611 Ag BaOH+ C2H4O_ethylen_o DF In2I4 Nb ScO2
2612 Ag+ Ba_OH_2 CH3CHO_ethanal DOCl In2I6 Nb+ Sc2O
2613 Ag- BaS CH3COOH DO2 In2O Nb- Sc2O2
2614 Air Ba2 OHCH2COOH DO2- K NbCl5 Si
2615 Al Be C2H5 D2 K+ NbO Si+
2616 Al+ Be+ C2H5Br D2+ K- NbOCl3 Si-
2617 Al- Be++ C2H6 D2- KAlF4 NbO2 SiBr
2618 AlBr BeBr CH3N2CH3 D2O KBO2 Ne SiBr2
2619 AlBr2 BeBr2 C2H5OH D2O2 KBr Ne+ SiBr3
2620 AlBr3 BeCl CH3OCH3 D2S KCN Ni SiBr4
2621 AlC BeCl2 CH3O2CH3 e- KCl Ni+ SiC
2622 AlC2 BeF CCN F KF Ni- SiC2
2623 AlCl BeF2 CNC F+ KH NiCl SiCl
2624 AlCl+ BeH OCCN F- KI NiCl2 SiCl2
2625 AlCl2 BeH+ C2N2 FCN Kli NiO SiCl3
2626 AlCl3 BeH2 C2O FCO KNO2 NiS SiCl4
2627 AlF BeI C3 FO KNO3 O SiF
2628 AlF+ BeI2 C3H3_1_propynl FO2_FOO KNa O+ SiFCl
2629 AlFCl BeN C3H3_2_propynl FO2_OFO KO O- SiF2
2630 AlFCl2 BeO C3H4_allene F2 KOH OD SiF3
2631 AlF2 BeOH C3H4_propyne F2O K2 OD- SiF4
2632 AlF2- BeOH+ C3H4_cyclo F2O2 K2+ OH SiH
2633 AlF2Cl Be_OH_2 C3H5_allyl FS2F K2Br2 OH+ SiH+
2634 AlF3 BeS C3H6_propylene Fe K2CO3 OH- SiHBr3
2635 AlF4- Be2 C3H6_cyclo Fe+ K2C2N2 O2 SiHCl
2636 AlH Be2Cl4 C3H6O_propylox Fe_CO_5 K2Cl2 O2+ SiHCl3
2637 AlHCl Be2F4 C3H6O_acetone FeCl K2F2 O2- SiHF
2638 AlHCl2 Be2O C3H6O_propanal FeCl2 K2I2 O3 SiHF3
2639 AlHF Be2OF2 C3H7_n_propyl FeCl3 K2O P SiHI3
2640 AlHFCl Be2O2 C3H7_i_propyl FeO K2O+ P+ SiH2
2641 AlHF2 Be3O3 C3H8 Fe_OH_2 K2O2 P- SiH2Br2
2642 AlH2 Be4O4 C3H8O_1propanol Fe2Cl4 K2O2H2 PCl SiH2Cl2
2643 AlH2Cl Br C3H8O_2propanol Fe2Cl6 K2SO4 PCl2 SiH2F2
2644 AlH2F Br+ CNCOCN Ga Kr PCl2- SiH2I2
2645 AlH3 Br- C3O2 Ga+ Kr+ PCl3 SiH3
2646 AlI BrCl C4 GaBr li PCl5 SiH3Br
2647 AlI2 BrF C4H2_butadiyne GaBr2 li+ PF SiH3Cl
2648 AlI3 BrF3 C4H4_1_3-cyclo GaBr3 li- PF+ SiH3F
2649 AlN BrF5 C4H6_butadiene GaCl liAlF4 PF- SiH3I
2650 AlO BrO C4H6_1butyne GaCl2 liBO2 PFCl SiH4
2651 AlO+ OBrO C4H6_2butyne GaCl3 liBr PFCl- SiI
2652 AlO- BrOO C4H6_cyclo GaF liCl PFCl2 SiI2
2653 AlOCl BrO3 C4H8_1_butene GaF2 liF PFCl4 SiN
2654 AlOCl2 Br2 C4H8_cis2_buten GaF3 liH PF2 SiO
2655 AlOF BrBrO C4H8_isobutene GaH liI PF2- SiO2
2656 AlOF2 BrOBr C4H8_cyclo GaI liN PF2Cl SiS
2657 AlOF2- C C4H9_n_butyl GaI2 liNO2 PF2Cl3 SiS2
2658 AlOH C+ C4H9_i_butyl GaI3 liNO3 PF3 Si2
2659 AlOHCl C- C4H9_s_butyl GaO liO PF3Cl2 Si2C
2660 AlOHCl2 CBr C4H9_t_butyl GaOH liOF PF4Cl Si2F6
2661 AlOHF CBr2 C4H10_n_butane Ga2Br2 liOH PF5 Si2N
2662 AlOHF2 CBr3 C4H10_isobutane Ga2Br4 liON PH Si3
2663 AlO2 CBr4 C4N2 Ga2Br6 li2 PH2 Sn
2664 AlO2- CCl C5 Ga2Cl2 li2+ PH2- Sn+
2665 Al_OH_2 CCl2 C5H6_1_3cyclo Ga2Cl4 li2Br2 PH3 Sn-
2666 Al_OH_2Cl CCl2Br2 C5H8_cyclo Ga2Cl6 li2F2 PN SnBr
2667 Al_OH_2F CCl3 C5H10_1_pentene Ga2F2 li2I2 PO SnBr2
2668 Al_OH_3 CCl3Br C5H10_cyclo Ga2F4 li2O PO- SnBr3
2669 AlS CCl4 C5H11_pentyl Ga2F6 li2O+ POCl3 SnBr4
2670 AlS2 CF C5H11_t_pentyl Ga2I2 li2O2 POFCl2 SnCl
2671 Al2 CF+ C5H12_n_pentane Ga2I4 li2O2H2 POF2Cl SnCl2
2672 Al2Br6 CFBr3 C5H12_i_pentane Ga2I6 li2SO4 POF3 SnCl3
2673 Al2C2 CFCl CH3C_CH3_2CH3 Ga2O li3+ PO2 SnCl4
2674 Al2Cl6 CFClBr2 C6D5_phenyl Ge li3Br3 PO2- SnF
2675 Al2F6 CFCl2 C6D6 Ge+ li3Cl3 PS SnF2
2676 Al2I6 CFCl2Br C6H2 Ge- li3F3 P2 SnF3
2677 Al2O CFCl3 C6H5_phenyl GeBr li3I3 P2O3 SnF4
2678 Al2O+ CF2 C6H5O_phenoxy GeBr2 Mg P2O4 SnI
2679 Al2O2 CF2+ C6H6 GeBr3 Mg+ P2O5 SnI2
2680 Al2O2+ CF2Br2 C6H5OH_phenol GeBr4 MgBr P3 SnI3
2681 Al2O3 CF2Cl C6H10_cyclo GeCl MgBr2 P3O6 SnI4
2682 Al2S CF2ClBr C6H12_1_hexene GeCl2 MgCl P4 SnO
2683 Al2S2 CF2Cl2 C6H12_cyclo GeCl3 MgCl+ P4O6 SnO2
2684 Ar CF3 C6H13_n_hexyl GeCl4 MgCl2 P4O7 SnS
2685 Ar+ CF3+ C6H14_n_hexane GeF MgF P4O8 SnS2
2686 B CF3Br C7H7_benzyl GeF2 MgF+ P4O9 Sn2
2687 B+ CF3Cl C7H8 GeF3 MgF2 P4O10 Sr
2688 B- CF4 C7H8O_cresol_mx GeF4 MgF2+ Pb Sr+
2689 BBr CH+ C7H14_1_heptene GeH4 MgH Pb+ SrBr
2690 BBr2 CHBr3 C7H15_n_heptyl GeI MgI Pb- SrBr2
2691 BBr3 CHCl C7H16_n_heptane GeO MgI2 PbBr SrCl
2692 BC CHClBr2 C7H16_2_methylh GeO2 MgN PbBr2 SrCl+
2693 BC2 CHCl2 C8H8_styrene GeS MgO PbBr3 SrCl2
2694 BCl CHCl2Br C8H10_ethylbenz GeS2 MgOH PbBr4 SrF
2695 BCl+ CHCl3 C8H16_1_octene Ge2 MgOH+ PbCl SrF+
2696 BClOH CHF C8H17_n_octyl H Mg_OH_2 PbCl2 SrF2
2697 BCl_OH_2 CHFBr2 C8H18_n_octane H+ MgS PbCl3 SrH
2698 BCl2 CHFCl C8H18_isooctane H- Mg2 PbCl4 SrI
2699 BCl2+ CHFClBr C9H19_n_nonyl HAlO Mg2F4 PbF SrI2
2700 BCl2OH CHFCl2 C10H8_naphthale HAlO2 Mn PbF2 SrO
2701 BF CHF2 C10H21_n_decyl HBO Mn+ PbF3 SrOH
2702 BFCl CHF2Br C12H9_o_bipheny HBO+ Mo PbF4 SrOH+
2703 BFCl2 CHF2Cl C12H10_biphenyl HBO2 Mo+ PbI Sr_OH_2
2704 BFOH CHF3 Ca HBS Mo- PbI2 SrS
2705 BF_OH_2 CHI3 Ca+ HBS+ MoO PbI3 Sr2
2706 BF2 CH2 CaBr HCN MoO2 PbI4 Ta
2707 BF2+ CH2Br2 CaBr2 HCO MoO3 PbO Ta+
2708 BF2- CH2Cl CaCl HCO+ MoO3- PbO2 Ta-
2709 BF2Cl CH2ClBr CaCl+ HCCN Mo2O6 PbS TaCl5
2710 BF2OH CH2Cl2 CaCl2 HCCO Mo3O9 PbS2 TaO
2711 BF3 CH2F CaF HCl Mo4O12 Rb TaO2
2712 BF4- CH2FBr CaF+ HD Mo5O15 Rb+ Ti
2713 BH CH2FCl CaF2 HD+ N Rb- Ti+
2714 BHCl CH2F2 CaH HDO N+ RbBO2 Ti-
2715 BHCl2 CH2I2 CaI HDO2 N- RbBr TiCl
2716 BHF CH3 CaI2 HF NCO RbCl TiCl2
2717 BHFCl CH3Br CaO HI ND RbF TiCl3
2718 BHF2 CH3Cl CaO+ HNC ND2 RbH TiCl4
2719 BH2 CH3F CaOH HNCO ND3 RbI TiO
2720 BH2Cl CH3I CaOH+ HNO NF RbK TiO+
2721 BH2F CH2OH Ca_OH_2 HNO2 NF2 Rbli TiOCl
2722 BH3 CH2OH+ CaS HNO3 NF3 RbNO2 TiOCl2
2723 BH3NH3 CH3O Ca2 HOCl NH RbNO3 TiO2
2724 BH4 CH4 Cd HOF NH+ RbNa U
2725 BI CH3OH Cd+ HO2 NHF RbO UF
2726 BI2 CH3OOH Cl HO2- NHF2 RbOH UF+
2727 BI3 CI Cl+ HPO NH2 Rb2Br2 UF-
2728 BN CI2 Cl- HSO3F NH2F Rb2Cl2 UF2
2729 BO CI3 ClCN H2 NH3 Rb2F2 UF2+
2730 BO- CI4 ClF H2+ NH2OH Rb2I2 UF2-
2731 BOCl CN ClF3 H2- NH4+ Rb2O UF3
2732 BOCl2 CN+ ClF5 HBOH NO Rb2O2 UF3+
2733 BOF CN- ClO HCOOH NOCl Rb2O2H2 UF3-
2734 BOF2 CNN ClO2 H2F2 NOF Rb2SO4 UF4
2735 BOH CO Cl2 H2O NOF3 Rn UF4+
2736 BO2 CO+ Cl2O H2O+ NO2 Rn+ UF4-
2737 BO2- COCl Co H2O2 NO2- S UF5
2738 B_OH_2 COCl2 Co+ H2S NO2Cl S+ UF5+
2739 BS COFCl Co- H2SO4 NO2F S- UF5-
2740 BS2 COF2 Cr H2BOH NO3 SCl UF6
2741 B2 COHCl Cr+ HB_OH_2 NO3- SCl2 UF6-
2742 B2C COHF Cr- H3BO3 NO3F SCl2+ UO
2743 B2Cl4 COS CrN H3B3O3 N2 SD UO+
2744 B2F4 CO2 CrO H3B3O6 N2+ SF UOF
2745 B2H CO2+ CrO2 H3F3 N2- SF+ UOF2
2746 B2H2 COOH CrO3 H3O+ NCN SF- UOF3
2747 B2H3 CP CrO3- H4F4 N2D2_cis SF2 UOF4
2748 B2H3_db CS Cs H5F5 N2F2 SF2+ UO2
2749 B2H4 CS2 Cs+ H6F6 N2F4 SF2- UO2+
2750 B2H4_db C2 Cs- H7F7 N2H2 SF3 UO2-
2751 B2H5 C2+ CsBO2 He NH2NO2 SF3+ UO2F
2752 B2H5_db C2- CsBr He+ N2H4 SF3- UO2F2
2753 B2H6 C2Cl CsCl Hg N2O SF4 UO3
2754 B2O C2Cl2 CsF Hg+ N2O+ SF4+ UO3-
2755 B2O2 C2Cl3 CsH HgBr2 N2O3 SF4- V
2756 B2O3 C2Cl4 CsI I N2O4 SF5 V+
2757 B2_OH_4 C2Cl6 Csli I+ N2O5 SF5+ V-
2758 B2S C2F CsNO2 I- N3 SF5- VCl4
2759 B2S2 C2FCl CsNO3 IF5 N3H SF6 VN
2760 B2S3 C2FCl3 CsNa IF7 Na SF6- VO
2761 B3H7_C2v C2F2 CsO I2 Na+ SH VO2
2762 B3H7_Cs C2F2Cl2 CsOH In Na- SH- V4O10
2763 B3H9 C2F3 CsRb In+ NaAlF4 SN W
2764 B3N3H6 C2F3Cl Cs2 InBr NaBO2 SO W+
2765 B3O3Cl3 C2F4 Cs2Br2 InBr2 NaBr SO- W-
2766 B3O3FCl2 C2F6 Cs2CO3 InBr3 NaCN SOF2 WCl6
2767 B3O3F2Cl C2H Cs2Cl2 InCl NaCl SO2 WO
2768 B3O3F3 C2HCl Cs2F2 InCl2 NaF SO2- WOCl4
2769 B4H4 C2HCl3 Cs2I2 InCl3 NaH SO2Cl2 WO2
2770 B4H10 C2HF Cs2O InF NaI SO2FCl WO2Cl2
2771 B4H12 C2HFCl2 Cs2O+ InF2 Nali SO2F2 WO3
2772 B5H9 C2HF2Cl Cs2O2 InF3 NaNO2 SO3 WO3-
2773 Ba C2HF3 Cs2O2H2 InH NaNO3 S2 Xe
2774 Ba+ C2H2_vinylidene Cs2SO4 InI NaO S2- Xe+
2775 BaBr C2H2Cl2 Cu InI2 NaOH S2Cl2 Zn
2776 BaBr2 C2H2FCl Cu+ InI3 NaOH+ S2F2 Zn+
2777 BaCl C2H2F2 Cu- InO Na2 S2O Zr
2778 BaCl+ CH2CO_ketene CuCl InOH Na2Br2 S3 Zr+
2779 BaCl2 O_CH_2O CuF In2Br2 Na2Cl2 S4 Zr-
2780 BaF HO_CO_2OH CuF2 In2Br4 Na2F2 S5 ZrN
2781 BaF+ C2H3_vinyl CuO In2Br6 Na2I2 S6 ZrO
2782 BaF2 CH2Br-COOH Cu2 In2Cl2 Na2O S7 ZrO+
2783 BaH C2H3Cl Cu3Cl3 In2Cl4 Na2O+ S8 ZrO2
2784 BaI CH2Cl-COOH D In2Cl6 Na2O2 Sc
2785 BaI2 C2H3F D+ In2F2 Na2O2H2 Sc+
2786 BaO CH3CN D- In2F4 Na2SO4 Sc-
2787 BaO+ CH3CO_acetyl DBr In2F6 Na3Cl3 ScO
2788 BaOH C2H4 DCl In2I2 Na3F3 ScO+
2789 </pre></HTML>"));
2790 end IdealGases;
2791 annotation(preferredView = "info", Documentation(info = "<HTML>
2792 <p>
2793 This library contains <a href=\"modelica://Modelica.Media.Interfaces\">interface</a>
2794 definitions for media and the following <b>property</b> models for
2795 single and multiple substance fluids with one and multiple phases:
2796 </p>
2797 <ul>
2798 <li> <a href=\"modelica://Modelica.Media.IdealGases\">Ideal gases:</a><br>
2799 1241 high precision gas models based on the
2800 NASA Glenn coefficients, plus ideal gas mixture models based
2801 on the same data.</li>
2802 <li> <a href=\"modelica://Modelica.Media.Water\">Water models:</a><br>
2803 ConstantPropertyLiquidWater, WaterIF97 (high precision
2804 water model according to the IAPWS/IF97 standard)</li>
2805 <li> <a href=\"modelica://Modelica.Media.Air\">Air models:</a><br>
2806 SimpleAir, DryAirNasa, ReferenceAir, MoistAir, ReferenceMoistAir.</li>
2807 <li> <a href=\"modelica://Modelica.Media.Incompressible\">
2808 Incompressible media:</a><br>
2809 TableBased incompressible fluid models (properties are defined by tables rho(T),
2810 HeatCapacity_cp(T), etc.)</li>
2811 <li> <a href=\"modelica://Modelica.Media.CompressibleLiquids\">
2812 Compressible liquids:</a><br>
2813 Simple liquid models with linear compressibility</li>
2814 <li> <a href=\"modelica://Modelica.Media.R134a\">Refrigerant Tetrafluoroethane (R134a)</a>.</li>
2815 </ul>
2816 <p>
2817 The following parts are useful, when newly starting with this library:
2818 <ul>
2819 <li> <a href=\"modelica://Modelica.Media.UsersGuide\">Modelica.Media.UsersGuide</a>.</li>
2820 <li> <a href=\"modelica://Modelica.Media.UsersGuide.MediumUsage\">Modelica.Media.UsersGuide.MediumUsage</a>
2821 describes how to use a medium model in a component model.</li>
2822 <li> <a href=\"modelica://Modelica.Media.UsersGuide.MediumDefinition\">
2823 Modelica.Media.UsersGuide.MediumDefinition</a>
2824 describes how a new fluid medium model has to be implemented.</li>
2825 <li> <a href=\"modelica://Modelica.Media.UsersGuide.ReleaseNotes\">Modelica.Media.UsersGuide.ReleaseNotes</a>
2826 summarizes the changes of the library releases.</li>
2827 <li> <a href=\"modelica://Modelica.Media.Examples\">Modelica.Media.Examples</a>
2828 contains examples that demonstrate the usage of this library.</li>
2829 </ul>
2830 <p>
2831 Copyright &copy; 1998-2013, Modelica Association.
2832 </p>
2833 <p>
2834 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
2835 </p>
2836 </HTML>", revisions = "<html>
2837 <ul>
2838 <li><i>May 16, 2013</i> by Stefan Wischhusen (XRG Simulation):<br/>
2839 Added new media models Air.ReferenceMoistAir, Air.ReferenceAir, R134a.</li>
2840 <li><i>May 25, 2011</i> by Francesco Casella:<br/>Added min/max attributes to Water, TableBased, MixtureGasNasa, SimpleAir and MoistAir local types.</li>
2841 <li><i>May 25, 2011</i> by Stefan Wischhusen:<br/>Added individual settings for polynomial fittings of properties.</li>
2842 </ul>
2843 </html>"), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-76, -80}, {-62, -30}, {-32, 40}, {4, 66}, {48, 66}, {73, 45}, {62, -8}, {48, -50}, {38, -80}}, color = {64, 64, 64}, smooth = Smooth.Bezier), Line(points = {{-40, 20}, {68, 20}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{-40, 20}, {-44, 88}, {-44, 88}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{68, 20}, {86, -58}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{-60, -28}, {56, -28}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{-60, -28}, {-74, 84}, {-74, 84}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{56, -28}, {70, -80}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{-76, -80}, {38, -80}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{-76, -80}, {-94, -16}, {-94, -16}}, color = {175, 175, 175}, smooth = Smooth.None)}));
2844 end Media;
2845
2846 package Thermal "Library of thermal system components to model heat transfer and simple thermo-fluid pipe flow"
2847 extends Modelica.Icons.Package;
2848
2849 package HeatTransfer "Library of 1-dimensional heat transfer with lumped elements"
2850 extends Modelica.Icons.Package;
2851
2852 package Interfaces "Connectors and partial models"
2853 extends Modelica.Icons.InterfacesPackage;
2854
2855 partial connector HeatPort "Thermal port for 1-dim. heat transfer"
2856 Modelica.SIunits.Temperature T "Port temperature";
2857 flow Modelica.SIunits.HeatFlowRate Q_flow "Heat flow rate (positive if flowing from outside into the component)";
2858 annotation(Documentation(info = "<html>
2859
2860 </html>"));
2861 end HeatPort;
2862
2863 connector HeatPort_a "Thermal port for 1-dim. heat transfer (filled rectangular icon)"
2864 extends HeatPort;
2865 annotation(defaultComponentName = "port_a", Documentation(info = "<HTML>
2866 <p>This connector is used for 1-dimensional heat flow between components.
2867 The variables in the connector are:</p>
2868 <pre>
2869 T Temperature in [Kelvin].
2870 Q_flow Heat flow rate in [Watt].
2871 </pre>
2872 <p>According to the Modelica sign convention, a <b>positive</b> heat flow
2873 rate <b>Q_flow</b> is considered to flow <b>into</b> a component. This
2874 convention has to be used whenever this connector is used in a model
2875 class.</p>
2876 <p>Note, that the two connector classes <b>HeatPort_a</b> and
2877 <b>HeatPort_b</b> are identical with the only exception of the different
2878 <b>icon layout</b>.</p></html>"), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {191, 0, 0}, fillColor = {191, 0, 0}, fillPattern = FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-50, 50}, {50, -50}}, lineColor = {191, 0, 0}, fillColor = {191, 0, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-120, 120}, {100, 60}}, lineColor = {191, 0, 0}, textString = "%name")}));
2879 end HeatPort_a;
2880
2881 partial model PartialElementaryConditionalHeatPortWithoutT "Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models"
2882 parameter Boolean useHeatPort = false "=true, if heatPort is enabled" annotation(Evaluate = true, HideResult = true, choices(checkBox = true));
2883 Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(final Q_flow = -lossPower) if useHeatPort "Optional port to which dissipated losses are transported in form of heat" annotation(Placement(transformation(extent = {{-110, -110}, {-90, -90}}), iconTransformation(extent = {{-110, -110}, {-90, -90}})));
2884 Modelica.SIunits.Power lossPower "Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
2885 annotation(Documentation(info = "<html>
2886 <p>
2887 This partial model provides a conditional heat port for dissipating losses.
2888 </p>
2889 <ul>
2890 <li>If <b>useHeatPort</b> is set to <b>false</b> (default), no heat port is available, and the thermal loss power is dissipated internally.
2891 <li>If <b>useHeatPort</b> is set to <b>true</b>, the heat port is available and must be connected from the outside.</li>
2892 </ul>
2893 <p>
2894 If this model is used, the loss power has to be provided by an equation in the model which inherits from the PartialElementaryConditionalHeatPortWithoutT model
2895 (<b>lossPower = ...</b>).
2896 </p>
2897
2898 <p>
2899 Note, this partial model is used in cases, where heatPort.T (that is the device temperature) is not utilized in the model. If this is desired, inherit instead from partial model
2900 <a href=\"modelica://Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPort\">PartialElementaryConditionalHeatPort</a>.
2901 </p>
2902 </html>"));
2903 end PartialElementaryConditionalHeatPortWithoutT;
2904 annotation(Documentation(info = "<html>
2905
2906 </html>"));
2907 end Interfaces;
2908 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {13.758, 27.517}, lineColor = {128, 128, 128}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{-54, -6}, {-61, -7}, {-75, -15}, {-79, -24}, {-80, -34}, {-78, -42}, {-73, -49}, {-64, -51}, {-57, -51}, {-47, -50}, {-41, -43}, {-38, -35}, {-40, -27}, {-40, -20}, {-42, -13}, {-47, -7}, {-54, -5}, {-54, -6}}), Polygon(origin = {13.758, 27.517}, fillColor = {160, 160, 164}, fillPattern = FillPattern.Solid, points = {{-75, -15}, {-79, -25}, {-80, -34}, {-78, -42}, {-72, -49}, {-64, -51}, {-57, -51}, {-47, -50}, {-57, -47}, {-65, -45}, {-71, -40}, {-74, -33}, {-76, -23}, {-75, -15}, {-75, -15}}), Polygon(origin = {13.758, 27.517}, lineColor = {160, 160, 164}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{39, -6}, {32, -7}, {18, -15}, {14, -24}, {13, -34}, {15, -42}, {20, -49}, {29, -51}, {36, -51}, {46, -50}, {52, -43}, {55, -35}, {53, -27}, {53, -20}, {51, -13}, {46, -7}, {39, -5}, {39, -6}}), Polygon(origin = {13.758, 27.517}, fillColor = {160, 160, 164}, fillPattern = FillPattern.Solid, points = {{18, -15}, {14, -25}, {13, -34}, {15, -42}, {21, -49}, {29, -51}, {36, -51}, {46, -50}, {36, -47}, {28, -45}, {22, -40}, {19, -33}, {17, -23}, {18, -15}, {18, -15}}), Polygon(origin = {13.758, 27.517}, lineColor = {191, 0, 0}, fillColor = {191, 0, 0}, fillPattern = FillPattern.Solid, points = {{-9, -23}, {-9, -10}, {18, -17}, {-9, -23}}), Line(origin = {13.758, 27.517}, points = {{-41, -17}, {-9, -17}}, color = {191, 0, 0}, thickness = 0.5), Line(origin = {13.758, 27.517}, points = {{-17, -40}, {15, -40}}, color = {191, 0, 0}, thickness = 0.5), Polygon(origin = {13.758, 27.517}, lineColor = {191, 0, 0}, fillColor = {191, 0, 0}, fillPattern = FillPattern.Solid, points = {{-17, -46}, {-17, -34}, {-40, -40}, {-17, -46}})}), Documentation(info = "<HTML>
2909 <p>
2910 This package contains components to model <b>1-dimensional heat transfer</b>
2911 with lumped elements. This allows especially to model heat transfer in
2912 machines provided the parameters of the lumped elements, such as
2913 the heat capacity of a part, can be determined by measurements
2914 (due to the complex geometries and many materials used in machines,
2915 calculating the lumped element parameters from some basic analytic
2916 formulas is usually not possible).
2917 </p>
2918 <p>
2919 Example models how to use this library are given in subpackage <b>Examples</b>.<br>
2920 For a first simple example, see <b>Examples.TwoMasses</b> where two masses
2921 with different initial temperatures are getting in contact to each
2922 other and arriving after some time at a common temperature.<br>
2923 <b>Examples.ControlledTemperature</b> shows how to hold a temperature
2924 within desired limits by switching on and off an electric resistor.<br>
2925 A more realistic example is provided in <b>Examples.Motor</b> where the
2926 heating of an electrical motor is modelled, see the following screen shot
2927 of this example:
2928 </p>
2929
2930 <p>
2931 <img src=\"modelica://Modelica/Resources/Images/Thermal/HeatTransfer/driveWithHeatTransfer.png\" ALT=\"driveWithHeatTransfer\">
2932 </p>
2933
2934 <p>
2935 The <b>filled</b> and <b>non-filled red squares</b> at the left and
2936 right side of a component represent <b>thermal ports</b> (connector HeatPort).
2937 Drawing a line between such squares means that they are thermally connected.
2938 The variables of a HeatPort connector are the temperature <b>T</b> at the port
2939 and the heat flow rate <b>Q_flow</b> flowing into the component (if Q_flow is positive,
2940 the heat flows into the element, otherwise it flows out of the element):
2941 </p>
2942 <pre> Modelica.SIunits.Temperature T \"absolute temperature at port in Kelvin\";
2943 Modelica.SIunits.HeatFlowRate Q_flow \"flow rate at the port in Watt\";
2944 </pre>
2945 <p>
2946 Note, that all temperatures of this package, including initial conditions,
2947 are given in Kelvin. For convenience, in subpackages <b>HeatTransfer.Celsius</b>,
2948 <b>HeatTransfer.Fahrenheit</b> and <b>HeatTransfer.Rankine</b> components are provided such that source and
2949 sensor information is available in degree Celsius, degree Fahrenheit, or degree Rankine,
2950 respectively. Additionally, in package <b>SIunits.Conversions</b> conversion
2951 functions between the units Kelvin and Celsius, Fahrenheit, Rankine are
2952 provided. These functions may be used in the following way:
2953 </p>
2954 <pre> <b>import</b> SI=Modelica.SIunits;
2955 <b>import</b> Modelica.SIunits.Conversions.*;
2956 ...
2957 <b>parameter</b> SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin
2958 </pre>
2959
2960 <p>
2961 There are several other components available, such as AxialConduction (discretized PDE in
2962 axial direction), which have been temporarily removed from this library. The reason is that
2963 these components reference material properties, such as thermal conductivity, and currently
2964 the Modelica design group is discussing a general scheme to describe material properties.
2965 </p>
2966 <p>
2967 For technical details in the design of this library, see the following reference:<br>
2968 <b>Michael Tiller (2001)</b>: <a href=\"http://www.amazon.de\">
2969 Introduction to Physical Modeling with Modelica</a>.
2970 Kluwer Academic Publishers Boston.
2971 </p>
2972 <p>
2973 <b>Acknowledgements:</b><br>
2974 Several helpful remarks from the following persons are acknowledged:
2975 John Batteh, Ford Motors, Dearborn, U.S.A;
2976 <a href=\"http://www.haumer.at/\">Anton Haumer</a>, Technical Consulting &amp; Electrical Engineering, Austria;
2977 Ludwig Marvan, VA TECH ELIN EBG Elektronik GmbH, Wien, Austria;
2978 Hans Olsson, Dassault Syst&egrave;mes AB, Sweden;
2979 Hubertus Tummescheit, Lund Institute of Technology, Lund, Sweden.
2980 </p>
2981 <dl>
2982 <dt><b>Main Authors:</b></dt>
2983 <dd>
2984 <p>
2985 <a href=\"http://www.haumer.at/\">Anton Haumer</a><br>
2986 Technical Consulting &amp; Electrical Engineering<br>
2987 A-3423 St.Andrae-Woerdern, Austria<br>
2988 email: <a href=\"mailto:a.haumer@haumer.at\">a.haumer@haumer.at</a>
2989 </p>
2990 </dd>
2991 </dl>
2992 <p><b>Copyright &copy; 2001-2013, Modelica Association, Michael Tiller and DLR.</b></p>
2993
2994 <p>
2995 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
2996 </p>
2997 </html>", revisions = "<html>
2998 <ul>
2999 <li><i>July 15, 2002</i>
3000 by Michael Tiller, <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
3001 and Nikolaus Sch&uuml;rmann:<br>
3002 Implemented.
3003 </li>
3004 <li><i>June 13, 2005</i>
3005 by <a href=\"http://www.haumer.at/\">Anton Haumer</a><br>
3006 Refined placing of connectors (cosmetic).<br>
3007 Refined all Examples; removed Examples.FrequencyInverter, introducing Examples.Motor<br>
3008 Introduced temperature dependent correction (1 + alpha*(T - T_ref)) in Fixed/PrescribedHeatFlow<br>
3009 </li>
3010 <li> v1.1.1 2007/11/13 Anton Haumer<br>
3011 components moved to sub-packages</li>
3012 <li> v1.2.0 2009/08/26 Anton Haumer<br>
3013 added component ThermalCollector</li>
3014
3015 </ul>
3016 </html>"));
3017 end HeatTransfer;
3018 annotation(Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Line(origin = {-47.5, 11.6667}, points = {{-2.5, -91.66670000000001}, {17.5, -71.66670000000001}, {-22.5, -51.6667}, {17.5, -31.6667}, {-22.5, -11.667}, {17.5, 8.333299999999999}, {-2.5, 28.3333}, {-2.5, 48.3333}}, smooth = Smooth.Bezier), Polygon(origin = {-50.0, 68.333}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{0.0, 21.667}, {-10.0, -8.333}, {10.0, -8.333}}), Line(origin = {2.5, 11.6667}, points = {{-2.5, -91.66670000000001}, {17.5, -71.66670000000001}, {-22.5, -51.6667}, {17.5, -31.6667}, {-22.5, -11.667}, {17.5, 8.333299999999999}, {-2.5, 28.3333}, {-2.5, 48.3333}}, smooth = Smooth.Bezier), Polygon(origin = {0.0, 68.333}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{0.0, 21.667}, {-10.0, -8.333}, {10.0, -8.333}}), Line(origin = {52.5, 11.6667}, points = {{-2.5, -91.66670000000001}, {17.5, -71.66670000000001}, {-22.5, -51.6667}, {17.5, -31.6667}, {-22.5, -11.667}, {17.5, 8.333299999999999}, {-2.5, 28.3333}, {-2.5, 48.3333}}, smooth = Smooth.Bezier), Polygon(origin = {50.0, 68.333}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{0.0, 21.667}, {-10.0, -8.333}, {10.0, -8.333}})}), Documentation(info = "<html>
3019 <p>
3020 This package contains libraries to model heat transfer
3021 and fluid heat flow.
3022 </p>
3023 </html>"));
3024 end Thermal;
3025
3026 package Math "Library of mathematical functions (e.g., sin, cos) and of functions operating on vectors and matrices"
3027 extends Modelica.Icons.Package;
3028
3029 package Icons "Icons for Math"
3030 extends Modelica.Icons.IconsPackage;
3031
3032 partial function AxisLeft "Basic icon for mathematical function with y-axis on left side" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-80, 68}}, color = {192, 192, 192}), Polygon(points = {{-80, 90}, {-88, 68}, {-72, 68}, {-80, 90}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Text(extent = {{-150, 150}, {150, 110}}, textString = "%name", lineColor = {0, 0, 255})}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 80}, {-88, 80}}, color = {95, 95, 95}), Line(points = {{-80, -80}, {-88, -80}}, color = {95, 95, 95}), Line(points = {{-80, -90}, {-80, 84}}, color = {95, 95, 95}), Text(extent = {{-75, 104}, {-55, 84}}, lineColor = {95, 95, 95}, textString = "y"), Polygon(points = {{-80, 98}, {-86, 82}, {-74, 82}, {-80, 98}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid)}), Documentation(info = "<html>
3033 <p>
3034 Icon for a mathematical function, consisting of an y-axis on the left side.
3035 It is expected, that an x-axis is added and a plot of the function.
3036 </p>
3037 </html>")); end AxisLeft;
3038
3039 partial function AxisCenter "Basic icon for mathematical function with y-axis in the center" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{0, -80}, {0, 68}}, color = {192, 192, 192}), Polygon(points = {{0, 90}, {-8, 68}, {8, 68}, {0, 90}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Text(extent = {{-150, 150}, {150, 110}}, textString = "%name", lineColor = {0, 0, 255})}), Diagram(graphics = {Line(points = {{0, 80}, {-8, 80}}, color = {95, 95, 95}), Line(points = {{0, -80}, {-8, -80}}, color = {95, 95, 95}), Line(points = {{0, -90}, {0, 84}}, color = {95, 95, 95}), Text(extent = {{5, 104}, {25, 84}}, lineColor = {95, 95, 95}, textString = "y"), Polygon(points = {{0, 98}, {-6, 82}, {6, 82}, {0, 98}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid)}), Documentation(info = "<html>
3040 <p>
3041 Icon for a mathematical function, consisting of an y-axis in the middle.
3042 It is expected, that an x-axis is added and a plot of the function.
3043 </p>
3044 </html>")); end AxisCenter;
3045 end Icons;
3046
3047 package Matrices "Library of functions operating on matrices"
3048 extends Modelica.Icons.Package;
3049
3050 function solve "Solve real system of linear equations A*x=b with a b vector (Gaussian elimination with partial pivoting)"
3051 extends Modelica.Icons.Function;
3052 input Real[:, size(A, 1)] A "Matrix A of A*x = b";
3053 input Real[size(A, 1)] b "Vector b of A*x = b";
3054 output Real[size(b, 1)] x "Vector x such that A*x = b";
3055 protected
3056 Integer info;
3057 algorithm
3058 (x, info) := LAPACK.dgesv_vec(A, b);
3059 assert(info == 0, "Solving a linear system of equations with function
3060 \"Matrices.solve\" is not possible, because the system has either
3061 no or infinitely many solutions (A is singular).");
3062 annotation(Documentation(info = "<HTML>
3063 <h4>Syntax</h4>
3064 <blockquote><pre>
3065 Matrices.<b>solve</b>(A,b);
3066 </pre></blockquote>
3067 <h4>Description</h4>
3068 <p>
3069 This function call returns the
3070 solution <b>x</b> of the linear system of equations
3071 </p>
3072 <blockquote>
3073 <p>
3074 <b>A</b>*<b>x</b> = <b>b</b>
3075 </p>
3076 </blockquote>
3077 <p>
3078 If a unique solution <b>x</b> does not exist (since <b>A</b> is singular),
3079 an assertion is triggered. If this is not desired, use instead
3080 <a href=\"modelica://Modelica.Math.Matrices.leastSquares\">Matrices.leastSquares</a>
3081 and inquire the singularity of the solution with the return argument rank
3082 (a unique solution is computed if rank = size(A,1)).
3083 </p>
3084
3085 <p>
3086 Note, the solution is computed with the LAPACK function \"dgesv\",
3087 i.e., by Gaussian elimination with partial pivoting.
3088 </p>
3089 <h4>Example</h4>
3090 <blockquote><pre>
3091 Real A[3,3] = [1,2,3;
3092 3,4,5;
3093 2,1,4];
3094 Real b[3] = {10,22,12};
3095 Real x[3];
3096 <b>algorithm</b>
3097 x := Matrices.solve(A,b); // x = {3,2,1}
3098 </pre></blockquote>
3099 <h4>See also</h4>
3100 <a href=\"modelica://Modelica.Math.Matrices.LU\">Matrices.LU</a>,
3101 <a href=\"modelica://Modelica.Math.Matrices.LU_solve\">Matrices.LU_solve</a>,
3102 <a href=\"modelica://Modelica.Math.Matrices.leastSquares\">Matrices.leastSquares</a>.
3103 </HTML>"));
3104 end solve;
3105
3106 package LAPACK "Interface to LAPACK library (should usually not directly be used but only indirectly via Modelica.Math.Matrices)"
3107 extends Modelica.Icons.Package;
3108
3109 function dgesv_vec "Solve real system of linear equations A*x=b with a b vector"
3110 extends Modelica.Icons.Function;
3111 input Real[:, size(A, 1)] A;
3112 input Real[size(A, 1)] b;
3113 output Real[size(A, 1)] x = b;
3114 output Integer info;
3115 protected
3116 Real[size(A, 1), size(A, 1)] Awork = A;
3117 Integer lda = max(1, size(A, 1));
3118 Integer ldb = max(1, size(b, 1));
3119 Integer[size(A, 1)] ipiv;
3120 external "FORTRAN 77" dgesv(size(A, 1), 1, Awork, lda, ipiv, x, ldb, info);
3121 annotation(Documentation(info = "
3122 Same as function LAPACK.dgesv, but right hand side is a vector and not a matrix.
3123 For details of the arguments, see documentation of dgesv.
3124 "));
3125 end dgesv_vec;
3126 annotation(Documentation(info = "<html>
3127 <p>
3128 This package contains external Modelica functions as interface to the
3129 LAPACK library
3130 (<a href=\"http://www.netlib.org/lapack\">http://www.netlib.org/lapack</a>)
3131 that provides FORTRAN subroutines to solve linear algebra
3132 tasks. Usually, these functions are not directly called, but only via
3133 the much more convenient interface of
3134 <a href=\"modelica://Modelica.Math.Matrices\">Modelica.Math.Matrices</a>.
3135 The documentation of the LAPACK functions is a copy of the original
3136 FORTRAN code. The details of LAPACK are described in:
3137 </p>
3138
3139 <dl>
3140 <dt>Anderson E., Bai Z., Bischof C., Blackford S., Demmel J., Dongarra J.,
3141 Du Croz J., Greenbaum A., Hammarling S., McKenney A., and Sorensen D.:</dt>
3142 <dd> <a href=\"http://www.netlib.org/lapack/lug/lapack_lug.html\">Lapack Users' Guide</a>.
3143 Third Edition, SIAM, 1999.</dd>
3144 </dl>
3145
3146 <p>
3147 See also <a href=\"http://en.wikipedia.org/wiki/Lapack\">http://en.wikipedia.org/wiki/Lapack</a>.
3148 </p>
3149
3150 <p>
3151 This package contains a direct interface to the LAPACK subroutines
3152 </p>
3153
3154 </html>"));
3155 end LAPACK;
3156 annotation(Documentation(info = "<HTML>
3157 <h4>Library content</h4>
3158 <p>
3159 This library provides functions operating on matrices. Below, the
3160 functions are ordered according to categories and a typical
3161 call of the respective function is shown.
3162 Most functions are solely an interface to the external
3163 <a href=\"modelica://Modelica.Math.Matrices.LAPACK\">LAPACK</a> library.
3164 </p>
3165
3166 <p>
3167 Note: A' is a short hand notation of transpose(A):
3168 </p>
3169
3170 <p><b>Basic Information</b></p>
3171 <ul>
3172 <li> <a href=\"modelica://Modelica.Math.Matrices.toString\">toString</a>(A)
3173 - returns the string representation of matrix A.</li>
3174
3175 <li> <a href=\"modelica://Modelica.Math.Matrices.isEqual\">isEqual</a>(M1, M2)
3176 - returns true if matrices M1 and M2 have the same size and the same elements.</li>
3177 </ul>
3178
3179 <p><b>Linear Equations</b></p>
3180 <ul>
3181 <li> <a href=\"modelica://Modelica.Math.Matrices.solve\">solve</a>(A,b)
3182 - returns solution x of the linear equation A*x=b (where b is a vector,
3183 and A is a square matrix that must be regular).</li>
3184
3185 <li> <a href=\"modelica://Modelica.Math.Matrices.solve2\">solve2</a>(A,B)
3186 - returns solution X of the linear equation A*X=B (where B is a matrix,
3187 and A is a square matrix that must be regular)</li>
3188
3189 <li> <a href=\"modelica://Modelica.Math.Matrices.leastSquares\">leastSquares</a>(A,b)
3190 - returns solution x of the linear equation A*x=b in a least squares sense
3191 (where b is a vector and A may be non-square and may be rank deficient)</li>
3192
3193 <li> <a href=\"modelica://Modelica.Math.Matrices.leastSquares2\">leastSquares2</a>(A,B)
3194 - returns solution X of the linear equation A*X=B in a least squares sense
3195 (where B is a matrix and A may be non-square and may be rank deficient)</li>
3196
3197 <li> <a href=\"modelica://Modelica.Math.Matrices.equalityLeastSquares\">equalityLeastSquares</a>(A,a,B,b)
3198 - returns solution x of a linear equality constrained least squares problem:
3199 min|A*x-a|^2 subject to B*x=b</<li>
3200
3201 <li> (LU,p,info) = <a href=\"modelica://Modelica.Math.Matrices.LU\">LU</a>(A)
3202 - returns the LU decomposition with row pivoting of a rectangular matrix A.</li>
3203
3204 <li> <a href=\"modelica://Modelica.Math.Matrices.LU_solve\">LU_solve</a>(LU,p,b)
3205 - returns solution x of the linear equation L*U*x[p]=b with a b
3206 vector and an LU decomposition from \"LU(..)\".</li>
3207
3208 <li> <a href=\"modelica://Modelica.Math.Matrices.LU_solve2\">LU_solve2</a>(LU,p,B)
3209 - returns solution X of the linear equation L*U*X[p,:]=B with a B
3210 matrix and an LU decomposition from \"LU(..)\".</li>
3211 </ul>
3212
3213 <p><b>Matrix Factorizations</b></p>
3214 <ul>
3215 <li> (eval,evec) = <a href=\"modelica://Modelica.Math.Matrices.eigenValues\">eigenValues</a>(A)
3216 - returns eigen values \"eval\" and eigen vectors \"evec\" for a real,
3217 nonsymmetric matrix A in a Real representation.</li>
3218
3219 <li> <a href=\"modelica://Modelica.Math.Matrices.eigenValueMatrix\">eigenValueMatrix</a>(eval)
3220 - returns real valued block diagonal matrix of the eigenvalues \"eval\" of matrix A.</li>
3221
3222 <li> (sigma,U,VT) = <a href=\"modelica://Modelica.Math.Matrices.singularValues\">singularValues</a>(A)
3223 - returns singular values \"sigma\" and left and right singular vectors U and VT
3224 of a rectangular matrix A.</li>
3225
3226 <li> (Q,R,p) = <a href=\"modelica://Modelica.Math.Matrices.QR\">QR</a>(A)
3227 - returns the QR decomposition with column pivoting of a rectangular matrix A
3228 such that Q*R = A[:,p].</li>
3229
3230 <li> (H,U) = <a href=\"modelica://Modelica.Math.Matrices.hessenberg\">hessenberg</a>(A)
3231 - returns the upper Hessenberg form H and the orthogonal transformation matrix U
3232 of a square matrix A such that H = U'*A*U.</li>
3233
3234 <li> <a href=\"modelica://Modelica.Math.Matrices.realSchur\">realSchur</a>(A)
3235 - returns the real Schur form of a square matrix A.</li>
3236
3237 <li> <a href=\"modelica://Modelica.Math.Matrices.cholesky\">cholesky</a>(A)
3238 - returns the cholesky factor H of a real symmetric positive definite matrix A so that A = H'*H.</li>
3239
3240 <li> (D,Aimproved) = <a href=\"modelica://Modelica.Math.Matrices.balance\">balance</a>(A)
3241 - returns an improved form Aimproved of a square matrix A that has a smaller condition as A,
3242 with Aimproved = inv(diagonal(D))*A*diagonal(D).</li>
3243 </ul>
3244
3245 <p><b>Matrix Properties</b></p>
3246 <ul>
3247 <li> <a href=\"modelica://Modelica.Math.Matrices.trace\">trace</a>(A)
3248 - returns the trace of square matrix A, i.e., the sum of the diagonal elements.</li>
3249
3250 <li> <a href=\"modelica://Modelica.Math.Matrices.det\">det</a>(A)
3251 - returns the determinant of square matrix A (using LU decomposition; try to avoid det(..))</li>
3252
3253 <li> <a href=\"modelica://Modelica.Math.Matrices.inv\">inv</a>(A)
3254 - returns the inverse of square matrix A (try to avoid, use instead \"solve2(..) with B=identity(..))</li>
3255
3256 <li> <a href=\"modelica://Modelica.Math.Matrices.rank\">rank</a>(A)
3257 - returns the rank of square matrix A (computed with singular value decomposition)</li>
3258
3259 <li> <a href=\"modelica://Modelica.Math.Matrices.conditionNumber\">conditionNumber</a>(A)
3260 - returns the condition number norm(A)*norm(inv(A)) of a square matrix A in the range 1..&infin;.</li>
3261
3262 <li> <a href=\"modelica://Modelica.Math.Matrices.rcond\">rcond</a>(A)
3263 - returns the reciprocal condition number 1/conditionNumber(A) of a square matrix A in the range 0..1.</li>
3264
3265 <li> <a href=\"modelica://Modelica.Math.Matrices.norm\">norm</a>(A)
3266 - returns the 1-, 2-, or infinity-norm of matrix A.</li>
3267
3268 <li> <a href=\"modelica://Modelica.Math.Matrices.frobeniusNorm\">frobeniusNorm</a>(A)
3269 - returns the Frobenius norm of matrix A.</li>
3270
3271 <li> <a href=\"modelica://Modelica.Math.Matrices.nullSpace\">nullSpace</a>(A)
3272 - returns the null space of matrix A.</li>
3273 </ul>
3274
3275 <p><b>Matrix Exponentials</b></p>
3276 <ul>
3277 <li> <a href=\"modelica://Modelica.Math.Matrices.exp\">exp</a>(A)
3278 - returns the exponential e^A of a matrix A by adaptive Taylor series
3279 expansion with scaling and balancing</li>
3280
3281 <li> (phi, gamma) = <a href=\"modelica://Modelica.Math.Matrices.integralExp\">integralExp</a>(A,B)
3282 - returns the exponential phi=e^A and the integral gamma=integral(exp(A*t)*dt)*B as needed
3283 for a discretized system with zero order hold.</li>
3284
3285 <li> (phi, gamma, gamma1) = <a href=\"modelica://Modelica.Math.Matrices.integralExpT\">integralExpT</a>(A,B)
3286 - returns the exponential phi=e^A, the integral gamma=integral(exp(A*t)*dt)*B,
3287 and the time-weighted integral gamma1 = integral((T-t)*exp(A*t)*dt)*B as needed
3288 for a discretized system with first order hold.</li>
3289 </ul>
3290
3291 <p><b>Matrix Equations</b></p>
3292 <ul>
3293 <li> <a href=\"modelica://Modelica.Math.Matrices.continuousLyapunov\">continuousLyapunov</a>(A,C)
3294 - returns solution X of the continuous-time Lyapunov equation X*A + A'*X = C</li>
3295
3296 <li> <a href=\"modelica://Modelica.Math.Matrices.continuousSylvester\">continuousSylvester</a>(A,B,C)
3297 - returns solution X of the continuous-time Sylvester equation A*X + X*B = C</li>
3298
3299 <li> <a href=\"modelica://Modelica.Math.Matrices.continuousRiccati\">continuousRiccati</a>(A,B,R,Q)
3300 - returns solution X of the continuous-time algebraic Riccati equation
3301 A'*X + X*A - X*B*inv(R)*B'*X + Q = 0</li>
3302
3303 <li> <a href=\"modelica://Modelica.Math.Matrices.discreteLyapunov\">discreteLyapunov</a>(A,C)
3304 - returns solution X of the discrete-time Lyapunov equation A'*X*A + sgn*X = C</li>
3305
3306 <li> <a href=\"modelica://Modelica.Math.Matrices.discreteSylvester\">discreteSylvester</a>(A,B,C)
3307 - returns solution X of the discrete-time Sylvester equation A*X*B + sgn*X = C</li>
3308
3309 <li> <a href=\"modelica://Modelica.Math.Matrices.discreteRiccati\">discreteRiccati</a>(A,B,R,Q)
3310 - returns solution X of the discrete-time algebraic Riccati equation
3311 A'*X*A - X - A'*X*B*inv(R + B'*X*B)*B'*X*A + Q = 0</li>
3312 </ul>
3313
3314 <p><b>Matrix Manipulation</b></p>
3315 <ul>
3316 <li> <a href=\"modelica://Modelica.Math.Matrices.sort\">sort</a>(M)
3317 - returns the sorted rows or columns of matrix M in ascending or descending order.</li>
3318
3319 <li> <a href=\"modelica://Modelica.Math.Matrices.flipLeftRight\">flipLeftRight</a>(M)
3320 - returns matrix M so that the columns of M are flipped in left/right direction.</li>
3321
3322 <li> <a href=\"modelica://Modelica.Math.Matrices.flipUpDown\">flipUpDown</a>(M)
3323 - returns matrix M so that the rows of M are flipped in up/down direction.</li>
3324 </ul>
3325
3326 <h4>See also</h4>
3327 <a href=\"modelica://Modelica.Math.Vectors\">Vectors</a>
3328
3329 </html>"));
3330 end Matrices;
3331
3332 function asin "Inverse sine (-1 <= u <= 1)"
3333 extends Modelica.Math.Icons.AxisCenter;
3334 input Real u;
3335 output .Modelica.SIunits.Angle y;
3336 external "builtin" y = asin(u);
3337 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-90, 0}, {68, 0}}, color = {192, 192, 192}), Polygon(points = {{90, 0}, {68, 8}, {68, -8}, {90, 0}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-79.2, -72.8}, {-77.59999999999999, -67.5}, {-73.59999999999999, -59.4}, {-66.3, -49.8}, {-53.5, -37.3}, {-30.2, -19.7}, {37.4, 24.8}, {57.5, 40.8}, {68.7, 52.7}, {75.2, 62.2}, {77.59999999999999, 67.5}, {80, 80}}, color = {0, 0, 0}), Text(extent = {{-88, 78}, {-16, 30}}, lineColor = {192, 192, 192}, textString = "asin")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-40, -72}, {-15, -88}}, textString = "-pi/2", lineColor = {0, 0, 255}), Text(extent = {{-38, 88}, {-13, 72}}, textString = " pi/2", lineColor = {0, 0, 255}), Text(extent = {{68, -9}, {88, -29}}, textString = "+1", lineColor = {0, 0, 255}), Text(extent = {{-90, 21}, {-70, 1}}, textString = "-1", lineColor = {0, 0, 255}), Line(points = {{-100, 0}, {84, 0}}, color = {95, 95, 95}), Polygon(points = {{98, 0}, {82, 6}, {82, -6}, {98, 0}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-79.2, -72.8}, {-77.59999999999999, -67.5}, {-73.59999999999999, -59.4}, {-66.3, -49.8}, {-53.5, -37.3}, {-30.2, -19.7}, {37.4, 24.8}, {57.5, 40.8}, {68.7, 52.7}, {75.2, 62.2}, {77.59999999999999, 67.5}, {80, 80}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{82, 24}, {102, 4}}, lineColor = {95, 95, 95}, textString = "u"), Line(points = {{0, 80}, {86, 80}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{80, 86}, {80, -10}}, color = {175, 175, 175}, smooth = Smooth.None)}), Documentation(info = "<html>
3338 <p>
3339 This function returns y = asin(u), with -1 &le; u &le; +1:
3340 </p>
3341
3342 <p>
3343 <img src=\"modelica://Modelica/Resources/Images/Math/asin.png\">
3344 </p>
3345 </html>"));
3346 end asin;
3347
3348 function exp "Exponential, base e"
3349 extends Modelica.Math.Icons.AxisCenter;
3350 input Real u;
3351 output Real y;
3352 external "builtin" y = exp(u);
3353 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-90, -80.3976}, {68, -80.3976}}, color = {192, 192, 192}), Polygon(points = {{90, -80.3976}, {68, -72.3976}, {68, -88.3976}, {90, -80.3976}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-31, -77.90000000000001}, {-6.03, -74}, {10.9, -68.40000000000001}, {23.7, -61}, {34.2, -51.6}, {43, -40.3}, {50.3, -27.8}, {56.7, -13.5}, {62.3, 2.23}, {67.09999999999999, 18.6}, {72, 38.2}, {76, 57.6}, {80, 80}}, color = {0, 0, 0}), Text(extent = {{-86, 50}, {-14, 2}}, lineColor = {192, 192, 192}, textString = "exp")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, -80.3976}, {84, -80.3976}}, color = {95, 95, 95}), Polygon(points = {{98, -80.3976}, {82, -74.3976}, {82, -86.3976}, {98, -80.3976}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-31, -77.90000000000001}, {-6.03, -74}, {10.9, -68.40000000000001}, {23.7, -61}, {34.2, -51.6}, {43, -40.3}, {50.3, -27.8}, {56.7, -13.5}, {62.3, 2.23}, {67.09999999999999, 18.6}, {72, 38.2}, {76, 57.6}, {80, 80}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-31, 72}, {-11, 88}}, textString = "20", lineColor = {0, 0, 255}), Text(extent = {{-92, -81}, {-72, -101}}, textString = "-3", lineColor = {0, 0, 255}), Text(extent = {{66, -81}, {86, -101}}, textString = "3", lineColor = {0, 0, 255}), Text(extent = {{2, -69}, {22, -89}}, textString = "1", lineColor = {0, 0, 255}), Text(extent = {{78, -54}, {98, -74}}, lineColor = {95, 95, 95}, textString = "u"), Line(points = {{0, 80}, {88, 80}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{80, 84}, {80, -84}}, color = {175, 175, 175}, smooth = Smooth.None)}), Documentation(info = "<html>
3354 <p>
3355 This function returns y = exp(u), with -&infin; &lt; u &lt; &infin;:
3356 </p>
3357
3358 <p>
3359 <img src=\"modelica://Modelica/Resources/Images/Math/exp.png\">
3360 </p>
3361 </html>"));
3362 end exp;
3363
3364 function log "Natural (base e) logarithm (u shall be > 0)"
3365 extends Modelica.Math.Icons.AxisLeft;
3366 input Real u;
3367 output Real y;
3368 external "builtin" y = log(u);
3369 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-90, 0}, {68, 0}}, color = {192, 192, 192}), Polygon(points = {{90, 0}, {68, 8}, {68, -8}, {90, 0}}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-80, -80}, {-79.2, -50.6}, {-78.40000000000001, -37}, {-77.59999999999999, -28}, {-76.8, -21.3}, {-75.2, -11.4}, {-72.8, -1.31}, {-69.5, 8.08}, {-64.7, 17.9}, {-57.5, 28}, {-47, 38.1}, {-31.8, 48.1}, {-10.1, 58}, {22.1, 68}, {68.7, 78.09999999999999}, {80, 80}}, color = {0, 0, 0}), Text(extent = {{-6, -24}, {66, -72}}, lineColor = {192, 192, 192}, textString = "log")}), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, 0}, {84, 0}}, color = {95, 95, 95}), Polygon(points = {{100, 0}, {84, 6}, {84, -6}, {100, 0}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Line(points = {{-78, -80}, {-77.2, -50.6}, {-76.40000000000001, -37}, {-75.59999999999999, -28}, {-74.8, -21.3}, {-73.2, -11.4}, {-70.8, -1.31}, {-67.5, 8.08}, {-62.7, 17.9}, {-55.5, 28}, {-45, 38.1}, {-29.8, 48.1}, {-8.1, 58}, {24.1, 68}, {70.7, 78.09999999999999}, {82, 80}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-105, 72}, {-85, 88}}, textString = "3", lineColor = {0, 0, 255}), Text(extent = {{60, -3}, {80, -23}}, textString = "20", lineColor = {0, 0, 255}), Text(extent = {{-78, -7}, {-58, -27}}, textString = "1", lineColor = {0, 0, 255}), Text(extent = {{84, 26}, {104, 6}}, lineColor = {95, 95, 95}, textString = "u"), Text(extent = {{-100, 9}, {-80, -11}}, textString = "0", lineColor = {0, 0, 255}), Line(points = {{-80, 80}, {84, 80}}, color = {175, 175, 175}, smooth = Smooth.None), Line(points = {{82, 82}, {82, -6}}, color = {175, 175, 175}, smooth = Smooth.None)}), Documentation(info = "<html>
3370 <p>
3371 This function returns y = log(10) (the natural logarithm of u),
3372 with u &gt; 0:
3373 </p>
3374
3375 <p>
3376 <img src=\"modelica://Modelica/Resources/Images/Math/log.png\">
3377 </p>
3378 </html>"));
3379 end log;
3380
3381 function tempInterpol1 "Temporary function for linear interpolation (will be removed)"
3382 extends Modelica.Icons.Function;
3383 extends Modelica.Icons.ObsoleteModel;
3384 input Real u "input value (first column of table)";
3385 input Real[:, :] table "table to be interpolated";
3386 input Integer icol "column of table to be interpolated";
3387 output Real y "interpolated input value (icol column of table)";
3388 protected
3389 Integer i;
3390 Integer n "number of rows of table";
3391 Real u1;
3392 Real u2;
3393 Real y1;
3394 Real y2;
3395 algorithm
3396 n := size(table, 1);
3397 if n <= 1 then
3398 y := table[1, icol];
3399 else
3400 if u <= table[1, 1] then
3401 i := 1;
3402 else
3403 i := 2;
3404 while i < n and u >= table[i, 1] loop
3405 i := i + 1;
3406 end while;
3407 i := i - 1;
3408 end if;
3409 u1 := table[i, 1];
3410 u2 := table[i + 1, 1];
3411 y1 := table[i, icol];
3412 y2 := table[i + 1, icol];
3413 assert(u2 > u1, "Table index must be increasing");
3414 y := y1 + (y2 - y1) * (u - u1) / (u2 - u1);
3415 end if;
3416 annotation(Documentation(info = "<html>
3417
3418 </html>"), derivative(zeroDerivative = table, zeroDerivative = icol) = tempInterpol1_der);
3419 end tempInterpol1;
3420
3421 function tempInterpol1_der "Temporary function for linear interpolation (will be removed)"
3422 input Real u "input value (first column of table)";
3423 input Real[:, :] table "table to be interpolated";
3424 input Integer icol "column of table to be interpolated";
3425 input Real du;
3426 output Real dy "interpolated input value (icol column of table)";
3427 protected
3428 Integer i;
3429 Integer n "number of rows of table";
3430 Real u1;
3431 Real u2;
3432 Real y1;
3433 Real y2;
3434 algorithm
3435 n := size(table, 1);
3436 if n <= 1 then
3437 dy := 0;
3438 else
3439 if u <= table[1, 1] then
3440 i := 1;
3441 else
3442 i := 2;
3443 while i < n and u >= table[i, 1] loop
3444 i := i + 1;
3445 end while;
3446 i := i - 1;
3447 end if;
3448 u1 := table[i, 1];
3449 u2 := table[i + 1, 1];
3450 y1 := table[i, icol];
3451 y2 := table[i + 1, icol];
3452 assert(u2 > u1, "Table index must be increasing");
3453 dy := (y2 - y1) / (u2 - u1);
3454 end if;
3455 annotation(Documentation(info = "<html>
3456
3457 </html>"));
3458 end tempInterpol1_der;
3459 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, 0}, {-68.7, 34.2}, {-61.5, 53.1}, {-55.1, 66.40000000000001}, {-49.4, 74.59999999999999}, {-43.8, 79.09999999999999}, {-38.2, 79.8}, {-32.6, 76.59999999999999}, {-26.9, 69.7}, {-21.3, 59.4}, {-14.9, 44.1}, {-6.83, 21.2}, {10.1, -30.8}, {17.3, -50.2}, {23.7, -64.2}, {29.3, -73.09999999999999}, {35, -78.40000000000001}, {40.6, -80}, {46.2, -77.59999999999999}, {51.9, -71.5}, {57.5, -61.9}, {63.9, -47.2}, {72, -24.8}, {80, 0}}, color = {0, 0, 0}, smooth = Smooth.Bezier)}), Documentation(info = "<HTML>
3460 <p>
3461 This package contains <b>basic mathematical functions</b> (such as sin(..)),
3462 as well as functions operating on
3463 <a href=\"modelica://Modelica.Math.Vectors\">vectors</a>,
3464 <a href=\"modelica://Modelica.Math.Matrices\">matrices</a>,
3465 <a href=\"modelica://Modelica.Math.Nonlinear\">nonlinear functions</a>, and
3466 <a href=\"modelica://Modelica.Math.BooleanVectors\">Boolean vectors</a>.
3467 </p>
3468
3469 <dl>
3470 <dt><b>Main Authors:</b>
3471 <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
3472 Marcus Baur<br>
3473 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e.V. (DLR)<br>
3474 Institut f&uuml;r Robotik und Mechatronik<br>
3475 Postfach 1116<br>
3476 D-82230 Wessling<br>
3477 Germany<br>
3478 email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
3479 </dl>
3480
3481 <p>
3482 Copyright &copy; 1998-2013, Modelica Association and DLR.
3483 </p>
3484 <p>
3485 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
3486 </p>
3487 </html>", revisions = "<html>
3488 <ul>
3489 <li><i>October 21, 2002</i>
3490 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
3491 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
3492 Function tempInterpol2 added.</li>
3493 <li><i>Oct. 24, 1999</i>
3494 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
3495 Icons for icon and diagram level introduced.</li>
3496 <li><i>June 30, 1999</i>
3497 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
3498 Realized.</li>
3499 </ul>
3500
3501 </html>"));
3502 end Math;
3503
3504 package Constants "Library of mathematical constants and constants of nature (e.g., pi, eps, R, sigma)"
3505 extends Modelica.Icons.Package;
3506 final constant Real pi = 2 * Math.asin(1.0);
3507 final constant Real eps = ModelicaServices.Machine.eps "Biggest number such that 1.0 + eps = 1.0";
3508 final constant Real inf = ModelicaServices.Machine.inf "Biggest Real number such that inf and -inf are representable on the machine";
3509 final constant .Modelica.SIunits.Velocity c = 299792458 "Speed of light in vacuum";
3510 final constant Real R(final unit = "J/(mol.K)") = 8.314472 "Molar gas constant";
3511 final constant Real mue_0(final unit = "N/A2") = 4 * pi * 1e-007 "Magnetic constant";
3512 final constant .Modelica.SIunits.Conversions.NonSIunits.Temperature_degC T_zero = -273.15 "Absolute zero temperature";
3513 annotation(Documentation(info = "<html>
3514 <p>
3515 This package provides often needed constants from mathematics, machine
3516 dependent constants and constants from nature. The latter constants
3517 (name, value, description) are from the following source:
3518 </p>
3519
3520 <dl>
3521 <dt>Peter J. Mohr and Barry N. Taylor (1999):</dt>
3522 <dd><b>CODATA Recommended Values of the Fundamental Physical Constants: 1998</b>.
3523 Journal of Physical and Chemical Reference Data, Vol. 28, No. 6, 1999 and
3524 Reviews of Modern Physics, Vol. 72, No. 2, 2000. See also <a href=
3525 \"http://physics.nist.gov/cuu/Constants/\">http://physics.nist.gov/cuu/Constants/</a></dd>
3526 </dl>
3527
3528 <p>CODATA is the Committee on Data for Science and Technology.</p>
3529
3530 <dl>
3531 <dt><b>Main Author:</b></dt>
3532 <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
3533 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
3534 Oberpfaffenhofen<br>
3535 Postfach 11 16<br>
3536 D-82230 We&szlig;ling<br>
3537 email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
3538 </dl>
3539
3540 <p>
3541 Copyright &copy; 1998-2013, Modelica Association and DLR.
3542 </p>
3543 <p>
3544 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
3545 </p>
3546 </html>", revisions = "<html>
3547 <ul>
3548 <li><i>Nov 8, 2004</i>
3549 by <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
3550 Constants updated according to 2002 CODATA values.</li>
3551 <li><i>Dec 9, 1999</i>
3552 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
3553 Constants updated according to 1998 CODATA values. Using names, values
3554 and description text from this source. Included magnetic and
3555 electric constant.</li>
3556 <li><i>Sep 18, 1999</i>
3557 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
3558 Constants eps, inf, small introduced.</li>
3559 <li><i>Nov 15, 1997</i>
3560 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
3561 Realized.</li>
3562 </ul>
3563 </html>"), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-9.2597, 25.6673}, fillColor = {102, 102, 102}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{48.017, 11.336}, {48.017, 11.336}, {10.766, 11.336}, {-25.684, 10.95}, {-34.944, -15.111}, {-34.944, -15.111}, {-32.298, -15.244}, {-32.298, -15.244}, {-22.112, 0.168}, {11.292, 0.234}, {48.267, -0.097}, {48.267, -0.097}}, smooth = Smooth.Bezier), Polygon(origin = {-19.9923, -8.3993}, fillColor = {102, 102, 102}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{3.239, 37.343}, {3.305, 37.343}, {-0.399, 2.683}, {-16.936, -20.071}, {-7.808, -28.604}, {6.811, -22.519}, {9.986000000000001, 37.145}, {9.986000000000001, 37.145}}, smooth = Smooth.Bezier), Polygon(origin = {23.753, -11.5422}, fillColor = {102, 102, 102}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-10.873, 41.478}, {-10.873, 41.478}, {-14.048, -4.162}, {-9.352, -24.8}, {7.912, -24.469}, {16.247, 0.27}, {16.247, 0.27}, {13.336, 0.07099999999999999}, {13.336, 0.07099999999999999}, {7.515, -9.983000000000001}, {-3.134, -7.271}, {-2.671, 41.214}, {-2.671, 41.214}}, smooth = Smooth.Bezier)}));
3564 end Constants;
3565
3566 package Icons "Library of icons"
3567 extends Icons.Package;
3568
3569 partial package Package "Icon for standard packages" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(lineColor = {200, 200, 200}, fillColor = {248, 248, 248}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0), Rectangle(lineColor = {128, 128, 128}, fillPattern = FillPattern.None, extent = {{-100.0, -100.0}, {100.0, 100.0}}, radius = 25.0)}), Documentation(info = "<html>
3570 <p>Standard package icon.</p>
3571 </html>")); end Package;
3572
3573 partial package VariantsPackage "Icon for package containing variants"
3574 extends Modelica.Icons.Package;
3575 annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(origin = {10.0, 10.0}, fillColor = {76, 76, 76}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-80.0, -80.0}, {-20.0, -20.0}}), Ellipse(origin = {10.0, 10.0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{0.0, -80.0}, {60.0, -20.0}}), Ellipse(origin = {10.0, 10.0}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{0.0, 0.0}, {60.0, 60.0}}), Ellipse(origin = {10.0, 10.0}, lineColor = {128, 128, 128}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-80.0, 0.0}, {-20.0, 60.0}})}), Documentation(info = "<html>
3576 <p>This icon shall be used for a package/library that contains several variants of one components.</p>
3577 </html>"));
3578 end VariantsPackage;
3579
3580 partial package InterfacesPackage "Icon for packages containing interfaces"
3581 extends Modelica.Icons.Package;
3582 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {20.0, 0.0}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{-10.0, 70.0}, {10.0, 70.0}, {40.0, 20.0}, {80.0, 20.0}, {80.0, -20.0}, {40.0, -20.0}, {10.0, -70.0}, {-10.0, -70.0}}), Polygon(fillColor = {102, 102, 102}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-100.0, 20.0}, {-60.0, 20.0}, {-30.0, 70.0}, {-10.0, 70.0}, {-10.0, -70.0}, {-30.0, -70.0}, {-60.0, -20.0}, {-100.0, -20.0}})}), Documentation(info = "<html>
3583 <p>This icon indicates packages containing interfaces.</p>
3584 </html>"));
3585 end InterfacesPackage;
3586
3587 partial package SourcesPackage "Icon for packages containing sources"
3588 extends Modelica.Icons.Package;
3589 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {23.3333, 0.0}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-23.333, 30.0}, {46.667, 0.0}, {-23.333, -30.0}}), Rectangle(fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-70, -4.5}, {0, 4.5}})}), Documentation(info = "<html>
3590 <p>This icon indicates a package which contains sources.</p>
3591 </html>"));
3592 end SourcesPackage;
3593
3594 partial package IconsPackage "Icon for packages containing icons"
3595 extends Modelica.Icons.Package;
3596 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}));
3597 end IconsPackage;
3598
3599 partial package MaterialPropertiesPackage "Icon for package containing property classes"
3600 extends Modelica.Icons.Package;
3601 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(lineColor = {102, 102, 102}, fillColor = {204, 204, 204}, pattern = LinePattern.None, fillPattern = FillPattern.Sphere, extent = {{-60.0, -60.0}, {60.0, 60.0}})}), Documentation(info = "<html>
3602 <p>This icon indicates a package that contains properties</p>
3603 </html>"));
3604 end MaterialPropertiesPackage;
3605
3606 partial class MaterialProperty "Icon for property classes" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Ellipse(lineColor = {102, 102, 102}, fillColor = {204, 204, 204}, pattern = LinePattern.None, fillPattern = FillPattern.Sphere, extent = {{-100.0, -100.0}, {100.0, 100.0}})}), Documentation(info = "<html>
3607 <p>This icon indicates a property class.</p>
3608 </html>")); end MaterialProperty;
3609
3610 partial function Function "Icon for functions" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Text(lineColor = {0, 0, 255}, extent = {{-150, 105}, {150, 145}}, textString = "%name"), Ellipse(lineColor = {108, 88, 49}, fillColor = {255, 215, 136}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Text(lineColor = {108, 88, 49}, extent = {{-90.0, -90.0}, {90.0, 90.0}}, textString = "f")}), Documentation(info = "<html>
3611 <p>This icon indicates Modelica functions.</p>
3612 </html>")); end Function;
3613
3614 partial record Record "Icon for records" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(lineColor = {0, 0, 255}, extent = {{-150, 60}, {150, 100}}, textString = "%name"), Rectangle(origin = {0.0, -25.0}, lineColor = {64, 64, 64}, fillColor = {255, 215, 136}, fillPattern = FillPattern.Solid, extent = {{-100.0, -75.0}, {100.0, 75.0}}, radius = 25.0), Line(points = {{-100.0, 0.0}, {100.0, 0.0}}, color = {64, 64, 64}), Line(origin = {0.0, -50.0}, points = {{-100.0, 0.0}, {100.0, 0.0}}, color = {64, 64, 64}), Line(origin = {0.0, -25.0}, points = {{0.0, 75.0}, {0.0, -75.0}}, color = {64, 64, 64})}), Documentation(info = "<html>
3615 <p>
3616 This icon is indicates a record.
3617 </p>
3618 </html>")); end Record;
3619
3620 partial class ObsoleteModel "Icon for classes that are obsolete and will be removed in later versions" annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-102, 102}, {102, -102}}, lineColor = {255, 0, 0}, pattern = LinePattern.Dash, lineThickness = 0.5)}), Documentation(info = "<html>
3621 <p>
3622 This partial class is intended to provide a <u>default icon
3623 for an obsolete model</u> that will be removed from the
3624 corresponding library in a future release.
3625 </p>
3626 </html>")); end ObsoleteModel;
3627 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(origin = {-8.167, -17}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-15.833, 20.0}, {-15.833, 30.0}, {14.167, 40.0}, {24.167, 20.0}, {4.167, -30.0}, {14.167, -30.0}, {24.167, -30.0}, {24.167, -40.0}, {-5.833, -50.0}, {-15.833, -30.0}, {4.167, 20.0}, {-5.833, 20.0}}, smooth = Smooth.Bezier, lineColor = {0, 0, 0}), Ellipse(origin = {-0.5, 56.5}, fillColor = {128, 128, 128}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-12.5, -12.5}, {12.5, 12.5}}, lineColor = {0, 0, 0})}), Documentation(info = "<html>
3628 <p>This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using &quot;extends&quot; or by directly copying the &quot;icon&quot; layer. </p>
3629
3630 <h4>Main Authors:</h4>
3631
3632 <dl>
3633 <dt><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a></dt>
3634 <dd>Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)</dd>
3635 <dd>Oberpfaffenhofen</dd>
3636 <dd>Postfach 1116</dd>
3637 <dd>D-82230 Wessling</dd>
3638 <dd>email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
3639 <dt>Christian Kral</dt>
3640 <dd><a href=\"http://www.ait.ac.at/\">Austrian Institute of Technology, AIT</a></dd>
3641 <dd>Mobility Department</dd><dd>Giefinggasse 2</dd>
3642 <dd>1210 Vienna, Austria</dd>
3643 <dd>email: <a href=\"mailto:dr.christian.kral@gmail.com\">dr.christian.kral@gmail.com</a></dd>
3644 <dt>Johan Andreasson</dt>
3645 <dd><a href=\"http://www.modelon.se/\">Modelon AB</a></dd>
3646 <dd>Ideon Science Park</dd>
3647 <dd>22370 Lund, Sweden</dd>
3648 <dd>email: <a href=\"mailto:johan.andreasson@modelon.se\">johan.andreasson@modelon.se</a></dd>
3649 </dl>
3650
3651 <p>Copyright &copy; 1998-2013, Modelica Association, DLR, AIT, and Modelon AB. </p>
3652 <p><i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified under the terms of the <b>Modelica license</b>, see the license conditions and the accompanying <b>disclaimer</b> in <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a>.</i> </p>
3653 </html>"));
3654 end Icons;
3655
3656 package SIunits "Library of type and unit definitions based on SI units according to ISO 31-1992"
3657 extends Modelica.Icons.Package;
3658
3659 package Icons "Icons for SIunits"
3660 extends Modelica.Icons.IconsPackage;
3661
3662 partial function Conversion "Base icon for conversion functions" annotation(Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {191, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-90, 0}, {30, 0}}, color = {191, 0, 0}), Polygon(points = {{90, 0}, {30, 20}, {30, -20}, {90, 0}}, lineColor = {191, 0, 0}, fillColor = {191, 0, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-115, 155}, {115, 105}}, textString = "%name", lineColor = {0, 0, 255})})); end Conversion;
3663 end Icons;
3664
3665 package Conversions "Conversion functions to/from non SI units and type definitions of non SI units"
3666 extends Modelica.Icons.Package;
3667
3668 package NonSIunits "Type definitions of non SI units"
3669 extends Modelica.Icons.Package;
3670 type Temperature_degC = Real(final quantity = "ThermodynamicTemperature", final unit = "degC") "Absolute temperature in degree Celsius (for relative temperature use SIunits.TemperatureDifference)" annotation(absoluteValue = true);
3671 type AngularVelocity_rpm = Real(final quantity = "AngularVelocity", final unit = "1/min") "Angular velocity in revolutions per minute. Alias unit names that are outside of the SI system: rpm, r/min, rev/min";
3672 type Pressure_bar = Real(final quantity = "Pressure", final unit = "bar") "Absolute pressure in bar";
3673 annotation(Documentation(info = "<HTML>
3674 <p>
3675 This package provides predefined types, such as <b>Angle_deg</b> (angle in
3676 degree), <b>AngularVelocity_rpm</b> (angular velocity in revolutions per
3677 minute) or <b>Temperature_degF</b> (temperature in degree Fahrenheit),
3678 which are in common use but are not part of the international standard on
3679 units according to ISO 31-1992 \"General principles concerning quantities,
3680 units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
3681 the use of their multiples and of certain other units\".</p>
3682 <p>If possible, the types in this package should not be used. Use instead
3683 types of package Modelica.SIunits. For more information on units, see also
3684 the book of Francois Cardarelli <b>Scientific Unit Conversion - A
3685 Practical Guide to Metrication</b> (Springer 1997).</p>
3686 <p>Some units, such as <b>Temperature_degC/Temp_C</b> are both defined in
3687 Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
3688 definitions have been placed erroneously in Modelica.SIunits although they
3689 are not SIunits. For backward compatibility, these type definitions are
3690 still kept in Modelica.SIunits.</p>
3691 </html>"), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}), graphics = {Text(origin = {15.0, 51.8518}, extent = {{-105.0, -86.8518}, {75.0, -16.8518}}, lineColor = {0, 0, 0}, textString = "[km/h]")}));
3692 end NonSIunits;
3693
3694 function to_degC "Convert from Kelvin to degCelsius"
3695 extends Modelica.SIunits.Icons.Conversion;
3696 input Temperature Kelvin "Kelvin value";
3697 output NonSIunits.Temperature_degC Celsius "Celsius value";
3698 algorithm
3699 Celsius := Kelvin + Modelica.Constants.T_zero;
3700 annotation(Inline = true, Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-20, 100}, {-100, 20}}, lineColor = {0, 0, 0}, textString = "K"), Text(extent = {{100, -20}, {20, -100}}, lineColor = {0, 0, 0}, textString = "degC")}));
3701 end to_degC;
3702
3703 function from_degC "Convert from degCelsius to Kelvin"
3704 extends Modelica.SIunits.Icons.Conversion;
3705 input NonSIunits.Temperature_degC Celsius "Celsius value";
3706 output Temperature Kelvin "Kelvin value";
3707 algorithm
3708 Kelvin := Celsius - Modelica.Constants.T_zero;
3709 annotation(Inline = true, Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-20, 100}, {-100, 20}}, lineColor = {0, 0, 0}, textString = "degC"), Text(extent = {{100, -20}, {20, -100}}, lineColor = {0, 0, 0}, textString = "K")}));
3710 end from_degC;
3711
3712 function to_rpm "Convert from radian per second to revolutions per minute"
3713 extends Modelica.SIunits.Icons.Conversion;
3714 input AngularVelocity rs "radian per second value";
3715 output NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
3716 algorithm
3717 rpm := 30 / Modelica.Constants.pi * rs;
3718 annotation(Inline = true, Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{30, 100}, {-100, 50}}, lineColor = {0, 0, 0}, textString = "rad/s"), Text(extent = {{100, -52}, {-40, -98}}, lineColor = {0, 0, 0}, textString = "1/min")}));
3719 end to_rpm;
3720
3721 function from_rpm "Convert from revolutions per minute to radian per second"
3722 extends Modelica.SIunits.Icons.Conversion;
3723 input NonSIunits.AngularVelocity_rpm rpm "revolutions per minute value";
3724 output AngularVelocity rs "radian per second value";
3725 algorithm
3726 rs := Modelica.Constants.pi / 30 * rpm;
3727 annotation(Inline = true, Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{14, 100}, {-102, 56}}, lineColor = {0, 0, 0}, textString = "1/min"), Text(extent = {{100, -56}, {-32, -102}}, lineColor = {0, 0, 0}, textString = "rad/s")}));
3728 end from_rpm;
3729
3730 function to_bar "Convert from Pascal to bar"
3731 extends Modelica.SIunits.Icons.Conversion;
3732 input Pressure Pa "Pascal value";
3733 output NonSIunits.Pressure_bar bar "bar value";
3734 algorithm
3735 bar := Pa / 100000.0;
3736 annotation(Inline = true, Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-12, 100}, {-100, 56}}, lineColor = {0, 0, 0}, textString = "Pa"), Text(extent = {{98, -52}, {-4, -100}}, lineColor = {0, 0, 0}, textString = "bar")}));
3737 end to_bar;
3738 annotation(Documentation(info = "<HTML>
3739 <p>This package provides conversion functions from the non SI Units
3740 defined in package Modelica.SIunits.Conversions.NonSIunits to the
3741 corresponding SI Units defined in package Modelica.SIunits and vice
3742 versa. It is recommended to use these functions in the following
3743 way (note, that all functions have one Real input and one Real output
3744 argument):</p>
3745 <pre>
3746 <b>import</b> SI = Modelica.SIunits;
3747 <b>import</b> Modelica.SIunits.Conversions.*;
3748 ...
3749 <b>parameter</b> SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin
3750 <b>parameter</b> SI.Angle phi = from_deg(180); // convert 180 degree to radian
3751 <b>parameter</b> SI.AngularVelocity w = from_rpm(3600); // convert 3600 revolutions per minutes
3752 // to radian per seconds
3753 </pre>
3754
3755 </html>"));
3756 end Conversions;
3757
3758 type Angle = Real(final quantity = "Angle", final unit = "rad", displayUnit = "deg");
3759 type Length = Real(final quantity = "Length", final unit = "m");
3760 type Height = Length(min = 0);
3761 type Area = Real(final quantity = "Area", final unit = "m2");
3762 type Volume = Real(final quantity = "Volume", final unit = "m3");
3763 type Time = Real(final quantity = "Time", final unit = "s");
3764 type AngularVelocity = Real(final quantity = "AngularVelocity", final unit = "rad/s");
3765 type AngularAcceleration = Real(final quantity = "AngularAcceleration", final unit = "rad/s2");
3766 type Velocity = Real(final quantity = "Velocity", final unit = "m/s");
3767 type Acceleration = Real(final quantity = "Acceleration", final unit = "m/s2");
3768 type Mass = Real(quantity = "Mass", final unit = "kg", min = 0);
3769 type Density = Real(final quantity = "Density", final unit = "kg/m3", displayUnit = "g/cm3", min = 0.0);
3770 type MomentOfInertia = Real(final quantity = "MomentOfInertia", final unit = "kg.m2");
3771 type Inertia = MomentOfInertia;
3772 type Force = Real(final quantity = "Force", final unit = "N");
3773 type Torque = Real(final quantity = "Torque", final unit = "N.m");
3774 type Pressure = Real(final quantity = "Pressure", final unit = "Pa", displayUnit = "bar");
3775 type AbsolutePressure = Pressure(min = 0.0, nominal = 100000.0);
3776 type DynamicViscosity = Real(final quantity = "DynamicViscosity", final unit = "Pa.s", min = 0);
3777 type Energy = Real(final quantity = "Energy", final unit = "J");
3778 type Power = Real(final quantity = "Power", final unit = "W");
3779 type MassFlowRate = Real(quantity = "MassFlowRate", final unit = "kg/s");
3780 type VolumeFlowRate = Real(final quantity = "VolumeFlowRate", final unit = "m3/s");
3781 type MomentumFlux = Real(final quantity = "MomentumFlux", final unit = "N");
3782 type ThermodynamicTemperature = Real(final quantity = "ThermodynamicTemperature", final unit = "K", min = 0.0, start = 288.15, nominal = 300, displayUnit = "degC") "Absolute temperature (use type TemperatureDifference for relative temperatures)" annotation(absoluteValue = true);
3783 type Temperature = ThermodynamicTemperature;
3784 type Compressibility = Real(final quantity = "Compressibility", final unit = "1/Pa");
3785 type IsothermalCompressibility = Compressibility;
3786 type HeatFlowRate = Real(final quantity = "Power", final unit = "W");
3787 type ThermalConductivity = Real(final quantity = "ThermalConductivity", final unit = "W/(m.K)");
3788 type SpecificHeatCapacity = Real(final quantity = "SpecificHeatCapacity", final unit = "J/(kg.K)");
3789 type RatioOfSpecificHeatCapacities = Real(final quantity = "RatioOfSpecificHeatCapacities", final unit = "1");
3790 type Entropy = Real(final quantity = "Entropy", final unit = "J/K");
3791 type SpecificEntropy = Real(final quantity = "SpecificEntropy", final unit = "J/(kg.K)");
3792 type SpecificEnergy = Real(final quantity = "SpecificEnergy", final unit = "J/kg");
3793 type SpecificEnthalpy = SpecificEnergy;
3794 type DerDensityByPressure = Real(final unit = "s2/m2");
3795 type DerDensityByTemperature = Real(final unit = "kg/(m3.K)");
3796 type AmountOfSubstance = Real(final quantity = "AmountOfSubstance", final unit = "mol", min = 0);
3797 type MolarMass = Real(final quantity = "MolarMass", final unit = "kg/mol", min = 0);
3798 type MassFraction = Real(final quantity = "MassFraction", final unit = "1", min = 0, max = 1);
3799 type MoleFraction = Real(final quantity = "MoleFraction", final unit = "1", min = 0, max = 1);
3800 type FaradayConstant = Real(final quantity = "FaradayConstant", final unit = "C/mol");
3801 annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-66, 78}, {-66, -40}}, color = {64, 64, 64}, smooth = Smooth.None), Ellipse(extent = {{12, 36}, {68, -38}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Rectangle(extent = {{-74, 78}, {-66, -40}}, lineColor = {64, 64, 64}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-66, -4}, {-66, 6}, {-16, 56}, {-16, 46}, {-66, -4}}, lineColor = {64, 64, 64}, smooth = Smooth.None, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 16}, {-40, 22}, {-2, -40}, {-10, -40}, {-46, 16}}, lineColor = {64, 64, 64}, smooth = Smooth.None, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Ellipse(extent = {{22, 26}, {58, -28}}, lineColor = {64, 64, 64}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 2}, {68, -46}, {64, -60}, {58, -68}, {48, -72}, {18, -72}, {18, -64}, {46, -64}, {54, -60}, {58, -54}, {60, -46}, {60, -26}, {64, -20}, {68, -6}, {68, 2}}, lineColor = {64, 64, 64}, smooth = Smooth.Bezier, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid)}), Documentation(info = "<html>
3802 <p>This package provides predefined types, such as <i>Mass</i>,
3803 <i>Angle</i>, <i>Time</i>, based on the international standard
3804 on units, e.g.,
3805 </p>
3806
3807 <pre> <b>type</b> Angle = Real(<b>final</b> quantity = \"Angle\",
3808 <b>final</b> unit = \"rad\",
3809 displayUnit = \"deg\");
3810 </pre>
3811
3812 <p>
3813 as well as conversion functions from non SI-units to SI-units
3814 and vice versa in subpackage
3815 <a href=\"modelica://Modelica.SIunits.Conversions\">Conversions</a>.
3816 </p>
3817
3818 <p>
3819 For an introduction how units are used in the Modelica standard library
3820 with package SIunits, have a look at:
3821 <a href=\"modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
3822 </p>
3823
3824 <p>
3825 Copyright &copy; 1998-2013, Modelica Association and DLR.
3826 </p>
3827 <p>
3828 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
3829 </p>
3830 </html>", revisions = "<html>
3831 <ul>
3832 <li><i>May 25, 2011</i> by Stefan Wischhusen:<br/>Added molar units for energy and enthalpy.</li>
3833 <li><i>Jan. 27, 2010</i> by Christian Kral:<br/>Added complex units.</li>
3834 <li><i>Dec. 14, 2005</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Add User&#39;;s Guide and removed &quot;min&quot; values for Resistance and Conductance.</li>
3835 <li><i>October 21, 2002</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br/>Added new package <b>Conversions</b>. Corrected typo <i>Wavelenght</i>.</li>
3836 <li><i>June 6, 2000</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Introduced the following new types<br/>type Temperature = ThermodynamicTemperature;<br/>types DerDensityByEnthalpy, DerDensityByPressure, DerDensityByTemperature, DerEnthalpyByPressure, DerEnergyByDensity, DerEnergyByPressure<br/>Attribute &quot;final&quot; removed from min and max values in order that these values can still be changed to narrow the allowed range of values.<br/>Quantity=&quot;Stress&quot; removed from type &quot;Stress&quot;, in order that a type &quot;Stress&quot; can be connected to a type &quot;Pressure&quot;.</li>
3837 <li><i>Oct. 27, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>New types due to electrical library: Transconductance, InversePotential, Damping.</li>
3838 <li><i>Sept. 18, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Renamed from SIunit to SIunits. Subpackages expanded, i.e., the SIunits package, does no longer contain subpackages.</li>
3839 <li><i>Aug 12, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Type &quot;Pressure&quot; renamed to &quot;AbsolutePressure&quot; and introduced a new type &quot;Pressure&quot; which does not contain a minimum of zero in order to allow convenient handling of relative pressure. Redefined BulkModulus as an alias to AbsolutePressure instead of Stress, since needed in hydraulics.</li>
3840 <li><i>June 29, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Bug-fix: Double definition of &quot;Compressibility&quot; removed and appropriate &quot;extends Heat&quot; clause introduced in package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
3841 <li><i>April 8, 1998</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and Astrid Jaschinski:<br/>Complete ISO 31 chapters realized.</li>
3842 <li><i>Nov. 15, 1997</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>:<br/>Some chapters realized.</li>
3843 </ul>
3844 </html>"));
3845 end SIunits;
3846 annotation(preferredView = "info", version = "3.2.1", versionBuild = 3, versionDate = "2013-08-14", dateModified = "2013-08-23 19:30:00Z", revisionId = "$Id:: package.mo 6954 2013-08-23 17:46:49Z #$", uses(Complex(version = "3.2.1"), ModelicaServices(version = "3.2.1")), conversion(noneFromVersion = "3.2", noneFromVersion = "3.1", noneFromVersion = "3.0.1", noneFromVersion = "3.0", from(version = "2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.1", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"), from(version = "2.2.2", script = "modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}), graphics = {Polygon(origin = {-6.9888, 20.048}, fillColor = {0, 0, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-93.0112, 10.3188}, {-93.0112, 10.3188}, {-73.011, 24.6}, {-63.011, 31.221}, {-51.219, 36.777}, {-39.842, 38.629}, {-31.376, 36.248}, {-25.819, 29.369}, {-24.232, 22.49}, {-23.703, 17.463}, {-15.501, 25.135}, {-6.24, 32.015}, {3.02, 36.777}, {15.191, 39.423}, {27.097, 37.306}, {32.653, 29.633}, {35.035, 20.108}, {43.501, 28.046}, {54.085, 35.19}, {65.991, 39.952}, {77.89700000000001, 39.688}, {87.422, 33.338}, {91.126, 21.696}, {90.068, 9.525}, {86.099, -1.058}, {79.749, -10.054}, {71.283, -21.431}, {62.816, -33.337}, {60.964, -32.808}, {70.489, -16.14}, {77.36799999999999, -2.381}, {81.072, 10.054}, {79.749, 19.05}, {72.605, 24.342}, {61.758, 23.019}, {49.587, 14.817}, {39.003, 4.763}, {29.214, -6.085}, {21.012, -16.669}, {13.339, -26.458}, {5.401, -36.777}, {-1.213, -46.037}, {-6.24, -53.446}, {-8.092000000000001, -52.387}, {-0.6840000000000001, -40.746}, {5.401, -30.692}, {12.81, -17.198}, {19.424, -3.969}, {23.658, 7.938}, {22.335, 18.785}, {16.514, 23.283}, {8.047000000000001, 23.019}, {-1.478, 19.05}, {-11.267, 11.113}, {-19.734, 2.381}, {-29.259, -8.202}, {-38.519, -19.579}, {-48.044, -31.221}, {-56.511, -43.392}, {-64.449, -55.298}, {-72.386, -66.93899999999999}, {-77.678, -74.61199999999999}, {-79.53, -74.083}, {-71.857, -61.383}, {-62.861, -46.037}, {-52.278, -28.046}, {-44.869, -15.346}, {-38.784, -2.117}, {-35.344, 8.731}, {-36.403, 19.844}, {-42.488, 23.813}, {-52.013, 22.49}, {-60.744, 16.933}, {-68.947, 10.054}, {-76.884, 2.646}, {-93.0112, -12.1707}, {-93.0112, -12.1707}}, smooth = Smooth.Bezier), Ellipse(origin = {40.8208, -37.7602}, fillColor = {161, 0, 4}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-17.8562, -17.8563}, {17.8563, 17.8562}})}), Documentation(info = "<HTML>
3847 <p>
3848 Package <b>Modelica&reg;</b> is a <b>standardized</b> and <b>free</b> package
3849 that is developed together with the Modelica&reg; language from the
3850 Modelica Association, see
3851 <a href=\"https://www.Modelica.org\">https://www.Modelica.org</a>.
3852 It is also called <b>Modelica Standard Library</b>.
3853 It provides model components in many domains that are based on
3854 standardized interface definitions. Some typical examples are shown
3855 in the next figure:
3856 </p>
3857
3858 <p>
3859 <img src=\"modelica://Modelica/Resources/Images/UsersGuide/ModelicaLibraries.png\">
3860 </p>
3861
3862 <p>
3863 For an introduction, have especially a look at:
3864 </p>
3865 <ul>
3866 <li> <a href=\"modelica://Modelica.UsersGuide.Overview\">Overview</a>
3867 provides an overview of the Modelica Standard Library
3868 inside the <a href=\"modelica://Modelica.UsersGuide\">User's Guide</a>.</li>
3869 <li><a href=\"modelica://Modelica.UsersGuide.ReleaseNotes\">Release Notes</a>
3870 summarizes the changes of new versions of this package.</li>
3871 <li> <a href=\"modelica://Modelica.UsersGuide.Contact\">Contact</a>
3872 lists the contributors of the Modelica Standard Library.</li>
3873 <li> The <b>Examples</b> packages in the various libraries, demonstrate
3874 how to use the components of the corresponding sublibrary.</li>
3875 </ul>
3876
3877 <p>
3878 This version of the Modelica Standard Library consists of
3879 </p>
3880 <ul>
3881 <li><b>1360</b> models and blocks, and</li>
3882 <li><b>1280</b> functions</li>
3883 </ul>
3884 <p>
3885 that are directly usable (= number of public, non-partial classes). It is fully compliant
3886 to <a href=\"https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf\">Modelica Specification Version 3.2 Revision 2</a>
3887 and it has been tested with Modelica tools from different vendors.
3888 </p>
3889
3890 <p>
3891 <b>Licensed by the Modelica Association under the Modelica License 2</b><br>
3892 Copyright &copy; 1998-2013, ABB, AIT, T.&nbsp;B&ouml;drich, DLR, Dassault Syst&egrave;mes AB, Fraunhofer, A.Haumer, ITI, Modelon,
3893 TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation.
3894 </p>
3895
3896 <p>
3897 <i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
3898 </p>
3899
3900 <p>
3901 <b>Modelica&reg;</b> is a registered trademark of the Modelica Association.
3902 </p>
3903 </html>"));
3904end Modelica;