| 1 | within ;
|
|---|
| 2 | package ModelicaServices
|
|---|
| 3 | "(version = 3.2.1, target = \"Dymola\") Models and functions used in the Modelica Standard Library requiring a tool specific implementation"
|
|---|
| 4 |
|
|---|
| 5 | package Machine
|
|---|
| 6 |
|
|---|
| 7 | final constant Real eps=1.e-15 "Biggest number such that 1.0 + eps = 1.0";
|
|---|
| 8 |
|
|---|
| 9 | final constant Real inf=1.e+60
|
|---|
| 10 | "Biggest Real number such that inf and -inf are representable on the machine";
|
|---|
| 11 | annotation (Documentation(info="<html>
|
|---|
| 12 | <p>
|
|---|
| 13 | Package in which processor specific constants are defined that are needed
|
|---|
| 14 | by numerical algorithms. Typically these constants are not directly used,
|
|---|
| 15 | but indirectly via the alias definition in
|
|---|
| 16 | <a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.
|
|---|
| 17 | </p>
|
|---|
| 18 | </html>"));
|
|---|
| 19 | end Machine;
|
|---|
| 20 | annotation (
|
|---|
| 21 | Protection(access=Access.hide),
|
|---|
| 22 | preferredView="info",
|
|---|
| 23 | version="3.2.1",
|
|---|
| 24 | versionDate="2013-01-17",
|
|---|
| 25 | versionBuild=1,
|
|---|
| 26 | uses(Modelica(version="3.2.1")),
|
|---|
| 27 | conversion(
|
|---|
| 28 | noneFromVersion="1.0",
|
|---|
| 29 | noneFromVersion="1.1",
|
|---|
| 30 | noneFromVersion="1.2"),
|
|---|
| 31 | Documentation(info="<html>
|
|---|
| 32 | <p>
|
|---|
| 33 | This package contains a set of functions and models to be used in the
|
|---|
| 34 | Modelica Standard Library that requires a tool specific implementation.
|
|---|
| 35 | These are:
|
|---|
| 36 | </p>
|
|---|
| 37 |
|
|---|
| 38 | <ul>
|
|---|
| 39 | <li> <a href=\"modelica://ModelicaServices.Animation.Shape\">Shape</a>
|
|---|
| 40 | provides a 3-dim. visualization of elementary
|
|---|
| 41 | mechanical objects. It is used in
|
|---|
| 42 | <a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape</a>
|
|---|
| 43 | via inheritance.</li>
|
|---|
| 44 |
|
|---|
| 45 | <li> <a href=\"modelica://ModelicaServices.Animation.Surface\">Surface</a>
|
|---|
| 46 | provides a 3-dim. visualization of
|
|---|
| 47 | moveable parameterized surface. It is used in
|
|---|
| 48 | <a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface</a>
|
|---|
| 49 | via inheritance.</li>
|
|---|
| 50 |
|
|---|
| 51 | <li> <a href=\"modelica://ModelicaServices.ExternalReferences.loadResource\">loadResource</a>
|
|---|
| 52 | provides a function to return the absolute path name of an URI or a local file name. It is used in
|
|---|
| 53 | <a href=\"modelica://Modelica.Utilities.Files.loadResource\">Modelica.Utilities.Files.loadResource</a>
|
|---|
| 54 | via inheritance.</li>
|
|---|
| 55 |
|
|---|
| 56 | <li> <a href=\"modelica://ModelicaServices.Machine\">ModelicaServices.Machine</a>
|
|---|
| 57 | provides a package of machine constants. It is used in
|
|---|
| 58 | <a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.</li>
|
|---|
| 59 |
|
|---|
| 60 | <li> <a href=\"modelica://ModelicaServices.Types.SolverMethod\">Types.SolverMethod</a>
|
|---|
| 61 | provides a string defining the integration method to solve differential equations in
|
|---|
| 62 | a clocked discretized continuous-time partition (see Modelica 3.3 language specification).
|
|---|
| 63 | It is not yet used in the Modelica Standard Library, but in the Modelica_Synchronous library
|
|---|
| 64 | that provides convenience blocks for the clock operators of Modelica version ≥ 3.3.</li>
|
|---|
| 65 | </ul>
|
|---|
| 66 |
|
|---|
| 67 | <p>
|
|---|
| 68 | This implementation is targeted for Dymola.
|
|---|
| 69 | </p>
|
|---|
| 70 |
|
|---|
| 71 | <p>
|
|---|
| 72 | <b>Licensed by DLR and Dassault Systèmes AB under the Modelica License 2</b><br>
|
|---|
| 73 | Copyright © 2009-2013, DLR and Dassault Systèmes AB.
|
|---|
| 74 | </p>
|
|---|
| 75 |
|
|---|
| 76 | <p>
|
|---|
| 77 | <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=\"http://www.modelica.org/licenses/ModelicaLicense2\"> http://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
|
|---|
| 78 | </p>
|
|---|
| 79 |
|
|---|
| 80 | </html>"));
|
|---|
| 81 | end ModelicaServices;
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 | package Modelica "Modelica Standard Library - Version 3.2.1 (Build 2)"
|
|---|
| 85 | extends Modelica.Icons.Package;
|
|---|
| 86 |
|
|---|
| 87 | package Blocks
|
|---|
| 88 | "Library of basic input/output control blocks (continuous, discrete, logical, table blocks)"
|
|---|
| 89 | import SI = Modelica.SIunits;
|
|---|
| 90 | extends Modelica.Icons.Package;
|
|---|
| 91 |
|
|---|
| 92 | package Continuous
|
|---|
| 93 | "Library of continuous control blocks with internal states"
|
|---|
| 94 | import Modelica.Blocks.Interfaces;
|
|---|
| 95 | import Modelica.SIunits;
|
|---|
| 96 | extends Modelica.Icons.Package;
|
|---|
| 97 |
|
|---|
| 98 | block FirstOrder "First order transfer function block (= 1 pole)"
|
|---|
| 99 | import Modelica.Blocks.Types.Init;
|
|---|
| 100 | parameter Real k(unit="1")=1 "Gain";
|
|---|
| 101 | parameter SIunits.Time T(start=1) "Time Constant";
|
|---|
| 102 | parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.NoInit
|
|---|
| 103 | "Type of initialization (1: no init, 2: steady state, 3/4: initial output)"
|
|---|
| 104 | annotation(Evaluate=true,
|
|---|
| 105 | Dialog(group="Initialization"));
|
|---|
| 106 | parameter Real y_start=0 "Initial or guess value of output (= state)"
|
|---|
| 107 | annotation (Dialog(group="Initialization"));
|
|---|
| 108 |
|
|---|
| 109 | extends Interfaces.SISO(y(start=y_start));
|
|---|
| 110 |
|
|---|
| 111 | initial equation
|
|---|
| 112 | if initType == Init.SteadyState then
|
|---|
| 113 | der(y) = 0;
|
|---|
| 114 | elseif initType == Init.InitialState or initType == Init.InitialOutput then
|
|---|
| 115 | y = y_start;
|
|---|
| 116 | end if;
|
|---|
| 117 | equation
|
|---|
| 118 | der(y) = (k*u - y)/T;
|
|---|
| 119 | annotation (
|
|---|
| 120 | Documentation(info="<HTML>
|
|---|
| 121 | <p>
|
|---|
| 122 | This blocks defines the transfer function between the input u
|
|---|
| 123 | and the output y (element-wise) as <i>first order</i> system:
|
|---|
| 124 | </p>
|
|---|
| 125 | <pre>
|
|---|
| 126 | k
|
|---|
| 127 | y = ------------ * u
|
|---|
| 128 | T * s + 1
|
|---|
| 129 | </pre>
|
|---|
| 130 | <p>
|
|---|
| 131 | If you would like to be able to change easily between different
|
|---|
| 132 | transfer functions (FirstOrder, SecondOrder, ... ) by changing
|
|---|
| 133 | parameters, use the general block <b>TransferFunction</b> instead
|
|---|
| 134 | and model a first order SISO system with parameters<br>
|
|---|
| 135 | b = {k}, a = {T, 1}.
|
|---|
| 136 | </p>
|
|---|
| 137 | <pre>
|
|---|
| 138 | Example:
|
|---|
| 139 | parameter: k = 0.3, T = 0.4
|
|---|
| 140 | results in:
|
|---|
| 141 | 0.3
|
|---|
| 142 | y = ----------- * u
|
|---|
| 143 | 0.4 s + 1.0
|
|---|
| 144 | </pre>
|
|---|
| 145 |
|
|---|
| 146 | </html>"), Icon(
|
|---|
| 147 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 148 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 149 | initialScale=0.1),
|
|---|
| 150 | graphics={
|
|---|
| 151 | Line(visible=true,
|
|---|
| 152 | points={{-80.0,78.0},{-80.0,-90.0}},
|
|---|
| 153 | color={192,192,192}),
|
|---|
| 154 | Polygon(visible=true,
|
|---|
| 155 | lineColor={192,192,192},
|
|---|
| 156 | fillColor={192,192,192},
|
|---|
| 157 | fillPattern=FillPattern.Solid,
|
|---|
| 158 | points={{-80.0,90.0},{-88.0,68.0},{-72.0,68.0},{-80.0,90.0}}),
|
|---|
| 159 | Line(visible=true,
|
|---|
| 160 | points={{-90.0,-80.0},{82.0,-80.0}},
|
|---|
| 161 | color={192,192,192}),
|
|---|
| 162 | Polygon(visible=true,
|
|---|
| 163 | lineColor={192,192,192},
|
|---|
| 164 | fillColor={192,192,192},
|
|---|
| 165 | fillPattern=FillPattern.Solid,
|
|---|
| 166 | points={{90.0,-80.0},{68.0,-72.0},{68.0,-88.0},{90.0,-80.0}}),
|
|---|
| 167 | Line(visible = true,
|
|---|
| 168 | origin = {-26.667,6.667},
|
|---|
| 169 | points = {{106.667,43.333},{-13.333,29.333},{-53.333,-86.667}},
|
|---|
| 170 | color = {0,0,127},
|
|---|
| 171 | smooth = Smooth.Bezier),
|
|---|
| 172 | Text(visible=true,
|
|---|
| 173 | lineColor={192,192,192},
|
|---|
| 174 | extent={{0.0,-60.0},{60.0,0.0}},
|
|---|
| 175 | textString="PT1"),
|
|---|
| 176 | Text(visible=true,
|
|---|
| 177 | extent={{-150.0,-150.0},{150.0,-110.0}},
|
|---|
| 178 | textString="T=%T")}),
|
|---|
| 179 | Diagram(coordinateSystem(
|
|---|
| 180 | preserveAspectRatio=true,
|
|---|
| 181 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 182 | Text(
|
|---|
| 183 | extent={{-48,52},{50,8}},
|
|---|
| 184 | lineColor={0,0,0},
|
|---|
| 185 | textString="k"),
|
|---|
| 186 | Text(
|
|---|
| 187 | extent={{-54,-6},{56,-56}},
|
|---|
| 188 | lineColor={0,0,0},
|
|---|
| 189 | textString="T s + 1"),
|
|---|
| 190 | Line(points={{-50,0},{50,0}}, color={0,0,0}),
|
|---|
| 191 | Rectangle(extent={{-60,60},{60,-60}}, lineColor={0,0,255}),
|
|---|
| 192 | Line(points={{-100,0},{-60,0}}, color={0,0,255}),
|
|---|
| 193 | Line(points={{60,0},{100,0}}, color={0,0,255})}));
|
|---|
| 194 | end FirstOrder;
|
|---|
| 195 | annotation (
|
|---|
| 196 | Documentation(info="<html>
|
|---|
| 197 | <p>
|
|---|
| 198 | This package contains basic <b>continuous</b> input/output blocks
|
|---|
| 199 | described by differential equations.
|
|---|
| 200 | </p>
|
|---|
| 201 |
|
|---|
| 202 | <p>
|
|---|
| 203 | All blocks of this package can be initialized in different
|
|---|
| 204 | ways controlled by parameter <b>initType</b>. The possible
|
|---|
| 205 | values of initType are defined in
|
|---|
| 206 | <a href=\"modelica://Modelica.Blocks.Types.Init\">Modelica.Blocks.Types.Init</a>:
|
|---|
| 207 | </p>
|
|---|
| 208 |
|
|---|
| 209 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 210 | <tr><td valign=\"top\"><b>Name</b></td>
|
|---|
| 211 | <td valign=\"top\"><b>Description</b></td></tr>
|
|---|
| 212 |
|
|---|
| 213 | <tr><td valign=\"top\"><b>Init.NoInit</b></td>
|
|---|
| 214 | <td valign=\"top\">no initialization (start values are used as guess values with fixed=false)</td></tr>
|
|---|
| 215 |
|
|---|
| 216 | <tr><td valign=\"top\"><b>Init.SteadyState</b></td>
|
|---|
| 217 | <td valign=\"top\">steady state initialization (derivatives of states are zero)</td></tr>
|
|---|
| 218 |
|
|---|
| 219 | <tr><td valign=\"top\"><b>Init.InitialState</b></td>
|
|---|
| 220 | <td valign=\"top\">Initialization with initial states</td></tr>
|
|---|
| 221 |
|
|---|
| 222 | <tr><td valign=\"top\"><b>Init.InitialOutput</b></td>
|
|---|
| 223 | <td valign=\"top\">Initialization with initial outputs (and steady state of the states if possible)</td></tr>
|
|---|
| 224 | </table>
|
|---|
| 225 |
|
|---|
| 226 | <p>
|
|---|
| 227 | For backward compatibility reasons the default of all blocks is
|
|---|
| 228 | <b>Init.NoInit</b>, with the exception of Integrator and LimIntegrator
|
|---|
| 229 | where the default is <b>Init.InitialState</b> (this was the initialization
|
|---|
| 230 | defined in version 2.2 of the Modelica standard library).
|
|---|
| 231 | </p>
|
|---|
| 232 |
|
|---|
| 233 | <p>
|
|---|
| 234 | In many cases, the most useful initial condition is
|
|---|
| 235 | <b>Init.SteadyState</b> because initial transients are then no longer
|
|---|
| 236 | present. The drawback is that in combination with a non-linear
|
|---|
| 237 | plant, non-linear algebraic equations occur that might be
|
|---|
| 238 | difficult to solve if appropriate guess values for the
|
|---|
| 239 | iteration variables are not provided (i.e., start values with fixed=false).
|
|---|
| 240 | However, it is often already useful to just initialize
|
|---|
| 241 | the linear blocks from the Continuous blocks library in SteadyState.
|
|---|
| 242 | This is uncritical, because only linear algebraic equations occur.
|
|---|
| 243 | If Init.NoInit is set, then the start values for the states are
|
|---|
| 244 | interpreted as <b>guess</b> values and are propagated to the
|
|---|
| 245 | states with fixed=<b>false</b>.
|
|---|
| 246 | </p>
|
|---|
| 247 |
|
|---|
| 248 | <p>
|
|---|
| 249 | Note, initialization with Init.SteadyState is usually difficult
|
|---|
| 250 | for a block that contains an integrator
|
|---|
| 251 | (Integrator, LimIntegrator, PI, PID, LimPID).
|
|---|
| 252 | This is due to the basic equation of an integrator:
|
|---|
| 253 | </p>
|
|---|
| 254 |
|
|---|
| 255 | <pre>
|
|---|
| 256 | <b>initial equation</b>
|
|---|
| 257 | <b>der</b>(y) = 0; // Init.SteadyState
|
|---|
| 258 | <b>equation</b>
|
|---|
| 259 | <b>der</b>(y) = k*u;
|
|---|
| 260 | </pre>
|
|---|
| 261 |
|
|---|
| 262 | <p>
|
|---|
| 263 | The steady state equation leads to the condition that the input to the
|
|---|
| 264 | integrator is zero. If the input u is already (directly or indirectly) defined
|
|---|
| 265 | by another initial condition, then the initialization problem is <b>singular</b>
|
|---|
| 266 | (has none or infinitely many solutions). This situation occurs often
|
|---|
| 267 | for mechanical systems, where, e.g., u = desiredSpeed - measuredSpeed and
|
|---|
| 268 | since speed is both a state and a derivative, it is always defined by
|
|---|
| 269 | Init.InitialState or Init.SteadyState initialization.
|
|---|
| 270 | </p>
|
|---|
| 271 |
|
|---|
| 272 | <p>
|
|---|
| 273 | In such a case, <b>Init.NoInit</b> has to be selected for the integrator
|
|---|
| 274 | and an additional initial equation has to be added to the system
|
|---|
| 275 | to which the integrator is connected. E.g., useful initial conditions
|
|---|
| 276 | for a 1-dim. rotational inertia controlled by a PI controller are that
|
|---|
| 277 | <b>angle</b>, <b>speed</b>, and <b>acceleration</b> of the inertia are zero.
|
|---|
| 278 | </p>
|
|---|
| 279 |
|
|---|
| 280 | </html>"), Icon(graphics={Line(
|
|---|
| 281 | origin={0.061,4.184},
|
|---|
| 282 | points={{81.939,36.056},{65.362,36.056},{14.39,-26.199},{-29.966,
|
|---|
| 283 | 113.485},{-65.374,-61.217},{-78.061,-78.184}},
|
|---|
| 284 | color={95,95,95},
|
|---|
| 285 | smooth=Smooth.Bezier)}));
|
|---|
| 286 | end Continuous;
|
|---|
| 287 |
|
|---|
| 288 | package Interfaces
|
|---|
| 289 | "Library of connectors and partial models for input/output blocks"
|
|---|
| 290 | import Modelica.SIunits;
|
|---|
| 291 | extends Modelica.Icons.InterfacesPackage;
|
|---|
| 292 |
|
|---|
| 293 | connector RealInput = input Real "'input Real' as connector" annotation (
|
|---|
| 294 | defaultComponentName="u",
|
|---|
| 295 | Icon(graphics={
|
|---|
| 296 | Polygon(
|
|---|
| 297 | lineColor={0,0,127},
|
|---|
| 298 | fillColor={0,0,127},
|
|---|
| 299 | fillPattern=FillPattern.Solid,
|
|---|
| 300 | points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})},
|
|---|
| 301 | coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 302 | preserveAspectRatio=true,
|
|---|
| 303 | initialScale=0.2)),
|
|---|
| 304 | Diagram(
|
|---|
| 305 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 306 | initialScale=0.2,
|
|---|
| 307 | extent={{-100.0,-100.0},{100.0,100.0}}),
|
|---|
| 308 | graphics={
|
|---|
| 309 | Polygon(
|
|---|
| 310 | lineColor={0,0,127},
|
|---|
| 311 | fillColor={0,0,127},
|
|---|
| 312 | fillPattern=FillPattern.Solid,
|
|---|
| 313 | points={{0.0,50.0},{100.0,0.0},{0.0,-50.0},{0.0,50.0}}),
|
|---|
| 314 | Text(
|
|---|
| 315 | lineColor={0,0,127},
|
|---|
| 316 | extent={{-10.0,60.0},{-10.0,85.0}},
|
|---|
| 317 | textString="%name")}),
|
|---|
| 318 | Documentation(info="<html>
|
|---|
| 319 | <p>
|
|---|
| 320 | Connector with one input signal of type Real.
|
|---|
| 321 | </p>
|
|---|
| 322 | </html>"));
|
|---|
| 323 |
|
|---|
| 324 | connector RealOutput = output Real "'output Real' as connector" annotation (
|
|---|
| 325 | defaultComponentName="y",
|
|---|
| 326 | Icon(
|
|---|
| 327 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 328 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 329 | initialScale=0.1),
|
|---|
| 330 | graphics={
|
|---|
| 331 | Polygon(
|
|---|
| 332 | lineColor={0,0,127},
|
|---|
| 333 | fillColor={255,255,255},
|
|---|
| 334 | fillPattern=FillPattern.Solid,
|
|---|
| 335 | points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}),
|
|---|
| 336 | Diagram(
|
|---|
| 337 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 338 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 339 | initialScale=0.1),
|
|---|
| 340 | graphics={
|
|---|
| 341 | Polygon(
|
|---|
| 342 | lineColor={0,0,127},
|
|---|
| 343 | fillColor={255,255,255},
|
|---|
| 344 | fillPattern=FillPattern.Solid,
|
|---|
| 345 | points={{-100.0,50.0},{0.0,0.0},{-100.0,-50.0}}),
|
|---|
| 346 | Text(
|
|---|
| 347 | lineColor={0,0,127},
|
|---|
| 348 | extent={{30.0,60.0},{30.0,110.0}},
|
|---|
| 349 | textString="%name")}),
|
|---|
| 350 | Documentation(info="<html>
|
|---|
| 351 | <p>
|
|---|
| 352 | Connector with one output signal of type Real.
|
|---|
| 353 | </p>
|
|---|
| 354 | </html>"));
|
|---|
| 355 |
|
|---|
| 356 | connector BooleanInput = input Boolean "'input Boolean' as connector"
|
|---|
| 357 | annotation (
|
|---|
| 358 | defaultComponentName="u",
|
|---|
| 359 | Icon(graphics={Polygon(
|
|---|
| 360 | points={{-100,100},{100,0},{-100,-100},{-100,100}},
|
|---|
| 361 | lineColor={255,0,255},
|
|---|
| 362 | fillColor={255,0,255},
|
|---|
| 363 | fillPattern=FillPattern.Solid)}, coordinateSystem(
|
|---|
| 364 | extent={{-100,-100},{100,100}},
|
|---|
| 365 | preserveAspectRatio=true,
|
|---|
| 366 | initialScale=0.2)),
|
|---|
| 367 | Diagram(coordinateSystem(
|
|---|
| 368 | preserveAspectRatio=true,
|
|---|
| 369 | initialScale=0.2,
|
|---|
| 370 | extent={{-100,-100},{100,100}}), graphics={Polygon(
|
|---|
| 371 | points={{0,50},{100,0},{0,-50},{0,50}},
|
|---|
| 372 | lineColor={255,0,255},
|
|---|
| 373 | fillColor={255,0,255},
|
|---|
| 374 | fillPattern=FillPattern.Solid), Text(
|
|---|
| 375 | extent={{-10,85},{-10,60}},
|
|---|
| 376 | lineColor={255,0,255},
|
|---|
| 377 | textString="%name")}),
|
|---|
| 378 | Documentation(info="<html>
|
|---|
| 379 | <p>
|
|---|
| 380 | Connector with one input signal of type Boolean.
|
|---|
| 381 | </p>
|
|---|
| 382 | </html>"));
|
|---|
| 383 |
|
|---|
| 384 | partial block SO "Single Output continuous control block"
|
|---|
| 385 | extends Modelica.Blocks.Icons.Block;
|
|---|
| 386 |
|
|---|
| 387 | RealOutput y "Connector of Real output signal" annotation (Placement(
|
|---|
| 388 | transformation(extent={{100,-10},{120,10}}, rotation=0)));
|
|---|
| 389 | annotation (Documentation(info="<html>
|
|---|
| 390 | <p>
|
|---|
| 391 | Block has one continuous Real output signal.
|
|---|
| 392 | </p>
|
|---|
| 393 | </html>"));
|
|---|
| 394 |
|
|---|
| 395 | end SO;
|
|---|
| 396 |
|
|---|
| 397 | partial block SISO "Single Input Single Output continuous control block"
|
|---|
| 398 | extends Modelica.Blocks.Icons.Block;
|
|---|
| 399 |
|
|---|
| 400 | RealInput u "Connector of Real input signal" annotation (Placement(
|
|---|
| 401 | transformation(extent={{-140,-20},{-100,20}}, rotation=0)));
|
|---|
| 402 | RealOutput y "Connector of Real output signal" annotation (Placement(
|
|---|
| 403 | transformation(extent={{100,-10},{120,10}}, rotation=0)));
|
|---|
| 404 | annotation (Documentation(info="<html>
|
|---|
| 405 | <p>
|
|---|
| 406 | Block has one continuous Real input and one continuous Real output signal.
|
|---|
| 407 | </p>
|
|---|
| 408 | </html>"));
|
|---|
| 409 | end SISO;
|
|---|
| 410 |
|
|---|
| 411 | partial block SI2SO
|
|---|
| 412 | "2 Single Input / 1 Single Output continuous control block"
|
|---|
| 413 | extends Modelica.Blocks.Icons.Block;
|
|---|
| 414 |
|
|---|
| 415 | RealInput u1 "Connector of Real input signal 1" annotation (Placement(
|
|---|
| 416 | transformation(extent={{-140,40},{-100,80}}, rotation=0)));
|
|---|
| 417 | RealInput u2 "Connector of Real input signal 2" annotation (Placement(
|
|---|
| 418 | transformation(extent={{-140,-80},{-100,-40}}, rotation=0)));
|
|---|
| 419 | RealOutput y "Connector of Real output signal" annotation (Placement(
|
|---|
| 420 | transformation(extent={{100,-10},{120,10}}, rotation=0)));
|
|---|
| 421 |
|
|---|
| 422 | annotation (Documentation(info="<html>
|
|---|
| 423 | <p>
|
|---|
| 424 | Block has two continuous Real input signals u1 and u2 and one
|
|---|
| 425 | continuous Real output signal y.
|
|---|
| 426 | </p>
|
|---|
| 427 | </html>"));
|
|---|
| 428 |
|
|---|
| 429 | end SI2SO;
|
|---|
| 430 |
|
|---|
| 431 | partial block SignalSource "Base class for continuous signal source"
|
|---|
| 432 | extends SO;
|
|---|
| 433 | parameter Real offset=0 "Offset of output signal y";
|
|---|
| 434 | parameter SIunits.Time startTime=0
|
|---|
| 435 | "Output y = offset for time < startTime";
|
|---|
| 436 | annotation (Documentation(info="<html>
|
|---|
| 437 | <p>
|
|---|
| 438 | Basic block for Real sources of package Blocks.Sources.
|
|---|
| 439 | This component has one continuous Real output signal y
|
|---|
| 440 | and two parameters (offset, startTime) to shift the
|
|---|
| 441 | generated signal.
|
|---|
| 442 | </p>
|
|---|
| 443 | </html>"));
|
|---|
| 444 | end SignalSource;
|
|---|
| 445 | annotation (Documentation(info="<HTML>
|
|---|
| 446 | <p>
|
|---|
| 447 | This package contains interface definitions for
|
|---|
| 448 | <b>continuous</b> input/output blocks with Real,
|
|---|
| 449 | Integer and Boolean signals. Furthermore, it contains
|
|---|
| 450 | partial models for continuous and discrete blocks.
|
|---|
| 451 | </p>
|
|---|
| 452 |
|
|---|
| 453 | </html>", revisions="<html>
|
|---|
| 454 | <ul>
|
|---|
| 455 | <li><i>Oct. 21, 2002</i>
|
|---|
| 456 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
|
|---|
| 457 | and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
|
|---|
| 458 | Added several new interfaces.
|
|---|
| 459 | <li><i>Oct. 24, 1999</i>
|
|---|
| 460 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 461 | RealInputSignal renamed to RealInput. RealOutputSignal renamed to
|
|---|
| 462 | output RealOutput. GraphBlock renamed to BlockIcon. SISOreal renamed to
|
|---|
| 463 | SISO. SOreal renamed to SO. I2SOreal renamed to M2SO.
|
|---|
| 464 | SignalGenerator renamed to SignalSource. Introduced the following
|
|---|
| 465 | new models: MIMO, MIMOs, SVcontrol, MVcontrol, DiscreteBlockIcon,
|
|---|
| 466 | DiscreteBlock, DiscreteSISO, DiscreteMIMO, DiscreteMIMOs,
|
|---|
| 467 | BooleanBlockIcon, BooleanSISO, BooleanSignalSource, MI2BooleanMOs.</li>
|
|---|
| 468 | <li><i>June 30, 1999</i>
|
|---|
| 469 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 470 | Realized a first version, based on an existing Dymola library
|
|---|
| 471 | of Dieter Moormann and Hilding Elmqvist.</li>
|
|---|
| 472 | </ul>
|
|---|
| 473 | </html>"));
|
|---|
| 474 | end Interfaces;
|
|---|
| 475 |
|
|---|
| 476 | package Sources
|
|---|
| 477 | "Library of signal source blocks generating Real and Boolean signals"
|
|---|
| 478 | import Modelica.Blocks.Interfaces;
|
|---|
| 479 | import Modelica.SIunits;
|
|---|
| 480 | extends Modelica.Icons.SourcesPackage;
|
|---|
| 481 |
|
|---|
| 482 | block Step "Generate step signal of type Real"
|
|---|
| 483 | parameter Real height=1 "Height of step";
|
|---|
| 484 | extends Interfaces.SignalSource;
|
|---|
| 485 |
|
|---|
| 486 | equation
|
|---|
| 487 | y = offset + (if time < startTime then 0 else height);
|
|---|
| 488 | annotation (
|
|---|
| 489 | Icon(coordinateSystem(
|
|---|
| 490 | preserveAspectRatio=true,
|
|---|
| 491 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 492 | Line(points={{-80,68},{-80,-80}}, color={192,192,192}),
|
|---|
| 493 | Polygon(
|
|---|
| 494 | points={{-80,90},{-88,68},{-72,68},{-80,90}},
|
|---|
| 495 | lineColor={192,192,192},
|
|---|
| 496 | fillColor={192,192,192},
|
|---|
| 497 | fillPattern=FillPattern.Solid),
|
|---|
| 498 | Line(points={{-90,-70},{82,-70}}, color={192,192,192}),
|
|---|
| 499 | Polygon(
|
|---|
| 500 | points={{90,-70},{68,-62},{68,-78},{90,-70}},
|
|---|
| 501 | lineColor={192,192,192},
|
|---|
| 502 | fillColor={192,192,192},
|
|---|
| 503 | fillPattern=FillPattern.Solid),
|
|---|
| 504 | Line(points={{-80,-70},{0,-70},{0,50},{80,50}}, color={0,0,0}),
|
|---|
| 505 | Text(
|
|---|
| 506 | extent={{-150,-150},{150,-110}},
|
|---|
| 507 | lineColor={0,0,0},
|
|---|
| 508 | textString="startTime=%startTime")}),
|
|---|
| 509 | Diagram(coordinateSystem(
|
|---|
| 510 | preserveAspectRatio=true,
|
|---|
| 511 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 512 | Polygon(
|
|---|
| 513 | points={{-80,90},{-86,68},{-74,68},{-80,90}},
|
|---|
| 514 | lineColor={95,95,95},
|
|---|
| 515 | fillColor={95,95,95},
|
|---|
| 516 | fillPattern=FillPattern.Solid),
|
|---|
| 517 | Line(points={{-80,68},{-80,-80}}, color={95,95,95}),
|
|---|
| 518 | Line(
|
|---|
| 519 | points={{-80,-18},{0,-18},{0,50},{80,50}},
|
|---|
| 520 | color={0,0,255},
|
|---|
| 521 | thickness=0.5),
|
|---|
| 522 | Line(points={{-90,-70},{82,-70}}, color={95,95,95}),
|
|---|
| 523 | Polygon(
|
|---|
| 524 | points={{90,-70},{68,-64},{68,-76},{90,-70}},
|
|---|
| 525 | lineColor={95,95,95},
|
|---|
| 526 | fillColor={95,95,95},
|
|---|
| 527 | fillPattern=FillPattern.Solid),
|
|---|
| 528 | Text(
|
|---|
| 529 | extent={{70,-80},{94,-100}},
|
|---|
| 530 | lineColor={0,0,0},
|
|---|
| 531 | textString="time"),
|
|---|
| 532 | Text(
|
|---|
| 533 | extent={{-21,-72},{25,-90}},
|
|---|
| 534 | lineColor={0,0,0},
|
|---|
| 535 | textString="startTime"),
|
|---|
| 536 | Line(points={{0,-18},{0,-70}}, color={95,95,95}),
|
|---|
| 537 | Text(
|
|---|
| 538 | extent={{-68,-36},{-22,-54}},
|
|---|
| 539 | lineColor={0,0,0},
|
|---|
| 540 | textString="offset"),
|
|---|
| 541 | Line(points={{-13,50},{-13,-17}}, color={95,95,95}),
|
|---|
| 542 | Polygon(
|
|---|
| 543 | points={{0,50},{-21,50},{0,50}},
|
|---|
| 544 | lineColor={95,95,95},
|
|---|
| 545 | fillColor={95,95,95},
|
|---|
| 546 | fillPattern=FillPattern.Solid),
|
|---|
| 547 | Polygon(
|
|---|
| 548 | points={{-13,-18},{-16,-5},{-10,-5},{-13,-18},{-13,-18}},
|
|---|
| 549 | lineColor={95,95,95},
|
|---|
| 550 | fillColor={95,95,95},
|
|---|
| 551 | fillPattern=FillPattern.Solid),
|
|---|
| 552 | Polygon(
|
|---|
| 553 | points={{-13,50},{-16,37},{-10,37},{-13,50}},
|
|---|
| 554 | lineColor={95,95,95},
|
|---|
| 555 | fillColor={95,95,95},
|
|---|
| 556 | fillPattern=FillPattern.Solid),
|
|---|
| 557 | Text(
|
|---|
| 558 | extent={{-68,26},{-22,8}},
|
|---|
| 559 | lineColor={0,0,0},
|
|---|
| 560 | textString="height"),
|
|---|
| 561 | Polygon(
|
|---|
| 562 | points={{-13,-70},{-16,-57},{-10,-57},{-13,-70},{-13,-70}},
|
|---|
| 563 | lineColor={95,95,95},
|
|---|
| 564 | fillColor={95,95,95},
|
|---|
| 565 | fillPattern=FillPattern.Solid),
|
|---|
| 566 | Line(points={{-13,-18},{-13,-70}}, color={95,95,95}),
|
|---|
| 567 | Polygon(
|
|---|
| 568 | points={{-13,-18},{-16,-31},{-10,-31},{-13,-18}},
|
|---|
| 569 | lineColor={95,95,95},
|
|---|
| 570 | fillColor={95,95,95},
|
|---|
| 571 | fillPattern=FillPattern.Solid),
|
|---|
| 572 | Text(
|
|---|
| 573 | extent={{-72,100},{-31,80}},
|
|---|
| 574 | lineColor={0,0,0},
|
|---|
| 575 | textString="y")}),
|
|---|
| 576 | Documentation(info="<html>
|
|---|
| 577 | <p>
|
|---|
| 578 | The Real output y is a step signal:
|
|---|
| 579 | </p>
|
|---|
| 580 |
|
|---|
| 581 | <p>
|
|---|
| 582 | <img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Step.png\"
|
|---|
| 583 | alt=\"Step.png\">
|
|---|
| 584 | </p>
|
|---|
| 585 |
|
|---|
| 586 | </html>"));
|
|---|
| 587 | end Step;
|
|---|
| 588 |
|
|---|
| 589 | block Ramp "Generate ramp signal"
|
|---|
| 590 | parameter Real height=1 "Height of ramps";
|
|---|
| 591 | parameter Modelica.SIunits.Time duration(min=0.0, start=2)
|
|---|
| 592 | "Duration of ramp (= 0.0 gives a Step)";
|
|---|
| 593 | parameter Real offset=0 "Offset of output signal";
|
|---|
| 594 | parameter Modelica.SIunits.Time startTime=0
|
|---|
| 595 | "Output = offset for time < startTime";
|
|---|
| 596 | extends Interfaces.SO;
|
|---|
| 597 |
|
|---|
| 598 | equation
|
|---|
| 599 | y = offset + (if time < startTime then 0 else if time < (startTime +
|
|---|
| 600 | duration) then (time - startTime)*height/duration else height);
|
|---|
| 601 | annotation (
|
|---|
| 602 | Icon(coordinateSystem(
|
|---|
| 603 | preserveAspectRatio=true,
|
|---|
| 604 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 605 | Line(points={{-80,68},{-80,-80}}, color={192,192,192}),
|
|---|
| 606 | Polygon(
|
|---|
| 607 | points={{-80,90},{-88,68},{-72,68},{-80,90}},
|
|---|
| 608 | lineColor={192,192,192},
|
|---|
| 609 | fillColor={192,192,192},
|
|---|
| 610 | fillPattern=FillPattern.Solid),
|
|---|
| 611 | Line(points={{-90,-70},{82,-70}}, color={192,192,192}),
|
|---|
| 612 | Polygon(
|
|---|
| 613 | points={{90,-70},{68,-62},{68,-78},{90,-70}},
|
|---|
| 614 | lineColor={192,192,192},
|
|---|
| 615 | fillColor={192,192,192},
|
|---|
| 616 | fillPattern=FillPattern.Solid),
|
|---|
| 617 | Line(points={{-80,-70},{-40,-70},{31,38}}, color={0,0,0}),
|
|---|
| 618 | Text(
|
|---|
| 619 | extent={{-150,-150},{150,-110}},
|
|---|
| 620 | lineColor={0,0,0},
|
|---|
| 621 | textString="duration=%duration"),
|
|---|
| 622 | Line(points={{31,38},{86,38}}, color={0,0,0})}),
|
|---|
| 623 | Diagram(coordinateSystem(
|
|---|
| 624 | preserveAspectRatio=true,
|
|---|
| 625 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 626 | Polygon(
|
|---|
| 627 | points={{-80,90},{-86,68},{-74,68},{-80,90}},
|
|---|
| 628 | lineColor={95,95,95},
|
|---|
| 629 | fillColor={95,95,95},
|
|---|
| 630 | fillPattern=FillPattern.Solid),
|
|---|
| 631 | Line(points={{-80,68},{-80,-80}}, color={95,95,95}),
|
|---|
| 632 | Line(
|
|---|
| 633 | points={{-80,-20},{-20,-20},{50,50}},
|
|---|
| 634 | color={0,0,255},
|
|---|
| 635 | thickness=0.5),
|
|---|
| 636 | Line(points={{-90,-70},{82,-70}}, color={95,95,95}),
|
|---|
| 637 | Polygon(
|
|---|
| 638 | points={{90,-70},{68,-64},{68,-76},{90,-70}},
|
|---|
| 639 | lineColor={95,95,95},
|
|---|
| 640 | fillColor={95,95,95},
|
|---|
| 641 | fillPattern=FillPattern.Solid),
|
|---|
| 642 | Polygon(
|
|---|
| 643 | points={{-40,-20},{-42,-30},{-38,-30},{-40,-20}},
|
|---|
| 644 | lineColor={95,95,95},
|
|---|
| 645 | fillColor={95,95,95},
|
|---|
| 646 | fillPattern=FillPattern.Solid),
|
|---|
| 647 | Line(
|
|---|
| 648 | points={{-40,-20},{-40,-70}},
|
|---|
| 649 | color={95,95,95},
|
|---|
| 650 | thickness=0.25,
|
|---|
| 651 | arrow={Arrow.None,Arrow.None}),
|
|---|
| 652 | Polygon(
|
|---|
| 653 | points={{-40,-70},{-42,-60},{-38,-60},{-40,-70},{-40,-70}},
|
|---|
| 654 | lineColor={95,95,95},
|
|---|
| 655 | fillColor={95,95,95},
|
|---|
| 656 | fillPattern=FillPattern.Solid),
|
|---|
| 657 | Text(
|
|---|
| 658 | extent={{-72,-39},{-34,-50}},
|
|---|
| 659 | lineColor={0,0,0},
|
|---|
| 660 | textString="offset"),
|
|---|
| 661 | Text(
|
|---|
| 662 | extent={{-38,-72},{6,-83}},
|
|---|
| 663 | lineColor={0,0,0},
|
|---|
| 664 | textString="startTime"),
|
|---|
| 665 | Text(
|
|---|
| 666 | extent={{-78,92},{-37,72}},
|
|---|
| 667 | lineColor={0,0,0},
|
|---|
| 668 | textString="y"),
|
|---|
| 669 | Text(
|
|---|
| 670 | extent={{70,-80},{94,-91}},
|
|---|
| 671 | lineColor={0,0,0},
|
|---|
| 672 | textString="time"),
|
|---|
| 673 | Line(points={{-20,-20},{-20,-70}}, color={95,95,95}),
|
|---|
| 674 | Line(
|
|---|
| 675 | points={{-19,-20},{50,-20}},
|
|---|
| 676 | color={95,95,95},
|
|---|
| 677 | thickness=0.25,
|
|---|
| 678 | arrow={Arrow.None,Arrow.None}),
|
|---|
| 679 | Line(
|
|---|
| 680 | points={{50,50},{101,50}},
|
|---|
| 681 | color={0,0,255},
|
|---|
| 682 | thickness=0.5),
|
|---|
| 683 | Line(
|
|---|
| 684 | points={{50,50},{50,-20}},
|
|---|
| 685 | color={95,95,95},
|
|---|
| 686 | thickness=0.25,
|
|---|
| 687 | arrow={Arrow.None,Arrow.None}),
|
|---|
| 688 | Polygon(
|
|---|
| 689 | points={{50,-20},{42,-18},{42,-22},{50,-20}},
|
|---|
| 690 | lineColor={95,95,95},
|
|---|
| 691 | fillColor={95,95,95},
|
|---|
| 692 | fillPattern=FillPattern.Solid),
|
|---|
| 693 | Polygon(
|
|---|
| 694 | points={{-20,-20},{-11,-18},{-11,-22},{-20,-20}},
|
|---|
| 695 | lineColor={95,95,95},
|
|---|
| 696 | fillColor={95,95,95},
|
|---|
| 697 | fillPattern=FillPattern.Solid),
|
|---|
| 698 | Polygon(
|
|---|
| 699 | points={{50,50},{48,40},{52,40},{50,50}},
|
|---|
| 700 | lineColor={95,95,95},
|
|---|
| 701 | fillColor={95,95,95},
|
|---|
| 702 | fillPattern=FillPattern.Solid),
|
|---|
| 703 | Polygon(
|
|---|
| 704 | points={{50,-20},{48,-10},{52,-10},{50,-20},{50,-20}},
|
|---|
| 705 | lineColor={95,95,95},
|
|---|
| 706 | fillColor={95,95,95},
|
|---|
| 707 | fillPattern=FillPattern.Solid),
|
|---|
| 708 | Text(
|
|---|
| 709 | extent={{53,23},{82,10}},
|
|---|
| 710 | lineColor={0,0,0},
|
|---|
| 711 | textString="height"),
|
|---|
| 712 | Text(
|
|---|
| 713 | extent={{-2,-21},{37,-33}},
|
|---|
| 714 | lineColor={0,0,0},
|
|---|
| 715 | textString="duration")}),
|
|---|
| 716 | Documentation(info="<html>
|
|---|
| 717 | <p>
|
|---|
| 718 | The Real output y is a ramp signal:
|
|---|
| 719 | </p>
|
|---|
| 720 |
|
|---|
| 721 | <p>
|
|---|
| 722 | <img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Ramp.png\"
|
|---|
| 723 | alt=\"Ramp.png\">
|
|---|
| 724 | </p>
|
|---|
| 725 |
|
|---|
| 726 | <p>
|
|---|
| 727 | If parameter duration is set to 0.0, the limiting case of a Step signal is achieved.
|
|---|
| 728 | </p>
|
|---|
| 729 | </html>"));
|
|---|
| 730 | end Ramp;
|
|---|
| 731 | annotation (Documentation(info="<HTML>
|
|---|
| 732 | <p>
|
|---|
| 733 | This package contains <b>source</b> components, i.e., blocks which
|
|---|
| 734 | have only output signals. These blocks are used as signal generators
|
|---|
| 735 | for Real, Integer and Boolean signals.
|
|---|
| 736 | </p>
|
|---|
| 737 |
|
|---|
| 738 | <p>
|
|---|
| 739 | All Real source signals (with the exception of the Constant source)
|
|---|
| 740 | have at least the following two parameters:
|
|---|
| 741 | </p>
|
|---|
| 742 |
|
|---|
| 743 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 744 | <tr><td valign=\"top\"><b>offset</b></td>
|
|---|
| 745 | <td valign=\"top\">Value which is added to the signal</td>
|
|---|
| 746 | </tr>
|
|---|
| 747 | <tr><td valign=\"top\"><b>startTime</b></td>
|
|---|
| 748 | <td valign=\"top\">Start time of signal. For time < startTime,
|
|---|
| 749 | the output y is set to offset.</td>
|
|---|
| 750 | </tr>
|
|---|
| 751 | </table>
|
|---|
| 752 |
|
|---|
| 753 | <p>
|
|---|
| 754 | The <b>offset</b> parameter is especially useful in order to shift
|
|---|
| 755 | the corresponding source, such that at initial time the system
|
|---|
| 756 | is stationary. To determine the corresponding value of offset,
|
|---|
| 757 | usually requires a trimming calculation.
|
|---|
| 758 | </p>
|
|---|
| 759 | </html>", revisions="<html>
|
|---|
| 760 | <ul>
|
|---|
| 761 | <li><i>October 21, 2002</i>
|
|---|
| 762 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
|
|---|
| 763 | and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
|
|---|
| 764 | Integer sources added. Step, TimeTable and BooleanStep slightly changed.</li>
|
|---|
| 765 | <li><i>Nov. 8, 1999</i>
|
|---|
| 766 | by <a href=\"mailto:clauss@eas.iis.fhg.de\">Christoph Clauß</a>,
|
|---|
| 767 | <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
|
|---|
| 768 | <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 769 | New sources: Exponentials, TimeTable. Trapezoid slightly enhanced
|
|---|
| 770 | (nperiod=-1 is an infinite number of periods).</li>
|
|---|
| 771 | <li><i>Oct. 31, 1999</i>
|
|---|
| 772 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 773 | <a href=\"mailto:clauss@eas.iis.fhg.de\">Christoph Clauß</a>,
|
|---|
| 774 | <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
|
|---|
| 775 | All sources vectorized. New sources: ExpSine, Trapezoid,
|
|---|
| 776 | BooleanConstant, BooleanStep, BooleanPulse, SampleTrigger.
|
|---|
| 777 | Improved documentation, especially detailed description of
|
|---|
| 778 | signals in diagram layer.</li>
|
|---|
| 779 | <li><i>June 29, 1999</i>
|
|---|
| 780 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 781 | Realized a first version, based on an existing Dymola library
|
|---|
| 782 | of Dieter Moormann and Hilding Elmqvist.</li>
|
|---|
| 783 | </ul>
|
|---|
| 784 | </html>"));
|
|---|
| 785 | end Sources;
|
|---|
| 786 |
|
|---|
| 787 | package Tables
|
|---|
| 788 | "Library of blocks to interpolate in one and two-dimensional tables"
|
|---|
| 789 | extends Modelica.Icons.Package;
|
|---|
| 790 |
|
|---|
| 791 | block CombiTable2D "Table look-up in two dimensions (matrix/file)"
|
|---|
| 792 | extends Modelica.Blocks.Interfaces.SI2SO;
|
|---|
| 793 | parameter Boolean tableOnFile=false
|
|---|
| 794 | "= true, if table is defined on file or in function usertab"
|
|---|
| 795 | annotation (Dialog(group="Table data definition"));
|
|---|
| 796 | parameter Real table[:, :] = fill(0.0, 0, 2)
|
|---|
| 797 | "Table matrix (grid u1 = first column, grid u2 = first row; e.g., table=[0,0;0,1])"
|
|---|
| 798 | annotation (Dialog(group="Table data definition",enable=not tableOnFile));
|
|---|
| 799 | parameter String tableName="NoName"
|
|---|
| 800 | "Table name on file or in function usertab (see docu)"
|
|---|
| 801 | annotation (Dialog(group="Table data definition",enable=tableOnFile));
|
|---|
| 802 | parameter String fileName="NoName" "File where matrix is stored"
|
|---|
| 803 | annotation (Dialog(
|
|---|
| 804 | group="Table data definition",
|
|---|
| 805 | enable=tableOnFile,
|
|---|
| 806 | loadSelector(filter="Text files (*.txt);;MATLAB MAT-files (*.mat)",
|
|---|
| 807 | caption="Open file in which table is present")));
|
|---|
| 808 | parameter Boolean verboseRead=true
|
|---|
| 809 | "= true, if info message that file is loading is to be printed"
|
|---|
| 810 | annotation (Dialog(group="Table data definition",enable=tableOnFile));
|
|---|
| 811 | parameter Modelica.Blocks.Types.Smoothness smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments
|
|---|
| 812 | "Smoothness of table interpolation"
|
|---|
| 813 | annotation (Dialog(group="Table data interpretation"));
|
|---|
| 814 | protected
|
|---|
| 815 | Modelica.Blocks.Types.ExternalCombiTable2D tableID=
|
|---|
| 816 | Modelica.Blocks.Types.ExternalCombiTable2D(
|
|---|
| 817 | if tableOnFile then tableName else "NoName",
|
|---|
| 818 | if tableOnFile and fileName <> "NoName" and not Modelica.Utilities.Strings.isEmpty(fileName) then fileName else "NoName",
|
|---|
| 819 | table,
|
|---|
| 820 | smoothness) "External table object";
|
|---|
| 821 | parameter Real tableOnFileRead(fixed=false)
|
|---|
| 822 | "= 1, if table was successfully read from file";
|
|---|
| 823 |
|
|---|
| 824 | function readTableData
|
|---|
| 825 | "Read table data from ASCII text or MATLAB MAT-file"
|
|---|
| 826 | extends Modelica.Icons.Function;
|
|---|
| 827 | input Modelica.Blocks.Types.ExternalCombiTable2D tableID;
|
|---|
| 828 | input Boolean forceRead = false
|
|---|
| 829 | "= true: Force reading of table data; = false: Only read, if not yet read.";
|
|---|
| 830 | input Boolean verboseRead
|
|---|
| 831 | "= true: Print info message; = false: No info message";
|
|---|
| 832 | output Real readSuccess "Table read success";
|
|---|
| 833 | external"C" readSuccess = ModelicaStandardTables_CombiTable2D_read(tableID, forceRead, verboseRead)
|
|---|
| 834 | annotation (Library={"ModelicaStandardTables"});
|
|---|
| 835 | end readTableData;
|
|---|
| 836 |
|
|---|
| 837 | function getTableValue "Interpolate 2-dim. table defined by matrix"
|
|---|
| 838 | extends Modelica.Icons.Function;
|
|---|
| 839 | input Modelica.Blocks.Types.ExternalCombiTable2D tableID;
|
|---|
| 840 | input Real u1;
|
|---|
| 841 | input Real u2;
|
|---|
| 842 | input Real tableAvailable
|
|---|
| 843 | "Dummy input to ensure correct sorting of function calls";
|
|---|
| 844 | output Real y;
|
|---|
| 845 | external"C" y = ModelicaStandardTables_CombiTable2D_getValue(tableID, u1, u2)
|
|---|
| 846 | annotation (Library={"ModelicaStandardTables"});
|
|---|
| 847 | annotation (derivative(noDerivative=tableAvailable) = getDerTableValue);
|
|---|
| 848 | end getTableValue;
|
|---|
| 849 |
|
|---|
| 850 | function getTableValueNoDer
|
|---|
| 851 | "Interpolate 2-dim. table defined by matrix (but do not provide a derivative function)"
|
|---|
| 852 | extends Modelica.Icons.Function;
|
|---|
| 853 | input Modelica.Blocks.Types.ExternalCombiTable2D tableID;
|
|---|
| 854 | input Real u1;
|
|---|
| 855 | input Real u2;
|
|---|
| 856 | input Real tableAvailable
|
|---|
| 857 | "Dummy input to ensure correct sorting of function calls";
|
|---|
| 858 | output Real y;
|
|---|
| 859 | external"C" y = ModelicaStandardTables_CombiTable2D_getValue(tableID, u1, u2)
|
|---|
| 860 | annotation (Library={"ModelicaStandardTables"});
|
|---|
| 861 | end getTableValueNoDer;
|
|---|
| 862 |
|
|---|
| 863 | function getDerTableValue
|
|---|
| 864 | "Derivative of interpolated 2-dim. table defined by matrix"
|
|---|
| 865 | extends Modelica.Icons.Function;
|
|---|
| 866 | input Modelica.Blocks.Types.ExternalCombiTable2D tableID;
|
|---|
| 867 | input Real u1;
|
|---|
| 868 | input Real u2;
|
|---|
| 869 | input Real tableAvailable
|
|---|
| 870 | "Dummy input to ensure correct sorting of function calls";
|
|---|
| 871 | input Real der_u1;
|
|---|
| 872 | input Real der_u2;
|
|---|
| 873 | output Real der_y;
|
|---|
| 874 | external"C" der_y = ModelicaStandardTables_CombiTable2D_getDerValue(tableID, u1, u2, der_u1, der_u2)
|
|---|
| 875 | annotation (Library={"ModelicaStandardTables"});
|
|---|
| 876 | end getDerTableValue;
|
|---|
| 877 |
|
|---|
| 878 | initial algorithm
|
|---|
| 879 | if tableOnFile then
|
|---|
| 880 | tableOnFileRead := readTableData(tableID, false, verboseRead);
|
|---|
| 881 | else
|
|---|
| 882 | tableOnFileRead := 1.;
|
|---|
| 883 | end if;
|
|---|
| 884 | equation
|
|---|
| 885 | if tableOnFile then
|
|---|
| 886 | assert(tableName <> "NoName",
|
|---|
| 887 | "tableOnFile = true and no table name given");
|
|---|
| 888 | else
|
|---|
| 889 | assert(size(table, 1) > 0 and size(table, 2) > 0,
|
|---|
| 890 | "tableOnFile = false and parameter table is an empty matrix");
|
|---|
| 891 | end if;
|
|---|
| 892 | if smoothness == Modelica.Blocks.Types.Smoothness.ConstantSegments then
|
|---|
| 893 | y = getTableValueNoDer(tableID, u1, u2, tableOnFileRead);
|
|---|
| 894 | else
|
|---|
| 895 | y = getTableValue(tableID, u1, u2, tableOnFileRead);
|
|---|
| 896 | end if;
|
|---|
| 897 | annotation (
|
|---|
| 898 | Documentation(info="<html>
|
|---|
| 899 | <p>
|
|---|
| 900 | <b>Linear interpolation</b> in <b>two</b> dimensions of a <b>table</b>.
|
|---|
| 901 | The grid points and function values are stored in a matrix \"table[i,j]\",
|
|---|
| 902 | where:
|
|---|
| 903 | </p>
|
|---|
| 904 | <ul>
|
|---|
| 905 | <li> the first column \"table[2:,1]\" contains the u[1] grid points,</li>
|
|---|
| 906 | <li> the first row \"table[1,2:]\" contains the u[2] grid points,</li>
|
|---|
| 907 | <li> the other rows and columns contain the data to be interpolated.</li>
|
|---|
| 908 | </ul>
|
|---|
| 909 | <p>
|
|---|
| 910 | Example:
|
|---|
| 911 | </p>
|
|---|
| 912 | <pre>
|
|---|
| 913 | | | | |
|
|---|
| 914 | | 1.0 | 2.0 | 3.0 | // u2
|
|---|
| 915 | ----*-------*-------*-------*
|
|---|
| 916 | 1.0 | 1.0 | 3.0 | 5.0 |
|
|---|
| 917 | ----*-------*-------*-------*
|
|---|
| 918 | 2.0 | 2.0 | 4.0 | 6.0 |
|
|---|
| 919 | ----*-------*-------*-------*
|
|---|
| 920 | // u1
|
|---|
| 921 | is defined as
|
|---|
| 922 | table = [0.0, 1.0, 2.0, 3.0;
|
|---|
| 923 | 1.0, 1.0, 3.0, 5.0;
|
|---|
| 924 | 2.0, 2.0, 4.0, 6.0]
|
|---|
| 925 | If, e.g., the input u is [1.0;1.0], the output y is 1.0,
|
|---|
| 926 | e.g., the input u is [2.0;1.5], the output y is 3.0.
|
|---|
| 927 | </pre>
|
|---|
| 928 | <ul>
|
|---|
| 929 | <li> The interpolation is <b>efficient</b>, because a search for a new
|
|---|
| 930 | interpolation starts at the interval used in the last call.</li>
|
|---|
| 931 | <li> If the table has only <b>one element</b>, the table value is returned,
|
|---|
| 932 | independent of the value of the input signal.</li>
|
|---|
| 933 | <li> If the input signal <b>u1</b> or <b>u2</b> is <b>outside</b> of the defined
|
|---|
| 934 | <b>interval</b>, the corresponding value is also determined by linear
|
|---|
| 935 | interpolation through the last or first two points of the table.</li>
|
|---|
| 936 | <li> The grid values (first column and first row) have to be strictly
|
|---|
| 937 | increasing.</li>
|
|---|
| 938 | </ul>
|
|---|
| 939 | <p>
|
|---|
| 940 | The table matrix can be defined in the following ways:
|
|---|
| 941 | </p>
|
|---|
| 942 | <ol>
|
|---|
| 943 | <li> Explicitly supplied as <b>parameter matrix</b> \"table\",
|
|---|
| 944 | and the other parameters have the following values:
|
|---|
| 945 | <pre>
|
|---|
| 946 | tableName is \"NoName\" or has only blanks,
|
|---|
| 947 | fileName is \"NoName\" or has only blanks.
|
|---|
| 948 | </pre></li>
|
|---|
| 949 | <li> <b>Read</b> from a <b>file</b> \"fileName\" where the matrix is stored as
|
|---|
| 950 | \"tableName\". Both ASCII and MAT-file format is possible.
|
|---|
| 951 | (The ASCII format is described below).
|
|---|
| 952 | The MAT-file format comes in four different versions: v4, v6, v7 and v7.3.
|
|---|
| 953 | The library supports at least v4, v6 and v7 whereas v7.3 is optional.
|
|---|
| 954 | It is most convenient to generate the MAT-file from FreeMat or MATLAB®
|
|---|
| 955 | by command
|
|---|
| 956 | <pre>
|
|---|
| 957 | save tables.mat tab1 tab2 tab3
|
|---|
| 958 | </pre>
|
|---|
| 959 | or Scilab by command
|
|---|
| 960 | <pre>
|
|---|
| 961 | savematfile tables.mat tab1 tab2 tab3
|
|---|
| 962 | </pre>
|
|---|
| 963 | when the three tables tab1, tab2, tab3 should be used from the model.<br>
|
|---|
| 964 | Note, a fileName can be defined as URI by using the helper function
|
|---|
| 965 | <a href=\"modelica://Modelica.Utilities.Files.loadResource\">loadResource</a>.</li>
|
|---|
| 966 | <li> Statically stored in function \"usertab\" in file \"usertab.c\".
|
|---|
| 967 | The matrix is identified by \"tableName\". Parameter
|
|---|
| 968 | fileName = \"NoName\" or has only blanks. Row-wise storage is always to be
|
|---|
| 969 | preferred as otherwise the table is reallocated and transposed.
|
|---|
| 970 | See the <a href=\"modelica://Modelica.Blocks.Tables\">Tables</a> package
|
|---|
| 971 | documentation for more details.</li>
|
|---|
| 972 | </ol>
|
|---|
| 973 | <p>
|
|---|
| 974 | When the constant \"NO_FILE_SYSTEM\" is defined, all file I/O related parts of the
|
|---|
| 975 | source code are removed by the C-preprocessor, such that no access to files takes place.
|
|---|
| 976 | </p>
|
|---|
| 977 | <p>
|
|---|
| 978 | If tables are read from an ASCII-file, the file needs to have the
|
|---|
| 979 | following structure (\"-----\" is not part of the file content):
|
|---|
| 980 | </p>
|
|---|
| 981 | <pre>
|
|---|
| 982 | -----------------------------------------------------
|
|---|
| 983 | #1
|
|---|
| 984 | double table2D_1(3,4) # comment line
|
|---|
| 985 | 0.0 1.0 2.0 3.0 # u[2] grid points
|
|---|
| 986 | 1.0 1.0 3.0 5.0
|
|---|
| 987 | 2.0 2.0 4.0 6.0
|
|---|
| 988 |
|
|---|
| 989 | double table2D_2(4,4) # comment line
|
|---|
| 990 | 0.0 1.0 2.0 3.0 # u[2] grid points
|
|---|
| 991 | 1.0 1.0 3.0 5.0
|
|---|
| 992 | 2.0 2.0 4.0 6.0
|
|---|
| 993 | 3.0 3.0 5.0 7.0
|
|---|
| 994 | -----------------------------------------------------
|
|---|
| 995 | </pre>
|
|---|
| 996 | <p>
|
|---|
| 997 | Note, that the first two characters in the file need to be
|
|---|
| 998 | \"#1\" (a line comment defining the version number of the file format).
|
|---|
| 999 | Afterwards, the corresponding matrix has to be declared
|
|---|
| 1000 | with type (= \"double\" or \"float\"), name and actual dimensions.
|
|---|
| 1001 | Finally, in successive rows of the file, the elements of the matrix
|
|---|
| 1002 | have to be given. The elements have to be provided as a sequence of
|
|---|
| 1003 | numbers in row-wise order (therefore a matrix row can span several
|
|---|
| 1004 | lines in the file and need not start at the beginning of a line).
|
|---|
| 1005 | Numbers have to be given according to C syntax (such as 2.3, -2, +2.e4).
|
|---|
| 1006 | Number separators are spaces, tab (\t), comma (,), or semicolon (;).
|
|---|
| 1007 | Several matrices may be defined one after another. Line comments start
|
|---|
| 1008 | with the hash symbol (#) and can appear everywhere.
|
|---|
| 1009 | Other characters, like trailing non comments, are not allowed in the file.
|
|---|
| 1010 | The matrix elements are interpreted in exactly the same way
|
|---|
| 1011 | as if the matrix is given as a parameter. For example, the first
|
|---|
| 1012 | column \"table2D_1[2:,1]\" contains the u[1] grid points,
|
|---|
| 1013 | and the first row \"table2D_1[1,2:]\" contains the u[2] grid points.
|
|---|
| 1014 | </p>
|
|---|
| 1015 |
|
|---|
| 1016 | <p>
|
|---|
| 1017 | MATLAB is a registered trademark of The MathWorks, Inc.
|
|---|
| 1018 | </p>
|
|---|
| 1019 | </html>"),Icon(
|
|---|
| 1020 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 1021 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 1022 | initialScale=0.1),
|
|---|
| 1023 | graphics={
|
|---|
| 1024 | Line(points={{-60.0,40.0},{-60.0,-40.0},{60.0,-40.0},{60.0,40.0},{30.0,40.0},{30.0,-40.0},{-30.0,-40.0},{-30.0,40.0},{-60.0,40.0},{-60.0,20.0},{60.0,20.0},{60.0,0.0},{-60.0,0.0},{-60.0,-20.0},{60.0,-20.0},{60.0,-40.0},{-60.0,-40.0},{-60.0,40.0},{60.0,40.0},{60.0,-40.0}}),
|
|---|
| 1025 | Line(points={{0.0,40.0},{0.0,-40.0}}),
|
|---|
| 1026 | Line(points={{-60.0,40.0},{-30.0,20.0}}),
|
|---|
| 1027 | Line(points={{-30.0,40.0},{-60.0,20.0}}),
|
|---|
| 1028 | Rectangle(origin={2.3077,-0.0},
|
|---|
| 1029 | fillColor={255,215,136},
|
|---|
| 1030 | fillPattern=FillPattern.Solid,
|
|---|
| 1031 | extent={{-62.3077,0.0},{-32.3077,20.0}}),
|
|---|
| 1032 | Rectangle(origin={2.3077,-0.0},
|
|---|
| 1033 | fillColor={255,215,136},
|
|---|
| 1034 | fillPattern=FillPattern.Solid,
|
|---|
| 1035 | extent={{-62.3077,-20.0},{-32.3077,0.0}}),
|
|---|
| 1036 | Rectangle(origin={2.3077,-0.0},
|
|---|
| 1037 | fillColor={255,215,136},
|
|---|
| 1038 | fillPattern=FillPattern.Solid,
|
|---|
| 1039 | extent={{-62.3077,-40.0},{-32.3077,-20.0}}),
|
|---|
| 1040 | Rectangle(fillColor={255,215,136},
|
|---|
| 1041 | fillPattern=FillPattern.Solid,
|
|---|
| 1042 | extent={{-30.0,20.0},{0.0,40.0}}),
|
|---|
| 1043 | Rectangle(fillColor={255,215,136},
|
|---|
| 1044 | fillPattern=FillPattern.Solid,
|
|---|
| 1045 | extent={{0.0,20.0},{30.0,40.0}}),
|
|---|
| 1046 | Rectangle(origin={-2.3077,-0.0},
|
|---|
| 1047 | fillColor={255,215,136},
|
|---|
| 1048 | fillPattern=FillPattern.Solid,
|
|---|
| 1049 | extent={{32.3077,20.0},{62.3077,40.0}})}),
|
|---|
| 1050 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
|
|---|
| 1051 | 100,100}}), graphics={
|
|---|
| 1052 | Rectangle(
|
|---|
| 1053 | extent={{-60,60},{60,-60}},
|
|---|
| 1054 | fillColor={235,235,235},
|
|---|
| 1055 | fillPattern=FillPattern.Solid,
|
|---|
| 1056 | lineColor={0,0,255}),
|
|---|
| 1057 | Line(points={{60,0},{100,0}}, color={0,0,255}),
|
|---|
| 1058 | Text(
|
|---|
| 1059 | extent={{-100,100},{100,64}},
|
|---|
| 1060 | textString="2 dimensional linear table interpolation",
|
|---|
| 1061 | lineColor={0,0,255}),
|
|---|
| 1062 | Line(points={{-54,40},{-54,-40},{54,-40},{54,40},{28,40},{28,-40},{-28,
|
|---|
| 1063 | -40},{-28,40},{-54,40},{-54,20},{54,20},{54,0},{-54,0},{-54,-20},
|
|---|
| 1064 | {54,-20},{54,-40},{-54,-40},{-54,40},{54,40},{54,-40}}, color={
|
|---|
| 1065 | 0,0,0}),
|
|---|
| 1066 | Line(points={{0,40},{0,-40}}, color={0,0,0}),
|
|---|
| 1067 | Rectangle(
|
|---|
| 1068 | extent={{-54,20},{-28,0}},
|
|---|
| 1069 | lineColor={0,0,0},
|
|---|
| 1070 | fillColor={255,255,0},
|
|---|
| 1071 | fillPattern=FillPattern.Solid),
|
|---|
| 1072 | Rectangle(
|
|---|
| 1073 | extent={{-54,0},{-28,-20}},
|
|---|
| 1074 | lineColor={0,0,0},
|
|---|
| 1075 | fillColor={255,255,0},
|
|---|
| 1076 | fillPattern=FillPattern.Solid),
|
|---|
| 1077 | Rectangle(
|
|---|
| 1078 | extent={{-54,-20},{-28,-40}},
|
|---|
| 1079 | lineColor={0,0,0},
|
|---|
| 1080 | fillColor={255,255,0},
|
|---|
| 1081 | fillPattern=FillPattern.Solid),
|
|---|
| 1082 | Rectangle(
|
|---|
| 1083 | extent={{-28,40},{0,20}},
|
|---|
| 1084 | lineColor={0,0,0},
|
|---|
| 1085 | fillColor={255,255,0},
|
|---|
| 1086 | fillPattern=FillPattern.Solid),
|
|---|
| 1087 | Rectangle(
|
|---|
| 1088 | extent={{0,40},{28,20}},
|
|---|
| 1089 | lineColor={0,0,0},
|
|---|
| 1090 | fillColor={255,255,0},
|
|---|
| 1091 | fillPattern=FillPattern.Solid),
|
|---|
| 1092 | Rectangle(
|
|---|
| 1093 | extent={{28,40},{54,20}},
|
|---|
| 1094 | lineColor={0,0,0},
|
|---|
| 1095 | fillColor={255,255,0},
|
|---|
| 1096 | fillPattern=FillPattern.Solid),
|
|---|
| 1097 | Line(points={{-54,40},{-28,20}}, color={0,0,0}),
|
|---|
| 1098 | Line(points={{-28,40},{-54,20}}, color={0,0,0}),
|
|---|
| 1099 | Text(
|
|---|
| 1100 | extent={{-54,-40},{-30,-56}},
|
|---|
| 1101 | textString="u1",
|
|---|
| 1102 | lineColor={0,0,255}),
|
|---|
| 1103 | Text(
|
|---|
| 1104 | extent={{28,58},{52,44}},
|
|---|
| 1105 | textString="u2",
|
|---|
| 1106 | lineColor={0,0,255}),
|
|---|
| 1107 | Text(
|
|---|
| 1108 | extent={{-2,12},{32,-22}},
|
|---|
| 1109 | textString="y",
|
|---|
| 1110 | lineColor={0,0,255})}));
|
|---|
| 1111 | end CombiTable2D;
|
|---|
| 1112 | annotation (Documentation(info="<html>
|
|---|
| 1113 | <p>This package contains blocks for one- and two-dimensional interpolation in tables. </p>
|
|---|
| 1114 | <h4>Special interest topic: Statically stored tables for real-time simulation targets</h4>
|
|---|
| 1115 | <p>Especially for use on real-time platform targets (e.g., HIL-simulators) with <b>no file system</b>, it is possible to statically
|
|---|
| 1116 | store tables using a function "usertab" in a file conventionally named "usertab.c". This can be more efficient than providing the tables as Modelica parameter arrays.</p>
|
|---|
| 1117 | <p>This is achieved by providing the tables in a specific structure as C-code and compiling that C-code together with the rest of the simulation model into a binary
|
|---|
| 1118 | that can be executed on the target platform. The "Resources/Data/Tables/" subdirectory of the MSL installation directory contains the files
|
|---|
| 1119 | <a href=\"modelica://Modelica/Resources/Data/Tables/usertab.c\">"usertab.c"</a> and <a href=\"modelica://Modelica/Resources/Data/Tables/usertab.h\">"usertab.h"</a>
|
|---|
| 1120 | that can be used as a template for own developments. While "usertab.c" would be typically used unmodified, the
|
|---|
| 1121 | "usertab.h" needs to adapted for the own needs.</p>
|
|---|
| 1122 | <p>In order to work it is necessary that the compiler pulls in the "usertab.c" file. Different Modelica tools might provide different mechanisms to do so.
|
|---|
| 1123 | Please consult the respective documentation/support for your Modelica tool.</p>
|
|---|
| 1124 | <p>A possible (though a bit "hackish") Modelica standard conformant approach is to pull in the required files by utilizing a "dummy"-function that uses the Modelica external function
|
|---|
| 1125 | interface to pull in the required "usertab.c". An example how this can be done is given below.</p>
|
|---|
| 1126 | <pre>
|
|---|
| 1127 | model Test25_usertab \"Test utilizing the usertab.c interface\"
|
|---|
| 1128 | extends Modelica.Icons.Example;
|
|---|
| 1129 | public
|
|---|
| 1130 | Modelica.Blocks.Sources.RealExpression realExpression(y=getUsertab(t_new.y))
|
|---|
| 1131 | annotation (Placement(transformation(extent={{-40,-34},{-10,-14}})));
|
|---|
| 1132 | Modelica.Blocks.Tables.CombiTable1D t_new(tableOnFile=true, tableName=\"TestTable_1D_a\")
|
|---|
| 1133 | annotation (Placement(transformation(extent={{-40,0},{-20,20}})));
|
|---|
| 1134 | Modelica.Blocks.Sources.Clock clock
|
|---|
| 1135 | annotation (Placement(transformation(extent={{-80,0},{-60,20}})));
|
|---|
| 1136 | protected
|
|---|
| 1137 | encapsulated function getUsertab
|
|---|
| 1138 | input Real dummy_u[:];
|
|---|
| 1139 | output Real dummy_y;
|
|---|
| 1140 | external \"C\" dummy_y= mydummyfunc(dummy_u);
|
|---|
| 1141 | annotation(IncludeDirectory=\"modelica://Modelica/Resources/Data/Tables\",
|
|---|
| 1142 | Include = \"#include \"usertab.c\"
|
|---|
| 1143 | double mydummyfunc(const double* dummy_in) {
|
|---|
| 1144 | return 0;
|
|---|
| 1145 | }
|
|---|
| 1146 | \");
|
|---|
| 1147 | end getUsertab;
|
|---|
| 1148 | equation
|
|---|
| 1149 | connect(clock.y,t_new. u[1]) annotation (Line(
|
|---|
| 1150 | points={{-59,10},{-42,10}},
|
|---|
| 1151 | color={0,0,127},
|
|---|
| 1152 | smooth=Smooth.None));
|
|---|
| 1153 | annotation (experiment(StartTime=0, StopTime=5), uses(Modelica(version=\"3.2.1\")));
|
|---|
| 1154 | end Test25_usertab;
|
|---|
| 1155 | </pre>
|
|---|
| 1156 | </html>"), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
|
|---|
| 1157 | {100,100}}), graphics={
|
|---|
| 1158 | Rectangle(
|
|---|
| 1159 | extent={{-76,-26},{80,-76}},
|
|---|
| 1160 | lineColor={95,95,95},
|
|---|
| 1161 | fillColor={235,235,235},
|
|---|
| 1162 | fillPattern=FillPattern.Solid),
|
|---|
| 1163 | Rectangle(
|
|---|
| 1164 | extent={{-76,24},{80,-26}},
|
|---|
| 1165 | lineColor={95,95,95},
|
|---|
| 1166 | fillColor={235,235,235},
|
|---|
| 1167 | fillPattern=FillPattern.Solid),
|
|---|
| 1168 | Rectangle(
|
|---|
| 1169 | extent={{-76,74},{80,24}},
|
|---|
| 1170 | lineColor={95,95,95},
|
|---|
| 1171 | fillColor={235,235,235},
|
|---|
| 1172 | fillPattern=FillPattern.Solid),
|
|---|
| 1173 | Line(
|
|---|
| 1174 | points={{-28,74},{-28,-76}},
|
|---|
| 1175 | color={95,95,95}),
|
|---|
| 1176 | Line(
|
|---|
| 1177 | points={{24,74},{24,-76}},
|
|---|
| 1178 | color={95,95,95})}));
|
|---|
| 1179 | end Tables;
|
|---|
| 1180 |
|
|---|
| 1181 | package Types
|
|---|
| 1182 | "Library of constants and types with choices, especially to build menus"
|
|---|
| 1183 | extends Modelica.Icons.TypesPackage;
|
|---|
| 1184 |
|
|---|
| 1185 | type Smoothness = enumeration(
|
|---|
| 1186 | LinearSegments "Table points are linearly interpolated",
|
|---|
| 1187 | ContinuousDerivative
|
|---|
| 1188 | "Table points are interpolated such that the first derivative is continuous",
|
|---|
| 1189 |
|
|---|
| 1190 | ConstantSegments
|
|---|
| 1191 | "Table points are not interpolated, but the value from the previous abscissa point is returned")
|
|---|
| 1192 | "Enumeration defining the smoothness of table interpolation";
|
|---|
| 1193 |
|
|---|
| 1194 | type Init = enumeration(
|
|---|
| 1195 | NoInit
|
|---|
| 1196 | "No initialization (start values are used as guess values with fixed=false)",
|
|---|
| 1197 |
|
|---|
| 1198 | SteadyState
|
|---|
| 1199 | "Steady state initialization (derivatives of states are zero)",
|
|---|
| 1200 | InitialState "Initialization with initial states",
|
|---|
| 1201 | InitialOutput
|
|---|
| 1202 | "Initialization with initial outputs (and steady state of the states if possible)")
|
|---|
| 1203 | "Enumeration defining initialization of a block" annotation (Evaluate=true,
|
|---|
| 1204 | Documentation(info="<html>
|
|---|
| 1205 | <p>The following initialization alternatives are available:</p>
|
|---|
| 1206 | <dl>
|
|---|
| 1207 | <dt><code><strong>NoInit</strong></code></dt>
|
|---|
| 1208 | <dd>No initialization (start values are used as guess values with <code>fixed=false</code>)</dd>
|
|---|
| 1209 | <dt><code><strong>SteadyState</strong></code></dt>
|
|---|
| 1210 | <dd>Steady state initialization (derivatives of states are zero)</dd>
|
|---|
| 1211 | <dt><code><strong>InitialState</strong></code></dt>
|
|---|
| 1212 | <dd>Initialization with initial states</dd>
|
|---|
| 1213 | <dt><code><strong>InitialOutput</strong></code></dt>
|
|---|
| 1214 | <dd>Initialization with initial outputs (and steady state of the states if possible)</dd>
|
|---|
| 1215 | </dl>
|
|---|
| 1216 | </html>"));
|
|---|
| 1217 |
|
|---|
| 1218 | class ExternalCombiTable2D
|
|---|
| 1219 | "External object of 2-dim. table defined by matrix"
|
|---|
| 1220 | extends ExternalObject;
|
|---|
| 1221 |
|
|---|
| 1222 | function constructor "Initialize 2-dim. table defined by matrix"
|
|---|
| 1223 | extends Modelica.Icons.Function;
|
|---|
| 1224 | input String tableName "Table name";
|
|---|
| 1225 | input String fileName "File name";
|
|---|
| 1226 | input Real table[:, :];
|
|---|
| 1227 | input Modelica.Blocks.Types.Smoothness smoothness;
|
|---|
| 1228 | output ExternalCombiTable2D externalCombiTable2D;
|
|---|
| 1229 | external"C" externalCombiTable2D = ModelicaStandardTables_CombiTable2D_init(
|
|---|
| 1230 | tableName,
|
|---|
| 1231 | fileName,
|
|---|
| 1232 | table,
|
|---|
| 1233 | size(table, 1),
|
|---|
| 1234 | size(table, 2),
|
|---|
| 1235 | smoothness) annotation (Library={"ModelicaStandardTables"});
|
|---|
| 1236 | end constructor;
|
|---|
| 1237 |
|
|---|
| 1238 | function destructor "Terminate 2-dim. table defined by matrix"
|
|---|
| 1239 | extends Modelica.Icons.Function;
|
|---|
| 1240 | input ExternalCombiTable2D externalCombiTable2D;
|
|---|
| 1241 | external"C" ModelicaStandardTables_CombiTable2D_close(externalCombiTable2D)
|
|---|
| 1242 | annotation (Library={"ModelicaStandardTables"});
|
|---|
| 1243 | end destructor;
|
|---|
| 1244 |
|
|---|
| 1245 | end ExternalCombiTable2D;
|
|---|
| 1246 | annotation (Documentation(info="<HTML>
|
|---|
| 1247 | <p>
|
|---|
| 1248 | In this package <b>types</b>, <b>constants</b> and <b>external objects</b> are defined that are used
|
|---|
| 1249 | in library Modelica.Blocks. The types have additional annotation choices
|
|---|
| 1250 | definitions that define the menus to be built up in the graphical
|
|---|
| 1251 | user interface when the type is used as parameter in a declaration.
|
|---|
| 1252 | </p>
|
|---|
| 1253 | </HTML>"));
|
|---|
| 1254 | end Types;
|
|---|
| 1255 |
|
|---|
| 1256 | package Icons "Icons for Blocks"
|
|---|
| 1257 | extends Modelica.Icons.IconsPackage;
|
|---|
| 1258 |
|
|---|
| 1259 | partial block Block "Basic graphical layout of input/output block"
|
|---|
| 1260 |
|
|---|
| 1261 | annotation (
|
|---|
| 1262 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
|
|---|
| 1263 | 100,100}}), graphics={Rectangle(
|
|---|
| 1264 | extent={{-100,-100},{100,100}},
|
|---|
| 1265 | lineColor={0,0,127},
|
|---|
| 1266 | fillColor={255,255,255},
|
|---|
| 1267 | fillPattern=FillPattern.Solid), Text(
|
|---|
| 1268 | extent={{-150,150},{150,110}},
|
|---|
| 1269 | textString="%name",
|
|---|
| 1270 | lineColor={0,0,255})}),
|
|---|
| 1271 | Documentation(info="<html>
|
|---|
| 1272 | <p>
|
|---|
| 1273 | Block that has only the basic icon for an input/output
|
|---|
| 1274 | block (no declarations, no equations). Most blocks
|
|---|
| 1275 | of package Modelica.Blocks inherit directly or indirectly
|
|---|
| 1276 | from this block.
|
|---|
| 1277 | </p>
|
|---|
| 1278 | </html>"));
|
|---|
| 1279 |
|
|---|
| 1280 | end Block;
|
|---|
| 1281 | end Icons;
|
|---|
| 1282 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}, initialScale=0.1), graphics={
|
|---|
| 1283 | Rectangle(
|
|---|
| 1284 | origin={0.0,35.1488},
|
|---|
| 1285 | fillColor={255,255,255},
|
|---|
| 1286 | extent={{-30.0,-20.1488},{30.0,20.1488}}),
|
|---|
| 1287 | Rectangle(
|
|---|
| 1288 | origin={0.0,-34.8512},
|
|---|
| 1289 | fillColor={255,255,255},
|
|---|
| 1290 | extent={{-30.0,-20.1488},{30.0,20.1488}}),
|
|---|
| 1291 | Line(
|
|---|
| 1292 | origin={-51.25,0.0},
|
|---|
| 1293 | points={{21.25,-35.0},{-13.75,-35.0},{-13.75,35.0},{6.25,35.0}}),
|
|---|
| 1294 | Polygon(
|
|---|
| 1295 | origin={-40.0,35.0},
|
|---|
| 1296 | pattern=LinePattern.None,
|
|---|
| 1297 | fillPattern=FillPattern.Solid,
|
|---|
| 1298 | points={{10.0,0.0},{-5.0,5.0},{-5.0,-5.0}}),
|
|---|
| 1299 | Line(
|
|---|
| 1300 | origin={51.25,0.0},
|
|---|
| 1301 | points={{-21.25,35.0},{13.75,35.0},{13.75,-35.0},{-6.25,-35.0}}),
|
|---|
| 1302 | Polygon(
|
|---|
| 1303 | origin={40.0,-35.0},
|
|---|
| 1304 | pattern=LinePattern.None,
|
|---|
| 1305 | fillPattern=FillPattern.Solid,
|
|---|
| 1306 | points={{-10.0,0.0},{5.0,5.0},{5.0,-5.0}})}), Documentation(info="<html>
|
|---|
| 1307 | <p>
|
|---|
| 1308 | This library contains input/output blocks to build up block diagrams.
|
|---|
| 1309 | </p>
|
|---|
| 1310 |
|
|---|
| 1311 | <dl>
|
|---|
| 1312 | <dt><b>Main Author:</b>
|
|---|
| 1313 | <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
|
|---|
| 1314 | Deutsches Zentrum für Luft und Raumfahrt e. V. (DLR)<br>
|
|---|
| 1315 | Oberpfaffenhofen<br>
|
|---|
| 1316 | Postfach 1116<br>
|
|---|
| 1317 | D-82230 Wessling<br>
|
|---|
| 1318 | email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
|
|---|
| 1319 | </dl>
|
|---|
| 1320 | <p>
|
|---|
| 1321 | Copyright © 1998-2013, Modelica Association and DLR.
|
|---|
| 1322 | </p>
|
|---|
| 1323 | <p>
|
|---|
| 1324 | <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>
|
|---|
| 1325 | </p>
|
|---|
| 1326 | </html>", revisions="<html>
|
|---|
| 1327 | <ul>
|
|---|
| 1328 | <li><i>June 23, 2004</i>
|
|---|
| 1329 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 1330 | Introduced new block connectors and adapted all blocks to the new connectors.
|
|---|
| 1331 | Included subpackages Continuous, Discrete, Logical, Nonlinear from
|
|---|
| 1332 | package ModelicaAdditions.Blocks.
|
|---|
| 1333 | Included subpackage ModelicaAdditions.Table in Modelica.Blocks.Sources
|
|---|
| 1334 | and in the new package Modelica.Blocks.Tables.
|
|---|
| 1335 | Added new blocks to Blocks.Sources and Blocks.Logical.
|
|---|
| 1336 | </li>
|
|---|
| 1337 | <li><i>October 21, 2002</i>
|
|---|
| 1338 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
|
|---|
| 1339 | and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
|
|---|
| 1340 | New subpackage Examples, additional components.
|
|---|
| 1341 | </li>
|
|---|
| 1342 | <li><i>June 20, 2000</i>
|
|---|
| 1343 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
|
|---|
| 1344 | Michael Tiller:<br>
|
|---|
| 1345 | Introduced a replaceable signal type into
|
|---|
| 1346 | Blocks.Interfaces.RealInput/RealOutput:
|
|---|
| 1347 | <pre>
|
|---|
| 1348 | replaceable type SignalType = Real
|
|---|
| 1349 | </pre>
|
|---|
| 1350 | in order that the type of the signal of an input/output block
|
|---|
| 1351 | can be changed to a physical type, for example:
|
|---|
| 1352 | <pre>
|
|---|
| 1353 | Sine sin1(outPort(redeclare type SignalType=Modelica.SIunits.Torque))
|
|---|
| 1354 | </pre>
|
|---|
| 1355 | </li>
|
|---|
| 1356 | <li><i>Sept. 18, 1999</i>
|
|---|
| 1357 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 1358 | Renamed to Blocks. New subpackages Math, Nonlinear.
|
|---|
| 1359 | Additional components in subpackages Interfaces, Continuous
|
|---|
| 1360 | and Sources. </li>
|
|---|
| 1361 | <li><i>June 30, 1999</i>
|
|---|
| 1362 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 1363 | Realized a first version, based on an existing Dymola library
|
|---|
| 1364 | of Dieter Moormann and Hilding Elmqvist.</li>
|
|---|
| 1365 | </ul>
|
|---|
| 1366 | </html>"));
|
|---|
| 1367 | end Blocks;
|
|---|
| 1368 |
|
|---|
| 1369 | package Mechanics
|
|---|
| 1370 | "Library of 1-dim. and 3-dim. mechanical components (multi-body, rotational, translational)"
|
|---|
| 1371 | extends Modelica.Icons.Package;
|
|---|
| 1372 |
|
|---|
| 1373 | package Rotational
|
|---|
| 1374 | "Library to model 1-dimensional, rotational mechanical systems"
|
|---|
| 1375 | extends Modelica.Icons.Package;
|
|---|
| 1376 | import SI = Modelica.SIunits;
|
|---|
| 1377 |
|
|---|
| 1378 | package Sensors
|
|---|
| 1379 | "Sensors to measure variables in 1D rotational mechanical components"
|
|---|
| 1380 | extends Modelica.Icons.SensorsPackage;
|
|---|
| 1381 |
|
|---|
| 1382 | model PowerSensor
|
|---|
| 1383 | "Ideal sensor to measure the power between two flanges (= flange_a.tau*der(flange_a.phi))"
|
|---|
| 1384 |
|
|---|
| 1385 | extends Rotational.Interfaces.PartialRelativeSensor;
|
|---|
| 1386 | Modelica.Blocks.Interfaces.RealOutput power(unit="W")
|
|---|
| 1387 | "Power in flange flange_a as output signal"
|
|---|
| 1388 | annotation (Placement(transformation(
|
|---|
| 1389 | origin={-80,-110},
|
|---|
| 1390 | extent={{10,-10},{-10,10}},
|
|---|
| 1391 | rotation=90)));
|
|---|
| 1392 |
|
|---|
| 1393 | equation
|
|---|
| 1394 | flange_a.phi = flange_b.phi;
|
|---|
| 1395 | power = flange_a.tau*der(flange_a.phi);
|
|---|
| 1396 | annotation (Documentation(info="<html>
|
|---|
| 1397 | <p>
|
|---|
| 1398 | Measures the <b>power between two flanges</b> in an ideal way
|
|---|
| 1399 | and provides the result as output signal <b>power</b>
|
|---|
| 1400 | (to be further processed with blocks of the Modelica.Blocks library).
|
|---|
| 1401 | </p>
|
|---|
| 1402 | </html>"), Icon(
|
|---|
| 1403 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 1404 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 1405 | initialScale=0.1),
|
|---|
| 1406 | graphics={
|
|---|
| 1407 | Text(extent={{-50.0,-120.0},{100.0,-80.0}},
|
|---|
| 1408 | textString="power"),
|
|---|
| 1409 | Line(points={{-80.0,-100.0},{-80.0,0.0}},
|
|---|
| 1410 | color={0,0,127})}));
|
|---|
| 1411 | end PowerSensor;
|
|---|
| 1412 | annotation (Documentation(info="<html>
|
|---|
| 1413 | <p>
|
|---|
| 1414 | This package contains ideal sensor components that provide
|
|---|
| 1415 | the connector variables as signals for further processing with the
|
|---|
| 1416 | Modelica.Blocks library.
|
|---|
| 1417 | </p>
|
|---|
| 1418 | </html>"));
|
|---|
| 1419 | end Sensors;
|
|---|
| 1420 |
|
|---|
| 1421 | package Interfaces
|
|---|
| 1422 | "Connectors and partial models for 1D rotational mechanical components"
|
|---|
| 1423 | extends Modelica.Icons.InterfacesPackage;
|
|---|
| 1424 |
|
|---|
| 1425 | connector Flange_a
|
|---|
| 1426 | "1-dim. rotational flange of a shaft (filled square icon)"
|
|---|
| 1427 | SI.Angle phi "Absolute rotation angle of flange";
|
|---|
| 1428 | flow SI.Torque tau "Cut torque in the flange";
|
|---|
| 1429 | annotation (
|
|---|
| 1430 | defaultComponentName="flange_a",
|
|---|
| 1431 | Documentation(info="<html>
|
|---|
| 1432 | <p>
|
|---|
| 1433 | This is a connector for 1-dim. rotational mechanical systems and models
|
|---|
| 1434 | the mechanical flange of a shaft. The following variables are defined in this connector:
|
|---|
| 1435 | </p>
|
|---|
| 1436 |
|
|---|
| 1437 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 1438 | <tr><td valign=\"top\"> <b>phi</b></td>
|
|---|
| 1439 | <td valign=\"top\"> Absolute rotation angle of the shaft flange in [rad] </td>
|
|---|
| 1440 | </tr>
|
|---|
| 1441 | <tr><td valign=\"top\"> <b>tau</b></td>
|
|---|
| 1442 | <td valign=\"top\"> Cut-torque in the shaft flange in [Nm] </td>
|
|---|
| 1443 | </tr>
|
|---|
| 1444 | </table>
|
|---|
| 1445 |
|
|---|
| 1446 | <p>
|
|---|
| 1447 | There is a second connector for flanges: Flange_b. The connectors
|
|---|
| 1448 | Flange_a and Flange_b are completely identical. There is only a difference
|
|---|
| 1449 | in the icons, in order to easier identify a flange variable in a diagram.
|
|---|
| 1450 | For a discussion on the actual direction of the cut-torque tau and
|
|---|
| 1451 | of the rotation angle, see section
|
|---|
| 1452 | <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SignConventions\">Sign Conventions</a>
|
|---|
| 1453 | in the user's guide of Rotational.
|
|---|
| 1454 | </p>
|
|---|
| 1455 |
|
|---|
| 1456 | <p>
|
|---|
| 1457 | If needed, the absolute angular velocity w and the
|
|---|
| 1458 | absolute angular acceleration a of the flange can be determined by
|
|---|
| 1459 | differentiation of the flange angle phi:
|
|---|
| 1460 | </p>
|
|---|
| 1461 | <pre>
|
|---|
| 1462 | w = der(phi); a = der(w)
|
|---|
| 1463 | </pre>
|
|---|
| 1464 | </html>"), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 1465 | Ellipse(
|
|---|
| 1466 | extent={{-100,100},{100,-100}},
|
|---|
| 1467 | lineColor={0,0,0},
|
|---|
| 1468 | fillColor={95,95,95},
|
|---|
| 1469 | fillPattern=FillPattern.Solid)}),
|
|---|
| 1470 | Diagram(coordinateSystem(
|
|---|
| 1471 | preserveAspectRatio=true,
|
|---|
| 1472 | extent={{-100,-100},{100,100}}), graphics={Text(
|
|---|
| 1473 | extent={{-160,90},{40,50}},
|
|---|
| 1474 | lineColor={0,0,0},
|
|---|
| 1475 | textString="%name"),Ellipse(
|
|---|
| 1476 | extent={{-40,40},{40,-40}},
|
|---|
| 1477 | lineColor={0,0,0},
|
|---|
| 1478 | fillColor={135,135,135},
|
|---|
| 1479 | fillPattern=FillPattern.Solid)}));
|
|---|
| 1480 | end Flange_a;
|
|---|
| 1481 |
|
|---|
| 1482 | connector Flange_b
|
|---|
| 1483 | "1-dim. rotational flange of a shaft (non-filled square icon)"
|
|---|
| 1484 | SI.Angle phi "Absolute rotation angle of flange";
|
|---|
| 1485 | flow SI.Torque tau "Cut torque in the flange";
|
|---|
| 1486 | annotation (
|
|---|
| 1487 | defaultComponentName="flange_b",
|
|---|
| 1488 | Documentation(info="<html>
|
|---|
| 1489 | <p>
|
|---|
| 1490 | This is a connector for 1-dim. rotational mechanical systems and models
|
|---|
| 1491 | the mechanical flange of a shaft. The following variables are defined in this connector:
|
|---|
| 1492 | </p>
|
|---|
| 1493 |
|
|---|
| 1494 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 1495 | <tr><td valign=\"top\"> <b>phi</b></td>
|
|---|
| 1496 | <td valign=\"top\"> Absolute rotation angle of the shaft flange in [rad] </td>
|
|---|
| 1497 | </tr>
|
|---|
| 1498 | <tr><td valign=\"top\"> <b>tau</b></td>
|
|---|
| 1499 | <td valign=\"top\"> Cut-torque in the shaft flange in [Nm] </td>
|
|---|
| 1500 | </tr>
|
|---|
| 1501 | </table>
|
|---|
| 1502 |
|
|---|
| 1503 | <p>
|
|---|
| 1504 | There is a second connector for flanges: Flange_a. The connectors
|
|---|
| 1505 | Flange_a and Flange_b are completely identical. There is only a difference
|
|---|
| 1506 | in the icons, in order to easier identify a flange variable in a diagram.
|
|---|
| 1507 | For a discussion on the actual direction of the cut-torque tau and
|
|---|
| 1508 | of the rotation angle, see section
|
|---|
| 1509 | <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SignConventions\">Sign Conventions</a>
|
|---|
| 1510 | in the user's guide of Rotational.
|
|---|
| 1511 | </p>
|
|---|
| 1512 |
|
|---|
| 1513 | <p>
|
|---|
| 1514 | If needed, the absolute angular velocity w and the
|
|---|
| 1515 | absolute angular acceleration a of the flange can be determined by
|
|---|
| 1516 | differentiation of the flange angle phi:
|
|---|
| 1517 | </p>
|
|---|
| 1518 | <pre>
|
|---|
| 1519 | w = der(phi); a = der(w)
|
|---|
| 1520 | </pre>
|
|---|
| 1521 | </html>"), Icon(coordinateSystem(
|
|---|
| 1522 | preserveAspectRatio=true,
|
|---|
| 1523 | extent={{-100,-100},{100,100}}), graphics={Ellipse(
|
|---|
| 1524 | extent={{-98,100},{102,-100}},
|
|---|
| 1525 | lineColor={0,0,0},
|
|---|
| 1526 | fillColor={255,255,255},
|
|---|
| 1527 | fillPattern=FillPattern.Solid)}),
|
|---|
| 1528 | Diagram(coordinateSystem(
|
|---|
| 1529 | preserveAspectRatio=true,
|
|---|
| 1530 | extent={{-100,-100},{100,100}}), graphics={Ellipse(
|
|---|
| 1531 | extent={{-40,40},{40,-40}},
|
|---|
| 1532 | lineColor={0,0,0},
|
|---|
| 1533 | fillColor={255,255,255},
|
|---|
| 1534 | fillPattern=FillPattern.Solid),Text(
|
|---|
| 1535 | extent={{-40,90},{160,50}},
|
|---|
| 1536 | lineColor={0,0,0},
|
|---|
| 1537 | textString="%name")}));
|
|---|
| 1538 | end Flange_b;
|
|---|
| 1539 |
|
|---|
| 1540 | partial model PartialRelativeSensor
|
|---|
| 1541 | "Partial model to measure a single relative variable between two flanges"
|
|---|
| 1542 | extends Modelica.Icons.RotationalSensor;
|
|---|
| 1543 |
|
|---|
| 1544 | Flange_a flange_a "Left flange of shaft" annotation (Placement(
|
|---|
| 1545 | transformation(extent={{-110,-10},{-90,10}}, rotation=0)));
|
|---|
| 1546 | Flange_b flange_b "Right flange of shaft" annotation (Placement(
|
|---|
| 1547 | transformation(extent={{90,-10},{110,10}}, rotation=0)));
|
|---|
| 1548 |
|
|---|
| 1549 | equation
|
|---|
| 1550 | 0 = flange_a.tau + flange_b.tau;
|
|---|
| 1551 | annotation (Documentation(info="<html>
|
|---|
| 1552 | <p>
|
|---|
| 1553 | This is a partial model for 1-dim. rotational components with two rigidly connected
|
|---|
| 1554 | flanges in order to measure relative kinematic quantities
|
|---|
| 1555 | between the two flanges or the cut-torque in the flange and
|
|---|
| 1556 | to provide the measured signal as output signal for further processing
|
|---|
| 1557 | with the blocks of package Modelica.Blocks.
|
|---|
| 1558 | </p>
|
|---|
| 1559 | </html>"), Icon(
|
|---|
| 1560 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 1561 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 1562 | initialScale=0.1),
|
|---|
| 1563 | graphics={
|
|---|
| 1564 | Line(points={{-70.0,0.0},{-90.0,0.0}}),
|
|---|
| 1565 | Line(points={{70.0,0.0},{90.0,0.0}}),
|
|---|
| 1566 | Text(lineColor={0,0,255},
|
|---|
| 1567 | extent={{-150.0,73.0},{150.0,113.0}},
|
|---|
| 1568 | textString="%name")}));
|
|---|
| 1569 | end PartialRelativeSensor;
|
|---|
| 1570 | annotation (Documentation(info="<html>
|
|---|
| 1571 | <p>
|
|---|
| 1572 | This package contains connectors and partial models for 1-dim.
|
|---|
| 1573 | rotational mechanical components. The components of this package can
|
|---|
| 1574 | only be used as basic building elements for models.
|
|---|
| 1575 | </p>
|
|---|
| 1576 | </html>"));
|
|---|
| 1577 | end Interfaces;
|
|---|
| 1578 | annotation (Documentation(info="<html>
|
|---|
| 1579 |
|
|---|
| 1580 | <p>
|
|---|
| 1581 | Library <b>Rotational</b> is a <b>free</b> Modelica package providing
|
|---|
| 1582 | 1-dimensional, rotational mechanical components to model in a convenient way
|
|---|
| 1583 | drive trains with frictional losses. A typical, simple example is shown
|
|---|
| 1584 | in the next figure:
|
|---|
| 1585 | </p>
|
|---|
| 1586 |
|
|---|
| 1587 | <img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveExample.png\">
|
|---|
| 1588 |
|
|---|
| 1589 | <p>
|
|---|
| 1590 | For an introduction, have especially a look at:
|
|---|
| 1591 | </p>
|
|---|
| 1592 | <ul>
|
|---|
| 1593 | <li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide\">Rotational.UsersGuide</a>
|
|---|
| 1594 | discusses the most important aspects how to use this library.</li>
|
|---|
| 1595 | <li> <a href=\"modelica://Modelica.Mechanics.Rotational.Examples\">Rotational.Examples</a>
|
|---|
| 1596 | contains examples that demonstrate the usage of this library.</li>
|
|---|
| 1597 | </ul>
|
|---|
| 1598 |
|
|---|
| 1599 | <p>
|
|---|
| 1600 | In version 3.0 of the Modelica Standard Library, the basic design of the
|
|---|
| 1601 | library has changed: Previously, bearing connectors could or could not be connected.
|
|---|
| 1602 | In 3.0, the bearing connector is renamed to \"<b>support</b>\" and this connector
|
|---|
| 1603 | is enabled via parameter \"useSupport\". If the support connector is enabled,
|
|---|
| 1604 | it must be connected, and if it is not enabled, it must not be connected.
|
|---|
| 1605 | </p>
|
|---|
| 1606 |
|
|---|
| 1607 | <p>
|
|---|
| 1608 | In version 3.2 of the Modelica Standard Library, all <b>dissipative</b> components
|
|---|
| 1609 | of the Rotational library got an optional <b>heatPort</b> connector to which the
|
|---|
| 1610 | dissipated energy is transported in form of heat. This connector is enabled
|
|---|
| 1611 | via parameter \"useHeatPort\". If the heatPort connector is enabled,
|
|---|
| 1612 | it must be connected, and if it is not enabled, it must not be connected.
|
|---|
| 1613 | Independently, whether the heatPort is enabled or not,
|
|---|
| 1614 | the dissipated power is available from the new variable \"<b>lossPower</b>\" (which is
|
|---|
| 1615 | positive if heat is flowing out of the heatPort). For an example, see
|
|---|
| 1616 | <a href=\"modelica://Modelica.Mechanics.Rotational.Examples.HeatLosses\">Examples.HeatLosses</a>.
|
|---|
| 1617 | </p>
|
|---|
| 1618 |
|
|---|
| 1619 | <p>
|
|---|
| 1620 | Copyright © 1998-2013, Modelica Association and DLR.
|
|---|
| 1621 | </p>
|
|---|
| 1622 | <p>
|
|---|
| 1623 | <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>
|
|---|
| 1624 | </p>
|
|---|
| 1625 | </html>", revisions=""), Icon(
|
|---|
| 1626 | coordinateSystem(preserveAspectRatio=true,
|
|---|
| 1627 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 1628 | initialScale=0.1),
|
|---|
| 1629 | graphics={
|
|---|
| 1630 | Line(visible=true,
|
|---|
| 1631 | origin={-2.0,46.0},
|
|---|
| 1632 | points={{-83.0,-66.0},{-63.0,-66.0}}),
|
|---|
| 1633 | Line(visible=true,
|
|---|
| 1634 | origin={29.0,48.0},
|
|---|
| 1635 | points={{36.0,-68.0},{56.0,-68.0}}),
|
|---|
| 1636 | Line(visible=true,
|
|---|
| 1637 | origin={-2.0,49.0},
|
|---|
| 1638 | points={{-83.0,-29.0},{-63.0,-29.0}}),
|
|---|
| 1639 | Line(visible=true,
|
|---|
| 1640 | origin={29.0,52.0},
|
|---|
| 1641 | points={{36.0,-32.0},{56.0,-32.0}}),
|
|---|
| 1642 | Line(visible=true,
|
|---|
| 1643 | origin={-2.0,49.0},
|
|---|
| 1644 | points={{-73.0,-9.0},{-73.0,-29.0}}),
|
|---|
| 1645 | Line(visible=true,
|
|---|
| 1646 | origin={29.0,52.0},
|
|---|
| 1647 | points={{46.0,-12.0},{46.0,-32.0}}),
|
|---|
| 1648 | Line(visible=true,
|
|---|
| 1649 | origin={-0.0,-47.5},
|
|---|
| 1650 | points={{-75.0,27.5},{-75.0,-27.5},{75.0,-27.5},{75.0,27.5}}),
|
|---|
| 1651 | Rectangle(visible=true,
|
|---|
| 1652 | origin={13.5135,76.9841},
|
|---|
| 1653 | lineColor={64,64,64},
|
|---|
| 1654 | fillColor={255,255,255},
|
|---|
| 1655 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 1656 | extent={{-63.5135,-126.9841},{36.4865,-26.9841}},
|
|---|
| 1657 | radius=10.0),
|
|---|
| 1658 | Rectangle(visible=true,
|
|---|
| 1659 | origin={13.5135,76.9841},
|
|---|
| 1660 | lineColor={64,64,64},
|
|---|
| 1661 | fillPattern=FillPattern.None,
|
|---|
| 1662 | extent={{-63.5135,-126.9841},{36.4865,-26.9841}},
|
|---|
| 1663 | radius=10.0),
|
|---|
| 1664 | Rectangle(visible=true,
|
|---|
| 1665 | origin={-3.0,73.0769},
|
|---|
| 1666 | lineColor={64,64,64},
|
|---|
| 1667 | fillColor={192,192,192},
|
|---|
| 1668 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 1669 | extent={{-87.0,-83.0769},{-47.0,-63.0769}}),
|
|---|
| 1670 | Rectangle(visible=true,
|
|---|
| 1671 | origin={22.3077,70.0},
|
|---|
| 1672 | lineColor={64,64,64},
|
|---|
| 1673 | fillColor={192,192,192},
|
|---|
| 1674 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 1675 | extent={{27.6923,-80.0},{67.6923,-60.0}})}));
|
|---|
| 1676 | end Rotational;
|
|---|
| 1677 | annotation (
|
|---|
| 1678 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}, initialScale=0.1), graphics={
|
|---|
| 1679 | Rectangle(
|
|---|
| 1680 | origin={8.6,63.3333},
|
|---|
| 1681 | lineColor={64,64,64},
|
|---|
| 1682 | fillColor={192,192,192},
|
|---|
| 1683 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 1684 | extent={{-4.6,-93.3333},{41.4,-53.3333}}),
|
|---|
| 1685 | Ellipse(
|
|---|
| 1686 | origin={9.0,46.0},
|
|---|
| 1687 | extent={{-90.0,-60.0},{-80.0,-50.0}}),
|
|---|
| 1688 | Line(
|
|---|
| 1689 | origin={9.0,46.0},
|
|---|
| 1690 | points={{-85.0,-55.0},{-60.0,-21.0}},
|
|---|
| 1691 | thickness=0.5),
|
|---|
| 1692 | Ellipse(
|
|---|
| 1693 | origin={9.0,46.0},
|
|---|
| 1694 | extent={{-65.0,-26.0},{-55.0,-16.0}}),
|
|---|
| 1695 | Line(
|
|---|
| 1696 | origin={9.0,46.0},
|
|---|
| 1697 | points={{-60.0,-21.0},{9.0,-55.0}},
|
|---|
| 1698 | thickness=0.5),
|
|---|
| 1699 | Ellipse(
|
|---|
| 1700 | origin={9.0,46.0},
|
|---|
| 1701 | fillPattern=FillPattern.Solid,
|
|---|
| 1702 | extent={{4.0,-60.0},{14.0,-50.0}}),
|
|---|
| 1703 | Line(
|
|---|
| 1704 | origin={9.0,46.0},
|
|---|
| 1705 | points={{-10.0,-26.0},{72.0,-26.0},{72.0,-86.0},{-10.0,-86.0}})}),
|
|---|
| 1706 | Documentation(info="<HTML>
|
|---|
| 1707 | <p>
|
|---|
| 1708 | This package contains components to model the movement
|
|---|
| 1709 | of 1-dim. rotational, 1-dim. translational, and
|
|---|
| 1710 | 3-dim. <b>mechanical systems</b>.
|
|---|
| 1711 | </p>
|
|---|
| 1712 |
|
|---|
| 1713 | <p>
|
|---|
| 1714 | Note, all <b>dissipative</b> components of the Modelica.Mechanics library have
|
|---|
| 1715 | an optional <b>heatPort</b> connector to which the
|
|---|
| 1716 | dissipated energy is transported in form of heat. This connector is enabled
|
|---|
| 1717 | via parameter \"useHeatPort\". If the heatPort connector is enabled,
|
|---|
| 1718 | it must be connected, and if it is not enabled, it must not be connected.
|
|---|
| 1719 | Independently, whether the heatPort is enabled or not,
|
|---|
| 1720 | the dissipated power is available from variable \"<b>lossPower</b>\" (which is
|
|---|
| 1721 | positive if heat is flowing out of the heatPort).
|
|---|
| 1722 | </p>
|
|---|
| 1723 | </html>"));
|
|---|
| 1724 | end Mechanics;
|
|---|
| 1725 |
|
|---|
| 1726 | package Media "Library of media property models"
|
|---|
| 1727 | extends Modelica.Icons.Package;
|
|---|
| 1728 | import SI = Modelica.SIunits;
|
|---|
| 1729 | import Cv = Modelica.SIunits.Conversions;
|
|---|
| 1730 |
|
|---|
| 1731 | package Interfaces "Interfaces for media models"
|
|---|
| 1732 | extends Modelica.Icons.InterfacesPackage;
|
|---|
| 1733 |
|
|---|
| 1734 | partial package PartialMedium
|
|---|
| 1735 | "Partial medium properties (base package of all media packages)"
|
|---|
| 1736 | extends Modelica.Media.Interfaces.Types;
|
|---|
| 1737 | extends Modelica.Icons.MaterialPropertiesPackage;
|
|---|
| 1738 |
|
|---|
| 1739 | // Constants to be set in Medium
|
|---|
| 1740 | constant Modelica.Media.Interfaces.Choices.IndependentVariables
|
|---|
| 1741 | ThermoStates "Enumeration type for independent variables";
|
|---|
| 1742 | constant String mediumName="unusablePartialMedium" "Name of the medium";
|
|---|
| 1743 | constant String substanceNames[:]={mediumName}
|
|---|
| 1744 | "Names of the mixture substances. Set substanceNames={mediumName} if only one substance.";
|
|---|
| 1745 | constant String extraPropertiesNames[:]=fill("", 0)
|
|---|
| 1746 | "Names of the additional (extra) transported properties. Set extraPropertiesNames=fill(\"\",0) if unused";
|
|---|
| 1747 | constant Boolean singleState
|
|---|
| 1748 | "= true, if u and d are not a function of pressure";
|
|---|
| 1749 | constant Boolean reducedX=true
|
|---|
| 1750 | "= true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details)";
|
|---|
| 1751 | constant Boolean fixedX=false
|
|---|
| 1752 | "= true if medium contains the equation X = reference_X";
|
|---|
| 1753 | constant AbsolutePressure reference_p=101325
|
|---|
| 1754 | "Reference pressure of Medium: default 1 atmosphere";
|
|---|
| 1755 | constant Temperature reference_T=298.15
|
|---|
| 1756 | "Reference temperature of Medium: default 25 deg Celsius";
|
|---|
| 1757 | constant MassFraction reference_X[nX]=fill(1/nX, nX)
|
|---|
| 1758 | "Default mass fractions of medium";
|
|---|
| 1759 | constant AbsolutePressure p_default=101325
|
|---|
| 1760 | "Default value for pressure of medium (for initialization)";
|
|---|
| 1761 | constant Temperature T_default=Modelica.SIunits.Conversions.from_degC(20)
|
|---|
| 1762 | "Default value for temperature of medium (for initialization)";
|
|---|
| 1763 | constant SpecificEnthalpy h_default=specificEnthalpy_pTX(
|
|---|
| 1764 | p_default,
|
|---|
| 1765 | T_default,
|
|---|
| 1766 | X_default)
|
|---|
| 1767 | "Default value for specific enthalpy of medium (for initialization)";
|
|---|
| 1768 | constant MassFraction X_default[nX]=reference_X
|
|---|
| 1769 | "Default value for mass fractions of medium (for initialization)";
|
|---|
| 1770 |
|
|---|
| 1771 | final constant Integer nS=size(substanceNames, 1) "Number of substances"
|
|---|
| 1772 | annotation (Evaluate=true);
|
|---|
| 1773 | constant Integer nX=nS "Number of mass fractions" annotation (Evaluate=true);
|
|---|
| 1774 | constant Integer nXi=if fixedX then 0 else if reducedX then nS - 1 else nS
|
|---|
| 1775 | "Number of structurally independent mass fractions (see docu for details)"
|
|---|
| 1776 | annotation (Evaluate=true);
|
|---|
| 1777 |
|
|---|
| 1778 | final constant Integer nC=size(extraPropertiesNames, 1)
|
|---|
| 1779 | "Number of extra (outside of standard mass-balance) transported properties"
|
|---|
| 1780 | annotation (Evaluate=true);
|
|---|
| 1781 | constant Real C_nominal[nC](min=fill(Modelica.Constants.eps, nC)) = 1.0e-6*
|
|---|
| 1782 | ones(nC) "Default for the nominal values for the extra properties";
|
|---|
| 1783 | replaceable record FluidConstants =
|
|---|
| 1784 | Modelica.Media.Interfaces.Types.Basic.FluidConstants
|
|---|
| 1785 | "Critical, triple, molecular and other standard data of fluid";
|
|---|
| 1786 |
|
|---|
| 1787 | replaceable record ThermodynamicState
|
|---|
| 1788 | "Minimal variable set that is available as input argument to every medium function"
|
|---|
| 1789 | extends Modelica.Icons.Record;
|
|---|
| 1790 | end ThermodynamicState;
|
|---|
| 1791 |
|
|---|
| 1792 | replaceable partial model BaseProperties
|
|---|
| 1793 | "Base properties (p, d, T, h, u, R, MM and, if applicable, X and Xi) of a medium"
|
|---|
| 1794 | InputAbsolutePressure p "Absolute pressure of medium";
|
|---|
| 1795 | InputMassFraction[nXi] Xi(start=reference_X[1:nXi])
|
|---|
| 1796 | "Structurally independent mass fractions";
|
|---|
| 1797 | InputSpecificEnthalpy h "Specific enthalpy of medium";
|
|---|
| 1798 | Density d "Density of medium";
|
|---|
| 1799 | Temperature T "Temperature of medium";
|
|---|
| 1800 | MassFraction[nX] X(start=reference_X)
|
|---|
| 1801 | "Mass fractions (= (component mass)/total mass m_i/m)";
|
|---|
| 1802 | SpecificInternalEnergy u "Specific internal energy of medium";
|
|---|
| 1803 | SpecificHeatCapacity R "Gas constant (of mixture if applicable)";
|
|---|
| 1804 | MolarMass MM "Molar mass (of mixture or single fluid)";
|
|---|
| 1805 | ThermodynamicState state
|
|---|
| 1806 | "Thermodynamic state record for optional functions";
|
|---|
| 1807 | parameter Boolean preferredMediumStates=false
|
|---|
| 1808 | "= true if StateSelect.prefer shall be used for the independent property variables of the medium"
|
|---|
| 1809 | annotation (Evaluate=true, Dialog(tab="Advanced"));
|
|---|
| 1810 | parameter Boolean standardOrderComponents=true
|
|---|
| 1811 | "If true, and reducedX = true, the last element of X will be computed from the other ones";
|
|---|
| 1812 | SI.Conversions.NonSIunits.Temperature_degC T_degC=
|
|---|
| 1813 | Modelica.SIunits.Conversions.to_degC(T)
|
|---|
| 1814 | "Temperature of medium in [degC]";
|
|---|
| 1815 | SI.Conversions.NonSIunits.Pressure_bar p_bar=
|
|---|
| 1816 | Modelica.SIunits.Conversions.to_bar(p)
|
|---|
| 1817 | "Absolute pressure of medium in [bar]";
|
|---|
| 1818 |
|
|---|
| 1819 | // Local connector definition, used for equation balancing check
|
|---|
| 1820 | connector InputAbsolutePressure = input SI.AbsolutePressure
|
|---|
| 1821 | "Pressure as input signal connector";
|
|---|
| 1822 | connector InputSpecificEnthalpy = input SI.SpecificEnthalpy
|
|---|
| 1823 | "Specific enthalpy as input signal connector";
|
|---|
| 1824 | connector InputMassFraction = input SI.MassFraction
|
|---|
| 1825 | "Mass fraction as input signal connector";
|
|---|
| 1826 |
|
|---|
| 1827 | equation
|
|---|
| 1828 | if standardOrderComponents then
|
|---|
| 1829 | Xi = X[1:nXi];
|
|---|
| 1830 |
|
|---|
| 1831 | if fixedX then
|
|---|
| 1832 | X = reference_X;
|
|---|
| 1833 | end if;
|
|---|
| 1834 | if reducedX and not fixedX then
|
|---|
| 1835 | X[nX] = 1 - sum(Xi);
|
|---|
| 1836 | end if;
|
|---|
| 1837 | for i in 1:nX loop
|
|---|
| 1838 | assert(X[i] >= -1.e-5 and X[i] <= 1 + 1.e-5, "Mass fraction X[" +
|
|---|
| 1839 | String(i) + "] = " + String(X[i]) + "of substance " +
|
|---|
| 1840 | substanceNames[i] + "\nof medium " + mediumName +
|
|---|
| 1841 | " is not in the range 0..1");
|
|---|
| 1842 | end for;
|
|---|
| 1843 |
|
|---|
| 1844 | end if;
|
|---|
| 1845 |
|
|---|
| 1846 | assert(p >= 0.0, "Pressure (= " + String(p) + " Pa) of medium \"" +
|
|---|
| 1847 | mediumName + "\" is negative\n(Temperature = " + String(T) + " K)");
|
|---|
| 1848 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 1849 | -100},{100,100}}), graphics={Rectangle(
|
|---|
| 1850 | extent={{-100,100},{100,-100}},
|
|---|
| 1851 | fillColor={255,255,255},
|
|---|
| 1852 | fillPattern=FillPattern.Solid,
|
|---|
| 1853 | lineColor={0,0,255}), Text(
|
|---|
| 1854 | extent={{-152,164},{152,102}},
|
|---|
| 1855 | textString="%name",
|
|---|
| 1856 | lineColor={0,0,255})}), Documentation(info="<html>
|
|---|
| 1857 | <p>
|
|---|
| 1858 | Model <b>BaseProperties</b> is a model within package <b>PartialMedium</b>
|
|---|
| 1859 | and contains the <b>declarations</b> of the minimum number of
|
|---|
| 1860 | variables that every medium model is supposed to support.
|
|---|
| 1861 | A specific medium inherits from model <b>BaseProperties</b> and provides
|
|---|
| 1862 | the equations for the basic properties.</p>
|
|---|
| 1863 | <p>
|
|---|
| 1864 | The BaseProperties model contains the following <b>7+nXi variables</b>
|
|---|
| 1865 | (nXi is the number of independent mass fractions defined in package
|
|---|
| 1866 | PartialMedium):
|
|---|
| 1867 | </p>
|
|---|
| 1868 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 1869 | <tr><td valign=\"top\"><b>Variable</b></td>
|
|---|
| 1870 | <td valign=\"top\"><b>Unit</b></td>
|
|---|
| 1871 | <td valign=\"top\"><b>Description</b></td></tr>
|
|---|
| 1872 | <tr><td valign=\"top\">T</td>
|
|---|
| 1873 | <td valign=\"top\">K</td>
|
|---|
| 1874 | <td valign=\"top\">temperature</td></tr>
|
|---|
| 1875 | <tr><td valign=\"top\">p</td>
|
|---|
| 1876 | <td valign=\"top\">Pa</td>
|
|---|
| 1877 | <td valign=\"top\">absolute pressure</td></tr>
|
|---|
| 1878 | <tr><td valign=\"top\">d</td>
|
|---|
| 1879 | <td valign=\"top\">kg/m3</td>
|
|---|
| 1880 | <td valign=\"top\">density</td></tr>
|
|---|
| 1881 | <tr><td valign=\"top\">h</td>
|
|---|
| 1882 | <td valign=\"top\">J/kg</td>
|
|---|
| 1883 | <td valign=\"top\">specific enthalpy</td></tr>
|
|---|
| 1884 | <tr><td valign=\"top\">u</td>
|
|---|
| 1885 | <td valign=\"top\">J/kg</td>
|
|---|
| 1886 | <td valign=\"top\">specific internal energy</td></tr>
|
|---|
| 1887 | <tr><td valign=\"top\">Xi[nXi]</td>
|
|---|
| 1888 | <td valign=\"top\">kg/kg</td>
|
|---|
| 1889 | <td valign=\"top\">independent mass fractions m_i/m</td></tr>
|
|---|
| 1890 | <tr><td valign=\"top\">R</td>
|
|---|
| 1891 | <td valign=\"top\">J/kg.K</td>
|
|---|
| 1892 | <td valign=\"top\">gas constant</td></tr>
|
|---|
| 1893 | <tr><td valign=\"top\">M</td>
|
|---|
| 1894 | <td valign=\"top\">kg/mol</td>
|
|---|
| 1895 | <td valign=\"top\">molar mass</td></tr>
|
|---|
| 1896 | </table>
|
|---|
| 1897 | <p>
|
|---|
| 1898 | In order to implement an actual medium model, one can extend from this
|
|---|
| 1899 | base model and add <b>5 equations</b> that provide relations among
|
|---|
| 1900 | these variables. Equations will also have to be added in order to
|
|---|
| 1901 | set all the variables within the ThermodynamicState record state.</p>
|
|---|
| 1902 | <p>
|
|---|
| 1903 | If standardOrderComponents=true, the full composition vector X[nX]
|
|---|
| 1904 | is determined by the equations contained in this base class, depending
|
|---|
| 1905 | on the independent mass fraction vector Xi[nXi].</p>
|
|---|
| 1906 | <p>Additional <b>2 + nXi</b> equations will have to be provided
|
|---|
| 1907 | when using the BaseProperties model, in order to fully specify the
|
|---|
| 1908 | thermodynamic conditions. The input connector qualifier applied to
|
|---|
| 1909 | p, h, and nXi indirectly declares the number of missing equations,
|
|---|
| 1910 | permitting advanced equation balance checking by Modelica tools.
|
|---|
| 1911 | Please note that this doesn't mean that the additional equations
|
|---|
| 1912 | should be connection equations, nor that exactly those variables
|
|---|
| 1913 | should be supplied, in order to complete the model.
|
|---|
| 1914 | For further information, see the Modelica.Media User's guide, and
|
|---|
| 1915 | Section 4.7 (Balanced Models) of the Modelica 3.0 specification.</p>
|
|---|
| 1916 | </html>"));
|
|---|
| 1917 | end BaseProperties;
|
|---|
| 1918 |
|
|---|
| 1919 | replaceable partial function setState_pTX
|
|---|
| 1920 | "Return thermodynamic state as function of p, T and composition X or Xi"
|
|---|
| 1921 | extends Modelica.Icons.Function;
|
|---|
| 1922 | input AbsolutePressure p "Pressure";
|
|---|
| 1923 | input Temperature T "Temperature";
|
|---|
| 1924 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 1925 | output ThermodynamicState state "Thermodynamic state record";
|
|---|
| 1926 | end setState_pTX;
|
|---|
| 1927 |
|
|---|
| 1928 | replaceable partial function setState_phX
|
|---|
| 1929 | "Return thermodynamic state as function of p, h and composition X or Xi"
|
|---|
| 1930 | extends Modelica.Icons.Function;
|
|---|
| 1931 | input AbsolutePressure p "Pressure";
|
|---|
| 1932 | input SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 1933 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 1934 | output ThermodynamicState state "Thermodynamic state record";
|
|---|
| 1935 | end setState_phX;
|
|---|
| 1936 |
|
|---|
| 1937 | replaceable partial function setState_psX
|
|---|
| 1938 | "Return thermodynamic state as function of p, s and composition X or Xi"
|
|---|
| 1939 | extends Modelica.Icons.Function;
|
|---|
| 1940 | input AbsolutePressure p "Pressure";
|
|---|
| 1941 | input SpecificEntropy s "Specific entropy";
|
|---|
| 1942 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 1943 | output ThermodynamicState state "Thermodynamic state record";
|
|---|
| 1944 | end setState_psX;
|
|---|
| 1945 |
|
|---|
| 1946 | replaceable partial function setState_dTX
|
|---|
| 1947 | "Return thermodynamic state as function of d, T and composition X or Xi"
|
|---|
| 1948 | extends Modelica.Icons.Function;
|
|---|
| 1949 | input Density d "Density";
|
|---|
| 1950 | input Temperature T "Temperature";
|
|---|
| 1951 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 1952 | output ThermodynamicState state "Thermodynamic state record";
|
|---|
| 1953 | end setState_dTX;
|
|---|
| 1954 |
|
|---|
| 1955 | replaceable partial function setSmoothState
|
|---|
| 1956 | "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b"
|
|---|
| 1957 | extends Modelica.Icons.Function;
|
|---|
| 1958 | input Real x "m_flow or dp";
|
|---|
| 1959 | input ThermodynamicState state_a "Thermodynamic state if x > 0";
|
|---|
| 1960 | input ThermodynamicState state_b "Thermodynamic state if x < 0";
|
|---|
| 1961 | input Real x_small(min=0)
|
|---|
| 1962 | "Smooth transition in the region -x_small < x < x_small";
|
|---|
| 1963 | output ThermodynamicState state
|
|---|
| 1964 | "Smooth thermodynamic state for all x (continuous and differentiable)";
|
|---|
| 1965 | annotation (Documentation(info="<html>
|
|---|
| 1966 | <p>
|
|---|
| 1967 | This function is used to approximate the equation
|
|---|
| 1968 | </p>
|
|---|
| 1969 | <pre>
|
|---|
| 1970 | state = <b>if</b> x > 0 <b>then</b> state_a <b>else</b> state_b;
|
|---|
| 1971 | </pre>
|
|---|
| 1972 |
|
|---|
| 1973 | <p>
|
|---|
| 1974 | by a smooth characteristic, so that the expression is continuous and differentiable:
|
|---|
| 1975 | </p>
|
|---|
| 1976 |
|
|---|
| 1977 | <pre>
|
|---|
| 1978 | state := <b>smooth</b>(1, <b>if</b> x > x_small <b>then</b> state_a <b>else</b>
|
|---|
| 1979 | <b>if</b> x < -x_small <b>then</b> state_b <b>else</b> f(state_a, state_b));
|
|---|
| 1980 | </pre>
|
|---|
| 1981 |
|
|---|
| 1982 | <p>
|
|---|
| 1983 | This is performed by applying function <b>Media.Common.smoothStep</b>(..)
|
|---|
| 1984 | on every element of the thermodynamic state record.
|
|---|
| 1985 | </p>
|
|---|
| 1986 |
|
|---|
| 1987 | <p>
|
|---|
| 1988 | If <b>mass fractions</b> X[:] are approximated with this function then this can be performed
|
|---|
| 1989 | for all <b>nX</b> mass fractions, instead of applying it for nX-1 mass fractions and computing
|
|---|
| 1990 | the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the
|
|---|
| 1991 | property that sum(state.X) = 1, provided sum(state_a.X) = sum(state_b.X) = 1.
|
|---|
| 1992 | This can be shown by evaluating the approximating function in the abs(x) < x_small
|
|---|
| 1993 | region (otherwise state.X is either state_a.X or state_b.X):
|
|---|
| 1994 | </p>
|
|---|
| 1995 |
|
|---|
| 1996 | <pre>
|
|---|
| 1997 | X[1] = smoothStep(x, X_a[1] , X_b[1] , x_small);
|
|---|
| 1998 | X[2] = smoothStep(x, X_a[2] , X_b[2] , x_small);
|
|---|
| 1999 | ...
|
|---|
| 2000 | X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);
|
|---|
| 2001 | </pre>
|
|---|
| 2002 |
|
|---|
| 2003 | <p>
|
|---|
| 2004 | or
|
|---|
| 2005 | </p>
|
|---|
| 2006 |
|
|---|
| 2007 | <pre>
|
|---|
| 2008 | X[1] = c*(X_a[1] - X_b[1]) + (X_a[1] + X_b[1])/2
|
|---|
| 2009 | X[2] = c*(X_a[2] - X_b[2]) + (X_a[2] + X_b[2])/2;
|
|---|
| 2010 | ...
|
|---|
| 2011 | X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2;
|
|---|
| 2012 | c = (x/x_small)*((x/x_small)^2 - 3)/4
|
|---|
| 2013 | </pre>
|
|---|
| 2014 |
|
|---|
| 2015 | <p>
|
|---|
| 2016 | Summing all mass fractions together results in
|
|---|
| 2017 | </p>
|
|---|
| 2018 |
|
|---|
| 2019 | <pre>
|
|---|
| 2020 | sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2
|
|---|
| 2021 | = c*(1 - 1) + (1 + 1)/2
|
|---|
| 2022 | = 1
|
|---|
| 2023 | </pre>
|
|---|
| 2024 |
|
|---|
| 2025 | </html>"));
|
|---|
| 2026 | end setSmoothState;
|
|---|
| 2027 |
|
|---|
| 2028 | replaceable partial function dynamicViscosity "Return dynamic viscosity"
|
|---|
| 2029 | extends Modelica.Icons.Function;
|
|---|
| 2030 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2031 | output DynamicViscosity eta "Dynamic viscosity";
|
|---|
| 2032 | end dynamicViscosity;
|
|---|
| 2033 |
|
|---|
| 2034 | replaceable partial function thermalConductivity
|
|---|
| 2035 | "Return thermal conductivity"
|
|---|
| 2036 | extends Modelica.Icons.Function;
|
|---|
| 2037 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2038 | output ThermalConductivity lambda "Thermal conductivity";
|
|---|
| 2039 | end thermalConductivity;
|
|---|
| 2040 |
|
|---|
| 2041 | replaceable function prandtlNumber "Return the Prandtl number"
|
|---|
| 2042 | extends Modelica.Icons.Function;
|
|---|
| 2043 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2044 | output PrandtlNumber Pr "Prandtl number";
|
|---|
| 2045 | algorithm
|
|---|
| 2046 | Pr := dynamicViscosity(state)*specificHeatCapacityCp(state)/
|
|---|
| 2047 | thermalConductivity(state);
|
|---|
| 2048 | end prandtlNumber;
|
|---|
| 2049 |
|
|---|
| 2050 | replaceable partial function pressure "Return pressure"
|
|---|
| 2051 | extends Modelica.Icons.Function;
|
|---|
| 2052 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2053 | output AbsolutePressure p "Pressure";
|
|---|
| 2054 | end pressure;
|
|---|
| 2055 |
|
|---|
| 2056 | replaceable partial function temperature "Return temperature"
|
|---|
| 2057 | extends Modelica.Icons.Function;
|
|---|
| 2058 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2059 | output Temperature T "Temperature";
|
|---|
| 2060 | end temperature;
|
|---|
| 2061 |
|
|---|
| 2062 | replaceable partial function density "Return density"
|
|---|
| 2063 | extends Modelica.Icons.Function;
|
|---|
| 2064 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2065 | output Density d "Density";
|
|---|
| 2066 | end density;
|
|---|
| 2067 |
|
|---|
| 2068 | replaceable partial function specificEnthalpy "Return specific enthalpy"
|
|---|
| 2069 | extends Modelica.Icons.Function;
|
|---|
| 2070 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2071 | output SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 2072 | end specificEnthalpy;
|
|---|
| 2073 |
|
|---|
| 2074 | replaceable partial function specificInternalEnergy
|
|---|
| 2075 | "Return specific internal energy"
|
|---|
| 2076 | extends Modelica.Icons.Function;
|
|---|
| 2077 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2078 | output SpecificEnergy u "Specific internal energy";
|
|---|
| 2079 | end specificInternalEnergy;
|
|---|
| 2080 |
|
|---|
| 2081 | replaceable partial function specificEntropy "Return specific entropy"
|
|---|
| 2082 | extends Modelica.Icons.Function;
|
|---|
| 2083 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2084 | output SpecificEntropy s "Specific entropy";
|
|---|
| 2085 | end specificEntropy;
|
|---|
| 2086 |
|
|---|
| 2087 | replaceable partial function specificGibbsEnergy
|
|---|
| 2088 | "Return specific Gibbs energy"
|
|---|
| 2089 | extends Modelica.Icons.Function;
|
|---|
| 2090 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2091 | output SpecificEnergy g "Specific Gibbs energy";
|
|---|
| 2092 | end specificGibbsEnergy;
|
|---|
| 2093 |
|
|---|
| 2094 | replaceable partial function specificHelmholtzEnergy
|
|---|
| 2095 | "Return specific Helmholtz energy"
|
|---|
| 2096 | extends Modelica.Icons.Function;
|
|---|
| 2097 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2098 | output SpecificEnergy f "Specific Helmholtz energy";
|
|---|
| 2099 | end specificHelmholtzEnergy;
|
|---|
| 2100 |
|
|---|
| 2101 | replaceable partial function specificHeatCapacityCp
|
|---|
| 2102 | "Return specific heat capacity at constant pressure"
|
|---|
| 2103 | extends Modelica.Icons.Function;
|
|---|
| 2104 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2105 | output SpecificHeatCapacity cp
|
|---|
| 2106 | "Specific heat capacity at constant pressure";
|
|---|
| 2107 | end specificHeatCapacityCp;
|
|---|
| 2108 |
|
|---|
| 2109 | function heatCapacity_cp = specificHeatCapacityCp
|
|---|
| 2110 | "Alias for deprecated name";
|
|---|
| 2111 |
|
|---|
| 2112 | replaceable partial function specificHeatCapacityCv
|
|---|
| 2113 | "Return specific heat capacity at constant volume"
|
|---|
| 2114 | extends Modelica.Icons.Function;
|
|---|
| 2115 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2116 | output SpecificHeatCapacity cv
|
|---|
| 2117 | "Specific heat capacity at constant volume";
|
|---|
| 2118 | end specificHeatCapacityCv;
|
|---|
| 2119 |
|
|---|
| 2120 | function heatCapacity_cv = specificHeatCapacityCv
|
|---|
| 2121 | "Alias for deprecated name";
|
|---|
| 2122 |
|
|---|
| 2123 | replaceable partial function isentropicExponent
|
|---|
| 2124 | "Return isentropic exponent"
|
|---|
| 2125 | extends Modelica.Icons.Function;
|
|---|
| 2126 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2127 | output IsentropicExponent gamma "Isentropic exponent";
|
|---|
| 2128 | end isentropicExponent;
|
|---|
| 2129 |
|
|---|
| 2130 | replaceable partial function isentropicEnthalpy
|
|---|
| 2131 | "Return isentropic enthalpy"
|
|---|
| 2132 | extends Modelica.Icons.Function;
|
|---|
| 2133 | input AbsolutePressure p_downstream "Downstream pressure";
|
|---|
| 2134 | input ThermodynamicState refState "Reference state for entropy";
|
|---|
| 2135 | output SpecificEnthalpy h_is "Isentropic enthalpy";
|
|---|
| 2136 | annotation (Documentation(info="<html>
|
|---|
| 2137 | <p>
|
|---|
| 2138 | This function computes an isentropic state transformation:
|
|---|
| 2139 | </p>
|
|---|
| 2140 | <ol>
|
|---|
| 2141 | <li> A medium is in a particular state, refState.</li>
|
|---|
| 2142 | <li> The enthalpy at another state (h_is) shall be computed
|
|---|
| 2143 | under the assumption that the state transformation from refState to h_is
|
|---|
| 2144 | is performed with a change of specific entropy ds = 0 and the pressure of state h_is
|
|---|
| 2145 | is p_downstream and the composition X upstream and downstream is assumed to be the same.</li>
|
|---|
| 2146 | </ol>
|
|---|
| 2147 |
|
|---|
| 2148 | </html>"));
|
|---|
| 2149 | end isentropicEnthalpy;
|
|---|
| 2150 |
|
|---|
| 2151 | replaceable partial function velocityOfSound "Return velocity of sound"
|
|---|
| 2152 | extends Modelica.Icons.Function;
|
|---|
| 2153 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2154 | output VelocityOfSound a "Velocity of sound";
|
|---|
| 2155 | end velocityOfSound;
|
|---|
| 2156 |
|
|---|
| 2157 | replaceable partial function isobaricExpansionCoefficient
|
|---|
| 2158 | "Return overall the isobaric expansion coefficient beta"
|
|---|
| 2159 | extends Modelica.Icons.Function;
|
|---|
| 2160 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2161 | output IsobaricExpansionCoefficient beta
|
|---|
| 2162 | "Isobaric expansion coefficient";
|
|---|
| 2163 | annotation (Documentation(info="<html>
|
|---|
| 2164 | <pre>
|
|---|
| 2165 | beta is defined as 1/v * der(v,T), with v = 1/d, at constant pressure p.
|
|---|
| 2166 | </pre>
|
|---|
| 2167 | </html>"));
|
|---|
| 2168 | end isobaricExpansionCoefficient;
|
|---|
| 2169 |
|
|---|
| 2170 | function beta = isobaricExpansionCoefficient
|
|---|
| 2171 | "Alias for isobaricExpansionCoefficient for user convenience";
|
|---|
| 2172 |
|
|---|
| 2173 | replaceable partial function isothermalCompressibility
|
|---|
| 2174 | "Return overall the isothermal compressibility factor"
|
|---|
| 2175 | extends Modelica.Icons.Function;
|
|---|
| 2176 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2177 | output SI.IsothermalCompressibility kappa "Isothermal compressibility";
|
|---|
| 2178 | annotation (Documentation(info="<html>
|
|---|
| 2179 | <pre>
|
|---|
| 2180 |
|
|---|
| 2181 | kappa is defined as - 1/v * der(v,p), with v = 1/d at constant temperature T.
|
|---|
| 2182 |
|
|---|
| 2183 | </pre>
|
|---|
| 2184 | </html>"));
|
|---|
| 2185 | end isothermalCompressibility;
|
|---|
| 2186 |
|
|---|
| 2187 | function kappa = isothermalCompressibility
|
|---|
| 2188 | "Alias of isothermalCompressibility for user convenience";
|
|---|
| 2189 |
|
|---|
| 2190 | // explicit derivative functions for finite element models
|
|---|
| 2191 | replaceable partial function density_derp_h
|
|---|
| 2192 | "Return density derivative w.r.t. pressure at const specific enthalpy"
|
|---|
| 2193 | extends Modelica.Icons.Function;
|
|---|
| 2194 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2195 | output DerDensityByPressure ddph "Density derivative w.r.t. pressure";
|
|---|
| 2196 | end density_derp_h;
|
|---|
| 2197 |
|
|---|
| 2198 | replaceable partial function density_derh_p
|
|---|
| 2199 | "Return density derivative w.r.t. specific enthalpy at constant pressure"
|
|---|
| 2200 | extends Modelica.Icons.Function;
|
|---|
| 2201 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2202 | output DerDensityByEnthalpy ddhp
|
|---|
| 2203 | "Density derivative w.r.t. specific enthalpy";
|
|---|
| 2204 | end density_derh_p;
|
|---|
| 2205 |
|
|---|
| 2206 | replaceable partial function density_derp_T
|
|---|
| 2207 | "Return density derivative w.r.t. pressure at const temperature"
|
|---|
| 2208 | extends Modelica.Icons.Function;
|
|---|
| 2209 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2210 | output DerDensityByPressure ddpT "Density derivative w.r.t. pressure";
|
|---|
| 2211 | end density_derp_T;
|
|---|
| 2212 |
|
|---|
| 2213 | replaceable partial function density_derT_p
|
|---|
| 2214 | "Return density derivative w.r.t. temperature at constant pressure"
|
|---|
| 2215 | extends Modelica.Icons.Function;
|
|---|
| 2216 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2217 | output DerDensityByTemperature ddTp
|
|---|
| 2218 | "Density derivative w.r.t. temperature";
|
|---|
| 2219 | end density_derT_p;
|
|---|
| 2220 |
|
|---|
| 2221 | replaceable partial function density_derX
|
|---|
| 2222 | "Return density derivative w.r.t. mass fraction"
|
|---|
| 2223 | extends Modelica.Icons.Function;
|
|---|
| 2224 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2225 | output Density[nX] dddX "Derivative of density w.r.t. mass fraction";
|
|---|
| 2226 | end density_derX;
|
|---|
| 2227 |
|
|---|
| 2228 | replaceable partial function molarMass
|
|---|
| 2229 | "Return the molar mass of the medium"
|
|---|
| 2230 | extends Modelica.Icons.Function;
|
|---|
| 2231 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 2232 | output MolarMass MM "Mixture molar mass";
|
|---|
| 2233 | end molarMass;
|
|---|
| 2234 |
|
|---|
| 2235 | replaceable function specificEnthalpy_pTX
|
|---|
| 2236 | "Return specific enthalpy from p, T, and X or Xi"
|
|---|
| 2237 | extends Modelica.Icons.Function;
|
|---|
| 2238 | input AbsolutePressure p "Pressure";
|
|---|
| 2239 | input Temperature T "Temperature";
|
|---|
| 2240 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2241 | output SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 2242 | algorithm
|
|---|
| 2243 | h := specificEnthalpy(setState_pTX(
|
|---|
| 2244 | p,
|
|---|
| 2245 | T,
|
|---|
| 2246 | X));
|
|---|
| 2247 | annotation (inverse(T=temperature_phX(
|
|---|
| 2248 | p,
|
|---|
| 2249 | h,
|
|---|
| 2250 | X)));
|
|---|
| 2251 | end specificEnthalpy_pTX;
|
|---|
| 2252 |
|
|---|
| 2253 | replaceable function specificEntropy_pTX
|
|---|
| 2254 | "Return specific enthalpy from p, T, and X or Xi"
|
|---|
| 2255 | extends Modelica.Icons.Function;
|
|---|
| 2256 | input AbsolutePressure p "Pressure";
|
|---|
| 2257 | input Temperature T "Temperature";
|
|---|
| 2258 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2259 | output SpecificEntropy s "Specific entropy";
|
|---|
| 2260 | algorithm
|
|---|
| 2261 | s := specificEntropy(setState_pTX(
|
|---|
| 2262 | p,
|
|---|
| 2263 | T,
|
|---|
| 2264 | X));
|
|---|
| 2265 |
|
|---|
| 2266 | annotation (inverse(T=temperature_psX(
|
|---|
| 2267 | p,
|
|---|
| 2268 | s,
|
|---|
| 2269 | X)));
|
|---|
| 2270 | end specificEntropy_pTX;
|
|---|
| 2271 |
|
|---|
| 2272 | replaceable function density_pTX "Return density from p, T, and X or Xi"
|
|---|
| 2273 | extends Modelica.Icons.Function;
|
|---|
| 2274 | input AbsolutePressure p "Pressure";
|
|---|
| 2275 | input Temperature T "Temperature";
|
|---|
| 2276 | input MassFraction X[:] "Mass fractions";
|
|---|
| 2277 | output Density d "Density";
|
|---|
| 2278 | algorithm
|
|---|
| 2279 | d := density(setState_pTX(
|
|---|
| 2280 | p,
|
|---|
| 2281 | T,
|
|---|
| 2282 | X));
|
|---|
| 2283 | end density_pTX;
|
|---|
| 2284 |
|
|---|
| 2285 | replaceable function temperature_phX
|
|---|
| 2286 | "Return temperature from p, h, and X or Xi"
|
|---|
| 2287 | extends Modelica.Icons.Function;
|
|---|
| 2288 | input AbsolutePressure p "Pressure";
|
|---|
| 2289 | input SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 2290 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2291 | output Temperature T "Temperature";
|
|---|
| 2292 | algorithm
|
|---|
| 2293 | T := temperature(setState_phX(
|
|---|
| 2294 | p,
|
|---|
| 2295 | h,
|
|---|
| 2296 | X));
|
|---|
| 2297 | end temperature_phX;
|
|---|
| 2298 |
|
|---|
| 2299 | replaceable function density_phX "Return density from p, h, and X or Xi"
|
|---|
| 2300 | extends Modelica.Icons.Function;
|
|---|
| 2301 | input AbsolutePressure p "Pressure";
|
|---|
| 2302 | input SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 2303 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2304 | output Density d "Density";
|
|---|
| 2305 | algorithm
|
|---|
| 2306 | d := density(setState_phX(
|
|---|
| 2307 | p,
|
|---|
| 2308 | h,
|
|---|
| 2309 | X));
|
|---|
| 2310 | end density_phX;
|
|---|
| 2311 |
|
|---|
| 2312 | replaceable function temperature_psX
|
|---|
| 2313 | "Return temperature from p,s, and X or Xi"
|
|---|
| 2314 | extends Modelica.Icons.Function;
|
|---|
| 2315 | input AbsolutePressure p "Pressure";
|
|---|
| 2316 | input SpecificEntropy s "Specific entropy";
|
|---|
| 2317 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2318 | output Temperature T "Temperature";
|
|---|
| 2319 | algorithm
|
|---|
| 2320 | T := temperature(setState_psX(
|
|---|
| 2321 | p,
|
|---|
| 2322 | s,
|
|---|
| 2323 | X));
|
|---|
| 2324 | annotation (inverse(s=specificEntropy_pTX(
|
|---|
| 2325 | p,
|
|---|
| 2326 | T,
|
|---|
| 2327 | X)));
|
|---|
| 2328 | end temperature_psX;
|
|---|
| 2329 |
|
|---|
| 2330 | replaceable function density_psX "Return density from p, s, and X or Xi"
|
|---|
| 2331 | extends Modelica.Icons.Function;
|
|---|
| 2332 | input AbsolutePressure p "Pressure";
|
|---|
| 2333 | input SpecificEntropy s "Specific entropy";
|
|---|
| 2334 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2335 | output Density d "Density";
|
|---|
| 2336 | algorithm
|
|---|
| 2337 | d := density(setState_psX(
|
|---|
| 2338 | p,
|
|---|
| 2339 | s,
|
|---|
| 2340 | X));
|
|---|
| 2341 | end density_psX;
|
|---|
| 2342 |
|
|---|
| 2343 | replaceable function specificEnthalpy_psX
|
|---|
| 2344 | "Return specific enthalpy from p, s, and X or Xi"
|
|---|
| 2345 | extends Modelica.Icons.Function;
|
|---|
| 2346 | input AbsolutePressure p "Pressure";
|
|---|
| 2347 | input SpecificEntropy s "Specific entropy";
|
|---|
| 2348 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 2349 | output SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 2350 | algorithm
|
|---|
| 2351 | h := specificEnthalpy(setState_psX(
|
|---|
| 2352 | p,
|
|---|
| 2353 | s,
|
|---|
| 2354 | X));
|
|---|
| 2355 | end specificEnthalpy_psX;
|
|---|
| 2356 |
|
|---|
| 2357 | type MassFlowRate = SI.MassFlowRate (
|
|---|
| 2358 | quantity="MassFlowRate." + mediumName,
|
|---|
| 2359 | min=-1.0e5,
|
|---|
| 2360 | max=1.e5) "Type for mass flow rate with medium specific attributes";
|
|---|
| 2361 |
|
|---|
| 2362 | // Only for backwards compatibility to version 3.2 (
|
|---|
| 2363 | // (do not use these definitions in new models, but use Modelica.Media.Interfaces.Choices instead)
|
|---|
| 2364 | package Choices = Modelica.Media.Interfaces.Choices annotation (obsolete=
|
|---|
| 2365 | "Use Modelica.Media.Interfaces.Choices");
|
|---|
| 2366 |
|
|---|
| 2367 | annotation (Documentation(info="<html>
|
|---|
| 2368 | <p>
|
|---|
| 2369 | <b>PartialMedium</b> is a package and contains all <b>declarations</b> for
|
|---|
| 2370 | a medium. This means that constants, models, and functions
|
|---|
| 2371 | are defined that every medium is supposed to support
|
|---|
| 2372 | (some of them are optional). A medium package
|
|---|
| 2373 | inherits from <b>PartialMedium</b> and provides the
|
|---|
| 2374 | equations for the medium. The details of this package
|
|---|
| 2375 | are described in
|
|---|
| 2376 | <a href=\"modelica://Modelica.Media.UsersGuide\">Modelica.Media.UsersGuide</a>.
|
|---|
| 2377 | </p>
|
|---|
| 2378 | </html>", revisions="<html>
|
|---|
| 2379 |
|
|---|
| 2380 | </html>"));
|
|---|
| 2381 | end PartialMedium;
|
|---|
| 2382 |
|
|---|
| 2383 | partial package PartialMixtureMedium
|
|---|
| 2384 | "Base class for pure substances of several chemical substances"
|
|---|
| 2385 | extends PartialMedium(redeclare replaceable record FluidConstants =
|
|---|
| 2386 | Modelica.Media.Interfaces.Types.IdealGas.FluidConstants);
|
|---|
| 2387 |
|
|---|
| 2388 | redeclare replaceable record extends ThermodynamicState
|
|---|
| 2389 | "Thermodynamic state variables"
|
|---|
| 2390 | AbsolutePressure p "Absolute pressure of medium";
|
|---|
| 2391 | Temperature T "Temperature of medium";
|
|---|
| 2392 | MassFraction X[nX]
|
|---|
| 2393 | "Mass fractions (= (component mass)/total mass m_i/m)";
|
|---|
| 2394 | end ThermodynamicState;
|
|---|
| 2395 |
|
|---|
| 2396 | constant FluidConstants[nS] fluidConstants "Constant data for the fluid";
|
|---|
| 2397 |
|
|---|
| 2398 | replaceable function gasConstant
|
|---|
| 2399 | "Return the gas constant of the mixture (also for liquids)"
|
|---|
| 2400 | extends Modelica.Icons.Function;
|
|---|
| 2401 | input ThermodynamicState state "Thermodynamic state";
|
|---|
| 2402 | output SI.SpecificHeatCapacity R "Mixture gas constant";
|
|---|
| 2403 | end gasConstant;
|
|---|
| 2404 |
|
|---|
| 2405 | function moleToMassFractions
|
|---|
| 2406 | "Return mass fractions X from mole fractions"
|
|---|
| 2407 | extends Modelica.Icons.Function;
|
|---|
| 2408 | input SI.MoleFraction moleFractions[:] "Mole fractions of mixture";
|
|---|
| 2409 | input MolarMass[:] MMX "Molar masses of components";
|
|---|
| 2410 | output SI.MassFraction X[size(moleFractions, 1)]
|
|---|
| 2411 | "Mass fractions of gas mixture";
|
|---|
| 2412 | protected
|
|---|
| 2413 | MolarMass Mmix=moleFractions*MMX "Molar mass of mixture";
|
|---|
| 2414 | algorithm
|
|---|
| 2415 | for i in 1:size(moleFractions, 1) loop
|
|---|
| 2416 | X[i] := moleFractions[i]*MMX[i]/Mmix;
|
|---|
| 2417 | end for;
|
|---|
| 2418 | annotation (smoothOrder=5);
|
|---|
| 2419 | end moleToMassFractions;
|
|---|
| 2420 |
|
|---|
| 2421 | function massToMoleFractions
|
|---|
| 2422 | "Return mole fractions from mass fractions X"
|
|---|
| 2423 | extends Modelica.Icons.Function;
|
|---|
| 2424 | input SI.MassFraction X[:] "Mass fractions of mixture";
|
|---|
| 2425 | input SI.MolarMass[:] MMX "Molar masses of components";
|
|---|
| 2426 | output SI.MoleFraction moleFractions[size(X, 1)]
|
|---|
| 2427 | "Mole fractions of gas mixture";
|
|---|
| 2428 | protected
|
|---|
| 2429 | Real invMMX[size(X, 1)] "Inverses of molar weights";
|
|---|
| 2430 | SI.MolarMass Mmix "Molar mass of mixture";
|
|---|
| 2431 | algorithm
|
|---|
| 2432 | for i in 1:size(X, 1) loop
|
|---|
| 2433 | invMMX[i] := 1/MMX[i];
|
|---|
| 2434 | end for;
|
|---|
| 2435 | Mmix := 1/(X*invMMX);
|
|---|
| 2436 | for i in 1:size(X, 1) loop
|
|---|
| 2437 | moleFractions[i] := Mmix*X[i]/MMX[i];
|
|---|
| 2438 | end for;
|
|---|
| 2439 | annotation (smoothOrder=5);
|
|---|
| 2440 | end massToMoleFractions;
|
|---|
| 2441 |
|
|---|
| 2442 | end PartialMixtureMedium;
|
|---|
| 2443 |
|
|---|
| 2444 | package Choices "Types, constants to define menu choices"
|
|---|
| 2445 | extends Modelica.Icons.Package;
|
|---|
| 2446 |
|
|---|
| 2447 | type IndependentVariables = enumeration(
|
|---|
| 2448 | T "Temperature",
|
|---|
| 2449 | pT "Pressure, Temperature",
|
|---|
| 2450 | ph "Pressure, Specific Enthalpy",
|
|---|
| 2451 | phX "Pressure, Specific Enthalpy, Mass Fraction",
|
|---|
| 2452 | pTX "Pressure, Temperature, Mass Fractions",
|
|---|
| 2453 | dTX "Density, Temperature, Mass Fractions")
|
|---|
| 2454 | "Enumeration defining the independent variables of a medium";
|
|---|
| 2455 |
|
|---|
| 2456 | type ReferenceEnthalpy = enumeration(
|
|---|
| 2457 | ZeroAt0K
|
|---|
| 2458 | "The enthalpy is 0 at 0 K (default), if the enthalpy of formation is excluded",
|
|---|
| 2459 |
|
|---|
| 2460 | ZeroAt25C
|
|---|
| 2461 | "The enthalpy is 0 at 25 degC, if the enthalpy of formation is excluded",
|
|---|
| 2462 |
|
|---|
| 2463 | UserDefined
|
|---|
| 2464 | "The user-defined reference enthalpy is used at 293.15 K (25 degC)")
|
|---|
| 2465 | "Enumeration defining the reference enthalpy of a medium"
|
|---|
| 2466 | annotation (
|
|---|
| 2467 | Evaluate=true);
|
|---|
| 2468 |
|
|---|
| 2469 | annotation (Documentation(info="<html>
|
|---|
| 2470 | <p>
|
|---|
| 2471 | Enumerations and data types for all types of fluids
|
|---|
| 2472 | </p>
|
|---|
| 2473 |
|
|---|
| 2474 | <p>
|
|---|
| 2475 | Note: Reference enthalpy might have to be extended with enthalpy of formation.
|
|---|
| 2476 | </p>
|
|---|
| 2477 | </html>"));
|
|---|
| 2478 | end Choices;
|
|---|
| 2479 |
|
|---|
| 2480 | package Types "Types to be used in fluid models"
|
|---|
| 2481 | extends Modelica.Icons.Package;
|
|---|
| 2482 |
|
|---|
| 2483 | type AbsolutePressure = SI.AbsolutePressure (
|
|---|
| 2484 | min=0,
|
|---|
| 2485 | max=1.e8,
|
|---|
| 2486 | nominal=1.e5,
|
|---|
| 2487 | start=1.e5)
|
|---|
| 2488 | "Type for absolute pressure with medium specific attributes";
|
|---|
| 2489 |
|
|---|
| 2490 | type Density = SI.Density (
|
|---|
| 2491 | min=0,
|
|---|
| 2492 | max=1.e5,
|
|---|
| 2493 | nominal=1,
|
|---|
| 2494 | start=1) "Type for density with medium specific attributes";
|
|---|
| 2495 |
|
|---|
| 2496 | type DynamicViscosity = SI.DynamicViscosity (
|
|---|
| 2497 | min=0,
|
|---|
| 2498 | max=1.e8,
|
|---|
| 2499 | nominal=1.e-3,
|
|---|
| 2500 | start=1.e-3)
|
|---|
| 2501 | "Type for dynamic viscosity with medium specific attributes";
|
|---|
| 2502 |
|
|---|
| 2503 | type MassFraction = Real (
|
|---|
| 2504 | quantity="MassFraction",
|
|---|
| 2505 | final unit="kg/kg",
|
|---|
| 2506 | min=0,
|
|---|
| 2507 | max=1,
|
|---|
| 2508 | nominal=0.1) "Type for mass fraction with medium specific attributes";
|
|---|
| 2509 |
|
|---|
| 2510 | type MoleFraction = Real (
|
|---|
| 2511 | quantity="MoleFraction",
|
|---|
| 2512 | final unit="mol/mol",
|
|---|
| 2513 | min=0,
|
|---|
| 2514 | max=1,
|
|---|
| 2515 | nominal=0.1) "Type for mole fraction with medium specific attributes";
|
|---|
| 2516 |
|
|---|
| 2517 | type MolarMass = SI.MolarMass (
|
|---|
| 2518 | min=0.001,
|
|---|
| 2519 | max=0.25,
|
|---|
| 2520 | nominal=0.032) "Type for molar mass with medium specific attributes";
|
|---|
| 2521 |
|
|---|
| 2522 | type MolarVolume = SI.MolarVolume (
|
|---|
| 2523 | min=1e-6,
|
|---|
| 2524 | max=1.0e6,
|
|---|
| 2525 | nominal=1.0) "Type for molar volume with medium specific attributes";
|
|---|
| 2526 |
|
|---|
| 2527 | type IsentropicExponent = SI.RatioOfSpecificHeatCapacities (
|
|---|
| 2528 | min=1,
|
|---|
| 2529 | max=500000,
|
|---|
| 2530 | nominal=1.2,
|
|---|
| 2531 | start=1.2)
|
|---|
| 2532 | "Type for isentropic exponent with medium specific attributes";
|
|---|
| 2533 |
|
|---|
| 2534 | type SpecificEnergy = SI.SpecificEnergy (
|
|---|
| 2535 | min=-1.0e8,
|
|---|
| 2536 | max=1.e8,
|
|---|
| 2537 | nominal=1.e6)
|
|---|
| 2538 | "Type for specific energy with medium specific attributes";
|
|---|
| 2539 |
|
|---|
| 2540 | type SpecificInternalEnergy = SpecificEnergy
|
|---|
| 2541 | "Type for specific internal energy with medium specific attributes";
|
|---|
| 2542 |
|
|---|
| 2543 | type SpecificEnthalpy = SI.SpecificEnthalpy (
|
|---|
| 2544 | min=-1.0e10,
|
|---|
| 2545 | max=1.e10,
|
|---|
| 2546 | nominal=1.e6)
|
|---|
| 2547 | "Type for specific enthalpy with medium specific attributes";
|
|---|
| 2548 |
|
|---|
| 2549 | type SpecificEntropy = SI.SpecificEntropy (
|
|---|
| 2550 | min=-1.e7,
|
|---|
| 2551 | max=1.e7,
|
|---|
| 2552 | nominal=1.e3)
|
|---|
| 2553 | "Type for specific entropy with medium specific attributes";
|
|---|
| 2554 |
|
|---|
| 2555 | type SpecificHeatCapacity = SI.SpecificHeatCapacity (
|
|---|
| 2556 | min=0,
|
|---|
| 2557 | max=1.e7,
|
|---|
| 2558 | nominal=1.e3,
|
|---|
| 2559 | start=1.e3)
|
|---|
| 2560 | "Type for specific heat capacity with medium specific attributes";
|
|---|
| 2561 |
|
|---|
| 2562 | type Temperature = SI.Temperature (
|
|---|
| 2563 | min=1,
|
|---|
| 2564 | max=1.e4,
|
|---|
| 2565 | nominal=300,
|
|---|
| 2566 | start=300) "Type for temperature with medium specific attributes";
|
|---|
| 2567 |
|
|---|
| 2568 | type ThermalConductivity = SI.ThermalConductivity (
|
|---|
| 2569 | min=0,
|
|---|
| 2570 | max=500,
|
|---|
| 2571 | nominal=1,
|
|---|
| 2572 | start=1)
|
|---|
| 2573 | "Type for thermal conductivity with medium specific attributes";
|
|---|
| 2574 |
|
|---|
| 2575 | type PrandtlNumber = SI.PrandtlNumber (
|
|---|
| 2576 | min=1e-3,
|
|---|
| 2577 | max=1e5,
|
|---|
| 2578 | nominal=1.0)
|
|---|
| 2579 | "Type for Prandtl number with medium specific attributes";
|
|---|
| 2580 |
|
|---|
| 2581 | type VelocityOfSound = SI.Velocity (
|
|---|
| 2582 | min=0,
|
|---|
| 2583 | max=1.e5,
|
|---|
| 2584 | nominal=1000,
|
|---|
| 2585 | start=1000)
|
|---|
| 2586 | "Type for velocity of sound with medium specific attributes";
|
|---|
| 2587 |
|
|---|
| 2588 | type ExtraProperty = Real (min=0.0, start=1.0)
|
|---|
| 2589 | "Type for unspecified, mass-specific property transported by flow";
|
|---|
| 2590 |
|
|---|
| 2591 | type IsobaricExpansionCoefficient = Real (
|
|---|
| 2592 | min=0,
|
|---|
| 2593 | max=1.0e8,
|
|---|
| 2594 | unit="1/K")
|
|---|
| 2595 | "Type for isobaric expansion coefficient with medium specific attributes";
|
|---|
| 2596 |
|
|---|
| 2597 | type DipoleMoment = Real (
|
|---|
| 2598 | min=0.0,
|
|---|
| 2599 | max=2.0,
|
|---|
| 2600 | unit="debye",
|
|---|
| 2601 | quantity="ElectricDipoleMoment")
|
|---|
| 2602 | "Type for dipole moment with medium specific attributes";
|
|---|
| 2603 |
|
|---|
| 2604 | type DerDensityByPressure = SI.DerDensityByPressure
|
|---|
| 2605 | "Type for partial derivative of density with respect to pressure with medium specific attributes";
|
|---|
| 2606 |
|
|---|
| 2607 | type DerDensityByEnthalpy = SI.DerDensityByEnthalpy
|
|---|
| 2608 | "Type for partial derivative of density with respect to enthalpy with medium specific attributes";
|
|---|
| 2609 |
|
|---|
| 2610 | type DerDensityByTemperature = SI.DerDensityByTemperature
|
|---|
| 2611 | "Type for partial derivative of density with respect to temperature with medium specific attributes";
|
|---|
| 2612 |
|
|---|
| 2613 | package Basic
|
|---|
| 2614 | "The most basic version of a record used in several degrees of detail"
|
|---|
| 2615 | extends Icons.Package;
|
|---|
| 2616 |
|
|---|
| 2617 | record FluidConstants
|
|---|
| 2618 | "Critical, triple, molecular and other standard data of fluid"
|
|---|
| 2619 | extends Modelica.Icons.Record;
|
|---|
| 2620 | String iupacName
|
|---|
| 2621 | "Complete IUPAC name (or common name, if non-existent)";
|
|---|
| 2622 | String casRegistryNumber
|
|---|
| 2623 | "Chemical abstracts sequencing number (if it exists)";
|
|---|
| 2624 | String chemicalFormula
|
|---|
| 2625 | "Chemical formula, (brutto, nomenclature according to Hill";
|
|---|
| 2626 | String structureFormula "Chemical structure formula";
|
|---|
| 2627 | MolarMass molarMass "Molar mass";
|
|---|
| 2628 | end FluidConstants;
|
|---|
| 2629 | end Basic;
|
|---|
| 2630 |
|
|---|
| 2631 | package IdealGas
|
|---|
| 2632 | "The ideal gas version of a record used in several degrees of detail"
|
|---|
| 2633 | extends Icons.Package;
|
|---|
| 2634 |
|
|---|
| 2635 | record FluidConstants "Extended fluid constants"
|
|---|
| 2636 | extends Modelica.Media.Interfaces.Types.Basic.FluidConstants;
|
|---|
| 2637 | Temperature criticalTemperature "Critical temperature";
|
|---|
| 2638 | AbsolutePressure criticalPressure "Critical pressure";
|
|---|
| 2639 | MolarVolume criticalMolarVolume "Critical molar Volume";
|
|---|
| 2640 | Real acentricFactor "Pitzer acentric factor";
|
|---|
| 2641 | // Temperature triplePointTemperature "Triple point temperature";
|
|---|
| 2642 | // AbsolutePressure triplePointPressure "Triple point pressure";
|
|---|
| 2643 | Temperature meltingPoint "Melting point at 101325 Pa";
|
|---|
| 2644 | Temperature normalBoilingPoint "Normal boiling point (at 101325 Pa)";
|
|---|
| 2645 | DipoleMoment dipoleMoment
|
|---|
| 2646 | "Dipole moment of molecule in Debye (1 debye = 3.33564e10-30 C.m)";
|
|---|
| 2647 | Boolean hasIdealGasHeatCapacity=false
|
|---|
| 2648 | "True if ideal gas heat capacity is available";
|
|---|
| 2649 | Boolean hasCriticalData=false "True if critical data are known";
|
|---|
| 2650 | Boolean hasDipoleMoment=false "True if a dipole moment known";
|
|---|
| 2651 | Boolean hasFundamentalEquation=false "True if a fundamental equation";
|
|---|
| 2652 | Boolean hasLiquidHeatCapacity=false
|
|---|
| 2653 | "True if liquid heat capacity is available";
|
|---|
| 2654 | Boolean hasSolidHeatCapacity=false
|
|---|
| 2655 | "True if solid heat capacity is available";
|
|---|
| 2656 | Boolean hasAccurateViscosityData=false
|
|---|
| 2657 | "True if accurate data for a viscosity function is available";
|
|---|
| 2658 | Boolean hasAccurateConductivityData=false
|
|---|
| 2659 | "True if accurate data for thermal conductivity is available";
|
|---|
| 2660 | Boolean hasVapourPressureCurve=false
|
|---|
| 2661 | "True if vapour pressure data, e.g., Antoine coefficents are known";
|
|---|
| 2662 | Boolean hasAcentricFactor=false
|
|---|
| 2663 | "True if Pitzer accentric factor is known";
|
|---|
| 2664 | SpecificEnthalpy HCRIT0=0.0
|
|---|
| 2665 | "Critical specific enthalpy of the fundamental equation";
|
|---|
| 2666 | SpecificEntropy SCRIT0=0.0
|
|---|
| 2667 | "Critical specific entropy of the fundamental equation";
|
|---|
| 2668 | SpecificEnthalpy deltah=0.0
|
|---|
| 2669 | "Difference between specific enthalpy model (h_m) and f.eq. (h_f) (h_m - h_f)";
|
|---|
| 2670 | SpecificEntropy deltas=0.0
|
|---|
| 2671 | "Difference between specific enthalpy model (s_m) and f.eq. (s_f) (s_m - s_f)";
|
|---|
| 2672 | end FluidConstants;
|
|---|
| 2673 | end IdealGas;
|
|---|
| 2674 | end Types;
|
|---|
| 2675 | annotation (Documentation(info="<HTML>
|
|---|
| 2676 | <p>
|
|---|
| 2677 | This package provides basic interfaces definitions of media models for different
|
|---|
| 2678 | kind of media.
|
|---|
| 2679 | </p>
|
|---|
| 2680 | </HTML>"));
|
|---|
| 2681 | end Interfaces;
|
|---|
| 2682 |
|
|---|
| 2683 | package Common
|
|---|
| 2684 | "Data structures and fundamental functions for fluid properties"
|
|---|
| 2685 | extends Modelica.Icons.Package;
|
|---|
| 2686 |
|
|---|
| 2687 | function smoothStep
|
|---|
| 2688 | "Approximation of a general step, such that the characteristic is continuous and differentiable"
|
|---|
| 2689 | extends Modelica.Icons.Function;
|
|---|
| 2690 | input Real x "Abscissa value";
|
|---|
| 2691 | input Real y1 "Ordinate value for x > 0";
|
|---|
| 2692 | input Real y2 "Ordinate value for x < 0";
|
|---|
| 2693 | input Real x_small(min=0) = 1e-5
|
|---|
| 2694 | "Approximation of step for -x_small <= x <= x_small; x_small > 0 required";
|
|---|
| 2695 | output Real y
|
|---|
| 2696 | "Ordinate value to approximate y = if x > 0 then y1 else y2";
|
|---|
| 2697 | algorithm
|
|---|
| 2698 | y := smooth(1, if x > x_small then y1 else if x < -x_small then y2 else if
|
|---|
| 2699 | abs(x_small) > 0 then (x/x_small)*((x/x_small)^2 - 3)*(y2 - y1)/4 + (y1
|
|---|
| 2700 | + y2)/2 else (y1 + y2)/2);
|
|---|
| 2701 |
|
|---|
| 2702 | annotation (
|
|---|
| 2703 | Inline=true,
|
|---|
| 2704 | smoothOrder=1,
|
|---|
| 2705 | Documentation(revisions="<html>
|
|---|
| 2706 | <ul>
|
|---|
| 2707 | <li><i>April 29, 2008</i>
|
|---|
| 2708 | by <a href=\"mailto:Martin.Otter@DLR.de\">Martin Otter</a>:<br>
|
|---|
| 2709 | Designed and implemented.</li>
|
|---|
| 2710 | <li><i>August 12, 2008</i>
|
|---|
| 2711 | by <a href=\"mailto:Michael.Sielemann@dlr.de\">Michael Sielemann</a>:<br>
|
|---|
| 2712 | Minor modification to cover the limit case <code>x_small -> 0</code> without division by zero.</li>
|
|---|
| 2713 | </ul>
|
|---|
| 2714 | </html>", info="<html>
|
|---|
| 2715 | <p>
|
|---|
| 2716 | This function is used to approximate the equation
|
|---|
| 2717 | </p>
|
|---|
| 2718 | <pre>
|
|---|
| 2719 | y = <b>if</b> x > 0 <b>then</b> y1 <b>else</b> y2;
|
|---|
| 2720 | </pre>
|
|---|
| 2721 |
|
|---|
| 2722 | <p>
|
|---|
| 2723 | by a smooth characteristic, so that the expression is continuous and differentiable:
|
|---|
| 2724 | </p>
|
|---|
| 2725 |
|
|---|
| 2726 | <pre>
|
|---|
| 2727 | y = <b>smooth</b>(1, <b>if</b> x > x_small <b>then</b> y1 <b>else</b>
|
|---|
| 2728 | <b>if</b> x < -x_small <b>then</b> y2 <b>else</b> f(y1, y2));
|
|---|
| 2729 | </pre>
|
|---|
| 2730 |
|
|---|
| 2731 | <p>
|
|---|
| 2732 | In the region -x_small < x < x_small a 2nd order polynomial is used
|
|---|
| 2733 | for a smooth transition from y1 to y2.
|
|---|
| 2734 | </p>
|
|---|
| 2735 |
|
|---|
| 2736 | <p>
|
|---|
| 2737 | If <b>mass fractions</b> X[:] are approximated with this function then this can be performed
|
|---|
| 2738 | for all <b>nX</b> mass fractions, instead of applying it for nX-1 mass fractions and computing
|
|---|
| 2739 | the last one by the mass fraction constraint sum(X)=1. The reason is that the approximating function has the
|
|---|
| 2740 | property that sum(X) = 1, provided sum(X_a) = sum(X_b) = 1
|
|---|
| 2741 | (and y1=X_a[i], y2=X_b[i]).
|
|---|
| 2742 | This can be shown by evaluating the approximating function in the abs(x) < x_small
|
|---|
| 2743 | region (otherwise X is either X_a or X_b):
|
|---|
| 2744 | </p>
|
|---|
| 2745 |
|
|---|
| 2746 | <pre>
|
|---|
| 2747 | X[1] = smoothStep(x, X_a[1] , X_b[1] , x_small);
|
|---|
| 2748 | X[2] = smoothStep(x, X_a[2] , X_b[2] , x_small);
|
|---|
| 2749 | ...
|
|---|
| 2750 | X[nX] = smoothStep(x, X_a[nX], X_b[nX], x_small);
|
|---|
| 2751 | </pre>
|
|---|
| 2752 |
|
|---|
| 2753 | <p>
|
|---|
| 2754 | or
|
|---|
| 2755 | </p>
|
|---|
| 2756 |
|
|---|
| 2757 | <pre>
|
|---|
| 2758 | X[1] = c*(X_a[1] - X_b[1]) + (X_a[1] + X_b[1])/2
|
|---|
| 2759 | X[2] = c*(X_a[2] - X_b[2]) + (X_a[2] + X_b[2])/2;
|
|---|
| 2760 | ...
|
|---|
| 2761 | X[nX] = c*(X_a[nX] - X_b[nX]) + (X_a[nX] + X_b[nX])/2;
|
|---|
| 2762 | c = (x/x_small)*((x/x_small)^2 - 3)/4
|
|---|
| 2763 | </pre>
|
|---|
| 2764 |
|
|---|
| 2765 | <p>
|
|---|
| 2766 | Summing all mass fractions together results in
|
|---|
| 2767 | </p>
|
|---|
| 2768 |
|
|---|
| 2769 | <pre>
|
|---|
| 2770 | sum(X) = c*(sum(X_a) - sum(X_b)) + (sum(X_a) + sum(X_b))/2
|
|---|
| 2771 | = c*(1 - 1) + (1 + 1)/2
|
|---|
| 2772 | = 1
|
|---|
| 2773 | </pre>
|
|---|
| 2774 | </html>"));
|
|---|
| 2775 | end smoothStep;
|
|---|
| 2776 |
|
|---|
| 2777 | package OneNonLinearEquation
|
|---|
| 2778 | "Determine solution of a non-linear algebraic equation in one unknown without derivatives in a reliable and efficient way"
|
|---|
| 2779 | extends Modelica.Icons.Package;
|
|---|
| 2780 |
|
|---|
| 2781 | replaceable record f_nonlinear_Data
|
|---|
| 2782 | "Data specific for function f_nonlinear"
|
|---|
| 2783 | extends Modelica.Icons.Record;
|
|---|
| 2784 | end f_nonlinear_Data;
|
|---|
| 2785 |
|
|---|
| 2786 | replaceable partial function f_nonlinear
|
|---|
| 2787 | "Nonlinear algebraic equation in one unknown: y = f_nonlinear(x,p,X)"
|
|---|
| 2788 | extends Modelica.Icons.Function;
|
|---|
| 2789 | input Real x "Independent variable of function";
|
|---|
| 2790 | input Real p=0.0
|
|---|
| 2791 | "Disregarded variables (here always used for pressure)";
|
|---|
| 2792 | input Real[:] X=fill(0, 0)
|
|---|
| 2793 | "Disregarded variables (her always used for composition)";
|
|---|
| 2794 | input f_nonlinear_Data f_nonlinear_data
|
|---|
| 2795 | "Additional data for the function";
|
|---|
| 2796 | output Real y "= f_nonlinear(x)";
|
|---|
| 2797 | // annotation(derivative(zeroDerivative=y)); // this must hold for all replaced functions
|
|---|
| 2798 | end f_nonlinear;
|
|---|
| 2799 |
|
|---|
| 2800 | replaceable function solve
|
|---|
| 2801 | "Solve f_nonlinear(x_zero)=y_zero; f_nonlinear(x_min) - y_zero and f_nonlinear(x_max)-y_zero must have different sign"
|
|---|
| 2802 | import Modelica.Utilities.Streams.error;
|
|---|
| 2803 | extends Modelica.Icons.Function;
|
|---|
| 2804 | input Real y_zero
|
|---|
| 2805 | "Determine x_zero, such that f_nonlinear(x_zero) = y_zero";
|
|---|
| 2806 | input Real x_min "Minimum value of x";
|
|---|
| 2807 | input Real x_max "Maximum value of x";
|
|---|
| 2808 | input Real pressure=0.0
|
|---|
| 2809 | "Disregarded variables (here always used for pressure)";
|
|---|
| 2810 | input Real[:] X=fill(0, 0)
|
|---|
| 2811 | "Disregarded variables (here always used for composition)";
|
|---|
| 2812 | input f_nonlinear_Data f_nonlinear_data
|
|---|
| 2813 | "Additional data for function f_nonlinear";
|
|---|
| 2814 | input Real x_tol=100*Modelica.Constants.eps
|
|---|
| 2815 | "Relative tolerance of the result";
|
|---|
| 2816 | output Real x_zero "f_nonlinear(x_zero) = y_zero";
|
|---|
| 2817 | protected
|
|---|
| 2818 | constant Real eps=Modelica.Constants.eps "Machine epsilon";
|
|---|
| 2819 | constant Real x_eps=1e-10
|
|---|
| 2820 | "Slight modification of x_min, x_max, since x_min, x_max are usually exactly at the borders T_min/h_min and then small numeric noise may make the interval invalid";
|
|---|
| 2821 | Real x_min2=x_min - x_eps;
|
|---|
| 2822 | Real x_max2=x_max + x_eps;
|
|---|
| 2823 | Real a=x_min2 "Current best minimum interval value";
|
|---|
| 2824 | Real b=x_max2 "Current best maximum interval value";
|
|---|
| 2825 | Real c "Intermediate point a <= c <= b";
|
|---|
| 2826 | Real d;
|
|---|
| 2827 | Real e "b - a";
|
|---|
| 2828 | Real m;
|
|---|
| 2829 | Real s;
|
|---|
| 2830 | Real p;
|
|---|
| 2831 | Real q;
|
|---|
| 2832 | Real r;
|
|---|
| 2833 | Real tol;
|
|---|
| 2834 | Real fa "= f_nonlinear(a) - y_zero";
|
|---|
| 2835 | Real fb "= f_nonlinear(b) - y_zero";
|
|---|
| 2836 | Real fc;
|
|---|
| 2837 | Boolean found=false;
|
|---|
| 2838 | algorithm
|
|---|
| 2839 | // Check that f(x_min) and f(x_max) have different sign
|
|---|
| 2840 | fa := f_nonlinear(
|
|---|
| 2841 | x_min2,
|
|---|
| 2842 | pressure,
|
|---|
| 2843 | X,
|
|---|
| 2844 | f_nonlinear_data) - y_zero;
|
|---|
| 2845 | fb := f_nonlinear(
|
|---|
| 2846 | x_max2,
|
|---|
| 2847 | pressure,
|
|---|
| 2848 | X,
|
|---|
| 2849 | f_nonlinear_data) - y_zero;
|
|---|
| 2850 | fc := fb;
|
|---|
| 2851 | if fa > 0.0 and fb > 0.0 or fa < 0.0 and fb < 0.0 then
|
|---|
| 2852 | error(
|
|---|
| 2853 | "The arguments x_min and x_max to OneNonLinearEquation.solve(..)\n"
|
|---|
| 2854 | + "do not bracket the root of the single non-linear equation:\n" +
|
|---|
| 2855 | " x_min = " + String(x_min2) + "\n" + " x_max = " + String(x_max2)
|
|---|
| 2856 | + "\n" + " y_zero = " + String(y_zero) + "\n" +
|
|---|
| 2857 | " fa = f(x_min) - y_zero = " + String(fa) + "\n" +
|
|---|
| 2858 | " fb = f(x_max) - y_zero = " + String(fb) + "\n" +
|
|---|
| 2859 | "fa and fb must have opposite sign which is not the case");
|
|---|
| 2860 | end if;
|
|---|
| 2861 |
|
|---|
| 2862 | // Initialize variables
|
|---|
| 2863 | c := a;
|
|---|
| 2864 | fc := fa;
|
|---|
| 2865 | e := b - a;
|
|---|
| 2866 | d := e;
|
|---|
| 2867 |
|
|---|
| 2868 | // Search loop
|
|---|
| 2869 | while not found loop
|
|---|
| 2870 | if abs(fc) < abs(fb) then
|
|---|
| 2871 | a := b;
|
|---|
| 2872 | b := c;
|
|---|
| 2873 | c := a;
|
|---|
| 2874 | fa := fb;
|
|---|
| 2875 | fb := fc;
|
|---|
| 2876 | fc := fa;
|
|---|
| 2877 | end if;
|
|---|
| 2878 |
|
|---|
| 2879 | tol := 2*eps*abs(b) + x_tol;
|
|---|
| 2880 | m := (c - b)/2;
|
|---|
| 2881 |
|
|---|
| 2882 | if abs(m) <= tol or fb == 0.0 then
|
|---|
| 2883 | // root found (interval is small enough)
|
|---|
| 2884 | found := true;
|
|---|
| 2885 | x_zero := b;
|
|---|
| 2886 | else
|
|---|
| 2887 | // Determine if a bisection is needed
|
|---|
| 2888 | if abs(e) < tol or abs(fa) <= abs(fb) then
|
|---|
| 2889 | e := m;
|
|---|
| 2890 | d := e;
|
|---|
| 2891 | else
|
|---|
| 2892 | s := fb/fa;
|
|---|
| 2893 | if a == c then
|
|---|
| 2894 | // linear interpolation
|
|---|
| 2895 | p := 2*m*s;
|
|---|
| 2896 | q := 1 - s;
|
|---|
| 2897 | else
|
|---|
| 2898 | // inverse quadratic interpolation
|
|---|
| 2899 | q := fa/fc;
|
|---|
| 2900 | r := fb/fc;
|
|---|
| 2901 | p := s*(2*m*q*(q - r) - (b - a)*(r - 1));
|
|---|
| 2902 | q := (q - 1)*(r - 1)*(s - 1);
|
|---|
| 2903 | end if;
|
|---|
| 2904 |
|
|---|
| 2905 | if p > 0 then
|
|---|
| 2906 | q := -q;
|
|---|
| 2907 | else
|
|---|
| 2908 | p := -p;
|
|---|
| 2909 | end if;
|
|---|
| 2910 |
|
|---|
| 2911 | s := e;
|
|---|
| 2912 | e := d;
|
|---|
| 2913 | if 2*p < 3*m*q - abs(tol*q) and p < abs(0.5*s*q) then
|
|---|
| 2914 | // interpolation successful
|
|---|
| 2915 | d := p/q;
|
|---|
| 2916 | else
|
|---|
| 2917 | // use bi-section
|
|---|
| 2918 | e := m;
|
|---|
| 2919 | d := e;
|
|---|
| 2920 | end if;
|
|---|
| 2921 | end if;
|
|---|
| 2922 |
|
|---|
| 2923 | // Best guess value is defined as "a"
|
|---|
| 2924 | a := b;
|
|---|
| 2925 | fa := fb;
|
|---|
| 2926 | b := b + (if abs(d) > tol then d else if m > 0 then tol else -tol);
|
|---|
| 2927 | fb := f_nonlinear(
|
|---|
| 2928 | b,
|
|---|
| 2929 | pressure,
|
|---|
| 2930 | X,
|
|---|
| 2931 | f_nonlinear_data) - y_zero;
|
|---|
| 2932 |
|
|---|
| 2933 | if fb > 0 and fc > 0 or fb < 0 and fc < 0 then
|
|---|
| 2934 | // initialize variables
|
|---|
| 2935 | c := a;
|
|---|
| 2936 | fc := fa;
|
|---|
| 2937 | e := b - a;
|
|---|
| 2938 | d := e;
|
|---|
| 2939 | end if;
|
|---|
| 2940 | end if;
|
|---|
| 2941 | end while;
|
|---|
| 2942 | end solve;
|
|---|
| 2943 |
|
|---|
| 2944 | annotation (Documentation(info="<html>
|
|---|
| 2945 | <p>
|
|---|
| 2946 | This function should currently only be used in Modelica.Media,
|
|---|
| 2947 | since it might be replaced in the future by another strategy,
|
|---|
| 2948 | where the tool is responsible for the solution of the non-linear
|
|---|
| 2949 | equation.
|
|---|
| 2950 | </p>
|
|---|
| 2951 |
|
|---|
| 2952 | <p>
|
|---|
| 2953 | This library determines the solution of one non-linear algebraic equation \"y=f(x)\"
|
|---|
| 2954 | in one unknown \"x\" in a reliable way. As input, the desired value y of the
|
|---|
| 2955 | non-linear function has to be given, as well as an interval x_min, x_max that
|
|---|
| 2956 | contains the solution, i.e., \"f(x_min) - y\" and \"f(x_max) - y\" must
|
|---|
| 2957 | have a different sign. If possible, a smaller interval is computed by
|
|---|
| 2958 | inverse quadratic interpolation (interpolating with a quadratic polynomial
|
|---|
| 2959 | through the last 3 points and computing the zero). If this fails,
|
|---|
| 2960 | bisection is used, which always reduces the interval by a factor of 2.
|
|---|
| 2961 | The inverse quadratic interpolation method has superlinear convergence.
|
|---|
| 2962 | This is roughly the same convergence rate as a globally convergent Newton
|
|---|
| 2963 | method, but without the need to compute derivatives of the non-linear
|
|---|
| 2964 | function. The solver function is a direct mapping of the Algol 60 procedure
|
|---|
| 2965 | \"zero\" to Modelica, from:
|
|---|
| 2966 | </p>
|
|---|
| 2967 |
|
|---|
| 2968 | <dl>
|
|---|
| 2969 | <dt> Brent R.P.:</dt>
|
|---|
| 2970 | <dd> <b>Algorithms for Minimization without derivatives</b>.
|
|---|
| 2971 | Prentice Hall, 1973, pp. 58-59.</dd>
|
|---|
| 2972 | </dl>
|
|---|
| 2973 |
|
|---|
| 2974 | <p>
|
|---|
| 2975 | Due to current limitations of the
|
|---|
| 2976 | Modelica language (not possible to pass a function reference to a function),
|
|---|
| 2977 | the construction to use this solver on a user-defined function is a bit
|
|---|
| 2978 | complicated (this method is from Hans Olsson, Dassault Systèmes AB). A user has to
|
|---|
| 2979 | provide a package in the following way:
|
|---|
| 2980 | </p>
|
|---|
| 2981 |
|
|---|
| 2982 | <pre>
|
|---|
| 2983 | <b>package</b> MyNonLinearSolver
|
|---|
| 2984 | <b>extends</b> OneNonLinearEquation;
|
|---|
| 2985 |
|
|---|
| 2986 | <b>redeclare record extends</b> Data
|
|---|
| 2987 | // Define data to be passed to user function
|
|---|
| 2988 | ...
|
|---|
| 2989 | <b>end</b> Data;
|
|---|
| 2990 |
|
|---|
| 2991 | <b>redeclare function extends</b> f_nonlinear
|
|---|
| 2992 | <b>algorithm</b>
|
|---|
| 2993 | // Compute the non-linear equation: y = f(x, Data)
|
|---|
| 2994 | <b>end</b> f_nonlinear;
|
|---|
| 2995 |
|
|---|
| 2996 | // Dummy definition that has to be present for current Dymola
|
|---|
| 2997 | <b>redeclare function extends</b> solve
|
|---|
| 2998 | <b>end</b> solve;
|
|---|
| 2999 | <b>end</b> MyNonLinearSolver;
|
|---|
| 3000 |
|
|---|
| 3001 | x_zero = MyNonLinearSolver.solve(y_zero, x_min, x_max, data=data);
|
|---|
| 3002 | </pre>
|
|---|
| 3003 | </html>"));
|
|---|
| 3004 | end OneNonLinearEquation;
|
|---|
| 3005 | annotation (Documentation(info="<HTML><h4>Package description</h4>
|
|---|
| 3006 | <p>Package Modelica.Media.Common provides records and functions shared by many of the property sub-packages.
|
|---|
| 3007 | High accuracy fluid property models share a lot of common structure, even if the actual models are different.
|
|---|
| 3008 | Common data structures and computations shared by these property models are collected in this library.
|
|---|
| 3009 | </p>
|
|---|
| 3010 |
|
|---|
| 3011 | </html>", revisions="<html>
|
|---|
| 3012 | <ul>
|
|---|
| 3013 | <li>First implemented: <i>July, 2000</i>
|
|---|
| 3014 | by <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>
|
|---|
| 3015 | for the ThermoFluid Library with help from Jonas Eborn and Falko Jens Wagner
|
|---|
| 3016 | </li>
|
|---|
| 3017 | <li>Code reorganization, enhanced documentation, additional functions: <i>December, 2002</i>
|
|---|
| 3018 | by <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a> and move to Modelica
|
|---|
| 3019 | properties library.</li>
|
|---|
| 3020 | <li>Inclusion into Modelica.Media: September 2003 </li>
|
|---|
| 3021 | </ul>
|
|---|
| 3022 |
|
|---|
| 3023 | <address>Author: Hubertus Tummescheit, <br>
|
|---|
| 3024 | Lund University<br>
|
|---|
| 3025 | Department of Automatic Control<br>
|
|---|
| 3026 | Box 118, 22100 Lund, Sweden<br>
|
|---|
| 3027 | email: hubertus@control.lth.se
|
|---|
| 3028 | </address>
|
|---|
| 3029 | </html>"));
|
|---|
| 3030 | end Common;
|
|---|
| 3031 |
|
|---|
| 3032 | package IdealGases
|
|---|
| 3033 | "Data and models of ideal gases (single, fixed and dynamic mixtures) from NASA source"
|
|---|
| 3034 | extends Modelica.Icons.VariantsPackage;
|
|---|
| 3035 |
|
|---|
| 3036 | package Common "Common packages and data for the ideal gas models"
|
|---|
| 3037 | extends Modelica.Icons.Package;
|
|---|
| 3038 |
|
|---|
| 3039 | record DataRecord
|
|---|
| 3040 | "Coefficient data record for properties of ideal gases based on NASA source"
|
|---|
| 3041 | extends Modelica.Icons.Record;
|
|---|
| 3042 | String name "Name of ideal gas";
|
|---|
| 3043 | SI.MolarMass MM "Molar mass";
|
|---|
| 3044 | SI.SpecificEnthalpy Hf "Enthalpy of formation at 298.15K";
|
|---|
| 3045 | SI.SpecificEnthalpy H0 "H0(298.15K) - H0(0K)";
|
|---|
| 3046 | SI.Temperature Tlimit
|
|---|
| 3047 | "Temperature limit between low and high data sets";
|
|---|
| 3048 | Real alow[7] "Low temperature coefficients a";
|
|---|
| 3049 | Real blow[2] "Low temperature constants b";
|
|---|
| 3050 | Real ahigh[7] "High temperature coefficients a";
|
|---|
| 3051 | Real bhigh[2] "High temperature constants b";
|
|---|
| 3052 | SI.SpecificHeatCapacity R "Gas constant";
|
|---|
| 3053 | annotation (Documentation(info="<HTML>
|
|---|
| 3054 | <p>
|
|---|
| 3055 | This data record contains the coefficients for the
|
|---|
| 3056 | ideal gas equations according to:
|
|---|
| 3057 | </p>
|
|---|
| 3058 | <blockquote>
|
|---|
| 3059 | <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
|
|---|
| 3060 | for Calculating Thermodynamic Properties of Individual Species</b>. NASA
|
|---|
| 3061 | report TP-2002-211556</p>
|
|---|
| 3062 | </blockquote>
|
|---|
| 3063 | <p>
|
|---|
| 3064 | The equations have the following structure:
|
|---|
| 3065 | </p>
|
|---|
| 3066 | <IMG src=\"modelica://Modelica/Resources/Images/Media/IdealGases/singleEquations.png\">
|
|---|
| 3067 | <p>
|
|---|
| 3068 | 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).
|
|---|
| 3069 | </p>
|
|---|
| 3070 | <p>
|
|---|
| 3071 | For most gases, the region of validity is from 200 K to 6000 K.
|
|---|
| 3072 | The equations are split into two regions that are separated
|
|---|
| 3073 | by Tlimit (usually 1000 K). In both regions the gas is described
|
|---|
| 3074 | by the data above. The two branches are continuous and in most
|
|---|
| 3075 | gases also differentiable at Tlimit.
|
|---|
| 3076 | </p>
|
|---|
| 3077 | </HTML>"));
|
|---|
| 3078 | end DataRecord;
|
|---|
| 3079 |
|
|---|
| 3080 | package Functions
|
|---|
| 3081 | "Basic Functions for ideal gases: cp, h, s, thermal conductivity, viscosity"
|
|---|
| 3082 | extends Modelica.Icons.Package;
|
|---|
| 3083 |
|
|---|
| 3084 | constant Boolean excludeEnthalpyOfFormation=true
|
|---|
| 3085 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3086 |
|
|---|
| 3087 | constant Modelica.Media.Interfaces.Choices.ReferenceEnthalpy referenceChoice=Modelica.Media.Interfaces.Choices.ReferenceEnthalpy.ZeroAt0K
|
|---|
| 3088 | "Choice of reference enthalpy";
|
|---|
| 3089 |
|
|---|
| 3090 | constant Modelica.Media.Interfaces.Types.SpecificEnthalpy h_offset=0.0
|
|---|
| 3091 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3092 |
|
|---|
| 3093 | function cp_T
|
|---|
| 3094 | "Compute specific heat capacity at constant pressure from temperature and gas data"
|
|---|
| 3095 | extends Modelica.Icons.Function;
|
|---|
| 3096 | input IdealGases.Common.DataRecord data "Ideal gas data";
|
|---|
| 3097 | input SI.Temperature T "Temperature";
|
|---|
| 3098 | output SI.SpecificHeatCapacity cp
|
|---|
| 3099 | "Specific heat capacity at temperature T";
|
|---|
| 3100 | algorithm
|
|---|
| 3101 | cp := smooth(0,if T < data.Tlimit then data.R*(1/(T*T)*(data.alow[1] + T*(
|
|---|
| 3102 | data.alow[2] + T*(1.*data.alow[3] + T*(data.alow[4] + T*(data.alow[5] + T
|
|---|
| 3103 | *(data.alow[6] + data.alow[7]*T))))))) else data.R*(1/(T*T)*(data.ahigh[1]
|
|---|
| 3104 | + T*(data.ahigh[2] + T*(1.*data.ahigh[3] + T*(data.ahigh[4] + T*(data.
|
|---|
| 3105 | ahigh[5] + T*(data.ahigh[6] + data.ahigh[7]*T))))))));
|
|---|
| 3106 | annotation (Inline=true,smoothOrder=2);
|
|---|
| 3107 | end cp_T;
|
|---|
| 3108 |
|
|---|
| 3109 | function h_T "Compute specific enthalpy from temperature and gas data; reference is decided by the
|
|---|
| 3110 | refChoice input, or by the referenceChoice package constant by default"
|
|---|
| 3111 | import Modelica.Media.Interfaces.Choices;
|
|---|
| 3112 | extends Modelica.Icons.Function;
|
|---|
| 3113 | input IdealGases.Common.DataRecord data "Ideal gas data";
|
|---|
| 3114 | input SI.Temperature T "Temperature";
|
|---|
| 3115 | input Boolean exclEnthForm=excludeEnthalpyOfFormation
|
|---|
| 3116 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3117 | input Modelica.Media.Interfaces.Choices.ReferenceEnthalpy
|
|---|
| 3118 | refChoice=referenceChoice
|
|---|
| 3119 | "Choice of reference enthalpy";
|
|---|
| 3120 | input SI.SpecificEnthalpy h_off=h_offset
|
|---|
| 3121 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3122 | output SI.SpecificEnthalpy h "Specific enthalpy at temperature T";
|
|---|
| 3123 |
|
|---|
| 3124 | algorithm
|
|---|
| 3125 | h := smooth(0,(if T < data.Tlimit then data.R*((-data.alow[1] + T*(data.
|
|---|
| 3126 | blow[1] + data.alow[2]*Math.log(T) + T*(1.*data.alow[3] + T*(0.5*data.
|
|---|
| 3127 | alow[4] + T*(1/3*data.alow[5] + T*(0.25*data.alow[6] + 0.2*data.alow[7]*T))))))
|
|---|
| 3128 | /T) else data.R*((-data.ahigh[1] + T*(data.bhigh[1] + data.ahigh[2]*
|
|---|
| 3129 | Math.log(T) + T*(1.*data.ahigh[3] + T*(0.5*data.ahigh[4] + T*(1/3*data.
|
|---|
| 3130 | ahigh[5] + T*(0.25*data.ahigh[6] + 0.2*data.ahigh[7]*T))))))/T)) + (if
|
|---|
| 3131 | exclEnthForm then -data.Hf else 0.0) + (if (refChoice
|
|---|
| 3132 | == Choices.ReferenceEnthalpy.ZeroAt0K) then data.H0 else 0.0) + (if
|
|---|
| 3133 | refChoice == Choices.ReferenceEnthalpy.UserDefined then h_off else
|
|---|
| 3134 | 0.0));
|
|---|
| 3135 | annotation (Inline=false,smoothOrder=2);
|
|---|
| 3136 | end h_T;
|
|---|
| 3137 |
|
|---|
| 3138 | function s0_T
|
|---|
| 3139 | "Compute specific entropy from temperature and gas data"
|
|---|
| 3140 | extends Modelica.Icons.Function;
|
|---|
| 3141 | input IdealGases.Common.DataRecord data "Ideal gas data";
|
|---|
| 3142 | input SI.Temperature T "Temperature";
|
|---|
| 3143 | output SI.SpecificEntropy s "Specific entropy at temperature T";
|
|---|
| 3144 | algorithm
|
|---|
| 3145 | s := if T < data.Tlimit then data.R*(data.blow[2] - 0.5*data.alow[
|
|---|
| 3146 | 1]/(T*T) - data.alow[2]/T + data.alow[3]*Math.log(T) + T*(
|
|---|
| 3147 | data.alow[4] + T*(0.5*data.alow[5] + T*(1/3*data.alow[6] + 0.25*data.alow[
|
|---|
| 3148 | 7]*T)))) else data.R*(data.bhigh[2] - 0.5*data.ahigh[1]/(T*T) - data.
|
|---|
| 3149 | ahigh[2]/T + data.ahigh[3]*Math.log(T) + T*(data.ahigh[4]
|
|---|
| 3150 | + T*(0.5*data.ahigh[5] + T*(1/3*data.ahigh[6] + 0.25*data.ahigh[7]*T))));
|
|---|
| 3151 | annotation (Inline=true, smoothOrder=2);
|
|---|
| 3152 | end s0_T;
|
|---|
| 3153 |
|
|---|
| 3154 | function dynamicViscosityLowPressure
|
|---|
| 3155 | "Dynamic viscosity of low pressure gases"
|
|---|
| 3156 | extends Modelica.Icons.Function;
|
|---|
| 3157 | input SI.Temp_K T "Gas temperature";
|
|---|
| 3158 | input SI.Temp_K Tc "Critical temperature of gas";
|
|---|
| 3159 | input SI.MolarMass M "Molar mass of gas";
|
|---|
| 3160 | input SI.MolarVolume Vc "Critical molar volume of gas";
|
|---|
| 3161 | input Real w "Acentric factor of gas";
|
|---|
| 3162 | input Interfaces.PartialMedium.DipoleMoment mu
|
|---|
| 3163 | "Dipole moment of gas molecule";
|
|---|
| 3164 | input Real k = 0.0
|
|---|
| 3165 | "Special correction for highly polar substances";
|
|---|
| 3166 | output SI.DynamicViscosity eta "Dynamic viscosity of gas";
|
|---|
| 3167 | protected
|
|---|
| 3168 | parameter Real Const1_SI=40.785*10^(-9.5)
|
|---|
| 3169 | "Constant in formula for eta converted to SI units";
|
|---|
| 3170 | parameter Real Const2_SI=131.3/1000.0
|
|---|
| 3171 | "Constant in formula for mur converted to SI units";
|
|---|
| 3172 | Real mur=Const2_SI*mu/sqrt(Vc*Tc)
|
|---|
| 3173 | "Dimensionless dipole moment of gas molecule";
|
|---|
| 3174 | Real Fc=1 - 0.2756*w + 0.059035*mur^4 + k
|
|---|
| 3175 | "Factor to account for molecular shape and polarities of gas";
|
|---|
| 3176 | Real Tstar "Dimensionless temperature defined by equation below";
|
|---|
| 3177 | Real Ov "Viscosity collision integral for the gas";
|
|---|
| 3178 |
|
|---|
| 3179 | algorithm
|
|---|
| 3180 | Tstar := 1.2593*T/Tc;
|
|---|
| 3181 | Ov := 1.16145*Tstar^(-0.14874) + 0.52487*Modelica.Math.exp(-0.7732*Tstar) + 2.16178*Modelica.Math.exp(-2.43787
|
|---|
| 3182 | *Tstar);
|
|---|
| 3183 | eta := Const1_SI*Fc*sqrt(M*T)/(Vc^(2/3)*Ov);
|
|---|
| 3184 | annotation (smoothOrder=2,
|
|---|
| 3185 | Documentation(info="<html>
|
|---|
| 3186 | <p>
|
|---|
| 3187 | The used formula are based on the method of Chung et al (1984, 1988) referred to in ref [1] chapter 9.
|
|---|
| 3188 | The formula 9-4.10 is the one being used. The Formula is given in non-SI units, the following conversion constants were used to
|
|---|
| 3189 | transform the formula to SI units:
|
|---|
| 3190 | </p>
|
|---|
| 3191 |
|
|---|
| 3192 | <ul>
|
|---|
| 3193 | <li> <b>Const1_SI:</b> The factor 10^(-9.5) =10^(-2.5)*1e-7 where the
|
|---|
| 3194 | factor 10^(-2.5) originates from the conversion of g/mol->kg/mol + cm^3/mol->m^3/mol
|
|---|
| 3195 | and the factor 1e-7 is due to conversion from microPoise->Pa.s.</li>
|
|---|
| 3196 | <li> <b>Const2_SI:</b> The factor 1/3.335641e-27 = 1e-3/3.335641e-30
|
|---|
| 3197 | where the factor 3.335641e-30 comes from debye->C.m and
|
|---|
| 3198 | 1e-3 is due to conversion from cm^3/mol->m^3/mol</li>
|
|---|
| 3199 | </ul>
|
|---|
| 3200 |
|
|---|
| 3201 | <h4>References:</h4>
|
|---|
| 3202 | <p>
|
|---|
| 3203 | [1] Bruce E. Poling, John E. Prausnitz, John P. O'Connell, \"The Properties of Gases and Liquids\" 5th Ed. Mc Graw Hill.
|
|---|
| 3204 | </p>
|
|---|
| 3205 |
|
|---|
| 3206 | <h4>Author</h4>
|
|---|
| 3207 | <p>T. Skoglund, Lund, Sweden, 2004-08-31</p>
|
|---|
| 3208 |
|
|---|
| 3209 | </html>"));
|
|---|
| 3210 | end dynamicViscosityLowPressure;
|
|---|
| 3211 |
|
|---|
| 3212 | function thermalConductivityEstimate
|
|---|
| 3213 | "Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation)"
|
|---|
| 3214 | extends Modelica.Icons.Function;
|
|---|
| 3215 | input Interfaces.PartialMedium.SpecificHeatCapacity Cp
|
|---|
| 3216 | "Constant pressure heat capacity";
|
|---|
| 3217 | input Interfaces.PartialMedium.DynamicViscosity eta
|
|---|
| 3218 | "Dynamic viscosity";
|
|---|
| 3219 | input Integer method(min=1,max=2)=1
|
|---|
| 3220 | "1: Eucken Method, 2: Modified Eucken Method";
|
|---|
| 3221 | input IdealGases.Common.DataRecord data "Ideal gas data";
|
|---|
| 3222 | output Interfaces.PartialMedium.ThermalConductivity lambda
|
|---|
| 3223 | "Thermal conductivity [W/(m.k)]";
|
|---|
| 3224 | algorithm
|
|---|
| 3225 | lambda := if method == 1 then eta*(Cp - data.R + (9/4)*data.R) else eta*(Cp
|
|---|
| 3226 | - data.R)*(1.32 + 1.77/((Cp/Modelica.Constants.R) - 1.0));
|
|---|
| 3227 | annotation (smoothOrder=2,
|
|---|
| 3228 | Documentation(info="<html>
|
|---|
| 3229 | <p>
|
|---|
| 3230 | This function provides two similar methods for estimating the
|
|---|
| 3231 | thermal conductivity of polyatomic gases.
|
|---|
| 3232 | The Eucken method (input method == 1) gives good results for low temperatures,
|
|---|
| 3233 | but it tends to give an underestimated value of the thermal conductivity
|
|---|
| 3234 | (lambda) at higher temperatures.<br>
|
|---|
| 3235 | The Modified Eucken method (input method == 2) gives good results for
|
|---|
| 3236 | high-temperatures, but it tends to give an overestimated value of the
|
|---|
| 3237 | thermal conductivity (lambda) at low temperatures.
|
|---|
| 3238 | </p>
|
|---|
| 3239 | </html>"));
|
|---|
| 3240 | end thermalConductivityEstimate;
|
|---|
| 3241 | end Functions;
|
|---|
| 3242 |
|
|---|
| 3243 | partial package MixtureGasNasa
|
|---|
| 3244 | "Medium model of a mixture of ideal gases based on NASA source"
|
|---|
| 3245 |
|
|---|
| 3246 | import Modelica.Math;
|
|---|
| 3247 | import Modelica.Media.Interfaces.Choices.ReferenceEnthalpy;
|
|---|
| 3248 |
|
|---|
| 3249 | extends Modelica.Media.Interfaces.PartialMixtureMedium(
|
|---|
| 3250 | ThermoStates=Modelica.Media.Interfaces.Choices.IndependentVariables.pTX,
|
|---|
| 3251 | substanceNames=data[:].name,
|
|---|
| 3252 | reducedX = false,
|
|---|
| 3253 | singleState=false,
|
|---|
| 3254 | reference_X=fill(1/nX,nX),
|
|---|
| 3255 | SpecificEnthalpy(start=if referenceChoice==ReferenceEnthalpy.ZeroAt0K then 3e5 else
|
|---|
| 3256 | if referenceChoice==ReferenceEnthalpy.UserDefined then h_offset else 0, nominal=1.0e5),
|
|---|
| 3257 | Density(start=10, nominal=10),
|
|---|
| 3258 | AbsolutePressure(start=10e5, nominal=10e5),
|
|---|
| 3259 | Temperature(min=200, max=6000, start=500, nominal=500));
|
|---|
| 3260 |
|
|---|
| 3261 | redeclare record extends ThermodynamicState
|
|---|
| 3262 | "Thermodynamic state variables"
|
|---|
| 3263 | end ThermodynamicState;
|
|---|
| 3264 |
|
|---|
| 3265 | // redeclare record extends FluidConstants "Fluid constants"
|
|---|
| 3266 | // end FluidConstants;
|
|---|
| 3267 |
|
|---|
| 3268 | constant Modelica.Media.IdealGases.Common.DataRecord[:] data
|
|---|
| 3269 | "Data records of ideal gas substances";
|
|---|
| 3270 | // ={Common.SingleGasesData.N2,Common.SingleGasesData.O2}
|
|---|
| 3271 |
|
|---|
| 3272 | constant Boolean excludeEnthalpyOfFormation=true
|
|---|
| 3273 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3274 | constant ReferenceEnthalpy referenceChoice=ReferenceEnthalpy.ZeroAt0K
|
|---|
| 3275 | "Choice of reference enthalpy";
|
|---|
| 3276 | constant SpecificEnthalpy h_offset=0.0
|
|---|
| 3277 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3278 |
|
|---|
| 3279 | // constant FluidConstants[nX] fluidConstants
|
|---|
| 3280 | // "Additional data needed for transport properties";
|
|---|
| 3281 | constant MolarMass[nX] MMX=data[:].MM "Molar masses of components";
|
|---|
| 3282 | constant Integer methodForThermalConductivity(min=1,max=2)=1;
|
|---|
| 3283 | redeclare replaceable model extends BaseProperties(
|
|---|
| 3284 | T(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default),
|
|---|
| 3285 | p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default),
|
|---|
| 3286 | Xi(each stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default),
|
|---|
| 3287 | final standardOrderComponents=true)
|
|---|
| 3288 | "Base properties (p, d, T, h, u, R, MM, X, and Xi of NASA mixture gas"
|
|---|
| 3289 | equation
|
|---|
| 3290 | assert(T >= 200 and T <= 6000, "
|
|---|
| 3291 | Temperature T (=" + String(T) + " K = 200 K) is not in the allowed range
|
|---|
| 3292 | 200 K <= T <= 6000 K
|
|---|
| 3293 | required from medium model \"" + mediumName + "\".");
|
|---|
| 3294 |
|
|---|
| 3295 | MM = molarMass(state);
|
|---|
| 3296 | h = h_TX(T, X);
|
|---|
| 3297 | R = data.R*X;
|
|---|
| 3298 | u = h - R*T;
|
|---|
| 3299 | d = p/(R*T);
|
|---|
| 3300 | // connect state with BaseProperties
|
|---|
| 3301 | state.T = T;
|
|---|
| 3302 | state.p = p;
|
|---|
| 3303 | state.X = if fixedX then reference_X else X;
|
|---|
| 3304 | end BaseProperties;
|
|---|
| 3305 |
|
|---|
| 3306 | redeclare function setState_pTX
|
|---|
| 3307 | "Return thermodynamic state as function of p, T and composition X"
|
|---|
| 3308 | extends Modelica.Icons.Function;
|
|---|
| 3309 | input AbsolutePressure p "Pressure";
|
|---|
| 3310 | input Temperature T "Temperature";
|
|---|
| 3311 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 3312 | output ThermodynamicState state;
|
|---|
| 3313 | algorithm
|
|---|
| 3314 | state := if size(X,1) == 0 then ThermodynamicState(p=p,T=T,X=reference_X) else if size(X,1) == nX then ThermodynamicState(p=p,T=T, X=X) else
|
|---|
| 3315 | ThermodynamicState(p=p,T=T, X=cat(1,X,{1-sum(X)}));
|
|---|
| 3316 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3317 | end setState_pTX;
|
|---|
| 3318 |
|
|---|
| 3319 | redeclare function setState_phX
|
|---|
| 3320 | "Return thermodynamic state as function of p, h and composition X"
|
|---|
| 3321 | extends Modelica.Icons.Function;
|
|---|
| 3322 | input AbsolutePressure p "Pressure";
|
|---|
| 3323 | input SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 3324 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 3325 | output ThermodynamicState state;
|
|---|
| 3326 | algorithm
|
|---|
| 3327 | state := if size(X,1) == 0 then ThermodynamicState(p=p,T=T_hX(h,reference_X),X=reference_X) else if size(X,1) == nX then ThermodynamicState(p=p,T=T_hX(h,X),X=X) else
|
|---|
| 3328 | ThermodynamicState(p=p,T=T_hX(h,X), X=cat(1,X,{1-sum(X)}));
|
|---|
| 3329 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3330 | end setState_phX;
|
|---|
| 3331 |
|
|---|
| 3332 | redeclare function setState_psX
|
|---|
| 3333 | "Return thermodynamic state as function of p, s and composition X"
|
|---|
| 3334 | extends Modelica.Icons.Function;
|
|---|
| 3335 | input AbsolutePressure p "Pressure";
|
|---|
| 3336 | input SpecificEntropy s "Specific entropy";
|
|---|
| 3337 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 3338 | output ThermodynamicState state;
|
|---|
| 3339 | algorithm
|
|---|
| 3340 | state := if size(X,1) == 0 then ThermodynamicState(p=p,T=T_psX(p,s,reference_X),X=reference_X) else if size(X,1) == nX then ThermodynamicState(p=p,T=T_psX(p,s,X),X=X) else
|
|---|
| 3341 | ThermodynamicState(p=p,T=T_psX(p,s,X), X=cat(1,X,{1-sum(X)}));
|
|---|
| 3342 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3343 | end setState_psX;
|
|---|
| 3344 |
|
|---|
| 3345 | redeclare function setState_dTX
|
|---|
| 3346 | "Return thermodynamic state as function of d, T and composition X"
|
|---|
| 3347 | extends Modelica.Icons.Function;
|
|---|
| 3348 | input Density d "Density";
|
|---|
| 3349 | input Temperature T "Temperature";
|
|---|
| 3350 | input MassFraction X[:]=reference_X "Mass fractions";
|
|---|
| 3351 | output ThermodynamicState state;
|
|---|
| 3352 | algorithm
|
|---|
| 3353 | state := if size(X,1) == 0 then ThermodynamicState(p=d*(data.R*reference_X)*T,T=T,X=reference_X) else if size(X,1) == nX then ThermodynamicState(p=d*(data.R*X)*T,T=T,X=X) else
|
|---|
| 3354 | ThermodynamicState(p=d*(data.R*cat(1,X,{1-sum(X)}))*T,T=T, X=cat(1,X,{1-sum(X)}));
|
|---|
| 3355 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3356 | end setState_dTX;
|
|---|
| 3357 |
|
|---|
| 3358 | redeclare function extends setSmoothState
|
|---|
| 3359 | "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b"
|
|---|
| 3360 | algorithm
|
|---|
| 3361 | state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small),
|
|---|
| 3362 | T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small),
|
|---|
| 3363 | X=Media.Common.smoothStep(x, state_a.X, state_b.X, x_small));
|
|---|
| 3364 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3365 | end setSmoothState;
|
|---|
| 3366 |
|
|---|
| 3367 | redeclare function extends pressure "Return pressure of ideal gas"
|
|---|
| 3368 | algorithm
|
|---|
| 3369 | p := state.p;
|
|---|
| 3370 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3371 | end pressure;
|
|---|
| 3372 |
|
|---|
| 3373 | redeclare function extends temperature
|
|---|
| 3374 | "Return temperature of ideal gas"
|
|---|
| 3375 | algorithm
|
|---|
| 3376 | T := state.T;
|
|---|
| 3377 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3378 | end temperature;
|
|---|
| 3379 |
|
|---|
| 3380 | redeclare function extends density "Return density of ideal gas"
|
|---|
| 3381 | algorithm
|
|---|
| 3382 | d := state.p/((state.X*data.R)*state.T);
|
|---|
| 3383 | annotation(Inline = true, smoothOrder = 3);
|
|---|
| 3384 | end density;
|
|---|
| 3385 |
|
|---|
| 3386 | redeclare function extends specificEnthalpy "Return specific enthalpy"
|
|---|
| 3387 | extends Modelica.Icons.Function;
|
|---|
| 3388 | algorithm
|
|---|
| 3389 | h := h_TX(state.T,state.X);
|
|---|
| 3390 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3391 | end specificEnthalpy;
|
|---|
| 3392 |
|
|---|
| 3393 | redeclare function extends specificInternalEnergy
|
|---|
| 3394 | "Return specific internal energy"
|
|---|
| 3395 | extends Modelica.Icons.Function;
|
|---|
| 3396 | algorithm
|
|---|
| 3397 | u := h_TX(state.T,state.X) - gasConstant(state)*state.T;
|
|---|
| 3398 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3399 | end specificInternalEnergy;
|
|---|
| 3400 |
|
|---|
| 3401 | redeclare function extends specificEntropy "Return specific entropy"
|
|---|
| 3402 | protected
|
|---|
| 3403 | Real[nX] Y(unit="mol/mol")=massToMoleFractions(state.X, data.MM)
|
|---|
| 3404 | "Molar fractions";
|
|---|
| 3405 | algorithm
|
|---|
| 3406 | s := s_TX(state.T, state.X) - sum(state.X[i]*Modelica.Constants.R/MMX[i]*
|
|---|
| 3407 | (if state.X[i]<Modelica.Constants.eps then Y[i] else
|
|---|
| 3408 | Modelica.Math.log(Y[i]*state.p/reference_p)) for i in 1:nX);
|
|---|
| 3409 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3410 | end specificEntropy;
|
|---|
| 3411 |
|
|---|
| 3412 | redeclare function extends specificGibbsEnergy
|
|---|
| 3413 | "Return specific Gibbs energy"
|
|---|
| 3414 | extends Modelica.Icons.Function;
|
|---|
| 3415 | algorithm
|
|---|
| 3416 | g := h_TX(state.T,state.X) - state.T*specificEntropy(state);
|
|---|
| 3417 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3418 | end specificGibbsEnergy;
|
|---|
| 3419 |
|
|---|
| 3420 | redeclare function extends specificHelmholtzEnergy
|
|---|
| 3421 | "Return specific Helmholtz energy"
|
|---|
| 3422 | extends Modelica.Icons.Function;
|
|---|
| 3423 | algorithm
|
|---|
| 3424 | f := h_TX(state.T,state.X) - gasConstant(state)*state.T - state.T*specificEntropy(state);
|
|---|
| 3425 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3426 | end specificHelmholtzEnergy;
|
|---|
| 3427 |
|
|---|
| 3428 | function h_TX "Return specific enthalpy"
|
|---|
| 3429 | import Modelica.Media.Interfaces.Choices;
|
|---|
| 3430 | extends Modelica.Icons.Function;
|
|---|
| 3431 | input SI.Temperature T "Temperature";
|
|---|
| 3432 | input MassFraction X[:]=reference_X
|
|---|
| 3433 | "Independent Mass fractions of gas mixture";
|
|---|
| 3434 | input Boolean exclEnthForm=excludeEnthalpyOfFormation
|
|---|
| 3435 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3436 | input Modelica.Media.Interfaces.Choices.ReferenceEnthalpy
|
|---|
| 3437 | refChoice=referenceChoice
|
|---|
| 3438 | "Choice of reference enthalpy";
|
|---|
| 3439 | input SI.SpecificEnthalpy h_off=h_offset
|
|---|
| 3440 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3441 | output SI.SpecificEnthalpy h "Specific enthalpy at temperature T";
|
|---|
| 3442 | algorithm
|
|---|
| 3443 | h :=(if fixedX then reference_X else X)*
|
|---|
| 3444 | {Modelica.Media.IdealGases.Common.Functions.h_T(
|
|---|
| 3445 | data[i], T, exclEnthForm, refChoice, h_off) for i in 1:nX};
|
|---|
| 3446 | annotation(Inline=false,smoothOrder=2);
|
|---|
| 3447 | end h_TX;
|
|---|
| 3448 |
|
|---|
| 3449 | function h_TX_der "Return specific enthalpy derivative"
|
|---|
| 3450 | import Modelica.Media.Interfaces.Choices;
|
|---|
| 3451 | extends Modelica.Icons.Function;
|
|---|
| 3452 | input SI.Temperature T "Temperature";
|
|---|
| 3453 | input MassFraction X[nX] "Independent Mass fractions of gas mixture";
|
|---|
| 3454 | input Boolean exclEnthForm=excludeEnthalpyOfFormation
|
|---|
| 3455 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3456 | input Modelica.Media.Interfaces.Choices.ReferenceEnthalpy
|
|---|
| 3457 | refChoice=referenceChoice
|
|---|
| 3458 | "Choice of reference enthalpy";
|
|---|
| 3459 | input SI.SpecificEnthalpy h_off=h_offset
|
|---|
| 3460 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3461 | input Real dT "Temperature derivative";
|
|---|
| 3462 | input Real dX[nX] "Independent mass fraction derivative";
|
|---|
| 3463 | output Real h_der "Specific enthalpy at temperature T";
|
|---|
| 3464 | algorithm
|
|---|
| 3465 | h_der := if fixedX then
|
|---|
| 3466 | dT*sum((Modelica.Media.IdealGases.Common.Functions.cp_T(
|
|---|
| 3467 | data[i], T)*reference_X[i]) for i in 1:nX) else
|
|---|
| 3468 | dT*sum((Modelica.Media.IdealGases.Common.Functions.cp_T(
|
|---|
| 3469 | data[i], T)*X[i]) for i in 1:nX)+
|
|---|
| 3470 | sum((Modelica.Media.IdealGases.Common.Functions.h_T(
|
|---|
| 3471 | data[i], T)*dX[i]) for i in 1:nX);
|
|---|
| 3472 | annotation (Inline = false, smoothOrder=1);
|
|---|
| 3473 | end h_TX_der;
|
|---|
| 3474 |
|
|---|
| 3475 | redeclare function extends gasConstant "Return gasConstant"
|
|---|
| 3476 | algorithm
|
|---|
| 3477 | R := data.R*state.X;
|
|---|
| 3478 | annotation(Inline = true, smoothOrder = 3);
|
|---|
| 3479 | end gasConstant;
|
|---|
| 3480 |
|
|---|
| 3481 | redeclare function extends specificHeatCapacityCp
|
|---|
| 3482 | "Return specific heat capacity at constant pressure"
|
|---|
| 3483 | algorithm
|
|---|
| 3484 | cp := {Modelica.Media.IdealGases.Common.Functions.cp_T(
|
|---|
| 3485 | data[i], state.T) for i in 1:nX}*state.X;
|
|---|
| 3486 | annotation(Inline=true,smoothOrder=1);
|
|---|
| 3487 | end specificHeatCapacityCp;
|
|---|
| 3488 |
|
|---|
| 3489 | redeclare function extends specificHeatCapacityCv
|
|---|
| 3490 | "Return specific heat capacity at constant volume from temperature and gas data"
|
|---|
| 3491 | algorithm
|
|---|
| 3492 | cv := {Modelica.Media.IdealGases.Common.Functions.cp_T(
|
|---|
| 3493 | data[i], state.T) for i in 1:nX}*state.X -data.R*state.X;
|
|---|
| 3494 | annotation(Inline=true, smoothOrder = 1);
|
|---|
| 3495 | end specificHeatCapacityCv;
|
|---|
| 3496 |
|
|---|
| 3497 | function MixEntropy "Return mixing entropy of ideal gases / R"
|
|---|
| 3498 | extends Modelica.Icons.Function;
|
|---|
| 3499 | input SI.MoleFraction x[:] "Mole fraction of mixture";
|
|---|
| 3500 | output Real smix
|
|---|
| 3501 | "Mixing entropy contribution, divided by gas constant";
|
|---|
| 3502 | algorithm
|
|---|
| 3503 | smix := sum(if x[i] > Modelica.Constants.eps then -x[i]*Modelica.Math.log(x[i]) else
|
|---|
| 3504 | x[i] for i in 1:size(x,1));
|
|---|
| 3505 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3506 | end MixEntropy;
|
|---|
| 3507 |
|
|---|
| 3508 | function s_TX
|
|---|
| 3509 | "Return temperature dependent part of the entropy, expects full entropy vector"
|
|---|
| 3510 | extends Modelica.Icons.Function;
|
|---|
| 3511 | input Temperature T "Temperature";
|
|---|
| 3512 | input MassFraction[nX] X "Mass fraction";
|
|---|
| 3513 | output SpecificEntropy s "Specific entropy";
|
|---|
| 3514 | algorithm
|
|---|
| 3515 | s := sum(Modelica.Media.IdealGases.Common.Functions.s0_T(
|
|---|
| 3516 | data[i], T)*X[i] for i in 1:size(X,1));
|
|---|
| 3517 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3518 | end s_TX;
|
|---|
| 3519 |
|
|---|
| 3520 | redeclare function extends isentropicExponent
|
|---|
| 3521 | "Return isentropic exponent"
|
|---|
| 3522 | algorithm
|
|---|
| 3523 | gamma := specificHeatCapacityCp(state)/specificHeatCapacityCv(state);
|
|---|
| 3524 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3525 | end isentropicExponent;
|
|---|
| 3526 |
|
|---|
| 3527 | redeclare function extends velocityOfSound "Return velocity of sound"
|
|---|
| 3528 | extends Modelica.Icons.Function;
|
|---|
| 3529 | input ThermodynamicState state "Properties at upstream location";
|
|---|
| 3530 | algorithm
|
|---|
| 3531 | a := sqrt(max(0,gasConstant(state)*state.T*specificHeatCapacityCp(state)/specificHeatCapacityCv(state)));
|
|---|
| 3532 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3533 | end velocityOfSound;
|
|---|
| 3534 |
|
|---|
| 3535 | function isentropicEnthalpyApproximation
|
|---|
| 3536 | "Approximate method of calculating h_is from upstream properties and downstream pressure"
|
|---|
| 3537 | extends Modelica.Icons.Function;
|
|---|
| 3538 | input AbsolutePressure p2 "Downstream pressure";
|
|---|
| 3539 | input ThermodynamicState state
|
|---|
| 3540 | "Thermodynamic state at upstream location";
|
|---|
| 3541 | output SpecificEnthalpy h_is "Isentropic enthalpy";
|
|---|
| 3542 | protected
|
|---|
| 3543 | SpecificEnthalpy h "Specific enthalpy at upstream location";
|
|---|
| 3544 | SpecificEnthalpy h_component[nX]
|
|---|
| 3545 | "Specific enthalpy at upstream location";
|
|---|
| 3546 | IsentropicExponent gamma = isentropicExponent(state)
|
|---|
| 3547 | "Isentropic exponent";
|
|---|
| 3548 | protected
|
|---|
| 3549 | MassFraction[nX] X "Complete X-vector";
|
|---|
| 3550 | algorithm
|
|---|
| 3551 | X := if reducedX then cat(1,state.X,{1-sum(state.X)}) else state.X;
|
|---|
| 3552 | h_component :={Modelica.Media.IdealGases.Common.Functions.h_T(
|
|---|
| 3553 | data[i], state.T, excludeEnthalpyOfFormation,
|
|---|
| 3554 | referenceChoice, h_offset) for i in 1:nX};
|
|---|
| 3555 | h :=h_component*X;
|
|---|
| 3556 | h_is := h + gamma/(gamma - 1.0)*(state.T*gasConstant(state))*
|
|---|
| 3557 | ((p2/state.p)^((gamma - 1)/gamma) - 1.0);
|
|---|
| 3558 | annotation(smoothOrder=2);
|
|---|
| 3559 | end isentropicEnthalpyApproximation;
|
|---|
| 3560 |
|
|---|
| 3561 | redeclare function extends isentropicEnthalpy
|
|---|
| 3562 | "Return isentropic enthalpy"
|
|---|
| 3563 | input Boolean exact = false
|
|---|
| 3564 | "Flag whether exact or approximate version should be used";
|
|---|
| 3565 | algorithm
|
|---|
| 3566 | h_is := if exact then specificEnthalpy_psX(p_downstream,specificEntropy(refState),refState.X) else
|
|---|
| 3567 | isentropicEnthalpyApproximation(p_downstream,refState);
|
|---|
| 3568 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3569 | end isentropicEnthalpy;
|
|---|
| 3570 |
|
|---|
| 3571 | function gasMixtureViscosity
|
|---|
| 3572 | "Return viscosities of gas mixtures at low pressures (Wilke method)"
|
|---|
| 3573 | extends Modelica.Icons.Function;
|
|---|
| 3574 | input MoleFraction[:] yi "Mole fractions";
|
|---|
| 3575 | input MolarMass[:] M "Mole masses";
|
|---|
| 3576 | input DynamicViscosity[:] eta "Pure component viscosities";
|
|---|
| 3577 | output DynamicViscosity etam "Viscosity of the mixture";
|
|---|
| 3578 | protected
|
|---|
| 3579 | Real fi[size(yi,1),size(yi,1)];
|
|---|
| 3580 | algorithm
|
|---|
| 3581 | for i in 1:size(eta,1) loop
|
|---|
| 3582 | assert(fluidConstants[i].hasDipoleMoment,"Dipole moment for " + fluidConstants[i].chemicalFormula +
|
|---|
| 3583 | " not known. Can not compute viscosity.");
|
|---|
| 3584 | assert(fluidConstants[i].hasCriticalData, "Critical data for "+ fluidConstants[i].chemicalFormula +
|
|---|
| 3585 | " not known. Can not compute viscosity.");
|
|---|
| 3586 | for j in 1:size(eta,1) loop
|
|---|
| 3587 | if i==1 then
|
|---|
| 3588 | fi[i,j] := (1 + (eta[i]/eta[j])^(1/2)*(M[j]/M[i])^(1/4))^2/(8*(1 + M[i]/M[j]))^(1/2);
|
|---|
| 3589 | elseif j<i then
|
|---|
| 3590 | fi[i,j] := eta[i]/eta[j]*M[j]/M[i]*fi[j,i];
|
|---|
| 3591 | else
|
|---|
| 3592 | fi[i,j] := (1 + (eta[i]/eta[j])^(1/2)*(M[j]/M[i])^(1/4))^2/(8*(1 + M[i]/M[j]))^(1/2);
|
|---|
| 3593 | end if;
|
|---|
| 3594 | end for;
|
|---|
| 3595 | end for;
|
|---|
| 3596 | etam := sum(yi[i]*eta[i]/sum(yi[j]*fi[i,j] for j in 1:size(eta,1)) for i in 1:size(eta,1));
|
|---|
| 3597 |
|
|---|
| 3598 | annotation (smoothOrder=2,
|
|---|
| 3599 | Documentation(info="<html>
|
|---|
| 3600 |
|
|---|
| 3601 | <p>
|
|---|
| 3602 | Simplification of the kinetic theory (Chapman and Enskog theory)
|
|---|
| 3603 | approach neglecting the second-order effects.<br>
|
|---|
| 3604 | <br>
|
|---|
| 3605 | This equation has been extensively tested (Amdur and Mason, 1958;
|
|---|
| 3606 | Bromley and Wilke, 1951; Cheung, 1958; Dahler, 1959; Gandhi and Saxena,
|
|---|
| 3607 | 1964; Ranz and Brodowsky, 1962; Saxena and Gambhir, 1963a; Strunk, et
|
|---|
| 3608 | al., 1964; Vanderslice, et al. 1962; Wright and Gray, 1962). In most
|
|---|
| 3609 | cases, only nonpolar mixtures were compared, and very good results
|
|---|
| 3610 | obtained. For some systems containing hydrogen as one component, less
|
|---|
| 3611 | satisfactory agreement was noted. Wilke's method predicted mixture
|
|---|
| 3612 | viscosities that were larger than experimental for the H2-N2 system,
|
|---|
| 3613 | but for H2-NH3, it underestimated the viscosities. <br>
|
|---|
| 3614 | Gururaja, et al. (1967) found that this method also overpredicted in
|
|---|
| 3615 | the H2-O2 case but was quite accurate for the H2-CO2 system. <br>
|
|---|
| 3616 | Wilke's approximation has proved reliable even for polar-polar gas
|
|---|
| 3617 | mixtures of aliphatic alcohols (Reid and Belenyessy, 1960). The
|
|---|
| 3618 | principal reservation appears to lie in those cases where Mi>>Mj
|
|---|
| 3619 | and etai>>etaj.<br>
|
|---|
| 3620 | </p>
|
|---|
| 3621 |
|
|---|
| 3622 | </html>"));
|
|---|
| 3623 | end gasMixtureViscosity;
|
|---|
| 3624 |
|
|---|
| 3625 | redeclare replaceable function extends dynamicViscosity
|
|---|
| 3626 | "Return mixture dynamic viscosity"
|
|---|
| 3627 | protected
|
|---|
| 3628 | DynamicViscosity[nX] etaX "Component dynamic viscosities";
|
|---|
| 3629 | algorithm
|
|---|
| 3630 | for i in 1:nX loop
|
|---|
| 3631 | etaX[i] := Modelica.Media.IdealGases.Common.Functions.dynamicViscosityLowPressure(
|
|---|
| 3632 | state.T,
|
|---|
| 3633 | fluidConstants[i].criticalTemperature,
|
|---|
| 3634 | fluidConstants[i].molarMass,
|
|---|
| 3635 | fluidConstants[i].criticalMolarVolume,
|
|---|
| 3636 | fluidConstants[i].acentricFactor,
|
|---|
| 3637 | fluidConstants[i].dipoleMoment);
|
|---|
| 3638 | end for;
|
|---|
| 3639 | eta := gasMixtureViscosity(massToMoleFractions(state.X,
|
|---|
| 3640 | fluidConstants[:].molarMass),
|
|---|
| 3641 | fluidConstants[:].molarMass,
|
|---|
| 3642 | etaX);
|
|---|
| 3643 | annotation (smoothOrder=2);
|
|---|
| 3644 | end dynamicViscosity;
|
|---|
| 3645 |
|
|---|
| 3646 | function mixtureViscosityChung
|
|---|
| 3647 | "Return the viscosity of gas mixtures without access to component viscosities (Chung, et. al. rules)"
|
|---|
| 3648 | extends Modelica.Icons.Function;
|
|---|
| 3649 |
|
|---|
| 3650 | input Temperature T "Temperature";
|
|---|
| 3651 | input Temperature[:] Tc "Critical temperatures";
|
|---|
| 3652 | input MolarVolume[:] Vcrit "Critical volumes (m3/mol)";
|
|---|
| 3653 | input Real[:] w "Acentric factors";
|
|---|
| 3654 | input Real[:] mu "Dipole moments (debyes)";
|
|---|
| 3655 | input MolarMass[:] MolecularWeights "Molecular weights (kg/mol)";
|
|---|
| 3656 | input MoleFraction[:] y "Molar Fractions";
|
|---|
| 3657 | input Real[:] kappa = zeros(nX) "Association Factors";
|
|---|
| 3658 | output DynamicViscosity etaMixture "Mixture viscosity (Pa.s)";
|
|---|
| 3659 | protected
|
|---|
| 3660 | constant Real[size(y,1)] Vc = Vcrit*1000000
|
|---|
| 3661 | "Critical volumes (cm3/mol)";
|
|---|
| 3662 | constant Real[size(y,1)] M = MolecularWeights*1000
|
|---|
| 3663 | "Molecular weights (g/mol)";
|
|---|
| 3664 | Integer n = size(y,1) "Number of mixed elements";
|
|---|
| 3665 | Real sigmam3 "Mixture sigma3 in Angstrom";
|
|---|
| 3666 | Real sigma[size(y,1),size(y,1)];
|
|---|
| 3667 | Real edivkm;
|
|---|
| 3668 | Real edivk[size(y,1),size(y,1)];
|
|---|
| 3669 | Real Mm;
|
|---|
| 3670 | Real Mij[size(y,1),size(y,1)];
|
|---|
| 3671 | Real wm "Accentric factor";
|
|---|
| 3672 | Real wij[size(y,1),size(y,1)];
|
|---|
| 3673 | Real kappam
|
|---|
| 3674 | "Correlation for highly polar substances such as alcohols and acids";
|
|---|
| 3675 | Real kappaij[size(y,1),size(y,1)];
|
|---|
| 3676 | Real mum;
|
|---|
| 3677 | Real Vcm;
|
|---|
| 3678 | Real Tcm;
|
|---|
| 3679 | Real murm "Dimensionless dipole moment of the mixture";
|
|---|
| 3680 | Real Fcm "Factor to correct for shape and polarity";
|
|---|
| 3681 | Real omegav;
|
|---|
| 3682 | Real Tmstar;
|
|---|
| 3683 | Real etam "Mixture viscosity in microP";
|
|---|
| 3684 | algorithm
|
|---|
| 3685 | //combining rules
|
|---|
| 3686 | for i in 1:n loop
|
|---|
| 3687 | for j in 1:n loop
|
|---|
| 3688 | Mij[i,j] := 2*M[i]*M[j]/(M[i]+M[j]);
|
|---|
| 3689 | if i==j then
|
|---|
| 3690 | sigma[i,j] := 0.809*Vc[i]^(1/3);
|
|---|
| 3691 | edivk[i,j] := Tc[i]/1.2593;
|
|---|
| 3692 | wij[i,j] := w[i];
|
|---|
| 3693 | kappaij[i,j] := kappa[i];
|
|---|
| 3694 | else
|
|---|
| 3695 | sigma[i,j] := (0.809*Vc[i]^(1/3)*0.809*Vc[j]^(1/3))^(1/2);
|
|---|
| 3696 | edivk[i,j] := (Tc[i]/1.2593*Tc[j]/1.2593)^(1/2);
|
|---|
| 3697 | wij[i,j] := (w[i] + w[j])/2;
|
|---|
| 3698 | kappaij[i,j] := (kappa[i]*kappa[j])^(1/2);
|
|---|
| 3699 | end if;
|
|---|
| 3700 | end for;
|
|---|
| 3701 | end for;
|
|---|
| 3702 | //mixing rules
|
|---|
| 3703 | sigmam3 := (sum(sum(y[i]*y[j]*sigma[i,j]^3 for j in 1:n) for i in 1:n));
|
|---|
| 3704 | //(epsilon/k)m
|
|---|
| 3705 | edivkm := (sum(sum(y[i]*y[j]*edivk[i,j]*sigma[i,j]^3 for j in 1:n) for i in 1:n))/sigmam3;
|
|---|
| 3706 | Mm := ((sum(sum(y[i]*y[j]*edivk[i,j]*sigma[i,j]^2*Mij[i,j]^(1/2) for j in 1:n) for i in 1:n))/(edivkm*sigmam3^(2/3)))^2;
|
|---|
| 3707 | wm := (sum(sum(y[i]*y[j]*wij[i,j]*sigma[i,j]^3 for j in 1:n) for i in 1:n))/sigmam3;
|
|---|
| 3708 | mum := (sigmam3*(sum(sum(y[i]*y[j]*mu[i]^2*mu[j]^2/sigma[i,j]^3 for j in 1:n) for i in 1:n)))^(1/4);
|
|---|
| 3709 | Vcm := sigmam3/(0.809)^3;
|
|---|
| 3710 | Tcm := 1.2593*edivkm;
|
|---|
| 3711 | murm := 131.3*mum/(Vcm*Tcm)^(1/2);
|
|---|
| 3712 | kappam := (sigmam3*(sum(sum(y[i]*y[j]*kappaij[i,j] for j in 1:n) for i in 1:n)));
|
|---|
| 3713 | Fcm := 1 - 0.275*wm + 0.059035*murm^4 + kappam;
|
|---|
| 3714 | Tmstar := T/edivkm;
|
|---|
| 3715 | omegav := 1.16145*(Tmstar)^(-0.14874) + 0.52487*Math.exp(-0.77320*Tmstar) + 2.16178*Math.exp(-2.43787*Tmstar);
|
|---|
| 3716 | etam := 26.69*Fcm*(Mm*T)^(1/2)/(sigmam3^(2/3)*omegav);
|
|---|
| 3717 | etaMixture := etam*1e7;
|
|---|
| 3718 |
|
|---|
| 3719 | annotation (smoothOrder=2,
|
|---|
| 3720 | Documentation(info="<html>
|
|---|
| 3721 |
|
|---|
| 3722 | <p>
|
|---|
| 3723 | Equation to estimate the viscosity of gas mixtures at low pressures.<br>
|
|---|
| 3724 | It is a simplification of an extension of the rigorous kinetic theory
|
|---|
| 3725 | of Chapman and Enskog to determine the viscosity of multicomponent
|
|---|
| 3726 | mixtures, at low pressures and with a factor to correct for molecule
|
|---|
| 3727 | shape and polarity.
|
|---|
| 3728 | </p>
|
|---|
| 3729 |
|
|---|
| 3730 | <p>
|
|---|
| 3731 | The input argument Kappa is a special correction for highly polar substances such as
|
|---|
| 3732 | alcohols and acids.<br>
|
|---|
| 3733 | Values of kappa for a few such materials:
|
|---|
| 3734 | </p>
|
|---|
| 3735 |
|
|---|
| 3736 | <table style=\"text-align: left; width: 302px; height: 200px;\" border=\"1\"
|
|---|
| 3737 | cellspacing=\"0\" cellpadding=\"2\">
|
|---|
| 3738 | <tbody>
|
|---|
| 3739 | <tr>
|
|---|
| 3740 | <td style=\"vertical-align: top;\">Compound <br>
|
|---|
| 3741 | </td>
|
|---|
| 3742 | <td style=\"vertical-align: top; text-align: center;\">Kappa<br>
|
|---|
| 3743 | </td>
|
|---|
| 3744 | <td style=\"vertical-align: top;\">Compound<br>
|
|---|
| 3745 | </td>
|
|---|
| 3746 | <td style=\"vertical-align: top;\">Kappa<br>
|
|---|
| 3747 | </td>
|
|---|
| 3748 | </tr>
|
|---|
| 3749 | <tr>
|
|---|
| 3750 | <td style=\"vertical-align: top;\">Methanol<br>
|
|---|
| 3751 | </td>
|
|---|
| 3752 | <td style=\"vertical-align: top;\">0.215<br>
|
|---|
| 3753 | </td>
|
|---|
| 3754 | <td style=\"vertical-align: top;\">n-Pentanol<br>
|
|---|
| 3755 | </td>
|
|---|
| 3756 | <td style=\"vertical-align: top;\">0.122<br>
|
|---|
| 3757 | </td>
|
|---|
| 3758 | </tr>
|
|---|
| 3759 | <tr>
|
|---|
| 3760 | <td style=\"vertical-align: top;\">Ethanol<br>
|
|---|
| 3761 | </td>
|
|---|
| 3762 | <td style=\"vertical-align: top;\">0.175<br>
|
|---|
| 3763 | </td>
|
|---|
| 3764 | <td style=\"vertical-align: top;\">n-Hexanol<br>
|
|---|
| 3765 | </td>
|
|---|
| 3766 | <td style=\"vertical-align: top;\">0.114<br>
|
|---|
| 3767 | </td>
|
|---|
| 3768 | </tr>
|
|---|
| 3769 | <tr>
|
|---|
| 3770 | <td style=\"vertical-align: top;\">n-Propanol<br>
|
|---|
| 3771 | </td>
|
|---|
| 3772 | <td style=\"vertical-align: top;\">0.143<br>
|
|---|
| 3773 | </td>
|
|---|
| 3774 | <td style=\"vertical-align: top;\">n-Heptanol<br>
|
|---|
| 3775 | </td>
|
|---|
| 3776 | <td style=\"vertical-align: top;\">0.109<br>
|
|---|
| 3777 | </td>
|
|---|
| 3778 | </tr>
|
|---|
| 3779 | <tr>
|
|---|
| 3780 | <td style=\"vertical-align: top;\">i-Propanol<br>
|
|---|
| 3781 | </td>
|
|---|
| 3782 | <td style=\"vertical-align: top;\">0.143<br>
|
|---|
| 3783 | </td>
|
|---|
| 3784 | <td style=\"vertical-align: top;\">Acetic Acid<br>
|
|---|
| 3785 | </td>
|
|---|
| 3786 | <td style=\"vertical-align: top;\">0.0916<br>
|
|---|
| 3787 | </td>
|
|---|
| 3788 | </tr>
|
|---|
| 3789 | <tr>
|
|---|
| 3790 | <td style=\"vertical-align: top;\">n-Butanol<br>
|
|---|
| 3791 | </td>
|
|---|
| 3792 | <td style=\"vertical-align: top;\">0.132<br>
|
|---|
| 3793 | </td>
|
|---|
| 3794 | <td style=\"vertical-align: top;\">Water<br>
|
|---|
| 3795 | </td>
|
|---|
| 3796 | <td style=\"vertical-align: top;\">0.076<br>
|
|---|
| 3797 | </td>
|
|---|
| 3798 | </tr>
|
|---|
| 3799 | <tr>
|
|---|
| 3800 | <td style=\"vertical-align: top;\">i-Butanol<br>
|
|---|
| 3801 | </td>
|
|---|
| 3802 | <td style=\"vertical-align: top;\">0.132</td>
|
|---|
| 3803 | <td style=\"vertical-align: top;\"><br>
|
|---|
| 3804 | </td>
|
|---|
| 3805 | <td style=\"vertical-align: top;\"><br>
|
|---|
| 3806 | </td>
|
|---|
| 3807 | </tr>
|
|---|
| 3808 | </tbody>
|
|---|
| 3809 | </table>
|
|---|
| 3810 | <p>
|
|---|
| 3811 | Chung, et al. (1984) suggest that for other alcohols not shown in the
|
|---|
| 3812 | table:<br>
|
|---|
| 3813 | <br>
|
|---|
| 3814 | kappa = 0.0682 + 4.704*[(number of -OH
|
|---|
| 3815 | groups)]/[molecular weight]<br>
|
|---|
| 3816 | <br>
|
|---|
| 3817 | <span style=\"font-weight: normal;\">S.I. units relation for the
|
|---|
| 3818 | debyes: </span><br>
|
|---|
| 3819 |
|
|---|
| 3820 |
|
|---|
| 3821 |
|
|---|
| 3822 | 1 debye = 3.162e-25 (J.m^3)^(1/2)<br>
|
|---|
| 3823 | </p>
|
|---|
| 3824 | <h4>References</h4>
|
|---|
| 3825 | <p>
|
|---|
| 3826 | [1] THE PROPERTIES OF GASES AND LIQUIDS, Fifth Edition,<br>
|
|---|
| 3827 | Bruce E. Poling, John M.
|
|---|
| 3828 | Prausnitz, John P. O'Connell.<br>
|
|---|
| 3829 | [2] Chung, T.-H., M. Ajlan, L. L. Lee, and K. E. Starling: Ind. Eng.
|
|---|
| 3830 | Chem. Res., 27: 671 (1988).<br>
|
|---|
| 3831 | [3] Chung, T.-H., L. L. Lee, and K. E. Starling; Ing. Eng. Chem.
|
|---|
| 3832 | Fundam., 23: 3 ()1984).<br>
|
|---|
| 3833 | </p>
|
|---|
| 3834 | </html>"));
|
|---|
| 3835 | end mixtureViscosityChung;
|
|---|
| 3836 |
|
|---|
| 3837 | function lowPressureThermalConductivity
|
|---|
| 3838 | "Return thermal conductivities of low-pressure gas mixtures (Mason and Saxena Modification)"
|
|---|
| 3839 | extends Modelica.Icons.Function;
|
|---|
| 3840 | input MoleFraction[:] y
|
|---|
| 3841 | "Mole fraction of the components in the gas mixture";
|
|---|
| 3842 | input Temperature T "Temperature";
|
|---|
| 3843 | input Temperature[:] Tc "Critical temperatures";
|
|---|
| 3844 | input AbsolutePressure[:] Pc "Critical pressures";
|
|---|
| 3845 | input MolarMass[:] M "Molecular weights";
|
|---|
| 3846 | input ThermalConductivity[:] lambda
|
|---|
| 3847 | "Thermal conductivities of the pure gases";
|
|---|
| 3848 | output ThermalConductivity lambdam
|
|---|
| 3849 | "Thermal conductivity of the gas mixture";
|
|---|
| 3850 | protected
|
|---|
| 3851 | MolarMass[size(y,1)] gamma;
|
|---|
| 3852 | Real[size(y,1)] Tr "Reduced temperature";
|
|---|
| 3853 | Real[size(y,1),size(y,1)] A "Mason and Saxena Modification";
|
|---|
| 3854 | constant Real epsilon = 1.0 "Numerical constant near unity";
|
|---|
| 3855 | algorithm
|
|---|
| 3856 | for i in 1:size(y,1) loop
|
|---|
| 3857 | gamma[i] := 210*(Tc[i]*M[i]^3/Pc[i]^4)^(1/6);
|
|---|
| 3858 | Tr[i] := T/Tc[i];
|
|---|
| 3859 | end for;
|
|---|
| 3860 | for i in 1:size(y,1) loop
|
|---|
| 3861 | for j in 1:size(y,1) loop
|
|---|
| 3862 | A[i,j] := epsilon*(1 + (gamma[j]*(Math.exp(0.0464*Tr[i]) - Math.exp(-0.2412*Tr[i]))/
|
|---|
| 3863 | (gamma[i]*(Math.exp(0.0464*Tr[j]) - Math.exp(-0.2412*Tr[j]))))^(1/2)*(M[i]/M[j])^(1/4))^2/
|
|---|
| 3864 | (8*(1 + M[i]/M[j]))^(1/2);
|
|---|
| 3865 | end for;
|
|---|
| 3866 | end for;
|
|---|
| 3867 | lambdam := sum(y[i]*lambda[i]/(sum(y[j]*A[i,j] for j in 1:size(y,1))) for i in 1:size(y,1));
|
|---|
| 3868 |
|
|---|
| 3869 | annotation (smoothOrder=2,
|
|---|
| 3870 | Documentation(info="<html>
|
|---|
| 3871 |
|
|---|
| 3872 | <p>
|
|---|
| 3873 | This function applies the Masson and Saxena modification of the
|
|---|
| 3874 | Wassiljewa Equation for the thermal conductivity for gas mixtures of
|
|---|
| 3875 | n elements at low pressure.
|
|---|
| 3876 | </p>
|
|---|
| 3877 |
|
|---|
| 3878 | <p>
|
|---|
| 3879 | For nonpolar gas mixtures errors will generally be less than 3 to 4%.
|
|---|
| 3880 | For mixtures of nonpolar-polar and polar-polar gases, errors greater
|
|---|
| 3881 | than 5 to 8% may be expected. For mixtures in which the sizes and
|
|---|
| 3882 | polarities of the constituent molecules are not greatly different, the
|
|---|
| 3883 | thermal conductivity can be estimated satisfactorily by a mole fraction
|
|---|
| 3884 | average of the pure component conductivities.
|
|---|
| 3885 | </p>
|
|---|
| 3886 |
|
|---|
| 3887 | </html>"));
|
|---|
| 3888 | end lowPressureThermalConductivity;
|
|---|
| 3889 |
|
|---|
| 3890 | redeclare replaceable function extends thermalConductivity
|
|---|
| 3891 | "Return thermal conductivity for low pressure gas mixtures"
|
|---|
| 3892 | input Integer method=methodForThermalConductivity
|
|---|
| 3893 | "Method to compute single component thermal conductivity";
|
|---|
| 3894 | protected
|
|---|
| 3895 | ThermalConductivity[nX] lambdaX "Component thermal conductivities";
|
|---|
| 3896 | DynamicViscosity[nX] eta "Component thermal dynamic viscosities";
|
|---|
| 3897 | SpecificHeatCapacity[nX] cp "Component heat capacity";
|
|---|
| 3898 | algorithm
|
|---|
| 3899 | for i in 1:nX loop
|
|---|
| 3900 | assert(fluidConstants[i].hasCriticalData, "Critical data for "+ fluidConstants[i].chemicalFormula +
|
|---|
| 3901 | " not known. Can not compute thermal conductivity.");
|
|---|
| 3902 | eta[i] := Modelica.Media.IdealGases.Common.Functions.dynamicViscosityLowPressure(
|
|---|
| 3903 | state.T,
|
|---|
| 3904 | fluidConstants[i].criticalTemperature,
|
|---|
| 3905 | fluidConstants[i].molarMass,
|
|---|
| 3906 | fluidConstants[i].criticalMolarVolume,
|
|---|
| 3907 | fluidConstants[i].acentricFactor,
|
|---|
| 3908 | fluidConstants[i].dipoleMoment);
|
|---|
| 3909 | cp[i] := Modelica.Media.IdealGases.Common.Functions.cp_T(
|
|---|
| 3910 | data[i],state.T);
|
|---|
| 3911 | lambdaX[i] :=Modelica.Media.IdealGases.Common.Functions.thermalConductivityEstimate(
|
|---|
| 3912 | Cp=cp[i], eta=
|
|---|
| 3913 | eta[i], method=method,data=data[i]);
|
|---|
| 3914 | end for;
|
|---|
| 3915 | lambda := lowPressureThermalConductivity(massToMoleFractions(state.X,
|
|---|
| 3916 | fluidConstants[:].molarMass),
|
|---|
| 3917 | state.T,
|
|---|
| 3918 | fluidConstants[:].criticalTemperature,
|
|---|
| 3919 | fluidConstants[:].criticalPressure,
|
|---|
| 3920 | fluidConstants[:].molarMass,
|
|---|
| 3921 | lambdaX);
|
|---|
| 3922 | annotation (smoothOrder=2);
|
|---|
| 3923 | end thermalConductivity;
|
|---|
| 3924 |
|
|---|
| 3925 | redeclare function extends isobaricExpansionCoefficient
|
|---|
| 3926 | "Return isobaric expansion coefficient beta"
|
|---|
| 3927 | algorithm
|
|---|
| 3928 | beta := 1/state.T;
|
|---|
| 3929 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3930 | end isobaricExpansionCoefficient;
|
|---|
| 3931 |
|
|---|
| 3932 | redeclare function extends isothermalCompressibility
|
|---|
| 3933 | "Return isothermal compressibility factor"
|
|---|
| 3934 | algorithm
|
|---|
| 3935 | kappa := 1.0/state.p;
|
|---|
| 3936 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3937 | end isothermalCompressibility;
|
|---|
| 3938 |
|
|---|
| 3939 | redeclare function extends density_derp_T
|
|---|
| 3940 | "Return density derivative by pressure at constant temperature"
|
|---|
| 3941 | algorithm
|
|---|
| 3942 | ddpT := 1/(state.T*gasConstant(state));
|
|---|
| 3943 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3944 | end density_derp_T;
|
|---|
| 3945 |
|
|---|
| 3946 | redeclare function extends density_derT_p
|
|---|
| 3947 | "Return density derivative by temperature at constant pressure"
|
|---|
| 3948 | algorithm
|
|---|
| 3949 | ddTp := -state.p/(state.T*state.T*gasConstant(state));
|
|---|
| 3950 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3951 | end density_derT_p;
|
|---|
| 3952 |
|
|---|
| 3953 | redeclare function density_derX
|
|---|
| 3954 | "Return density derivative by mass fraction"
|
|---|
| 3955 | extends Modelica.Icons.Function;
|
|---|
| 3956 | input ThermodynamicState state "Thermodynamic state record";
|
|---|
| 3957 | output Density[nX] dddX "Derivative of density w.r.t. mass fraction";
|
|---|
| 3958 | algorithm
|
|---|
| 3959 | dddX := {-state.p/(state.T*gasConstant(state))*molarMass(state)/data[
|
|---|
| 3960 | i].MM for i in 1:nX};
|
|---|
| 3961 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3962 | end density_derX;
|
|---|
| 3963 |
|
|---|
| 3964 | redeclare function extends molarMass "Return molar mass of mixture"
|
|---|
| 3965 | algorithm
|
|---|
| 3966 | MM := 1/sum(state.X[j]/data[j].MM for j in 1:size(state.X, 1));
|
|---|
| 3967 | annotation(Inline=true,smoothOrder=2);
|
|---|
| 3968 | end molarMass;
|
|---|
| 3969 |
|
|---|
| 3970 | function T_hX
|
|---|
| 3971 | "Return temperature from specific enthalpy and mass fraction"
|
|---|
| 3972 | extends Modelica.Icons.Function;
|
|---|
| 3973 | input SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 3974 | input MassFraction[:] X "Mass fractions of composition";
|
|---|
| 3975 | input Boolean exclEnthForm=excludeEnthalpyOfFormation
|
|---|
| 3976 | "If true, enthalpy of formation Hf is not included in specific enthalpy h";
|
|---|
| 3977 | input Modelica.Media.Interfaces.Choices.ReferenceEnthalpy
|
|---|
| 3978 | refChoice=referenceChoice
|
|---|
| 3979 | "Choice of reference enthalpy";
|
|---|
| 3980 | input SI.SpecificEnthalpy h_off=h_offset
|
|---|
| 3981 | "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
|
|---|
| 3982 | output Temperature T "Temperature";
|
|---|
| 3983 | protected
|
|---|
| 3984 | MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)});
|
|---|
| 3985 | package Internal
|
|---|
| 3986 | "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)"
|
|---|
| 3987 | extends Modelica.Media.Common.OneNonLinearEquation;
|
|---|
| 3988 | redeclare record extends f_nonlinear_Data
|
|---|
| 3989 | "Data to be passed to non-linear function"
|
|---|
| 3990 | extends Modelica.Media.IdealGases.Common.DataRecord;
|
|---|
| 3991 | end f_nonlinear_Data;
|
|---|
| 3992 |
|
|---|
| 3993 | redeclare function extends f_nonlinear
|
|---|
| 3994 | algorithm
|
|---|
| 3995 | y := h_TX(x,X);
|
|---|
| 3996 | end f_nonlinear;
|
|---|
| 3997 |
|
|---|
| 3998 | // Dummy definition has to be added for current Dymola
|
|---|
| 3999 | redeclare function extends solve
|
|---|
| 4000 | end solve;
|
|---|
| 4001 | end Internal;
|
|---|
| 4002 |
|
|---|
| 4003 | algorithm
|
|---|
| 4004 | T := Internal.solve(h, 200, 6000, 1.0e5, Xfull, data[1]);
|
|---|
| 4005 | annotation(inverse(h = h_TX(T,X,exclEnthForm,refChoice,h_off)));
|
|---|
| 4006 | end T_hX;
|
|---|
| 4007 |
|
|---|
| 4008 | function T_psX
|
|---|
| 4009 | "Return temperature from pressure, specific entropy and mass fraction"
|
|---|
| 4010 | extends Modelica.Icons.Function;
|
|---|
| 4011 | input AbsolutePressure p "Pressure";
|
|---|
| 4012 | input SpecificEntropy s "Specific entropy";
|
|---|
| 4013 | input MassFraction[:] X "Mass fractions of composition";
|
|---|
| 4014 | output Temperature T "Temperature";
|
|---|
| 4015 | protected
|
|---|
| 4016 | MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)});
|
|---|
| 4017 | package Internal
|
|---|
| 4018 | "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)"
|
|---|
| 4019 | extends Modelica.Media.Common.OneNonLinearEquation;
|
|---|
| 4020 | redeclare record extends f_nonlinear_Data
|
|---|
| 4021 | "Data to be passed to non-linear function"
|
|---|
| 4022 | extends Modelica.Media.IdealGases.Common.DataRecord;
|
|---|
| 4023 | end f_nonlinear_Data;
|
|---|
| 4024 |
|
|---|
| 4025 | redeclare function extends f_nonlinear
|
|---|
| 4026 | "Note that this function always sees the complete mass fraction vector"
|
|---|
| 4027 | protected
|
|---|
| 4028 | MassFraction[nX] Xfull = if size(X,1) == nX then X else cat(1,X,{1-sum(X)});
|
|---|
| 4029 | Real[nX] Y(unit="mol/mol")=massToMoleFractions(if size(X,1) == nX then X else cat(1,X,{1-sum(X)}), data.MM)
|
|---|
| 4030 | "Molar fractions";
|
|---|
| 4031 | algorithm
|
|---|
| 4032 | y := s_TX(x,Xfull) - sum(Xfull[i]*Modelica.Constants.R/MMX[i]*
|
|---|
| 4033 | (if Xfull[i]<Modelica.Constants.eps then Y[i] else
|
|---|
| 4034 | Modelica.Math.log(Y[i]*p/reference_p)) for i in 1:nX);
|
|---|
| 4035 | // s_TX(x,X)- data[:].R*X*(Modelica.Math.log(p/reference_p)
|
|---|
| 4036 | // + MixEntropy(massToMoleFractions(X,data[:].MM)));
|
|---|
| 4037 | end f_nonlinear;
|
|---|
| 4038 |
|
|---|
| 4039 | // Dummy definition has to be added for current Dymola
|
|---|
| 4040 | redeclare function extends solve
|
|---|
| 4041 | end solve;
|
|---|
| 4042 | end Internal;
|
|---|
| 4043 |
|
|---|
| 4044 | algorithm
|
|---|
| 4045 | T := Internal.solve(s, 200, 6000, p, Xfull, data[1]);
|
|---|
| 4046 | end T_psX;
|
|---|
| 4047 |
|
|---|
| 4048 | // redeclare function extends specificEnthalpy_psX
|
|---|
| 4049 | // protected
|
|---|
| 4050 | // Temperature T "Temperature";
|
|---|
| 4051 | // algorithm
|
|---|
| 4052 | // T := temperature_psX(p,s,X);
|
|---|
| 4053 | // h := specificEnthalpy_pTX(p,T,X);
|
|---|
| 4054 | // end extends;
|
|---|
| 4055 |
|
|---|
| 4056 | // redeclare function extends density_phX
|
|---|
| 4057 | // "Compute density from pressure, specific enthalpy and mass fraction"
|
|---|
| 4058 | // protected
|
|---|
| 4059 | // Temperature T "Temperature";
|
|---|
| 4060 | // SpecificHeatCapacity R "Gas constant";
|
|---|
| 4061 | // algorithm
|
|---|
| 4062 | // T := temperature_phX(p,h,X);
|
|---|
| 4063 | // R := if (not reducedX) then
|
|---|
| 4064 | // sum(data[i].R*X[i] for i in 1:size(substanceNames, 1)) else
|
|---|
| 4065 | // sum(data[i].R*X[i] for i in 1:size(substanceNames, 1)-1) + data[end].R*(1-sum(X[i]));
|
|---|
| 4066 | // d := p/(R*T);
|
|---|
| 4067 | // end density_phX;
|
|---|
| 4068 |
|
|---|
| 4069 | annotation (Documentation(info="<HTML>
|
|---|
| 4070 | <p>
|
|---|
| 4071 | This model calculates the medium properties for single component ideal gases.
|
|---|
| 4072 | </p>
|
|---|
| 4073 | <p>
|
|---|
| 4074 | <b>Sources for model and literature:</b><br>
|
|---|
| 4075 | Original Data: Computer program for calculation of complex chemical
|
|---|
| 4076 | equilibrium compositions and applications. Part 1: Analysis
|
|---|
| 4077 | Document ID: 19950013764 N (95N20180) File Series: NASA Technical Reports
|
|---|
| 4078 | Report Number: NASA-RP-1311 E-8017 NAS 1.61:1311
|
|---|
| 4079 | Authors: Gordon, Sanford (NASA Lewis Research Center)
|
|---|
| 4080 | Mcbride, Bonnie J. (NASA Lewis Research Center)
|
|---|
| 4081 | Published: Oct 01, 1994.
|
|---|
| 4082 | </p>
|
|---|
| 4083 | <p><b>Known limits of validity:</b></br>
|
|---|
| 4084 | The data is valid for
|
|---|
| 4085 | temperatures between 200 K and 6000 K. A few of the data sets for
|
|---|
| 4086 | monatomic gases have a discontinuous 1st derivative at 1000 K, but
|
|---|
| 4087 | this never caused problems so far.
|
|---|
| 4088 | </p>
|
|---|
| 4089 | <p>
|
|---|
| 4090 | This model has been copied from the ThermoFluid library.
|
|---|
| 4091 | It has been developed by Hubertus Tummescheit.
|
|---|
| 4092 | </p>
|
|---|
| 4093 | </HTML>"));
|
|---|
| 4094 | end MixtureGasNasa;
|
|---|
| 4095 |
|
|---|
| 4096 | package FluidData "Critical data, dipole moments and related data"
|
|---|
| 4097 | extends Modelica.Icons.Package;
|
|---|
| 4098 | import Modelica.Media.Interfaces.PartialMixtureMedium;
|
|---|
| 4099 | import Modelica.Media.IdealGases.Common.SingleGasesData;
|
|---|
| 4100 |
|
|---|
| 4101 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants N2(
|
|---|
| 4102 | chemicalFormula = "N2",
|
|---|
| 4103 | iupacName = "unknown",
|
|---|
| 4104 | structureFormula = "unknown",
|
|---|
| 4105 | casRegistryNumber = "7727-37-9",
|
|---|
| 4106 | meltingPoint = 63.15,
|
|---|
| 4107 | normalBoilingPoint = 77.35,
|
|---|
| 4108 | criticalTemperature = 126.20,
|
|---|
| 4109 | criticalPressure = 33.98e5,
|
|---|
| 4110 | criticalMolarVolume = 90.10e-6,
|
|---|
| 4111 | acentricFactor = 0.037,
|
|---|
| 4112 | dipoleMoment = 0.0,
|
|---|
| 4113 | molarMass = SingleGasesData.N2.MM,
|
|---|
| 4114 | hasDipoleMoment = true,
|
|---|
| 4115 | hasIdealGasHeatCapacity=true,
|
|---|
| 4116 | hasCriticalData = true,
|
|---|
| 4117 | hasAcentricFactor = true);
|
|---|
| 4118 |
|
|---|
| 4119 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants O2(
|
|---|
| 4120 | chemicalFormula = "O2",
|
|---|
| 4121 | iupacName = "unknown",
|
|---|
| 4122 | structureFormula = "unknown",
|
|---|
| 4123 | casRegistryNumber = "7782-44-7",
|
|---|
| 4124 | meltingPoint = 54.36,
|
|---|
| 4125 | normalBoilingPoint = 90.17,
|
|---|
| 4126 | criticalTemperature = 154.58,
|
|---|
| 4127 | criticalPressure = 50.43e5,
|
|---|
| 4128 | criticalMolarVolume = 73.37e-6,
|
|---|
| 4129 | acentricFactor = 0.022,
|
|---|
| 4130 | dipoleMoment = 0.0,
|
|---|
| 4131 | molarMass = SingleGasesData.O2.MM,
|
|---|
| 4132 | hasDipoleMoment = true,
|
|---|
| 4133 | hasIdealGasHeatCapacity=true,
|
|---|
| 4134 | hasCriticalData = true,
|
|---|
| 4135 | hasAcentricFactor = true);
|
|---|
| 4136 |
|
|---|
| 4137 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants CO2(
|
|---|
| 4138 | chemicalFormula = "CO2",
|
|---|
| 4139 | iupacName = "unknown",
|
|---|
| 4140 | structureFormula = "unknown",
|
|---|
| 4141 | casRegistryNumber = "124-38-9",
|
|---|
| 4142 | meltingPoint = 216.58,
|
|---|
| 4143 | normalBoilingPoint = -1.0,
|
|---|
| 4144 | criticalTemperature = 304.12,
|
|---|
| 4145 | criticalPressure = 73.74e5,
|
|---|
| 4146 | criticalMolarVolume = 94.07e-6,
|
|---|
| 4147 | acentricFactor = 0.225,
|
|---|
| 4148 | dipoleMoment = 0.0,
|
|---|
| 4149 | molarMass = SingleGasesData.CO2.MM,
|
|---|
| 4150 | hasDipoleMoment = true,
|
|---|
| 4151 | hasIdealGasHeatCapacity=true,
|
|---|
| 4152 | hasCriticalData = true,
|
|---|
| 4153 | hasAcentricFactor = true);
|
|---|
| 4154 |
|
|---|
| 4155 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants H2O(
|
|---|
| 4156 | chemicalFormula = "H2O",
|
|---|
| 4157 | iupacName = "oxidane",
|
|---|
| 4158 | structureFormula = "H2O",
|
|---|
| 4159 | casRegistryNumber = "7732-18-5",
|
|---|
| 4160 | meltingPoint = 273.15,
|
|---|
| 4161 | normalBoilingPoint = 373.124,
|
|---|
| 4162 | criticalTemperature = 647.096,
|
|---|
| 4163 | criticalPressure = 220.64e5,
|
|---|
| 4164 | criticalMolarVolume = 55.95e-6,
|
|---|
| 4165 | acentricFactor = 0.344,
|
|---|
| 4166 | dipoleMoment = 1.8,
|
|---|
| 4167 | molarMass = SingleGasesData.H2O.MM,
|
|---|
| 4168 | hasDipoleMoment = true,
|
|---|
| 4169 | hasIdealGasHeatCapacity=true,
|
|---|
| 4170 | hasCriticalData = true,
|
|---|
| 4171 | hasAcentricFactor = true);
|
|---|
| 4172 |
|
|---|
| 4173 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants Ar(
|
|---|
| 4174 | chemicalFormula = "Ar",
|
|---|
| 4175 | iupacName = "unknown",
|
|---|
| 4176 | structureFormula = "unknown",
|
|---|
| 4177 | casRegistryNumber = "7440-37-1",
|
|---|
| 4178 | meltingPoint = 83.80,
|
|---|
| 4179 | normalBoilingPoint = 87.27,
|
|---|
| 4180 | criticalTemperature = 150.86,
|
|---|
| 4181 | criticalPressure = 48.98e5,
|
|---|
| 4182 | criticalMolarVolume = 74.57e-6,
|
|---|
| 4183 | acentricFactor = -0.002,
|
|---|
| 4184 | dipoleMoment = 0.0,
|
|---|
| 4185 | molarMass = SingleGasesData.Ar.MM,
|
|---|
| 4186 | hasDipoleMoment = true,
|
|---|
| 4187 | hasIdealGasHeatCapacity=true,
|
|---|
| 4188 | hasCriticalData = true,
|
|---|
| 4189 | hasAcentricFactor = true);
|
|---|
| 4190 |
|
|---|
| 4191 | constant Modelica.Media.Interfaces.Types.IdealGas.FluidConstants CH4(
|
|---|
| 4192 | chemicalFormula = "CH4",
|
|---|
| 4193 | iupacName = "unknown",
|
|---|
| 4194 | structureFormula = "unknown",
|
|---|
| 4195 | casRegistryNumber = "74-82-8",
|
|---|
| 4196 | meltingPoint = 90.69,
|
|---|
| 4197 | normalBoilingPoint = 111.66,
|
|---|
| 4198 | criticalTemperature = 190.56,
|
|---|
| 4199 | criticalPressure = 45.99e5,
|
|---|
| 4200 | criticalMolarVolume = 98.60e-6,
|
|---|
| 4201 | acentricFactor = 0.011,
|
|---|
| 4202 | dipoleMoment = 0.0,
|
|---|
| 4203 | molarMass = SingleGasesData.CH4.MM,
|
|---|
| 4204 | hasDipoleMoment = true,
|
|---|
| 4205 | hasIdealGasHeatCapacity=true,
|
|---|
| 4206 | hasCriticalData = true,
|
|---|
| 4207 | hasAcentricFactor = true);
|
|---|
| 4208 | annotation (Documentation(info="<html>
|
|---|
| 4209 | <p>
|
|---|
| 4210 | This package contains FluidConstants data records for the following 37 gases
|
|---|
| 4211 | (see also the description in
|
|---|
| 4212 | <a href=\"modelica://Modelica.Media.IdealGases\">Modelica.Media.IdealGases</a>):
|
|---|
| 4213 | </p>
|
|---|
| 4214 | <pre>
|
|---|
| 4215 | Argon Methane Methanol Carbon Monoxide Carbon Dioxide
|
|---|
| 4216 | Acetylene Ethylene Ethanol Ethane Propylene
|
|---|
| 4217 | Propane 1-Propanol 1-Butene N-Butane 1-Pentene
|
|---|
| 4218 | N-Pentane Benzene 1-Hexene N-Hexane 1-Heptane
|
|---|
| 4219 | N-Heptane Ethylbenzene N-Octane Chlorine Fluorine
|
|---|
| 4220 | Hydrogen Steam Helium Ammonia Nitric Oxide
|
|---|
| 4221 | Nitrogen Dioxide Nitrogen Nitrous Oxide Neon Oxygen
|
|---|
| 4222 | Sulfur Dioxide Sulfur Trioxide
|
|---|
| 4223 | </pre>
|
|---|
| 4224 |
|
|---|
| 4225 | </html>"));
|
|---|
| 4226 | end FluidData;
|
|---|
| 4227 |
|
|---|
| 4228 | package SingleGasesData
|
|---|
| 4229 | "Ideal gas data based on the NASA Glenn coefficients"
|
|---|
| 4230 | extends Modelica.Icons.Package;
|
|---|
| 4231 |
|
|---|
| 4232 | constant IdealGases.Common.DataRecord Ar(
|
|---|
| 4233 | name="Ar",
|
|---|
| 4234 | MM=0.039948,
|
|---|
| 4235 | Hf=0,
|
|---|
| 4236 | H0=155137.3785921698,
|
|---|
| 4237 | Tlimit=1000,
|
|---|
| 4238 | alow={0,0,2.5,0,0,0,0},
|
|---|
| 4239 | blow={-745.375,4.37967491},
|
|---|
| 4240 | ahigh={20.10538475,-0.05992661069999999,2.500069401,-3.99214116e-008,
|
|---|
| 4241 | 1.20527214e-011,-1.819015576e-015,1.078576636e-019},
|
|---|
| 4242 | bhigh={-744.993961,4.37918011},
|
|---|
| 4243 | R=208.1323720837088);
|
|---|
| 4244 |
|
|---|
| 4245 | constant IdealGases.Common.DataRecord CH4(
|
|---|
| 4246 | name="CH4",
|
|---|
| 4247 | MM=0.01604246,
|
|---|
| 4248 | Hf=-4650159.63885838,
|
|---|
| 4249 | H0=624355.7409524474,
|
|---|
| 4250 | Tlimit=1000,
|
|---|
| 4251 | alow={-176685.0998,2786.18102,-12.0257785,0.0391761929,-3.61905443e-005,
|
|---|
| 4252 | 2.026853043e-008,-4.976705489999999e-012},
|
|---|
| 4253 | blow={-23313.1436,89.0432275},
|
|---|
| 4254 | ahigh={3730042.76,-13835.01485,20.49107091,-0.001961974759,4.72731304e-007,
|
|---|
| 4255 | -3.72881469e-011,1.623737207e-015},
|
|---|
| 4256 | bhigh={75320.6691,-121.9124889},
|
|---|
| 4257 | R=518.2791167938085);
|
|---|
| 4258 |
|
|---|
| 4259 | constant IdealGases.Common.DataRecord CO2(
|
|---|
| 4260 | name="CO2",
|
|---|
| 4261 | MM=0.0440095,
|
|---|
| 4262 | Hf=-8941478.544405185,
|
|---|
| 4263 | H0=212805.6215135368,
|
|---|
| 4264 | Tlimit=1000,
|
|---|
| 4265 | alow={49436.5054,-626.411601,5.30172524,0.002503813816,-2.127308728e-007,-7.68998878e-010,
|
|---|
| 4266 | 2.849677801e-013},
|
|---|
| 4267 | blow={-45281.9846,-7.04827944},
|
|---|
| 4268 | ahigh={117696.2419,-1788.791477,8.29152319,-9.22315678e-005,4.86367688e-009,
|
|---|
| 4269 | -1.891053312e-012,6.330036589999999e-016},
|
|---|
| 4270 | bhigh={-39083.5059,-26.52669281},
|
|---|
| 4271 | R=188.9244822140674);
|
|---|
| 4272 |
|
|---|
| 4273 | constant IdealGases.Common.DataRecord H2O(
|
|---|
| 4274 | name="H2O",
|
|---|
| 4275 | MM=0.01801528,
|
|---|
| 4276 | Hf=-13423382.81725291,
|
|---|
| 4277 | H0=549760.6476280135,
|
|---|
| 4278 | Tlimit=1000,
|
|---|
| 4279 | alow={-39479.6083,575.573102,0.931782653,0.00722271286,-7.34255737e-006,
|
|---|
| 4280 | 4.95504349e-009,-1.336933246e-012},
|
|---|
| 4281 | blow={-33039.7431,17.24205775},
|
|---|
| 4282 | ahigh={1034972.096,-2412.698562,4.64611078,0.002291998307,-6.836830479999999e-007,
|
|---|
| 4283 | 9.426468930000001e-011,-4.82238053e-015},
|
|---|
| 4284 | bhigh={-13842.86509,-7.97814851},
|
|---|
| 4285 | R=461.5233290850878);
|
|---|
| 4286 |
|
|---|
| 4287 | constant IdealGases.Common.DataRecord N2(
|
|---|
| 4288 | name="N2",
|
|---|
| 4289 | MM=0.0280134,
|
|---|
| 4290 | Hf=0,
|
|---|
| 4291 | H0=309498.4543111511,
|
|---|
| 4292 | Tlimit=1000,
|
|---|
| 4293 | alow={22103.71497,-381.846182,6.08273836,-0.00853091441,1.384646189e-005,-9.62579362e-009,
|
|---|
| 4294 | 2.519705809e-012},
|
|---|
| 4295 | blow={710.846086,-10.76003744},
|
|---|
| 4296 | ahigh={587712.406,-2239.249073,6.06694922,-0.00061396855,1.491806679e-007,-1.923105485e-011,
|
|---|
| 4297 | 1.061954386e-015},
|
|---|
| 4298 | bhigh={12832.10415,-15.86640027},
|
|---|
| 4299 | R=296.8033869505308);
|
|---|
| 4300 |
|
|---|
| 4301 | constant IdealGases.Common.DataRecord O2(
|
|---|
| 4302 | name="O2",
|
|---|
| 4303 | MM=0.0319988,
|
|---|
| 4304 | Hf=0,
|
|---|
| 4305 | H0=271263.4223783392,
|
|---|
| 4306 | Tlimit=1000,
|
|---|
| 4307 | alow={-34255.6342,484.700097,1.119010961,0.00429388924,-6.83630052e-007,-2.0233727e-009,
|
|---|
| 4308 | 1.039040018e-012},
|
|---|
| 4309 | blow={-3391.45487,18.4969947},
|
|---|
| 4310 | ahigh={-1037939.022,2344.830282,1.819732036,0.001267847582,-2.188067988e-007,
|
|---|
| 4311 | 2.053719572e-011,-8.193467050000001e-016},
|
|---|
| 4312 | bhigh={-16890.10929,17.38716506},
|
|---|
| 4313 | R=259.8369938872708);
|
|---|
| 4314 | annotation ( Documentation(info="<HTML>
|
|---|
| 4315 | <p>This package contains ideal gas models for the 1241 ideal gases from</p>
|
|---|
| 4316 | <blockquote>
|
|---|
| 4317 | <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
|
|---|
| 4318 | for Calculating Thermodynamic Properties of Individual Species</b>. NASA
|
|---|
| 4319 | report TP-2002-211556</p>
|
|---|
| 4320 | </blockquote>
|
|---|
| 4321 |
|
|---|
| 4322 | <pre>
|
|---|
| 4323 | Ag BaOH+ C2H4O_ethylen_o DF In2I4 Nb ScO2
|
|---|
| 4324 | Ag+ Ba_OH_2 CH3CHO_ethanal DOCl In2I6 Nb+ Sc2O
|
|---|
| 4325 | Ag- BaS CH3COOH DO2 In2O Nb- Sc2O2
|
|---|
| 4326 | Air Ba2 OHCH2COOH DO2- K NbCl5 Si
|
|---|
| 4327 | Al Be C2H5 D2 K+ NbO Si+
|
|---|
| 4328 | Al+ Be+ C2H5Br D2+ K- NbOCl3 Si-
|
|---|
| 4329 | Al- Be++ C2H6 D2- KAlF4 NbO2 SiBr
|
|---|
| 4330 | AlBr BeBr CH3N2CH3 D2O KBO2 Ne SiBr2
|
|---|
| 4331 | AlBr2 BeBr2 C2H5OH D2O2 KBr Ne+ SiBr3
|
|---|
| 4332 | AlBr3 BeCl CH3OCH3 D2S KCN Ni SiBr4
|
|---|
| 4333 | AlC BeCl2 CH3O2CH3 e- KCl Ni+ SiC
|
|---|
| 4334 | AlC2 BeF CCN F KF Ni- SiC2
|
|---|
| 4335 | AlCl BeF2 CNC F+ KH NiCl SiCl
|
|---|
| 4336 | AlCl+ BeH OCCN F- KI NiCl2 SiCl2
|
|---|
| 4337 | AlCl2 BeH+ C2N2 FCN Kli NiO SiCl3
|
|---|
| 4338 | AlCl3 BeH2 C2O FCO KNO2 NiS SiCl4
|
|---|
| 4339 | AlF BeI C3 FO KNO3 O SiF
|
|---|
| 4340 | AlF+ BeI2 C3H3_1_propynl FO2_FOO KNa O+ SiFCl
|
|---|
| 4341 | AlFCl BeN C3H3_2_propynl FO2_OFO KO O- SiF2
|
|---|
| 4342 | AlFCl2 BeO C3H4_allene F2 KOH OD SiF3
|
|---|
| 4343 | AlF2 BeOH C3H4_propyne F2O K2 OD- SiF4
|
|---|
| 4344 | AlF2- BeOH+ C3H4_cyclo F2O2 K2+ OH SiH
|
|---|
| 4345 | AlF2Cl Be_OH_2 C3H5_allyl FS2F K2Br2 OH+ SiH+
|
|---|
| 4346 | AlF3 BeS C3H6_propylene Fe K2CO3 OH- SiHBr3
|
|---|
| 4347 | AlF4- Be2 C3H6_cyclo Fe+ K2C2N2 O2 SiHCl
|
|---|
| 4348 | AlH Be2Cl4 C3H6O_propylox Fe_CO_5 K2Cl2 O2+ SiHCl3
|
|---|
| 4349 | AlHCl Be2F4 C3H6O_acetone FeCl K2F2 O2- SiHF
|
|---|
| 4350 | AlHCl2 Be2O C3H6O_propanal FeCl2 K2I2 O3 SiHF3
|
|---|
| 4351 | AlHF Be2OF2 C3H7_n_propyl FeCl3 K2O P SiHI3
|
|---|
| 4352 | AlHFCl Be2O2 C3H7_i_propyl FeO K2O+ P+ SiH2
|
|---|
| 4353 | AlHF2 Be3O3 C3H8 Fe_OH_2 K2O2 P- SiH2Br2
|
|---|
| 4354 | AlH2 Be4O4 C3H8O_1propanol Fe2Cl4 K2O2H2 PCl SiH2Cl2
|
|---|
| 4355 | AlH2Cl Br C3H8O_2propanol Fe2Cl6 K2SO4 PCl2 SiH2F2
|
|---|
| 4356 | AlH2F Br+ CNCOCN Ga Kr PCl2- SiH2I2
|
|---|
| 4357 | AlH3 Br- C3O2 Ga+ Kr+ PCl3 SiH3
|
|---|
| 4358 | AlI BrCl C4 GaBr li PCl5 SiH3Br
|
|---|
| 4359 | AlI2 BrF C4H2_butadiyne GaBr2 li+ PF SiH3Cl
|
|---|
| 4360 | AlI3 BrF3 C4H4_1_3-cyclo GaBr3 li- PF+ SiH3F
|
|---|
| 4361 | AlN BrF5 C4H6_butadiene GaCl liAlF4 PF- SiH3I
|
|---|
| 4362 | AlO BrO C4H6_1butyne GaCl2 liBO2 PFCl SiH4
|
|---|
| 4363 | AlO+ OBrO C4H6_2butyne GaCl3 liBr PFCl- SiI
|
|---|
| 4364 | AlO- BrOO C4H6_cyclo GaF liCl PFCl2 SiI2
|
|---|
| 4365 | AlOCl BrO3 C4H8_1_butene GaF2 liF PFCl4 SiN
|
|---|
| 4366 | AlOCl2 Br2 C4H8_cis2_buten GaF3 liH PF2 SiO
|
|---|
| 4367 | AlOF BrBrO C4H8_isobutene GaH liI PF2- SiO2
|
|---|
| 4368 | AlOF2 BrOBr C4H8_cyclo GaI liN PF2Cl SiS
|
|---|
| 4369 | AlOF2- C C4H9_n_butyl GaI2 liNO2 PF2Cl3 SiS2
|
|---|
| 4370 | AlOH C+ C4H9_i_butyl GaI3 liNO3 PF3 Si2
|
|---|
| 4371 | AlOHCl C- C4H9_s_butyl GaO liO PF3Cl2 Si2C
|
|---|
| 4372 | AlOHCl2 CBr C4H9_t_butyl GaOH liOF PF4Cl Si2F6
|
|---|
| 4373 | AlOHF CBr2 C4H10_n_butane Ga2Br2 liOH PF5 Si2N
|
|---|
| 4374 | AlOHF2 CBr3 C4H10_isobutane Ga2Br4 liON PH Si3
|
|---|
| 4375 | AlO2 CBr4 C4N2 Ga2Br6 li2 PH2 Sn
|
|---|
| 4376 | AlO2- CCl C5 Ga2Cl2 li2+ PH2- Sn+
|
|---|
| 4377 | Al_OH_2 CCl2 C5H6_1_3cyclo Ga2Cl4 li2Br2 PH3 Sn-
|
|---|
| 4378 | Al_OH_2Cl CCl2Br2 C5H8_cyclo Ga2Cl6 li2F2 PN SnBr
|
|---|
| 4379 | Al_OH_2F CCl3 C5H10_1_pentene Ga2F2 li2I2 PO SnBr2
|
|---|
| 4380 | Al_OH_3 CCl3Br C5H10_cyclo Ga2F4 li2O PO- SnBr3
|
|---|
| 4381 | AlS CCl4 C5H11_pentyl Ga2F6 li2O+ POCl3 SnBr4
|
|---|
| 4382 | AlS2 CF C5H11_t_pentyl Ga2I2 li2O2 POFCl2 SnCl
|
|---|
| 4383 | Al2 CF+ C5H12_n_pentane Ga2I4 li2O2H2 POF2Cl SnCl2
|
|---|
| 4384 | Al2Br6 CFBr3 C5H12_i_pentane Ga2I6 li2SO4 POF3 SnCl3
|
|---|
| 4385 | Al2C2 CFCl CH3C_CH3_2CH3 Ga2O li3+ PO2 SnCl4
|
|---|
| 4386 | Al2Cl6 CFClBr2 C6D5_phenyl Ge li3Br3 PO2- SnF
|
|---|
| 4387 | Al2F6 CFCl2 C6D6 Ge+ li3Cl3 PS SnF2
|
|---|
| 4388 | Al2I6 CFCl2Br C6H2 Ge- li3F3 P2 SnF3
|
|---|
| 4389 | Al2O CFCl3 C6H5_phenyl GeBr li3I3 P2O3 SnF4
|
|---|
| 4390 | Al2O+ CF2 C6H5O_phenoxy GeBr2 Mg P2O4 SnI
|
|---|
| 4391 | Al2O2 CF2+ C6H6 GeBr3 Mg+ P2O5 SnI2
|
|---|
| 4392 | Al2O2+ CF2Br2 C6H5OH_phenol GeBr4 MgBr P3 SnI3
|
|---|
| 4393 | Al2O3 CF2Cl C6H10_cyclo GeCl MgBr2 P3O6 SnI4
|
|---|
| 4394 | Al2S CF2ClBr C6H12_1_hexene GeCl2 MgCl P4 SnO
|
|---|
| 4395 | Al2S2 CF2Cl2 C6H12_cyclo GeCl3 MgCl+ P4O6 SnO2
|
|---|
| 4396 | Ar CF3 C6H13_n_hexyl GeCl4 MgCl2 P4O7 SnS
|
|---|
| 4397 | Ar+ CF3+ C6H14_n_hexane GeF MgF P4O8 SnS2
|
|---|
| 4398 | B CF3Br C7H7_benzyl GeF2 MgF+ P4O9 Sn2
|
|---|
| 4399 | B+ CF3Cl C7H8 GeF3 MgF2 P4O10 Sr
|
|---|
| 4400 | B- CF4 C7H8O_cresol_mx GeF4 MgF2+ Pb Sr+
|
|---|
| 4401 | BBr CH+ C7H14_1_heptene GeH4 MgH Pb+ SrBr
|
|---|
| 4402 | BBr2 CHBr3 C7H15_n_heptyl GeI MgI Pb- SrBr2
|
|---|
| 4403 | BBr3 CHCl C7H16_n_heptane GeO MgI2 PbBr SrCl
|
|---|
| 4404 | BC CHClBr2 C7H16_2_methylh GeO2 MgN PbBr2 SrCl+
|
|---|
| 4405 | BC2 CHCl2 C8H8_styrene GeS MgO PbBr3 SrCl2
|
|---|
| 4406 | BCl CHCl2Br C8H10_ethylbenz GeS2 MgOH PbBr4 SrF
|
|---|
| 4407 | BCl+ CHCl3 C8H16_1_octene Ge2 MgOH+ PbCl SrF+
|
|---|
| 4408 | BClOH CHF C8H17_n_octyl H Mg_OH_2 PbCl2 SrF2
|
|---|
| 4409 | BCl_OH_2 CHFBr2 C8H18_n_octane H+ MgS PbCl3 SrH
|
|---|
| 4410 | BCl2 CHFCl C8H18_isooctane H- Mg2 PbCl4 SrI
|
|---|
| 4411 | BCl2+ CHFClBr C9H19_n_nonyl HAlO Mg2F4 PbF SrI2
|
|---|
| 4412 | BCl2OH CHFCl2 C10H8_naphthale HAlO2 Mn PbF2 SrO
|
|---|
| 4413 | BF CHF2 C10H21_n_decyl HBO Mn+ PbF3 SrOH
|
|---|
| 4414 | BFCl CHF2Br C12H9_o_bipheny HBO+ Mo PbF4 SrOH+
|
|---|
| 4415 | BFCl2 CHF2Cl C12H10_biphenyl HBO2 Mo+ PbI Sr_OH_2
|
|---|
| 4416 | BFOH CHF3 Ca HBS Mo- PbI2 SrS
|
|---|
| 4417 | BF_OH_2 CHI3 Ca+ HBS+ MoO PbI3 Sr2
|
|---|
| 4418 | BF2 CH2 CaBr HCN MoO2 PbI4 Ta
|
|---|
| 4419 | BF2+ CH2Br2 CaBr2 HCO MoO3 PbO Ta+
|
|---|
| 4420 | BF2- CH2Cl CaCl HCO+ MoO3- PbO2 Ta-
|
|---|
| 4421 | BF2Cl CH2ClBr CaCl+ HCCN Mo2O6 PbS TaCl5
|
|---|
| 4422 | BF2OH CH2Cl2 CaCl2 HCCO Mo3O9 PbS2 TaO
|
|---|
| 4423 | BF3 CH2F CaF HCl Mo4O12 Rb TaO2
|
|---|
| 4424 | BF4- CH2FBr CaF+ HD Mo5O15 Rb+ Ti
|
|---|
| 4425 | BH CH2FCl CaF2 HD+ N Rb- Ti+
|
|---|
| 4426 | BHCl CH2F2 CaH HDO N+ RbBO2 Ti-
|
|---|
| 4427 | BHCl2 CH2I2 CaI HDO2 N- RbBr TiCl
|
|---|
| 4428 | BHF CH3 CaI2 HF NCO RbCl TiCl2
|
|---|
| 4429 | BHFCl CH3Br CaO HI ND RbF TiCl3
|
|---|
| 4430 | BHF2 CH3Cl CaO+ HNC ND2 RbH TiCl4
|
|---|
| 4431 | BH2 CH3F CaOH HNCO ND3 RbI TiO
|
|---|
| 4432 | BH2Cl CH3I CaOH+ HNO NF RbK TiO+
|
|---|
| 4433 | BH2F CH2OH Ca_OH_2 HNO2 NF2 Rbli TiOCl
|
|---|
| 4434 | BH3 CH2OH+ CaS HNO3 NF3 RbNO2 TiOCl2
|
|---|
| 4435 | BH3NH3 CH3O Ca2 HOCl NH RbNO3 TiO2
|
|---|
| 4436 | BH4 CH4 Cd HOF NH+ RbNa U
|
|---|
| 4437 | BI CH3OH Cd+ HO2 NHF RbO UF
|
|---|
| 4438 | BI2 CH3OOH Cl HO2- NHF2 RbOH UF+
|
|---|
| 4439 | BI3 CI Cl+ HPO NH2 Rb2Br2 UF-
|
|---|
| 4440 | BN CI2 Cl- HSO3F NH2F Rb2Cl2 UF2
|
|---|
| 4441 | BO CI3 ClCN H2 NH3 Rb2F2 UF2+
|
|---|
| 4442 | BO- CI4 ClF H2+ NH2OH Rb2I2 UF2-
|
|---|
| 4443 | BOCl CN ClF3 H2- NH4+ Rb2O UF3
|
|---|
| 4444 | BOCl2 CN+ ClF5 HBOH NO Rb2O2 UF3+
|
|---|
| 4445 | BOF CN- ClO HCOOH NOCl Rb2O2H2 UF3-
|
|---|
| 4446 | BOF2 CNN ClO2 H2F2 NOF Rb2SO4 UF4
|
|---|
| 4447 | BOH CO Cl2 H2O NOF3 Rn UF4+
|
|---|
| 4448 | BO2 CO+ Cl2O H2O+ NO2 Rn+ UF4-
|
|---|
| 4449 | BO2- COCl Co H2O2 NO2- S UF5
|
|---|
| 4450 | B_OH_2 COCl2 Co+ H2S NO2Cl S+ UF5+
|
|---|
| 4451 | BS COFCl Co- H2SO4 NO2F S- UF5-
|
|---|
| 4452 | BS2 COF2 Cr H2BOH NO3 SCl UF6
|
|---|
| 4453 | B2 COHCl Cr+ HB_OH_2 NO3- SCl2 UF6-
|
|---|
| 4454 | B2C COHF Cr- H3BO3 NO3F SCl2+ UO
|
|---|
| 4455 | B2Cl4 COS CrN H3B3O3 N2 SD UO+
|
|---|
| 4456 | B2F4 CO2 CrO H3B3O6 N2+ SF UOF
|
|---|
| 4457 | B2H CO2+ CrO2 H3F3 N2- SF+ UOF2
|
|---|
| 4458 | B2H2 COOH CrO3 H3O+ NCN SF- UOF3
|
|---|
| 4459 | B2H3 CP CrO3- H4F4 N2D2_cis SF2 UOF4
|
|---|
| 4460 | B2H3_db CS Cs H5F5 N2F2 SF2+ UO2
|
|---|
| 4461 | B2H4 CS2 Cs+ H6F6 N2F4 SF2- UO2+
|
|---|
| 4462 | B2H4_db C2 Cs- H7F7 N2H2 SF3 UO2-
|
|---|
| 4463 | B2H5 C2+ CsBO2 He NH2NO2 SF3+ UO2F
|
|---|
| 4464 | B2H5_db C2- CsBr He+ N2H4 SF3- UO2F2
|
|---|
| 4465 | B2H6 C2Cl CsCl Hg N2O SF4 UO3
|
|---|
| 4466 | B2O C2Cl2 CsF Hg+ N2O+ SF4+ UO3-
|
|---|
| 4467 | B2O2 C2Cl3 CsH HgBr2 N2O3 SF4- V
|
|---|
| 4468 | B2O3 C2Cl4 CsI I N2O4 SF5 V+
|
|---|
| 4469 | B2_OH_4 C2Cl6 Csli I+ N2O5 SF5+ V-
|
|---|
| 4470 | B2S C2F CsNO2 I- N3 SF5- VCl4
|
|---|
| 4471 | B2S2 C2FCl CsNO3 IF5 N3H SF6 VN
|
|---|
| 4472 | B2S3 C2FCl3 CsNa IF7 Na SF6- VO
|
|---|
| 4473 | B3H7_C2v C2F2 CsO I2 Na+ SH VO2
|
|---|
| 4474 | B3H7_Cs C2F2Cl2 CsOH In Na- SH- V4O10
|
|---|
| 4475 | B3H9 C2F3 CsRb In+ NaAlF4 SN W
|
|---|
| 4476 | B3N3H6 C2F3Cl Cs2 InBr NaBO2 SO W+
|
|---|
| 4477 | B3O3Cl3 C2F4 Cs2Br2 InBr2 NaBr SO- W-
|
|---|
| 4478 | B3O3FCl2 C2F6 Cs2CO3 InBr3 NaCN SOF2 WCl6
|
|---|
| 4479 | B3O3F2Cl C2H Cs2Cl2 InCl NaCl SO2 WO
|
|---|
| 4480 | B3O3F3 C2HCl Cs2F2 InCl2 NaF SO2- WOCl4
|
|---|
| 4481 | B4H4 C2HCl3 Cs2I2 InCl3 NaH SO2Cl2 WO2
|
|---|
| 4482 | B4H10 C2HF Cs2O InF NaI SO2FCl WO2Cl2
|
|---|
| 4483 | B4H12 C2HFCl2 Cs2O+ InF2 Nali SO2F2 WO3
|
|---|
| 4484 | B5H9 C2HF2Cl Cs2O2 InF3 NaNO2 SO3 WO3-
|
|---|
| 4485 | Ba C2HF3 Cs2O2H2 InH NaNO3 S2 Xe
|
|---|
| 4486 | Ba+ C2H2_vinylidene Cs2SO4 InI NaO S2- Xe+
|
|---|
| 4487 | BaBr C2H2Cl2 Cu InI2 NaOH S2Cl2 Zn
|
|---|
| 4488 | BaBr2 C2H2FCl Cu+ InI3 NaOH+ S2F2 Zn+
|
|---|
| 4489 | BaCl C2H2F2 Cu- InO Na2 S2O Zr
|
|---|
| 4490 | BaCl+ CH2CO_ketene CuCl InOH Na2Br2 S3 Zr+
|
|---|
| 4491 | BaCl2 O_CH_2O CuF In2Br2 Na2Cl2 S4 Zr-
|
|---|
| 4492 | BaF HO_CO_2OH CuF2 In2Br4 Na2F2 S5 ZrN
|
|---|
| 4493 | BaF+ C2H3_vinyl CuO In2Br6 Na2I2 S6 ZrO
|
|---|
| 4494 | BaF2 CH2Br-COOH Cu2 In2Cl2 Na2O S7 ZrO+
|
|---|
| 4495 | BaH C2H3Cl Cu3Cl3 In2Cl4 Na2O+ S8 ZrO2
|
|---|
| 4496 | BaI CH2Cl-COOH D In2Cl6 Na2O2 Sc
|
|---|
| 4497 | BaI2 C2H3F D+ In2F2 Na2O2H2 Sc+
|
|---|
| 4498 | BaO CH3CN D- In2F4 Na2SO4 Sc-
|
|---|
| 4499 | BaO+ CH3CO_acetyl DBr In2F6 Na3Cl3 ScO
|
|---|
| 4500 | BaOH C2H4 DCl In2I2 Na3F3 ScO+
|
|---|
| 4501 | </pre>
|
|---|
| 4502 | </HTML>"));
|
|---|
| 4503 | end SingleGasesData;
|
|---|
| 4504 | annotation (Documentation(info="<html>
|
|---|
| 4505 |
|
|---|
| 4506 | </html>"));
|
|---|
| 4507 | end Common;
|
|---|
| 4508 | annotation (Documentation(info="<HTML>
|
|---|
| 4509 | <p>This package contains data for the 1241 ideal gases from</p>
|
|---|
| 4510 | <blockquote>
|
|---|
| 4511 | <p>McBride B.J., Zehe M.J., and Gordon S. (2002): <b>NASA Glenn Coefficients
|
|---|
| 4512 | for Calculating Thermodynamic Properties of Individual Species</b>. NASA
|
|---|
| 4513 | report TP-2002-211556</p>
|
|---|
| 4514 | </blockquote>
|
|---|
| 4515 | <p>Medium models for some of these gases are available in package
|
|---|
| 4516 | <a href=\"modelica://Modelica.Media.IdealGases.SingleGases\">IdealGases.SingleGases</a>
|
|---|
| 4517 | and some examples for mixtures are available in package <a href=\"modelica://Modelica.Media.IdealGases.MixtureGases\">IdealGases.MixtureGases</a>
|
|---|
| 4518 | </p>
|
|---|
| 4519 | <h4>Using and Adapting Medium Models</h4>
|
|---|
| 4520 | <p>
|
|---|
| 4521 | 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
|
|---|
| 4522 | subtypes of
|
|---|
| 4523 | <a href=\"modelica://Modelica.Media.Interfaces.PartialMedium\">Interfaces.PartialMedium</a>
|
|---|
| 4524 | (i.e., can be utilized at all places where PartialMedium is defined),
|
|---|
| 4525 | a few additional steps have to be performed:
|
|---|
| 4526 | </p>
|
|---|
| 4527 | <ol>
|
|---|
| 4528 | <li>
|
|---|
| 4529 | All single gas media need to define a constant instance of record
|
|---|
| 4530 | <a href=\"modelica://Modelica.Media.Interfaces.PartialMedium.FluidConstants\">IdealGases.Common.SingleGasNasa.FluidConstants</a>.
|
|---|
| 4531 | For 37 ideal gases such records are provided in package
|
|---|
| 4532 | <a href=\"modelica://Modelica.Media.IdealGases.Common.FluidData\">IdealGases.Common.FluidData</a>.
|
|---|
| 4533 | For the other gases, such a record instance has to be provided by the user, e.g., by getting
|
|---|
| 4534 | 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>
|
|---|
| 4535 |
|
|---|
| 4536 | <li>When the data is available, and a user has an instance of a
|
|---|
| 4537 | <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>
|
|---|
| 4538 | <li><ul>
|
|---|
| 4539 | <li>For single components, a new package following the pattern in
|
|---|
| 4540 | <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>
|
|---|
| 4541 | <li>For mixtures of several components, a new package following the pattern in
|
|---|
| 4542 | <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>
|
|---|
| 4543 | </ul></li>
|
|---|
| 4544 | </ol>
|
|---|
| 4545 | <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>
|
|---|
| 4546 | <p>
|
|---|
| 4547 | Data records for heat capacity, specific enthalpy and specific entropy exist for the following substances and ions:
|
|---|
| 4548 | </p>
|
|---|
| 4549 | <pre>
|
|---|
| 4550 | Ag BaOH+ C2H4O_ethylen_o DF In2I4 Nb ScO2
|
|---|
| 4551 | Ag+ Ba_OH_2 CH3CHO_ethanal DOCl In2I6 Nb+ Sc2O
|
|---|
| 4552 | Ag- BaS CH3COOH DO2 In2O Nb- Sc2O2
|
|---|
| 4553 | Air Ba2 OHCH2COOH DO2- K NbCl5 Si
|
|---|
| 4554 | Al Be C2H5 D2 K+ NbO Si+
|
|---|
| 4555 | Al+ Be+ C2H5Br D2+ K- NbOCl3 Si-
|
|---|
| 4556 | Al- Be++ C2H6 D2- KAlF4 NbO2 SiBr
|
|---|
| 4557 | AlBr BeBr CH3N2CH3 D2O KBO2 Ne SiBr2
|
|---|
| 4558 | AlBr2 BeBr2 C2H5OH D2O2 KBr Ne+ SiBr3
|
|---|
| 4559 | AlBr3 BeCl CH3OCH3 D2S KCN Ni SiBr4
|
|---|
| 4560 | AlC BeCl2 CH3O2CH3 e- KCl Ni+ SiC
|
|---|
| 4561 | AlC2 BeF CCN F KF Ni- SiC2
|
|---|
| 4562 | AlCl BeF2 CNC F+ KH NiCl SiCl
|
|---|
| 4563 | AlCl+ BeH OCCN F- KI NiCl2 SiCl2
|
|---|
| 4564 | AlCl2 BeH+ C2N2 FCN Kli NiO SiCl3
|
|---|
| 4565 | AlCl3 BeH2 C2O FCO KNO2 NiS SiCl4
|
|---|
| 4566 | AlF BeI C3 FO KNO3 O SiF
|
|---|
| 4567 | AlF+ BeI2 C3H3_1_propynl FO2_FOO KNa O+ SiFCl
|
|---|
| 4568 | AlFCl BeN C3H3_2_propynl FO2_OFO KO O- SiF2
|
|---|
| 4569 | AlFCl2 BeO C3H4_allene F2 KOH OD SiF3
|
|---|
| 4570 | AlF2 BeOH C3H4_propyne F2O K2 OD- SiF4
|
|---|
| 4571 | AlF2- BeOH+ C3H4_cyclo F2O2 K2+ OH SiH
|
|---|
| 4572 | AlF2Cl Be_OH_2 C3H5_allyl FS2F K2Br2 OH+ SiH+
|
|---|
| 4573 | AlF3 BeS C3H6_propylene Fe K2CO3 OH- SiHBr3
|
|---|
| 4574 | AlF4- Be2 C3H6_cyclo Fe+ K2C2N2 O2 SiHCl
|
|---|
| 4575 | AlH Be2Cl4 C3H6O_propylox Fe_CO_5 K2Cl2 O2+ SiHCl3
|
|---|
| 4576 | AlHCl Be2F4 C3H6O_acetone FeCl K2F2 O2- SiHF
|
|---|
| 4577 | AlHCl2 Be2O C3H6O_propanal FeCl2 K2I2 O3 SiHF3
|
|---|
| 4578 | AlHF Be2OF2 C3H7_n_propyl FeCl3 K2O P SiHI3
|
|---|
| 4579 | AlHFCl Be2O2 C3H7_i_propyl FeO K2O+ P+ SiH2
|
|---|
| 4580 | AlHF2 Be3O3 C3H8 Fe_OH_2 K2O2 P- SiH2Br2
|
|---|
| 4581 | AlH2 Be4O4 C3H8O_1propanol Fe2Cl4 K2O2H2 PCl SiH2Cl2
|
|---|
| 4582 | AlH2Cl Br C3H8O_2propanol Fe2Cl6 K2SO4 PCl2 SiH2F2
|
|---|
| 4583 | AlH2F Br+ CNCOCN Ga Kr PCl2- SiH2I2
|
|---|
| 4584 | AlH3 Br- C3O2 Ga+ Kr+ PCl3 SiH3
|
|---|
| 4585 | AlI BrCl C4 GaBr li PCl5 SiH3Br
|
|---|
| 4586 | AlI2 BrF C4H2_butadiyne GaBr2 li+ PF SiH3Cl
|
|---|
| 4587 | AlI3 BrF3 C4H4_1_3-cyclo GaBr3 li- PF+ SiH3F
|
|---|
| 4588 | AlN BrF5 C4H6_butadiene GaCl liAlF4 PF- SiH3I
|
|---|
| 4589 | AlO BrO C4H6_1butyne GaCl2 liBO2 PFCl SiH4
|
|---|
| 4590 | AlO+ OBrO C4H6_2butyne GaCl3 liBr PFCl- SiI
|
|---|
| 4591 | AlO- BrOO C4H6_cyclo GaF liCl PFCl2 SiI2
|
|---|
| 4592 | AlOCl BrO3 C4H8_1_butene GaF2 liF PFCl4 SiN
|
|---|
| 4593 | AlOCl2 Br2 C4H8_cis2_buten GaF3 liH PF2 SiO
|
|---|
| 4594 | AlOF BrBrO C4H8_isobutene GaH liI PF2- SiO2
|
|---|
| 4595 | AlOF2 BrOBr C4H8_cyclo GaI liN PF2Cl SiS
|
|---|
| 4596 | AlOF2- C C4H9_n_butyl GaI2 liNO2 PF2Cl3 SiS2
|
|---|
| 4597 | AlOH C+ C4H9_i_butyl GaI3 liNO3 PF3 Si2
|
|---|
| 4598 | AlOHCl C- C4H9_s_butyl GaO liO PF3Cl2 Si2C
|
|---|
| 4599 | AlOHCl2 CBr C4H9_t_butyl GaOH liOF PF4Cl Si2F6
|
|---|
| 4600 | AlOHF CBr2 C4H10_n_butane Ga2Br2 liOH PF5 Si2N
|
|---|
| 4601 | AlOHF2 CBr3 C4H10_isobutane Ga2Br4 liON PH Si3
|
|---|
| 4602 | AlO2 CBr4 C4N2 Ga2Br6 li2 PH2 Sn
|
|---|
| 4603 | AlO2- CCl C5 Ga2Cl2 li2+ PH2- Sn+
|
|---|
| 4604 | Al_OH_2 CCl2 C5H6_1_3cyclo Ga2Cl4 li2Br2 PH3 Sn-
|
|---|
| 4605 | Al_OH_2Cl CCl2Br2 C5H8_cyclo Ga2Cl6 li2F2 PN SnBr
|
|---|
| 4606 | Al_OH_2F CCl3 C5H10_1_pentene Ga2F2 li2I2 PO SnBr2
|
|---|
| 4607 | Al_OH_3 CCl3Br C5H10_cyclo Ga2F4 li2O PO- SnBr3
|
|---|
| 4608 | AlS CCl4 C5H11_pentyl Ga2F6 li2O+ POCl3 SnBr4
|
|---|
| 4609 | AlS2 CF C5H11_t_pentyl Ga2I2 li2O2 POFCl2 SnCl
|
|---|
| 4610 | Al2 CF+ C5H12_n_pentane Ga2I4 li2O2H2 POF2Cl SnCl2
|
|---|
| 4611 | Al2Br6 CFBr3 C5H12_i_pentane Ga2I6 li2SO4 POF3 SnCl3
|
|---|
| 4612 | Al2C2 CFCl CH3C_CH3_2CH3 Ga2O li3+ PO2 SnCl4
|
|---|
| 4613 | Al2Cl6 CFClBr2 C6D5_phenyl Ge li3Br3 PO2- SnF
|
|---|
| 4614 | Al2F6 CFCl2 C6D6 Ge+ li3Cl3 PS SnF2
|
|---|
| 4615 | Al2I6 CFCl2Br C6H2 Ge- li3F3 P2 SnF3
|
|---|
| 4616 | Al2O CFCl3 C6H5_phenyl GeBr li3I3 P2O3 SnF4
|
|---|
| 4617 | Al2O+ CF2 C6H5O_phenoxy GeBr2 Mg P2O4 SnI
|
|---|
| 4618 | Al2O2 CF2+ C6H6 GeBr3 Mg+ P2O5 SnI2
|
|---|
| 4619 | Al2O2+ CF2Br2 C6H5OH_phenol GeBr4 MgBr P3 SnI3
|
|---|
| 4620 | Al2O3 CF2Cl C6H10_cyclo GeCl MgBr2 P3O6 SnI4
|
|---|
| 4621 | Al2S CF2ClBr C6H12_1_hexene GeCl2 MgCl P4 SnO
|
|---|
| 4622 | Al2S2 CF2Cl2 C6H12_cyclo GeCl3 MgCl+ P4O6 SnO2
|
|---|
| 4623 | Ar CF3 C6H13_n_hexyl GeCl4 MgCl2 P4O7 SnS
|
|---|
| 4624 | Ar+ CF3+ C6H14_n_hexane GeF MgF P4O8 SnS2
|
|---|
| 4625 | B CF3Br C7H7_benzyl GeF2 MgF+ P4O9 Sn2
|
|---|
| 4626 | B+ CF3Cl C7H8 GeF3 MgF2 P4O10 Sr
|
|---|
| 4627 | B- CF4 C7H8O_cresol_mx GeF4 MgF2+ Pb Sr+
|
|---|
| 4628 | BBr CH+ C7H14_1_heptene GeH4 MgH Pb+ SrBr
|
|---|
| 4629 | BBr2 CHBr3 C7H15_n_heptyl GeI MgI Pb- SrBr2
|
|---|
| 4630 | BBr3 CHCl C7H16_n_heptane GeO MgI2 PbBr SrCl
|
|---|
| 4631 | BC CHClBr2 C7H16_2_methylh GeO2 MgN PbBr2 SrCl+
|
|---|
| 4632 | BC2 CHCl2 C8H8_styrene GeS MgO PbBr3 SrCl2
|
|---|
| 4633 | BCl CHCl2Br C8H10_ethylbenz GeS2 MgOH PbBr4 SrF
|
|---|
| 4634 | BCl+ CHCl3 C8H16_1_octene Ge2 MgOH+ PbCl SrF+
|
|---|
| 4635 | BClOH CHF C8H17_n_octyl H Mg_OH_2 PbCl2 SrF2
|
|---|
| 4636 | BCl_OH_2 CHFBr2 C8H18_n_octane H+ MgS PbCl3 SrH
|
|---|
| 4637 | BCl2 CHFCl C8H18_isooctane H- Mg2 PbCl4 SrI
|
|---|
| 4638 | BCl2+ CHFClBr C9H19_n_nonyl HAlO Mg2F4 PbF SrI2
|
|---|
| 4639 | BCl2OH CHFCl2 C10H8_naphthale HAlO2 Mn PbF2 SrO
|
|---|
| 4640 | BF CHF2 C10H21_n_decyl HBO Mn+ PbF3 SrOH
|
|---|
| 4641 | BFCl CHF2Br C12H9_o_bipheny HBO+ Mo PbF4 SrOH+
|
|---|
| 4642 | BFCl2 CHF2Cl C12H10_biphenyl HBO2 Mo+ PbI Sr_OH_2
|
|---|
| 4643 | BFOH CHF3 Ca HBS Mo- PbI2 SrS
|
|---|
| 4644 | BF_OH_2 CHI3 Ca+ HBS+ MoO PbI3 Sr2
|
|---|
| 4645 | BF2 CH2 CaBr HCN MoO2 PbI4 Ta
|
|---|
| 4646 | BF2+ CH2Br2 CaBr2 HCO MoO3 PbO Ta+
|
|---|
| 4647 | BF2- CH2Cl CaCl HCO+ MoO3- PbO2 Ta-
|
|---|
| 4648 | BF2Cl CH2ClBr CaCl+ HCCN Mo2O6 PbS TaCl5
|
|---|
| 4649 | BF2OH CH2Cl2 CaCl2 HCCO Mo3O9 PbS2 TaO
|
|---|
| 4650 | BF3 CH2F CaF HCl Mo4O12 Rb TaO2
|
|---|
| 4651 | BF4- CH2FBr CaF+ HD Mo5O15 Rb+ Ti
|
|---|
| 4652 | BH CH2FCl CaF2 HD+ N Rb- Ti+
|
|---|
| 4653 | BHCl CH2F2 CaH HDO N+ RbBO2 Ti-
|
|---|
| 4654 | BHCl2 CH2I2 CaI HDO2 N- RbBr TiCl
|
|---|
| 4655 | BHF CH3 CaI2 HF NCO RbCl TiCl2
|
|---|
| 4656 | BHFCl CH3Br CaO HI ND RbF TiCl3
|
|---|
| 4657 | BHF2 CH3Cl CaO+ HNC ND2 RbH TiCl4
|
|---|
| 4658 | BH2 CH3F CaOH HNCO ND3 RbI TiO
|
|---|
| 4659 | BH2Cl CH3I CaOH+ HNO NF RbK TiO+
|
|---|
| 4660 | BH2F CH2OH Ca_OH_2 HNO2 NF2 Rbli TiOCl
|
|---|
| 4661 | BH3 CH2OH+ CaS HNO3 NF3 RbNO2 TiOCl2
|
|---|
| 4662 | BH3NH3 CH3O Ca2 HOCl NH RbNO3 TiO2
|
|---|
| 4663 | BH4 CH4 Cd HOF NH+ RbNa U
|
|---|
| 4664 | BI CH3OH Cd+ HO2 NHF RbO UF
|
|---|
| 4665 | BI2 CH3OOH Cl HO2- NHF2 RbOH UF+
|
|---|
| 4666 | BI3 CI Cl+ HPO NH2 Rb2Br2 UF-
|
|---|
| 4667 | BN CI2 Cl- HSO3F NH2F Rb2Cl2 UF2
|
|---|
| 4668 | BO CI3 ClCN H2 NH3 Rb2F2 UF2+
|
|---|
| 4669 | BO- CI4 ClF H2+ NH2OH Rb2I2 UF2-
|
|---|
| 4670 | BOCl CN ClF3 H2- NH4+ Rb2O UF3
|
|---|
| 4671 | BOCl2 CN+ ClF5 HBOH NO Rb2O2 UF3+
|
|---|
| 4672 | BOF CN- ClO HCOOH NOCl Rb2O2H2 UF3-
|
|---|
| 4673 | BOF2 CNN ClO2 H2F2 NOF Rb2SO4 UF4
|
|---|
| 4674 | BOH CO Cl2 H2O NOF3 Rn UF4+
|
|---|
| 4675 | BO2 CO+ Cl2O H2O+ NO2 Rn+ UF4-
|
|---|
| 4676 | BO2- COCl Co H2O2 NO2- S UF5
|
|---|
| 4677 | B_OH_2 COCl2 Co+ H2S NO2Cl S+ UF5+
|
|---|
| 4678 | BS COFCl Co- H2SO4 NO2F S- UF5-
|
|---|
| 4679 | BS2 COF2 Cr H2BOH NO3 SCl UF6
|
|---|
| 4680 | B2 COHCl Cr+ HB_OH_2 NO3- SCl2 UF6-
|
|---|
| 4681 | B2C COHF Cr- H3BO3 NO3F SCl2+ UO
|
|---|
| 4682 | B2Cl4 COS CrN H3B3O3 N2 SD UO+
|
|---|
| 4683 | B2F4 CO2 CrO H3B3O6 N2+ SF UOF
|
|---|
| 4684 | B2H CO2+ CrO2 H3F3 N2- SF+ UOF2
|
|---|
| 4685 | B2H2 COOH CrO3 H3O+ NCN SF- UOF3
|
|---|
| 4686 | B2H3 CP CrO3- H4F4 N2D2_cis SF2 UOF4
|
|---|
| 4687 | B2H3_db CS Cs H5F5 N2F2 SF2+ UO2
|
|---|
| 4688 | B2H4 CS2 Cs+ H6F6 N2F4 SF2- UO2+
|
|---|
| 4689 | B2H4_db C2 Cs- H7F7 N2H2 SF3 UO2-
|
|---|
| 4690 | B2H5 C2+ CsBO2 He NH2NO2 SF3+ UO2F
|
|---|
| 4691 | B2H5_db C2- CsBr He+ N2H4 SF3- UO2F2
|
|---|
| 4692 | B2H6 C2Cl CsCl Hg N2O SF4 UO3
|
|---|
| 4693 | B2O C2Cl2 CsF Hg+ N2O+ SF4+ UO3-
|
|---|
| 4694 | B2O2 C2Cl3 CsH HgBr2 N2O3 SF4- V
|
|---|
| 4695 | B2O3 C2Cl4 CsI I N2O4 SF5 V+
|
|---|
| 4696 | B2_OH_4 C2Cl6 Csli I+ N2O5 SF5+ V-
|
|---|
| 4697 | B2S C2F CsNO2 I- N3 SF5- VCl4
|
|---|
| 4698 | B2S2 C2FCl CsNO3 IF5 N3H SF6 VN
|
|---|
| 4699 | B2S3 C2FCl3 CsNa IF7 Na SF6- VO
|
|---|
| 4700 | B3H7_C2v C2F2 CsO I2 Na+ SH VO2
|
|---|
| 4701 | B3H7_Cs C2F2Cl2 CsOH In Na- SH- V4O10
|
|---|
| 4702 | B3H9 C2F3 CsRb In+ NaAlF4 SN W
|
|---|
| 4703 | B3N3H6 C2F3Cl Cs2 InBr NaBO2 SO W+
|
|---|
| 4704 | B3O3Cl3 C2F4 Cs2Br2 InBr2 NaBr SO- W-
|
|---|
| 4705 | B3O3FCl2 C2F6 Cs2CO3 InBr3 NaCN SOF2 WCl6
|
|---|
| 4706 | B3O3F2Cl C2H Cs2Cl2 InCl NaCl SO2 WO
|
|---|
| 4707 | B3O3F3 C2HCl Cs2F2 InCl2 NaF SO2- WOCl4
|
|---|
| 4708 | B4H4 C2HCl3 Cs2I2 InCl3 NaH SO2Cl2 WO2
|
|---|
| 4709 | B4H10 C2HF Cs2O InF NaI SO2FCl WO2Cl2
|
|---|
| 4710 | B4H12 C2HFCl2 Cs2O+ InF2 Nali SO2F2 WO3
|
|---|
| 4711 | B5H9 C2HF2Cl Cs2O2 InF3 NaNO2 SO3 WO3-
|
|---|
| 4712 | Ba C2HF3 Cs2O2H2 InH NaNO3 S2 Xe
|
|---|
| 4713 | Ba+ C2H2_vinylidene Cs2SO4 InI NaO S2- Xe+
|
|---|
| 4714 | BaBr C2H2Cl2 Cu InI2 NaOH S2Cl2 Zn
|
|---|
| 4715 | BaBr2 C2H2FCl Cu+ InI3 NaOH+ S2F2 Zn+
|
|---|
| 4716 | BaCl C2H2F2 Cu- InO Na2 S2O Zr
|
|---|
| 4717 | BaCl+ CH2CO_ketene CuCl InOH Na2Br2 S3 Zr+
|
|---|
| 4718 | BaCl2 O_CH_2O CuF In2Br2 Na2Cl2 S4 Zr-
|
|---|
| 4719 | BaF HO_CO_2OH CuF2 In2Br4 Na2F2 S5 ZrN
|
|---|
| 4720 | BaF+ C2H3_vinyl CuO In2Br6 Na2I2 S6 ZrO
|
|---|
| 4721 | BaF2 CH2Br-COOH Cu2 In2Cl2 Na2O S7 ZrO+
|
|---|
| 4722 | BaH C2H3Cl Cu3Cl3 In2Cl4 Na2O+ S8 ZrO2
|
|---|
| 4723 | BaI CH2Cl-COOH D In2Cl6 Na2O2 Sc
|
|---|
| 4724 | BaI2 C2H3F D+ In2F2 Na2O2H2 Sc+
|
|---|
| 4725 | BaO CH3CN D- In2F4 Na2SO4 Sc-
|
|---|
| 4726 | BaO+ CH3CO_acetyl DBr In2F6 Na3Cl3 ScO
|
|---|
| 4727 | BaOH C2H4 DCl In2I2 Na3F3 ScO+
|
|---|
| 4728 | </pre></HTML>"));
|
|---|
| 4729 | end IdealGases;
|
|---|
| 4730 | annotation (preferredView="info",Documentation(info="<HTML>
|
|---|
| 4731 | <p>
|
|---|
| 4732 | This library contains <a href=\"modelica://Modelica.Media.Interfaces\">interface</a>
|
|---|
| 4733 | definitions for media and the following <b>property</b> models for
|
|---|
| 4734 | single and multiple substance fluids with one and multiple phases:
|
|---|
| 4735 | </p>
|
|---|
| 4736 | <ul>
|
|---|
| 4737 | <li> <a href=\"modelica://Modelica.Media.IdealGases\">Ideal gases:</a><br>
|
|---|
| 4738 | 1241 high precision gas models based on the
|
|---|
| 4739 | NASA Glenn coefficients, plus ideal gas mixture models based
|
|---|
| 4740 | on the same data.</li>
|
|---|
| 4741 | <li> <a href=\"modelica://Modelica.Media.Water\">Water models:</a><br>
|
|---|
| 4742 | ConstantPropertyLiquidWater, WaterIF97 (high precision
|
|---|
| 4743 | water model according to the IAPWS/IF97 standard)</li>
|
|---|
| 4744 | <li> <a href=\"modelica://Modelica.Media.Air\">Air models:</a><br>
|
|---|
| 4745 | SimpleAir, DryAirNasa, ReferenceAir, MoistAir, ReferenceMoistAir.</li>
|
|---|
| 4746 | <li> <a href=\"modelica://Modelica.Media.Incompressible\">
|
|---|
| 4747 | Incompressible media:</a><br>
|
|---|
| 4748 | TableBased incompressible fluid models (properties are defined by tables rho(T),
|
|---|
| 4749 | HeatCapacity_cp(T), etc.)</li>
|
|---|
| 4750 | <li> <a href=\"modelica://Modelica.Media.CompressibleLiquids\">
|
|---|
| 4751 | Compressible liquids:</a><br>
|
|---|
| 4752 | Simple liquid models with linear compressibility</li>
|
|---|
| 4753 | <li> <a href=\"modelica://Modelica.Media.R134a\">Refrigerant Tetrafluoroethane (R134a)</a>.</li>
|
|---|
| 4754 | </ul>
|
|---|
| 4755 | <p>
|
|---|
| 4756 | The following parts are useful, when newly starting with this library:
|
|---|
| 4757 | <ul>
|
|---|
| 4758 | <li> <a href=\"modelica://Modelica.Media.UsersGuide\">Modelica.Media.UsersGuide</a>.</li>
|
|---|
| 4759 | <li> <a href=\"modelica://Modelica.Media.UsersGuide.MediumUsage\">Modelica.Media.UsersGuide.MediumUsage</a>
|
|---|
| 4760 | describes how to use a medium model in a component model.</li>
|
|---|
| 4761 | <li> <a href=\"modelica://Modelica.Media.UsersGuide.MediumDefinition\">
|
|---|
| 4762 | Modelica.Media.UsersGuide.MediumDefinition</a>
|
|---|
| 4763 | describes how a new fluid medium model has to be implemented.</li>
|
|---|
| 4764 | <li> <a href=\"modelica://Modelica.Media.UsersGuide.ReleaseNotes\">Modelica.Media.UsersGuide.ReleaseNotes</a>
|
|---|
| 4765 | summarizes the changes of the library releases.</li>
|
|---|
| 4766 | <li> <a href=\"modelica://Modelica.Media.Examples\">Modelica.Media.Examples</a>
|
|---|
| 4767 | contains examples that demonstrate the usage of this library.</li>
|
|---|
| 4768 | </ul>
|
|---|
| 4769 | <p>
|
|---|
| 4770 | Copyright © 1998-2013, Modelica Association.
|
|---|
| 4771 | </p>
|
|---|
| 4772 | <p>
|
|---|
| 4773 | <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>
|
|---|
| 4774 | </p>
|
|---|
| 4775 | </HTML>", revisions="<html>
|
|---|
| 4776 | <ul>
|
|---|
| 4777 | <li><i>May 16, 2013</i> by Stefan Wischhusen (XRG Simulation):<br/>
|
|---|
| 4778 | Added new media models Air.ReferenceMoistAir, Air.ReferenceAir, R134a.</li>
|
|---|
| 4779 | <li><i>May 25, 2011</i> by Francesco Casella:<br/>Added min/max attributes to Water, TableBased, MixtureGasNasa, SimpleAir and MoistAir local types.</li>
|
|---|
| 4780 | <li><i>May 25, 2011</i> by Stefan Wischhusen:<br/>Added individual settings for polynomial fittings of properties.</li>
|
|---|
| 4781 | </ul>
|
|---|
| 4782 | </html>"),
|
|---|
| 4783 | Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
|
|---|
| 4784 | graphics={
|
|---|
| 4785 | Line(
|
|---|
| 4786 | points= {{-76,-80},{-62,-30},{-32,40},{4,66},{48,66},{73,45},{62,-8},{48,-50},{38,-80}},
|
|---|
| 4787 | color={64,64,64},
|
|---|
| 4788 | smooth=Smooth.Bezier),
|
|---|
| 4789 | Line(
|
|---|
| 4790 | points={{-40,20},{68,20}},
|
|---|
| 4791 | color={175,175,175},
|
|---|
| 4792 | smooth=Smooth.None),
|
|---|
| 4793 | Line(
|
|---|
| 4794 | points={{-40,20},{-44,88},{-44,88}},
|
|---|
| 4795 | color={175,175,175},
|
|---|
| 4796 | smooth=Smooth.None),
|
|---|
| 4797 | Line(
|
|---|
| 4798 | points={{68,20},{86,-58}},
|
|---|
| 4799 | color={175,175,175},
|
|---|
| 4800 | smooth=Smooth.None),
|
|---|
| 4801 | Line(
|
|---|
| 4802 | points={{-60,-28},{56,-28}},
|
|---|
| 4803 | color={175,175,175},
|
|---|
| 4804 | smooth=Smooth.None),
|
|---|
| 4805 | Line(
|
|---|
| 4806 | points={{-60,-28},{-74,84},{-74,84}},
|
|---|
| 4807 | color={175,175,175},
|
|---|
| 4808 | smooth=Smooth.None),
|
|---|
| 4809 | Line(
|
|---|
| 4810 | points={{56,-28},{70,-80}},
|
|---|
| 4811 | color={175,175,175},
|
|---|
| 4812 | smooth=Smooth.None),
|
|---|
| 4813 | Line(
|
|---|
| 4814 | points={{-76,-80},{38,-80}},
|
|---|
| 4815 | color={175,175,175},
|
|---|
| 4816 | smooth=Smooth.None),
|
|---|
| 4817 | Line(
|
|---|
| 4818 | points={{-76,-80},{-94,-16},{-94,-16}},
|
|---|
| 4819 | color={175,175,175},
|
|---|
| 4820 | smooth=Smooth.None)}));
|
|---|
| 4821 | end Media;
|
|---|
| 4822 |
|
|---|
| 4823 | package Math
|
|---|
| 4824 | "Library of mathematical functions (e.g., sin, cos) and of functions operating on vectors and matrices"
|
|---|
| 4825 | import SI = Modelica.SIunits;
|
|---|
| 4826 | extends Modelica.Icons.Package;
|
|---|
| 4827 |
|
|---|
| 4828 | package Icons "Icons for Math"
|
|---|
| 4829 | extends Modelica.Icons.IconsPackage;
|
|---|
| 4830 |
|
|---|
| 4831 | partial function AxisLeft
|
|---|
| 4832 | "Basic icon for mathematical function with y-axis on left side"
|
|---|
| 4833 |
|
|---|
| 4834 | annotation (
|
|---|
| 4835 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
|
|---|
| 4836 | 100}}), graphics={
|
|---|
| 4837 | Rectangle(
|
|---|
| 4838 | extent={{-100,100},{100,-100}},
|
|---|
| 4839 | lineColor={0,0,0},
|
|---|
| 4840 | fillColor={255,255,255},
|
|---|
| 4841 | fillPattern=FillPattern.Solid),
|
|---|
| 4842 | Line(points={{-80,-80},{-80,68}}, color={192,192,192}),
|
|---|
| 4843 | Polygon(
|
|---|
| 4844 | points={{-80,90},{-88,68},{-72,68},{-80,90}},
|
|---|
| 4845 | lineColor={192,192,192},
|
|---|
| 4846 | fillColor={192,192,192},
|
|---|
| 4847 | fillPattern=FillPattern.Solid),
|
|---|
| 4848 | Text(
|
|---|
| 4849 | extent={{-150,150},{150,110}},
|
|---|
| 4850 | textString="%name",
|
|---|
| 4851 | lineColor={0,0,255})}),
|
|---|
| 4852 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
|
|---|
| 4853 | 100,100}}), graphics={Line(points={{-80,80},{-88,80}}, color={95,
|
|---|
| 4854 | 95,95}),Line(points={{-80,-80},{-88,-80}}, color={95,95,95}),Line(
|
|---|
| 4855 | points={{-80,-90},{-80,84}}, color={95,95,95}),Text(
|
|---|
| 4856 | extent={{-75,104},{-55,84}},
|
|---|
| 4857 | lineColor={95,95,95},
|
|---|
| 4858 | textString="y"),Polygon(
|
|---|
| 4859 | points={{-80,98},{-86,82},{-74,82},{-80,98}},
|
|---|
| 4860 | lineColor={95,95,95},
|
|---|
| 4861 | fillColor={95,95,95},
|
|---|
| 4862 | fillPattern=FillPattern.Solid)}),
|
|---|
| 4863 | Documentation(info="<html>
|
|---|
| 4864 | <p>
|
|---|
| 4865 | Icon for a mathematical function, consisting of an y-axis on the left side.
|
|---|
| 4866 | It is expected, that an x-axis is added and a plot of the function.
|
|---|
| 4867 | </p>
|
|---|
| 4868 | </html>"));
|
|---|
| 4869 | end AxisLeft;
|
|---|
| 4870 |
|
|---|
| 4871 | partial function AxisCenter
|
|---|
| 4872 | "Basic icon for mathematical function with y-axis in the center"
|
|---|
| 4873 |
|
|---|
| 4874 | annotation (
|
|---|
| 4875 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
|
|---|
| 4876 | 100}}), graphics={
|
|---|
| 4877 | Rectangle(
|
|---|
| 4878 | extent={{-100,100},{100,-100}},
|
|---|
| 4879 | lineColor={0,0,0},
|
|---|
| 4880 | fillColor={255,255,255},
|
|---|
| 4881 | fillPattern=FillPattern.Solid),
|
|---|
| 4882 | Line(points={{0,-80},{0,68}}, color={192,192,192}),
|
|---|
| 4883 | Polygon(
|
|---|
| 4884 | points={{0,90},{-8,68},{8,68},{0,90}},
|
|---|
| 4885 | lineColor={192,192,192},
|
|---|
| 4886 | fillColor={192,192,192},
|
|---|
| 4887 | fillPattern=FillPattern.Solid),
|
|---|
| 4888 | Text(
|
|---|
| 4889 | extent={{-150,150},{150,110}},
|
|---|
| 4890 | textString="%name",
|
|---|
| 4891 | lineColor={0,0,255})}),
|
|---|
| 4892 | Diagram(graphics={Line(points={{0,80},{-8,80}}, color={95,95,95}),Line(
|
|---|
| 4893 | points={{0,-80},{-8,-80}}, color={95,95,95}),Line(points={{0,-90},{
|
|---|
| 4894 | 0,84}}, color={95,95,95}),Text(
|
|---|
| 4895 | extent={{5,104},{25,84}},
|
|---|
| 4896 | lineColor={95,95,95},
|
|---|
| 4897 | textString="y"),Polygon(
|
|---|
| 4898 | points={{0,98},{-6,82},{6,82},{0,98}},
|
|---|
| 4899 | lineColor={95,95,95},
|
|---|
| 4900 | fillColor={95,95,95},
|
|---|
| 4901 | fillPattern=FillPattern.Solid)}),
|
|---|
| 4902 | Documentation(info="<html>
|
|---|
| 4903 | <p>
|
|---|
| 4904 | Icon for a mathematical function, consisting of an y-axis in the middle.
|
|---|
| 4905 | It is expected, that an x-axis is added and a plot of the function.
|
|---|
| 4906 | </p>
|
|---|
| 4907 | </html>"));
|
|---|
| 4908 | end AxisCenter;
|
|---|
| 4909 | end Icons;
|
|---|
| 4910 |
|
|---|
| 4911 | function sin "Sine"
|
|---|
| 4912 | extends Modelica.Math.Icons.AxisLeft;
|
|---|
| 4913 | input Modelica.SIunits.Angle u;
|
|---|
| 4914 | output Real y;
|
|---|
| 4915 |
|
|---|
| 4916 | external "builtin" y= sin(u);
|
|---|
| 4917 | annotation (
|
|---|
| 4918 | Icon(coordinateSystem(
|
|---|
| 4919 | preserveAspectRatio=true,
|
|---|
| 4920 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 4921 | Line(points={{-90,0},{68,0}}, color={192,192,192}),
|
|---|
| 4922 | Polygon(
|
|---|
| 4923 | points={{90,0},{68,8},{68,-8},{90,0}},
|
|---|
| 4924 | lineColor={192,192,192},
|
|---|
| 4925 | fillColor={192,192,192},
|
|---|
| 4926 | fillPattern=FillPattern.Solid),
|
|---|
| 4927 | Line(points={{-80,0},{-68.7,34.2},{-61.5,53.1},{-55.1,66.4},{-49.4,74.6},
|
|---|
| 4928 | {-43.8,79.1},{-38.2,79.8},{-32.6,76.6},{-26.9,69.7},{-21.3,59.4},
|
|---|
| 4929 | {-14.9,44.1},{-6.83,21.2},{10.1,-30.8},{17.3,-50.2},{23.7,-64.2},
|
|---|
| 4930 | {29.3,-73.1},{35,-78.4},{40.6,-80},{46.2,-77.6},{51.9,-71.5},{
|
|---|
| 4931 | 57.5,-61.9},{63.9,-47.2},{72,-24.8},{80,0}}, color={0,0,0}),
|
|---|
| 4932 | Text(
|
|---|
| 4933 | extent={{12,84},{84,36}},
|
|---|
| 4934 | lineColor={192,192,192},
|
|---|
| 4935 | textString="sin")}),
|
|---|
| 4936 | Diagram(coordinateSystem(
|
|---|
| 4937 | preserveAspectRatio=true,
|
|---|
| 4938 | extent={{-100,-100},{100,100}}), graphics={Line(points={{-100,0},{84,0}}, color={95,95,95}),
|
|---|
| 4939 | Polygon(
|
|---|
| 4940 | points={{100,0},{84,6},{84,-6},{100,0}},
|
|---|
| 4941 | lineColor={95,95,95},
|
|---|
| 4942 | fillColor={95,95,95},
|
|---|
| 4943 | fillPattern=FillPattern.Solid),Line(
|
|---|
| 4944 | points={{-80,0},{-68.7,34.2},{-61.5,53.1},{-55.1,66.4},{-49.4,74.6},
|
|---|
| 4945 | {-43.8,79.1},{-38.2,79.8},{-32.6,76.6},{-26.9,69.7},{-21.3,59.4},{-14.9,
|
|---|
| 4946 | 44.1},{-6.83,21.2},{10.1,-30.8},{17.3,-50.2},{23.7,-64.2},{29.3,-73.1},
|
|---|
| 4947 | {35,-78.4},{40.6,-80},{46.2,-77.6},{51.9,-71.5},{57.5,-61.9},{63.9,
|
|---|
| 4948 | -47.2},{72,-24.8},{80,0}},
|
|---|
| 4949 | color={0,0,255},
|
|---|
| 4950 | thickness=0.5),Text(
|
|---|
| 4951 | extent={{-105,72},{-85,88}},
|
|---|
| 4952 | textString="1",
|
|---|
| 4953 | lineColor={0,0,255}),Text(
|
|---|
| 4954 | extent={{70,25},{90,5}},
|
|---|
| 4955 | textString="2*pi",
|
|---|
| 4956 | lineColor={0,0,255}),Text(
|
|---|
| 4957 | extent={{-103,-72},{-83,-88}},
|
|---|
| 4958 | textString="-1",
|
|---|
| 4959 | lineColor={0,0,255}),Text(
|
|---|
| 4960 | extent={{82,-6},{102,-26}},
|
|---|
| 4961 | lineColor={95,95,95},
|
|---|
| 4962 | textString="u"),Line(
|
|---|
| 4963 | points={{-80,80},{-28,80}},
|
|---|
| 4964 | color={175,175,175},
|
|---|
| 4965 | smooth=Smooth.None),Line(
|
|---|
| 4966 | points={{-80,-80},{50,-80}},
|
|---|
| 4967 | color={175,175,175},
|
|---|
| 4968 | smooth=Smooth.None)}),
|
|---|
| 4969 | Documentation(info="<html>
|
|---|
| 4970 | <p>
|
|---|
| 4971 | This function returns y = sin(u), with -∞ < u < ∞:
|
|---|
| 4972 | </p>
|
|---|
| 4973 |
|
|---|
| 4974 | <p>
|
|---|
| 4975 | <img src=\"modelica://Modelica/Resources/Images/Math/sin.png\">
|
|---|
| 4976 | </p>
|
|---|
| 4977 | </html>"));
|
|---|
| 4978 | end sin;
|
|---|
| 4979 |
|
|---|
| 4980 | function asin "Inverse sine (-1 <= u <= 1)"
|
|---|
| 4981 | extends Modelica.Math.Icons.AxisCenter;
|
|---|
| 4982 | input Real u;
|
|---|
| 4983 | output SI.Angle y;
|
|---|
| 4984 |
|
|---|
| 4985 | external "builtin" y= asin(u);
|
|---|
| 4986 | annotation (
|
|---|
| 4987 | Icon(coordinateSystem(
|
|---|
| 4988 | preserveAspectRatio=true,
|
|---|
| 4989 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 4990 | Line(points={{-90,0},{68,0}}, color={192,192,192}),
|
|---|
| 4991 | Polygon(
|
|---|
| 4992 | points={{90,0},{68,8},{68,-8},{90,0}},
|
|---|
| 4993 | lineColor={192,192,192},
|
|---|
| 4994 | fillColor={192,192,192},
|
|---|
| 4995 | fillPattern=FillPattern.Solid),
|
|---|
| 4996 | Line(points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
|
|---|
| 4997 | -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
|
|---|
| 4998 | 52.7},{75.2,62.2},{77.6,67.5},{80,80}}, color={0,0,0}),
|
|---|
| 4999 | Text(
|
|---|
| 5000 | extent={{-88,78},{-16,30}},
|
|---|
| 5001 | lineColor={192,192,192},
|
|---|
| 5002 | textString="asin")}),
|
|---|
| 5003 | Diagram(coordinateSystem(
|
|---|
| 5004 | preserveAspectRatio=true,
|
|---|
| 5005 | extent={{-100,-100},{100,100}}), graphics={Text(
|
|---|
| 5006 | extent={{-40,-72},{-15,-88}},
|
|---|
| 5007 | textString="-pi/2",
|
|---|
| 5008 | lineColor={0,0,255}),Text(
|
|---|
| 5009 | extent={{-38,88},{-13,72}},
|
|---|
| 5010 | textString=" pi/2",
|
|---|
| 5011 | lineColor={0,0,255}),Text(
|
|---|
| 5012 | extent={{68,-9},{88,-29}},
|
|---|
| 5013 | textString="+1",
|
|---|
| 5014 | lineColor={0,0,255}),Text(
|
|---|
| 5015 | extent={{-90,21},{-70,1}},
|
|---|
| 5016 | textString="-1",
|
|---|
| 5017 | lineColor={0,0,255}),Line(points={{-100,0},{84,0}}, color={95,95,95}),
|
|---|
| 5018 | Polygon(
|
|---|
| 5019 | points={{98,0},{82,6},{82,-6},{98,0}},
|
|---|
| 5020 | lineColor={95,95,95},
|
|---|
| 5021 | fillColor={95,95,95},
|
|---|
| 5022 | fillPattern=FillPattern.Solid),Line(
|
|---|
| 5023 | points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
|
|---|
| 5024 | -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
|
|---|
| 5025 | 52.7},{75.2,62.2},{77.6,67.5},{80,80}},
|
|---|
| 5026 | color={0,0,255},
|
|---|
| 5027 | thickness=0.5),Text(
|
|---|
| 5028 | extent={{82,24},{102,4}},
|
|---|
| 5029 | lineColor={95,95,95},
|
|---|
| 5030 | textString="u"),Line(
|
|---|
| 5031 | points={{0,80},{86,80}},
|
|---|
| 5032 | color={175,175,175},
|
|---|
| 5033 | smooth=Smooth.None),Line(
|
|---|
| 5034 | points={{80,86},{80,-10}},
|
|---|
| 5035 | color={175,175,175},
|
|---|
| 5036 | smooth=Smooth.None)}),
|
|---|
| 5037 | Documentation(info="<html>
|
|---|
| 5038 | <p>
|
|---|
| 5039 | This function returns y = asin(u), with -1 ≤ u ≤ +1:
|
|---|
| 5040 | </p>
|
|---|
| 5041 |
|
|---|
| 5042 | <p>
|
|---|
| 5043 | <img src=\"modelica://Modelica/Resources/Images/Math/asin.png\">
|
|---|
| 5044 | </p>
|
|---|
| 5045 | </html>"));
|
|---|
| 5046 | end asin;
|
|---|
| 5047 |
|
|---|
| 5048 | function exp "Exponential, base e"
|
|---|
| 5049 | extends Modelica.Math.Icons.AxisCenter;
|
|---|
| 5050 | input Real u;
|
|---|
| 5051 | output Real y;
|
|---|
| 5052 |
|
|---|
| 5053 | external "builtin" y= exp(u);
|
|---|
| 5054 | annotation (
|
|---|
| 5055 | Icon(coordinateSystem(
|
|---|
| 5056 | preserveAspectRatio=true,
|
|---|
| 5057 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5058 | Line(points={{-90,-80.3976},{68,-80.3976}}, color={192,192,192}),
|
|---|
| 5059 | Polygon(
|
|---|
| 5060 | points={{90,-80.3976},{68,-72.3976},{68,-88.3976},{90,-80.3976}},
|
|---|
| 5061 | lineColor={192,192,192},
|
|---|
| 5062 | fillColor={192,192,192},
|
|---|
| 5063 | fillPattern=FillPattern.Solid),
|
|---|
| 5064 | Line(points={{-80,-80},{-31,-77.9},{-6.03,-74},{10.9,-68.4},{23.7,-61},
|
|---|
| 5065 | {34.2,-51.6},{43,-40.3},{50.3,-27.8},{56.7,-13.5},{62.3,2.23},{
|
|---|
| 5066 | 67.1,18.6},{72,38.2},{76,57.6},{80,80}}, color={0,0,0}),
|
|---|
| 5067 | Text(
|
|---|
| 5068 | extent={{-86,50},{-14,2}},
|
|---|
| 5069 | lineColor={192,192,192},
|
|---|
| 5070 | textString="exp")}),
|
|---|
| 5071 | Diagram(coordinateSystem(
|
|---|
| 5072 | preserveAspectRatio=true,
|
|---|
| 5073 | extent={{-100,-100},{100,100}}), graphics={Line(points={{-100,-80.3976},{84,-80.3976}},
|
|---|
| 5074 | color={95,95,95}),Polygon(
|
|---|
| 5075 | points={{98,-80.3976},{82,-74.3976},{82,-86.3976},{98,-80.3976}},
|
|---|
| 5076 | lineColor={95,95,95},
|
|---|
| 5077 | fillColor={95,95,95},
|
|---|
| 5078 | fillPattern=FillPattern.Solid),Line(
|
|---|
| 5079 | points={{-80,-80},{-31,-77.9},{-6.03,-74},{10.9,-68.4},{23.7,-61},{
|
|---|
| 5080 | 34.2,-51.6},{43,-40.3},{50.3,-27.8},{56.7,-13.5},{62.3,2.23},{67.1,
|
|---|
| 5081 | 18.6},{72,38.2},{76,57.6},{80,80}},
|
|---|
| 5082 | color={0,0,255},
|
|---|
| 5083 | thickness=0.5),Text(
|
|---|
| 5084 | extent={{-31,72},{-11,88}},
|
|---|
| 5085 | textString="20",
|
|---|
| 5086 | lineColor={0,0,255}),Text(
|
|---|
| 5087 | extent={{-92,-81},{-72,-101}},
|
|---|
| 5088 | textString="-3",
|
|---|
| 5089 | lineColor={0,0,255}),Text(
|
|---|
| 5090 | extent={{66,-81},{86,-101}},
|
|---|
| 5091 | textString="3",
|
|---|
| 5092 | lineColor={0,0,255}),Text(
|
|---|
| 5093 | extent={{2,-69},{22,-89}},
|
|---|
| 5094 | textString="1",
|
|---|
| 5095 | lineColor={0,0,255}),Text(
|
|---|
| 5096 | extent={{78,-54},{98,-74}},
|
|---|
| 5097 | lineColor={95,95,95},
|
|---|
| 5098 | textString="u"),Line(
|
|---|
| 5099 | points={{0,80},{88,80}},
|
|---|
| 5100 | color={175,175,175},
|
|---|
| 5101 | smooth=Smooth.None),Line(
|
|---|
| 5102 | points={{80,84},{80,-84}},
|
|---|
| 5103 | color={175,175,175},
|
|---|
| 5104 | smooth=Smooth.None)}),
|
|---|
| 5105 | Documentation(info="<html>
|
|---|
| 5106 | <p>
|
|---|
| 5107 | This function returns y = exp(u), with -∞ < u < ∞:
|
|---|
| 5108 | </p>
|
|---|
| 5109 |
|
|---|
| 5110 | <p>
|
|---|
| 5111 | <img src=\"modelica://Modelica/Resources/Images/Math/exp.png\">
|
|---|
| 5112 | </p>
|
|---|
| 5113 | </html>"));
|
|---|
| 5114 | end exp;
|
|---|
| 5115 |
|
|---|
| 5116 | function log "Natural (base e) logarithm (u shall be > 0)"
|
|---|
| 5117 | extends Modelica.Math.Icons.AxisLeft;
|
|---|
| 5118 | input Real u;
|
|---|
| 5119 | output Real y;
|
|---|
| 5120 |
|
|---|
| 5121 | external "builtin" y= log(u);
|
|---|
| 5122 | annotation (
|
|---|
| 5123 | Icon(coordinateSystem(
|
|---|
| 5124 | preserveAspectRatio=true,
|
|---|
| 5125 | extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5126 | Line(points={{-90,0},{68,0}}, color={192,192,192}),
|
|---|
| 5127 | Polygon(
|
|---|
| 5128 | points={{90,0},{68,8},{68,-8},{90,0}},
|
|---|
| 5129 | lineColor={192,192,192},
|
|---|
| 5130 | fillColor={192,192,192},
|
|---|
| 5131 | fillPattern=FillPattern.Solid),
|
|---|
| 5132 | Line(points={{-80,-80},{-79.2,-50.6},{-78.4,-37},{-77.6,-28},{-76.8,-21.3},
|
|---|
| 5133 | {-75.2,-11.4},{-72.8,-1.31},{-69.5,8.08},{-64.7,17.9},{-57.5,28},
|
|---|
| 5134 | {-47,38.1},{-31.8,48.1},{-10.1,58},{22.1,68},{68.7,78.1},{80,80}},
|
|---|
| 5135 | color={0,0,0}),
|
|---|
| 5136 | Text(
|
|---|
| 5137 | extent={{-6,-24},{66,-72}},
|
|---|
| 5138 | lineColor={192,192,192},
|
|---|
| 5139 | textString="log")}),
|
|---|
| 5140 | Diagram(coordinateSystem(
|
|---|
| 5141 | preserveAspectRatio=true,
|
|---|
| 5142 | extent={{-100,-100},{100,100}}), graphics={Line(points={{-100,0},{84,0}}, color={95,95,95}),
|
|---|
| 5143 | Polygon(
|
|---|
| 5144 | points={{100,0},{84,6},{84,-6},{100,0}},
|
|---|
| 5145 | lineColor={95,95,95},
|
|---|
| 5146 | fillColor={95,95,95},
|
|---|
| 5147 | fillPattern=FillPattern.Solid),Line(
|
|---|
| 5148 | points={{-78,-80},{-77.2,-50.6},{-76.4,-37},{-75.6,-28},{-74.8,-21.3},
|
|---|
| 5149 | {-73.2,-11.4},{-70.8,-1.31},{-67.5,8.08},{-62.7,17.9},{-55.5,28},{-45,
|
|---|
| 5150 | 38.1},{-29.8,48.1},{-8.1,58},{24.1,68},{70.7,78.1},{82,80}},
|
|---|
| 5151 | color={0,0,255},
|
|---|
| 5152 | thickness=0.5),Text(
|
|---|
| 5153 | extent={{-105,72},{-85,88}},
|
|---|
| 5154 | textString="3",
|
|---|
| 5155 | lineColor={0,0,255}),Text(
|
|---|
| 5156 | extent={{60,-3},{80,-23}},
|
|---|
| 5157 | textString="20",
|
|---|
| 5158 | lineColor={0,0,255}),Text(
|
|---|
| 5159 | extent={{-78,-7},{-58,-27}},
|
|---|
| 5160 | textString="1",
|
|---|
| 5161 | lineColor={0,0,255}),Text(
|
|---|
| 5162 | extent={{84,26},{104,6}},
|
|---|
| 5163 | lineColor={95,95,95},
|
|---|
| 5164 | textString="u"),Text(
|
|---|
| 5165 | extent={{-100,9},{-80,-11}},
|
|---|
| 5166 | textString="0",
|
|---|
| 5167 | lineColor={0,0,255}),Line(
|
|---|
| 5168 | points={{-80,80},{84,80}},
|
|---|
| 5169 | color={175,175,175},
|
|---|
| 5170 | smooth=Smooth.None),Line(
|
|---|
| 5171 | points={{82,82},{82,-6}},
|
|---|
| 5172 | color={175,175,175},
|
|---|
| 5173 | smooth=Smooth.None)}),
|
|---|
| 5174 | Documentation(info="<html>
|
|---|
| 5175 | <p>
|
|---|
| 5176 | This function returns y = log(10) (the natural logarithm of u),
|
|---|
| 5177 | with u > 0:
|
|---|
| 5178 | </p>
|
|---|
| 5179 |
|
|---|
| 5180 | <p>
|
|---|
| 5181 | <img src=\"modelica://Modelica/Resources/Images/Math/log.png\">
|
|---|
| 5182 | </p>
|
|---|
| 5183 | </html>"));
|
|---|
| 5184 | end log;
|
|---|
| 5185 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
|
|---|
| 5186 | {100,100}}), graphics={Line(points={{-80,0},{-68.7,34.2},{-61.5,53.1},
|
|---|
| 5187 | {-55.1,66.4},{-49.4,74.6},{-43.8,79.1},{-38.2,79.8},{-32.6,76.6},{
|
|---|
| 5188 | -26.9,69.7},{-21.3,59.4},{-14.9,44.1},{-6.83,21.2},{10.1,-30.8},{17.3,
|
|---|
| 5189 | -50.2},{23.7,-64.2},{29.3,-73.1},{35,-78.4},{40.6,-80},{46.2,-77.6},
|
|---|
| 5190 | {51.9,-71.5},{57.5,-61.9},{63.9,-47.2},{72,-24.8},{80,0}}, color={
|
|---|
| 5191 | 0,0,0}, smooth=Smooth.Bezier)}), Documentation(info="<HTML>
|
|---|
| 5192 | <p>
|
|---|
| 5193 | This package contains <b>basic mathematical functions</b> (such as sin(..)),
|
|---|
| 5194 | as well as functions operating on
|
|---|
| 5195 | <a href=\"modelica://Modelica.Math.Vectors\">vectors</a>,
|
|---|
| 5196 | <a href=\"modelica://Modelica.Math.Matrices\">matrices</a>,
|
|---|
| 5197 | <a href=\"modelica://Modelica.Math.Nonlinear\">nonlinear functions</a>, and
|
|---|
| 5198 | <a href=\"modelica://Modelica.Math.BooleanVectors\">Boolean vectors</a>.
|
|---|
| 5199 | </p>
|
|---|
| 5200 |
|
|---|
| 5201 | <dl>
|
|---|
| 5202 | <dt><b>Main Authors:</b>
|
|---|
| 5203 | <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
|
|---|
| 5204 | Marcus Baur<br>
|
|---|
| 5205 | Deutsches Zentrum für Luft und Raumfahrt e.V. (DLR)<br>
|
|---|
| 5206 | Institut für Robotik und Mechatronik<br>
|
|---|
| 5207 | Postfach 1116<br>
|
|---|
| 5208 | D-82230 Wessling<br>
|
|---|
| 5209 | Germany<br>
|
|---|
| 5210 | email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
|
|---|
| 5211 | </dl>
|
|---|
| 5212 |
|
|---|
| 5213 | <p>
|
|---|
| 5214 | Copyright © 1998-2013, Modelica Association and DLR.
|
|---|
| 5215 | </p>
|
|---|
| 5216 | <p>
|
|---|
| 5217 | <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>
|
|---|
| 5218 | </p>
|
|---|
| 5219 | </html>", revisions="<html>
|
|---|
| 5220 | <ul>
|
|---|
| 5221 | <li><i>October 21, 2002</i>
|
|---|
| 5222 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
|
|---|
| 5223 | and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
|
|---|
| 5224 | Function tempInterpol2 added.</li>
|
|---|
| 5225 | <li><i>Oct. 24, 1999</i>
|
|---|
| 5226 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 5227 | Icons for icon and diagram level introduced.</li>
|
|---|
| 5228 | <li><i>June 30, 1999</i>
|
|---|
| 5229 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 5230 | Realized.</li>
|
|---|
| 5231 | </ul>
|
|---|
| 5232 |
|
|---|
| 5233 | </html>"));
|
|---|
| 5234 | end Math;
|
|---|
| 5235 |
|
|---|
| 5236 | package Utilities
|
|---|
| 5237 | "Library of utility functions dedicated to scripting (operating on files, streams, strings, system)"
|
|---|
| 5238 | extends Modelica.Icons.Package;
|
|---|
| 5239 |
|
|---|
| 5240 | package Streams "Read from files and write to files"
|
|---|
| 5241 | extends Modelica.Icons.Package;
|
|---|
| 5242 |
|
|---|
| 5243 | function error "Print error message and cancel all actions"
|
|---|
| 5244 | extends Modelica.Icons.Function;
|
|---|
| 5245 | input String string "String to be printed to error message window";
|
|---|
| 5246 | external "C" ModelicaError(string) annotation(Library="ModelicaExternalC");
|
|---|
| 5247 | annotation (Documentation(info="<html>
|
|---|
| 5248 | <h4>Syntax</h4>
|
|---|
| 5249 | <blockquote><pre>
|
|---|
| 5250 | Streams.<b>error</b>(string);
|
|---|
| 5251 | </pre></blockquote>
|
|---|
| 5252 | <h4>Description</h4>
|
|---|
| 5253 | <p>
|
|---|
| 5254 | Print the string \"string\" as error message and
|
|---|
| 5255 | cancel all actions. Line breaks are characterized
|
|---|
| 5256 | by \"\\n\" in the string.
|
|---|
| 5257 | </p>
|
|---|
| 5258 | <h4>Example</h4>
|
|---|
| 5259 | <blockquote><pre>
|
|---|
| 5260 | Streams.error(\"x (= \" + String(x) + \")\\nhas to be in the range 0 .. 1\");
|
|---|
| 5261 | </pre></blockquote>
|
|---|
| 5262 | <h4>See also</h4>
|
|---|
| 5263 | <p>
|
|---|
| 5264 | <a href=\"modelica://Modelica.Utilities.Streams\">Streams</a>,
|
|---|
| 5265 | <a href=\"modelica://Modelica.Utilities.Streams.print\">Streams.print</a>,
|
|---|
| 5266 | <a href=\"modelica://ModelicaReference.Operators.'String()'\">ModelicaReference.Operators.'String()'</a>
|
|---|
| 5267 | </p>
|
|---|
| 5268 | </html>"));
|
|---|
| 5269 | end error;
|
|---|
| 5270 | annotation (
|
|---|
| 5271 | Documentation(info="<HTML>
|
|---|
| 5272 | <h4>Library content</h4>
|
|---|
| 5273 | <p>
|
|---|
| 5274 | Package <b>Streams</b> contains functions to input and output strings
|
|---|
| 5275 | to a message window or on files. Note that a string is interpreted
|
|---|
| 5276 | and displayed as html text (e.g., with print(..) or error(..))
|
|---|
| 5277 | if it is enclosed with the Modelica html quotation, e.g.,
|
|---|
| 5278 | </p>
|
|---|
| 5279 | <center>
|
|---|
| 5280 | string = \"<html> first line <br> second line </html>\".
|
|---|
| 5281 | </center>
|
|---|
| 5282 | <p>
|
|---|
| 5283 | It is a quality of implementation, whether (a) all tags of html are supported
|
|---|
| 5284 | or only a subset, (b) how html tags are interpreted if the output device
|
|---|
| 5285 | does not allow to display formatted text.
|
|---|
| 5286 | </p>
|
|---|
| 5287 | <p>
|
|---|
| 5288 | In the table below an example call to every function is given:
|
|---|
| 5289 | </p>
|
|---|
| 5290 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 5291 | <tr><th><b><i>Function/type</i></b></th><th><b><i>Description</i></b></th></tr>
|
|---|
| 5292 | <tr><td valign=\"top\"><a href=\"modelica://Modelica.Utilities.Streams.print\">print</a>(string)<br>
|
|---|
| 5293 | <a href=\"modelica://Modelica.Utilities.Streams.print\">print</a>(string,fileName)</td>
|
|---|
| 5294 | <td valign=\"top\"> Print string \"string\" or vector of strings to message window or on
|
|---|
| 5295 | file \"fileName\".</td>
|
|---|
| 5296 | </tr>
|
|---|
| 5297 | <tr><td valign=\"top\">stringVector =
|
|---|
| 5298 | <a href=\"modelica://Modelica.Utilities.Streams.readFile\">readFile</a>(fileName)</td>
|
|---|
| 5299 | <td valign=\"top\"> Read complete text file and return it as a vector of strings.</td>
|
|---|
| 5300 | </tr>
|
|---|
| 5301 | <tr><td valign=\"top\">(string, endOfFile) =
|
|---|
| 5302 | <a href=\"modelica://Modelica.Utilities.Streams.readLine\">readLine</a>(fileName, lineNumber)</td>
|
|---|
| 5303 | <td valign=\"top\">Returns from the file the content of line lineNumber.</td>
|
|---|
| 5304 | </tr>
|
|---|
| 5305 | <tr><td valign=\"top\">lines =
|
|---|
| 5306 | <a href=\"modelica://Modelica.Utilities.Streams.countLines\">countLines</a>(fileName)</td>
|
|---|
| 5307 | <td valign=\"top\">Returns the number of lines in a file.</td>
|
|---|
| 5308 | </tr>
|
|---|
| 5309 | <tr><td valign=\"top\"><a href=\"modelica://Modelica.Utilities.Streams.error\">error</a>(string)</td>
|
|---|
| 5310 | <td valign=\"top\"> Print error message \"string\" to message window
|
|---|
| 5311 | and cancel all actions</td>
|
|---|
| 5312 | </tr>
|
|---|
| 5313 | <tr><td valign=\"top\"><a href=\"modelica://Modelica.Utilities.Streams.close\">close</a>(fileName)</td>
|
|---|
| 5314 | <td valign=\"top\"> Close file if it is still open. Ignore call if
|
|---|
| 5315 | file is already closed or does not exist. </td>
|
|---|
| 5316 | </tr>
|
|---|
| 5317 | </table>
|
|---|
| 5318 | <p>
|
|---|
| 5319 | Use functions <b>scanXXX</b> from package
|
|---|
| 5320 | <a href=\"modelica://Modelica.Utilities.Strings\">Strings</a>
|
|---|
| 5321 | to parse a string.
|
|---|
| 5322 | </p>
|
|---|
| 5323 | <p>
|
|---|
| 5324 | If Real, Integer or Boolean values shall be printed
|
|---|
| 5325 | or used in an error message, they have to be first converted
|
|---|
| 5326 | to strings with the builtin operator
|
|---|
| 5327 | <a href=\"modelica://ModelicaReference.Operators.'String()'\">ModelicaReference.Operators.'String()'</a>(...).
|
|---|
| 5328 | Example:
|
|---|
| 5329 | </p>
|
|---|
| 5330 | <pre>
|
|---|
| 5331 | <b>if</b> x < 0 <b>or</b> x > 1 <b>then</b>
|
|---|
| 5332 | Streams.error(\"x (= \" + String(x) + \") has to be in the range 0 .. 1\");
|
|---|
| 5333 | <b>end if</b>;
|
|---|
| 5334 | </pre>
|
|---|
| 5335 | </html>"));
|
|---|
| 5336 | end Streams;
|
|---|
| 5337 |
|
|---|
| 5338 | package Strings "Operations on strings"
|
|---|
| 5339 | extends Modelica.Icons.Package;
|
|---|
| 5340 |
|
|---|
| 5341 | function length "Returns length of string"
|
|---|
| 5342 | extends Modelica.Icons.Function;
|
|---|
| 5343 | input String string;
|
|---|
| 5344 | output Integer result "Number of characters of string";
|
|---|
| 5345 | external "C" result = ModelicaStrings_length(string) annotation(Library="ModelicaExternalC");
|
|---|
| 5346 | annotation (Documentation(info="<html>
|
|---|
| 5347 | <h4>Syntax</h4>
|
|---|
| 5348 | <blockquote><pre>
|
|---|
| 5349 | Strings.<b>length</b>(string);
|
|---|
| 5350 | </pre></blockquote>
|
|---|
| 5351 | <h4>Description</h4>
|
|---|
| 5352 | <p>
|
|---|
| 5353 | Returns the number of characters of \"string\".
|
|---|
| 5354 | </p>
|
|---|
| 5355 | </html>"));
|
|---|
| 5356 | end length;
|
|---|
| 5357 |
|
|---|
| 5358 | function isEmpty
|
|---|
| 5359 | "Return true if a string is empty (has only white space characters)"
|
|---|
| 5360 | extends Modelica.Icons.Function;
|
|---|
| 5361 | input String string;
|
|---|
| 5362 | output Boolean result "True, if string is empty";
|
|---|
| 5363 | protected
|
|---|
| 5364 | Integer nextIndex;
|
|---|
| 5365 | Integer len;
|
|---|
| 5366 | algorithm
|
|---|
| 5367 | nextIndex := Strings.Advanced.skipWhiteSpace(string);
|
|---|
| 5368 | len := Strings.length(string);
|
|---|
| 5369 | if len < 1 or nextIndex > len then
|
|---|
| 5370 | result := true;
|
|---|
| 5371 | else
|
|---|
| 5372 | result := false;
|
|---|
| 5373 | end if;
|
|---|
| 5374 |
|
|---|
| 5375 | annotation (Documentation(info="<html>
|
|---|
| 5376 | <h4>Syntax</h4>
|
|---|
| 5377 | <blockquote><pre>
|
|---|
| 5378 | Strings.<b>isEmpty</b>(string);
|
|---|
| 5379 | </pre></blockquote>
|
|---|
| 5380 | <h4>Description</h4>
|
|---|
| 5381 | <p>
|
|---|
| 5382 | Returns true if the string has no characters or if the string consists
|
|---|
| 5383 | only of white space characters. Otherwise, false is returned.
|
|---|
| 5384 | </p>
|
|---|
| 5385 |
|
|---|
| 5386 | <h4>Example</h4>
|
|---|
| 5387 | <blockquote><pre>
|
|---|
| 5388 | isEmpty(\"\"); // returns true
|
|---|
| 5389 | isEmpty(\" \"); // returns true
|
|---|
| 5390 | isEmpty(\" abc\"); // returns false
|
|---|
| 5391 | isEmpty(\"a\"); // returns false
|
|---|
| 5392 | </pre></blockquote>
|
|---|
| 5393 | </html>"));
|
|---|
| 5394 | end isEmpty;
|
|---|
| 5395 |
|
|---|
| 5396 | package Advanced "Advanced scanning functions"
|
|---|
| 5397 | extends Modelica.Icons.Package;
|
|---|
| 5398 |
|
|---|
| 5399 | function skipWhiteSpace "Scans white space"
|
|---|
| 5400 | extends Modelica.Icons.Function;
|
|---|
| 5401 | input String string;
|
|---|
| 5402 | input Integer startIndex(min=1)=1;
|
|---|
| 5403 | output Integer nextIndex;
|
|---|
| 5404 | external "C" nextIndex = ModelicaStrings_skipWhiteSpace(string, startIndex) annotation(Library="ModelicaExternalC");
|
|---|
| 5405 | annotation (Documentation(info="<html>
|
|---|
| 5406 | <h4>Syntax</h4>
|
|---|
| 5407 | <blockquote><pre>
|
|---|
| 5408 | nextIndex = <b>skipWhiteSpace</b>(string, startIndex);
|
|---|
| 5409 | </pre></blockquote>
|
|---|
| 5410 | <h4>Description</h4>
|
|---|
| 5411 | <p>
|
|---|
| 5412 | Starts scanning of \"string\" at position \"startIndex\" and
|
|---|
| 5413 | skips white space. The function returns nextIndex = index of character
|
|---|
| 5414 | of the first non white space character.
|
|---|
| 5415 | </p>
|
|---|
| 5416 | <h4>See also</h4>
|
|---|
| 5417 | <a href=\"modelica://Modelica.Utilities.Strings.Advanced\">Strings.Advanced</a>.
|
|---|
| 5418 | </html>"));
|
|---|
| 5419 | end skipWhiteSpace;
|
|---|
| 5420 | annotation (Documentation(info="<html>
|
|---|
| 5421 | <h4>Library content</h4>
|
|---|
| 5422 | <p>
|
|---|
| 5423 | Package <b>Strings.Advanced</b> contains basic scanning
|
|---|
| 5424 | functions. These functions should be <b>not called</b> directly, because
|
|---|
| 5425 | it is much simpler to utilize the higher level functions \"Strings.scanXXX\".
|
|---|
| 5426 | The functions of the \"Strings.Advanced\" library provide
|
|---|
| 5427 | the basic interface in order to implement the higher level
|
|---|
| 5428 | functions in package \"Strings\".
|
|---|
| 5429 | </p>
|
|---|
| 5430 | <p>
|
|---|
| 5431 | Library \"Advanced\" provides the following functions:
|
|---|
| 5432 | </p>
|
|---|
| 5433 | <pre>
|
|---|
| 5434 | (nextIndex, realNumber) = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanReal\">scanReal</a> (string, startIndex, unsigned=false);
|
|---|
| 5435 | (nextIndex, integerNumber) = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanInteger\">scanInteger</a> (string, startIndex, unsigned=false);
|
|---|
| 5436 | (nextIndex, string2) = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanString\">scanString</a> (string, startIndex);
|
|---|
| 5437 | (nextIndex, identifier) = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanIdentifier\">scanIdentifier</a> (string, startIndex);
|
|---|
| 5438 | nextIndex = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.skipWhiteSpace\">skipWhiteSpace</a> (string, startIndex);
|
|---|
| 5439 | nextIndex = <a href=\"modelica://Modelica.Utilities.Strings.Advanced.skipLineComments\">skipLineComments</a>(string, startIndex);
|
|---|
| 5440 | </pre>
|
|---|
| 5441 | <p>
|
|---|
| 5442 | All functions perform the following actions:
|
|---|
| 5443 | </p>
|
|---|
| 5444 | <ol>
|
|---|
| 5445 | <li> Scanning starts at character position \"startIndex\" of
|
|---|
| 5446 | \"string\" (startIndex has a default of 1).
|
|---|
| 5447 | <li> First, white space is skipped, such as blanks (\" \"), tabs (\"\\t\"), or newline (\"\\n\")</li>
|
|---|
| 5448 | <li> Afterwards, the required token is scanned.</li>
|
|---|
| 5449 | <li> If successful, on return nextIndex = index of character
|
|---|
| 5450 | directly after the found token and the token value is returned
|
|---|
| 5451 | as second output argument.<br>
|
|---|
| 5452 | If not successful, on return nextIndex = startIndex.
|
|---|
| 5453 | </li>
|
|---|
| 5454 | </ol>
|
|---|
| 5455 | <p>
|
|---|
| 5456 | The following additional rules apply for the scanning:
|
|---|
| 5457 | </p>
|
|---|
| 5458 | <ul>
|
|---|
| 5459 | <li> Function <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanReal\">scanReal</a>:<br>
|
|---|
| 5460 | Scans a full number including one optional leading \"+\" or \"-\" (if unsigned=false)
|
|---|
| 5461 | according to the Modelica grammar. For example, \"+1.23e-5\", \"0.123\" are
|
|---|
| 5462 | Real numbers, but \".1\" is not.
|
|---|
| 5463 | Note, an Integer number, such as \"123\" is also treated as a Real number.<br> </li>
|
|---|
| 5464 | <li> Function <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanInteger\">scanInteger</a>:<br>
|
|---|
| 5465 | Scans an Integer number including one optional leading \"+\"
|
|---|
| 5466 | or \"-\" (if unsigned=false) according to the Modelica (and C/C++) grammar.
|
|---|
| 5467 | For example, \"+123\", \"20\" are Integer numbers.
|
|---|
| 5468 | Note, a Real number, such as \"123.4\" is not an Integer and
|
|---|
| 5469 | scanInteger returns nextIndex = startIndex.<br> </li>
|
|---|
| 5470 | <li> Function <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanString\">scanString</a>:<br>
|
|---|
| 5471 | Scans a String according to the Modelica (and C/C++) grammar, e.g.,
|
|---|
| 5472 | \"This is a \"string\"\" is a valid string token.<br> </li>
|
|---|
| 5473 | <li> Function <a href=\"modelica://Modelica.Utilities.Strings.Advanced.scanIdentifier\">scanIdentifier</a>:<br>
|
|---|
| 5474 | Scans a Modelica identifier, i.e., the identifier starts either
|
|---|
| 5475 | with a letter, followed by letters, digits or \"_\".
|
|---|
| 5476 | For example, \"w_rel\", \"T12\".<br> </li>
|
|---|
| 5477 | <li> Function <a href=\"modelica://Modelica.Utilities.Strings.Advanced.skipLineComments\">skipLineComments</a><br>
|
|---|
| 5478 | Skips white space and Modelica (C/C++) line comments iteratively.
|
|---|
| 5479 | A line comment starts with \"//\" and ends either with an
|
|---|
| 5480 | end-of-line (\"\\n\") or the end of the \"string\". </li>
|
|---|
| 5481 | </ul>
|
|---|
| 5482 | </html>"));
|
|---|
| 5483 | end Advanced;
|
|---|
| 5484 | annotation (
|
|---|
| 5485 | Documentation(info="<HTML>
|
|---|
| 5486 | <h4>Library content</h4>
|
|---|
| 5487 | <p>
|
|---|
| 5488 | Package <b>Strings</b> contains functions to manipulate strings.
|
|---|
| 5489 | </p>
|
|---|
| 5490 | <p>
|
|---|
| 5491 | In the table below an example
|
|---|
| 5492 | call to every function is given using the <b>default</b> options.
|
|---|
| 5493 | </p>
|
|---|
| 5494 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 5495 | <tr><th><b><i>Function</i></b></th><th><b><i>Description</i></b></th></tr>
|
|---|
| 5496 | <tr><td valign=\"top\">len = <a href=\"modelica://Modelica.Utilities.Strings.length\">length</a>(string)</td>
|
|---|
| 5497 | <td valign=\"top\">Returns length of string</td></tr>
|
|---|
| 5498 | <tr><td valign=\"top\">string2 = <a href=\"modelica://Modelica.Utilities.Strings.substring\">substring</a>(string1,startIndex,endIndex)
|
|---|
| 5499 | </td>
|
|---|
| 5500 | <td valign=\"top\">Returns a substring defined by start and end index</td></tr>
|
|---|
| 5501 | <tr><td valign=\"top\">result = <a href=\"modelica://Modelica.Utilities.Strings.repeat\">repeat</a>(n)<br>
|
|---|
| 5502 | result = <a href=\"modelica://Modelica.Utilities.Strings.repeat\">repeat</a>(n,string)</td>
|
|---|
| 5503 | <td valign=\"top\">Repeat a blank or a string n times.</td></tr>
|
|---|
| 5504 | <tr><td valign=\"top\">result = <a href=\"modelica://Modelica.Utilities.Strings.compare\">compare</a>(string1, string2)</td>
|
|---|
| 5505 | <td valign=\"top\">Compares two substrings with regards to alphabetical order</td></tr>
|
|---|
| 5506 | <tr><td valign=\"top\">identical =
|
|---|
| 5507 | <a href=\"modelica://Modelica.Utilities.Strings.isEqual\">isEqual</a>(string1,string2)</td>
|
|---|
| 5508 | <td valign=\"top\">Determine whether two strings are identical</td></tr>
|
|---|
| 5509 | <tr><td valign=\"top\">result = <a href=\"modelica://Modelica.Utilities.Strings.count\">count</a>(string,searchString)</td>
|
|---|
| 5510 | <td valign=\"top\">Count the number of occurrences of a string</td></tr>
|
|---|
| 5511 | <tr>
|
|---|
| 5512 | <td valign=\"top\">index = <a href=\"modelica://Modelica.Utilities.Strings.find\">find</a>(string,searchString)</td>
|
|---|
| 5513 | <td valign=\"top\">Find first occurrence of a string in another string</td></tr>
|
|---|
| 5514 | <tr>
|
|---|
| 5515 | <td valign=\"top\">index = <a href=\"modelica://Modelica.Utilities.Strings.findLast\">findLast</a>(string,searchString)</td>
|
|---|
| 5516 | <td valign=\"top\">Find last occurrence of a string in another string</td></tr>
|
|---|
| 5517 | <tr><td valign=\"top\">string2 = <a href=\"modelica://Modelica.Utilities.Strings.replace\">replace</a>(string,searchString,replaceString)</td>
|
|---|
| 5518 | <td valign=\"top\">Replace one or all occurrences of a string</td></tr>
|
|---|
| 5519 | <tr><td valign=\"top\">stringVector2 = <a href=\"modelica://Modelica.Utilities.Strings.sort\">sort</a>(stringVector1)</td>
|
|---|
| 5520 | <td valign=\"top\">Sort vector of strings in alphabetic order</td></tr>
|
|---|
| 5521 | <tr><td valign=\"top\">(token, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanToken\">scanToken</a>(string,startIndex)</td>
|
|---|
| 5522 | <td valign=\"top\">Scan for a token (Real/Integer/Boolean/String/Identifier/Delimiter/NoToken)</td></tr>
|
|---|
| 5523 | <tr><td valign=\"top\">(number, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanReal\">scanReal</a>(string,startIndex)</td>
|
|---|
| 5524 | <td valign=\"top\">Scan for a Real constant</td></tr>
|
|---|
| 5525 | <tr><td valign=\"top\">(number, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanInteger\">scanInteger</a>(string,startIndex)</td>
|
|---|
| 5526 | <td valign=\"top\">Scan for an Integer constant</td></tr>
|
|---|
| 5527 | <tr><td valign=\"top\">(boolean, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanBoolean\">scanBoolean</a>(string,startIndex)</td>
|
|---|
| 5528 | <td valign=\"top\">Scan for a Boolean constant</td></tr>
|
|---|
| 5529 | <tr><td valign=\"top\">(string2, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanString\">scanString</a>(string,startIndex)</td>
|
|---|
| 5530 | <td valign=\"top\">Scan for a String constant</td></tr>
|
|---|
| 5531 | <tr><td valign=\"top\">(identifier, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanIdentifier\">scanIdentifier</a>(string,startIndex)</td>
|
|---|
| 5532 | <td valign=\"top\">Scan for an identifier</td></tr>
|
|---|
| 5533 | <tr><td valign=\"top\">(delimiter, index) = <a href=\"modelica://Modelica.Utilities.Strings.scanDelimiter\">scanDelimiter</a>(string,startIndex)</td>
|
|---|
| 5534 | <td valign=\"top\">Scan for delimiters</td></tr>
|
|---|
| 5535 | <tr><td valign=\"top\"><a href=\"modelica://Modelica.Utilities.Strings.scanNoToken\">scanNoToken</a>(string,startIndex)</td>
|
|---|
| 5536 | <td valign=\"top\">Check that remaining part of string consists solely of <br>
|
|---|
| 5537 | white space or line comments (\"// ...\\n\").</td></tr>
|
|---|
| 5538 | <tr><td valign=\"top\"><a href=\"modelica://Modelica.Utilities.Strings.syntaxError\">syntaxError</a>(string,index,message)</td>
|
|---|
| 5539 | <td valign=\"top\"> Print a \"syntax error message\" as well as a string and the <br>
|
|---|
| 5540 | index at which scanning detected an error</td></tr>
|
|---|
| 5541 | </table>
|
|---|
| 5542 | <p>
|
|---|
| 5543 | The functions \"compare\", \"isEqual\", \"count\", \"find\", \"findLast\", \"replace\", \"sort\"
|
|---|
| 5544 | have the optional
|
|---|
| 5545 | input argument <b>caseSensitive</b> with default <b>true</b>.
|
|---|
| 5546 | If <b>false</b>, the operation is carried out without taking
|
|---|
| 5547 | into account whether a character is upper or lower case.
|
|---|
| 5548 | </p>
|
|---|
| 5549 | </HTML>"));
|
|---|
| 5550 | end Strings;
|
|---|
| 5551 | annotation (
|
|---|
| 5552 | Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
|
|---|
| 5553 | Polygon(
|
|---|
| 5554 | origin={1.3835,-4.1418},
|
|---|
| 5555 | rotation=45.0,
|
|---|
| 5556 | fillColor={64,64,64},
|
|---|
| 5557 | pattern=LinePattern.None,
|
|---|
| 5558 | fillPattern=FillPattern.Solid,
|
|---|
| 5559 | points={{-15.0,93.333},{-15.0,68.333},{0.0,58.333},{15.0,68.333},{15.0,93.333},{20.0,93.333},{25.0,83.333},{25.0,58.333},{10.0,43.333},{10.0,-41.667},{25.0,-56.667},{25.0,-76.667},{10.0,-91.667},{0.0,-91.667},{0.0,-81.667},{5.0,-81.667},{15.0,-71.667},{15.0,-61.667},{5.0,-51.667},{-5.0,-51.667},{-15.0,-61.667},{-15.0,-71.667},{-5.0,-81.667},{0.0,-81.667},{0.0,-91.667},{-10.0,-91.667},{-25.0,-76.667},{-25.0,-56.667},{-10.0,-41.667},{-10.0,43.333},{-25.0,58.333},{-25.0,83.333},{-20.0,93.333}}),
|
|---|
| 5560 | Polygon(
|
|---|
| 5561 | origin={10.1018,5.218},
|
|---|
| 5562 | rotation=-45.0,
|
|---|
| 5563 | fillColor={255,255,255},
|
|---|
| 5564 | fillPattern=FillPattern.Solid,
|
|---|
| 5565 | points={{-15.0,87.273},{15.0,87.273},{20.0,82.273},{20.0,27.273},{10.0,17.273},{10.0,7.273},{20.0,2.273},{20.0,-2.727},{5.0,-2.727},{5.0,-77.727},{10.0,-87.727},{5.0,-112.727},{-5.0,-112.727},{-10.0,-87.727},{-5.0,-77.727},{-5.0,-2.727},{-20.0,-2.727},{-20.0,2.273},{-10.0,7.273},{-10.0,17.273},{-20.0,27.273},{-20.0,82.273}})}),
|
|---|
| 5566 | Documentation(info="<html>
|
|---|
| 5567 | <p>
|
|---|
| 5568 | This package contains Modelica <b>functions</b> that are
|
|---|
| 5569 | especially suited for <b>scripting</b>. The functions might
|
|---|
| 5570 | be used to work with strings, read data from file, write data
|
|---|
| 5571 | to file or copy, move and remove files.
|
|---|
| 5572 | </p>
|
|---|
| 5573 | <p>
|
|---|
| 5574 | For an introduction, have especially a look at:
|
|---|
| 5575 | </p>
|
|---|
| 5576 | <ul>
|
|---|
| 5577 | <li> <a href=\"modelica://Modelica.Utilities.UsersGuide\">Modelica.Utilities.User's Guide</a>
|
|---|
| 5578 | discusses the most important aspects of this library.</li>
|
|---|
| 5579 | <li> <a href=\"modelica://Modelica.Utilities.Examples\">Modelica.Utilities.Examples</a>
|
|---|
| 5580 | contains examples that demonstrate the usage of this library.</li>
|
|---|
| 5581 | </ul>
|
|---|
| 5582 | <p>
|
|---|
| 5583 | The following main sublibraries are available:
|
|---|
| 5584 | </p>
|
|---|
| 5585 | <ul>
|
|---|
| 5586 | <li> <a href=\"modelica://Modelica.Utilities.Files\">Files</a>
|
|---|
| 5587 | provides functions to operate on files and directories, e.g.,
|
|---|
| 5588 | to copy, move, remove files.</li>
|
|---|
| 5589 | <li> <a href=\"modelica://Modelica.Utilities.Streams\">Streams</a>
|
|---|
| 5590 | provides functions to read from files and write to files.</li>
|
|---|
| 5591 | <li> <a href=\"modelica://Modelica.Utilities.Strings\">Strings</a>
|
|---|
| 5592 | provides functions to operate on strings. E.g.
|
|---|
| 5593 | substring, find, replace, sort, scanToken.</li>
|
|---|
| 5594 | <li> <a href=\"modelica://Modelica.Utilities.System\">System</a>
|
|---|
| 5595 | provides functions to interact with the environment.
|
|---|
| 5596 | E.g., get or set the working directory or environment
|
|---|
| 5597 | variables and to send a command to the default shell.</li>
|
|---|
| 5598 | </ul>
|
|---|
| 5599 |
|
|---|
| 5600 | <p>
|
|---|
| 5601 | Copyright © 1998-2013, Modelica Association, DLR, and Dassault Systèmes AB.
|
|---|
| 5602 | </p>
|
|---|
| 5603 |
|
|---|
| 5604 | <p>
|
|---|
| 5605 | <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>
|
|---|
| 5606 | </p>
|
|---|
| 5607 |
|
|---|
| 5608 | </html>"));
|
|---|
| 5609 | end Utilities;
|
|---|
| 5610 |
|
|---|
| 5611 | package Constants
|
|---|
| 5612 | "Library of mathematical constants and constants of nature (e.g., pi, eps, R, sigma)"
|
|---|
| 5613 | import SI = Modelica.SIunits;
|
|---|
| 5614 | import NonSI = Modelica.SIunits.Conversions.NonSIunits;
|
|---|
| 5615 | extends Modelica.Icons.Package;
|
|---|
| 5616 |
|
|---|
| 5617 | final constant Real pi=2*Modelica.Math.asin(1.0);
|
|---|
| 5618 |
|
|---|
| 5619 | final constant Real eps=ModelicaServices.Machine.eps
|
|---|
| 5620 | "Biggest number such that 1.0 + eps = 1.0";
|
|---|
| 5621 |
|
|---|
| 5622 | final constant Real inf=ModelicaServices.Machine.inf
|
|---|
| 5623 | "Biggest Real number such that inf and -inf are representable on the machine";
|
|---|
| 5624 |
|
|---|
| 5625 | final constant Real R(final unit="J/(mol.K)") = 8.314472
|
|---|
| 5626 | "Molar gas constant";
|
|---|
| 5627 |
|
|---|
| 5628 | final constant NonSI.Temperature_degC T_zero=-273.15
|
|---|
| 5629 | "Absolute zero temperature";
|
|---|
| 5630 | annotation (
|
|---|
| 5631 | Documentation(info="<html>
|
|---|
| 5632 | <p>
|
|---|
| 5633 | This package provides often needed constants from mathematics, machine
|
|---|
| 5634 | dependent constants and constants from nature. The latter constants
|
|---|
| 5635 | (name, value, description) are from the following source:
|
|---|
| 5636 | </p>
|
|---|
| 5637 |
|
|---|
| 5638 | <dl>
|
|---|
| 5639 | <dt>Peter J. Mohr and Barry N. Taylor (1999):</dt>
|
|---|
| 5640 | <dd><b>CODATA Recommended Values of the Fundamental Physical Constants: 1998</b>.
|
|---|
| 5641 | Journal of Physical and Chemical Reference Data, Vol. 28, No. 6, 1999 and
|
|---|
| 5642 | Reviews of Modern Physics, Vol. 72, No. 2, 2000. See also <a href=
|
|---|
| 5643 | \"http://physics.nist.gov/cuu/Constants/\">http://physics.nist.gov/cuu/Constants/</a></dd>
|
|---|
| 5644 | </dl>
|
|---|
| 5645 |
|
|---|
| 5646 | <p>CODATA is the Committee on Data for Science and Technology.</p>
|
|---|
| 5647 |
|
|---|
| 5648 | <dl>
|
|---|
| 5649 | <dt><b>Main Author:</b></dt>
|
|---|
| 5650 | <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
|
|---|
| 5651 | Deutsches Zentrum für Luft und Raumfahrt e. V. (DLR)<br>
|
|---|
| 5652 | Oberpfaffenhofen<br>
|
|---|
| 5653 | Postfach 11 16<br>
|
|---|
| 5654 | D-82230 Weßling<br>
|
|---|
| 5655 | email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
|
|---|
| 5656 | </dl>
|
|---|
| 5657 |
|
|---|
| 5658 | <p>
|
|---|
| 5659 | Copyright © 1998-2013, Modelica Association and DLR.
|
|---|
| 5660 | </p>
|
|---|
| 5661 | <p>
|
|---|
| 5662 | <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>
|
|---|
| 5663 | </p>
|
|---|
| 5664 | </html>", revisions="<html>
|
|---|
| 5665 | <ul>
|
|---|
| 5666 | <li><i>Nov 8, 2004</i>
|
|---|
| 5667 | by <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
|
|---|
| 5668 | Constants updated according to 2002 CODATA values.</li>
|
|---|
| 5669 | <li><i>Dec 9, 1999</i>
|
|---|
| 5670 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 5671 | Constants updated according to 1998 CODATA values. Using names, values
|
|---|
| 5672 | and description text from this source. Included magnetic and
|
|---|
| 5673 | electric constant.</li>
|
|---|
| 5674 | <li><i>Sep 18, 1999</i>
|
|---|
| 5675 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 5676 | Constants eps, inf, small introduced.</li>
|
|---|
| 5677 | <li><i>Nov 15, 1997</i>
|
|---|
| 5678 | by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
|
|---|
| 5679 | Realized.</li>
|
|---|
| 5680 | </ul>
|
|---|
| 5681 | </html>"),
|
|---|
| 5682 | Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
|
|---|
| 5683 | Polygon(
|
|---|
| 5684 | origin={-9.2597,25.6673},
|
|---|
| 5685 | fillColor={102,102,102},
|
|---|
| 5686 | pattern=LinePattern.None,
|
|---|
| 5687 | fillPattern=FillPattern.Solid,
|
|---|
| 5688 | 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}},
|
|---|
| 5689 | smooth=Smooth.Bezier),
|
|---|
| 5690 | Polygon(
|
|---|
| 5691 | origin={-19.9923,-8.3993},
|
|---|
| 5692 | fillColor={102,102,102},
|
|---|
| 5693 | pattern=LinePattern.None,
|
|---|
| 5694 | fillPattern=FillPattern.Solid,
|
|---|
| 5695 | 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.986,37.145},{9.986,37.145}},
|
|---|
| 5696 | smooth=Smooth.Bezier),
|
|---|
| 5697 | Polygon(
|
|---|
| 5698 | origin={23.753,-11.5422},
|
|---|
| 5699 | fillColor={102,102,102},
|
|---|
| 5700 | pattern=LinePattern.None,
|
|---|
| 5701 | fillPattern=FillPattern.Solid,
|
|---|
| 5702 | 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.071},{13.336,0.071},{7.515,-9.983},{-3.134,-7.271},{-2.671,41.214},{-2.671,41.214}},
|
|---|
| 5703 | smooth=Smooth.Bezier)}));
|
|---|
| 5704 | end Constants;
|
|---|
| 5705 |
|
|---|
| 5706 | package Icons "Library of icons"
|
|---|
| 5707 | extends Icons.Package;
|
|---|
| 5708 |
|
|---|
| 5709 | partial package ExamplesPackage
|
|---|
| 5710 | "Icon for packages containing runnable examples"
|
|---|
| 5711 | extends Modelica.Icons.Package;
|
|---|
| 5712 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5713 | -100},{100,100}}), graphics={
|
|---|
| 5714 | Polygon(
|
|---|
| 5715 | origin={8.0,14.0},
|
|---|
| 5716 | lineColor={78,138,73},
|
|---|
| 5717 | fillColor={78,138,73},
|
|---|
| 5718 | pattern=LinePattern.None,
|
|---|
| 5719 | fillPattern=FillPattern.Solid,
|
|---|
| 5720 | points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Documentation(info="<html>
|
|---|
| 5721 | <p>This icon indicates a package that contains executable examples.</p>
|
|---|
| 5722 | </html>"));
|
|---|
| 5723 | end ExamplesPackage;
|
|---|
| 5724 |
|
|---|
| 5725 | partial package Package "Icon for standard packages"
|
|---|
| 5726 |
|
|---|
| 5727 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5728 | Rectangle(
|
|---|
| 5729 | lineColor={200,200,200},
|
|---|
| 5730 | fillColor={248,248,248},
|
|---|
| 5731 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 5732 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 5733 | radius=25.0),
|
|---|
| 5734 | Rectangle(
|
|---|
| 5735 | lineColor={128,128,128},
|
|---|
| 5736 | fillPattern=FillPattern.None,
|
|---|
| 5737 | extent={{-100.0,-100.0},{100.0,100.0}},
|
|---|
| 5738 | radius=25.0)}), Documentation(info="<html>
|
|---|
| 5739 | <p>Standard package icon.</p>
|
|---|
| 5740 | </html>"));
|
|---|
| 5741 | end Package;
|
|---|
| 5742 |
|
|---|
| 5743 | partial package VariantsPackage "Icon for package containing variants"
|
|---|
| 5744 | extends Modelica.Icons.Package;
|
|---|
| 5745 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
|
|---|
| 5746 | {100,100}}), graphics={
|
|---|
| 5747 | Ellipse(
|
|---|
| 5748 | origin={10.0,10.0},
|
|---|
| 5749 | fillColor={76,76,76},
|
|---|
| 5750 | pattern=LinePattern.None,
|
|---|
| 5751 | fillPattern=FillPattern.Solid,
|
|---|
| 5752 | extent={{-80.0,-80.0},{-20.0,-20.0}}),
|
|---|
| 5753 | Ellipse(
|
|---|
| 5754 | origin={10.0,10.0},
|
|---|
| 5755 | pattern=LinePattern.None,
|
|---|
| 5756 | fillPattern=FillPattern.Solid,
|
|---|
| 5757 | extent={{0.0,-80.0},{60.0,-20.0}}),
|
|---|
| 5758 | Ellipse(
|
|---|
| 5759 | origin={10.0,10.0},
|
|---|
| 5760 | fillColor={128,128,128},
|
|---|
| 5761 | pattern=LinePattern.None,
|
|---|
| 5762 | fillPattern=FillPattern.Solid,
|
|---|
| 5763 | extent={{0.0,0.0},{60.0,60.0}}),
|
|---|
| 5764 | Ellipse(
|
|---|
| 5765 | origin={10.0,10.0},
|
|---|
| 5766 | lineColor={128,128,128},
|
|---|
| 5767 | fillColor={255,255,255},
|
|---|
| 5768 | fillPattern=FillPattern.Solid,
|
|---|
| 5769 | extent={{-80.0,0.0},{-20.0,60.0}})}),
|
|---|
| 5770 | Documentation(info="<html>
|
|---|
| 5771 | <p>This icon shall be used for a package/library that contains several variants of one components.</p>
|
|---|
| 5772 | </html>"));
|
|---|
| 5773 | end VariantsPackage;
|
|---|
| 5774 |
|
|---|
| 5775 | partial package InterfacesPackage "Icon for packages containing interfaces"
|
|---|
| 5776 | extends Modelica.Icons.Package;
|
|---|
| 5777 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5778 | -100},{100,100}}), graphics={
|
|---|
| 5779 | Polygon(origin={20.0,0.0},
|
|---|
| 5780 | lineColor={64,64,64},
|
|---|
| 5781 | fillColor={255,255,255},
|
|---|
| 5782 | fillPattern=FillPattern.Solid,
|
|---|
| 5783 | 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}}),
|
|---|
| 5784 | Polygon(fillColor={102,102,102},
|
|---|
| 5785 | pattern=LinePattern.None,
|
|---|
| 5786 | fillPattern=FillPattern.Solid,
|
|---|
| 5787 | 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}})}),
|
|---|
| 5788 | Documentation(info="<html>
|
|---|
| 5789 | <p>This icon indicates packages containing interfaces.</p>
|
|---|
| 5790 | </html>"));
|
|---|
| 5791 | end InterfacesPackage;
|
|---|
| 5792 |
|
|---|
| 5793 | partial package SourcesPackage "Icon for packages containing sources"
|
|---|
| 5794 | extends Modelica.Icons.Package;
|
|---|
| 5795 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5796 | -100},{100,100}}), graphics={
|
|---|
| 5797 | Polygon(origin={23.3333,0.0},
|
|---|
| 5798 | fillColor={128,128,128},
|
|---|
| 5799 | pattern=LinePattern.None,
|
|---|
| 5800 | fillPattern=FillPattern.Solid,
|
|---|
| 5801 | points={{-23.333,30.0},{46.667,0.0},{-23.333,-30.0}}),
|
|---|
| 5802 | Rectangle(
|
|---|
| 5803 | fillColor= {128,128,128},
|
|---|
| 5804 | pattern= LinePattern.None,
|
|---|
| 5805 | fillPattern= FillPattern.Solid,
|
|---|
| 5806 | extent= {{-70,-4.5},{0,4.5}})}),
|
|---|
| 5807 | Documentation(info="<html>
|
|---|
| 5808 | <p>This icon indicates a package which contains sources.</p>
|
|---|
| 5809 | </html>"));
|
|---|
| 5810 | end SourcesPackage;
|
|---|
| 5811 |
|
|---|
| 5812 | partial package SensorsPackage "Icon for packages containing sensors"
|
|---|
| 5813 | extends Modelica.Icons.Package;
|
|---|
| 5814 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5815 | -100},{100,100}}), graphics={
|
|---|
| 5816 | Ellipse(origin={0.0,-30.0},
|
|---|
| 5817 | fillColor={255,255,255},
|
|---|
| 5818 | extent={{-90.0,-90.0},{90.0,90.0}},
|
|---|
| 5819 | startAngle=20.0,
|
|---|
| 5820 | endAngle=160.0),
|
|---|
| 5821 | Ellipse(origin={0.0,-30.0},
|
|---|
| 5822 | fillColor={128,128,128},
|
|---|
| 5823 | pattern=LinePattern.None,
|
|---|
| 5824 | fillPattern=FillPattern.Solid,
|
|---|
| 5825 | extent={{-20.0,-20.0},{20.0,20.0}}),
|
|---|
| 5826 | Line(origin={0.0,-30.0},
|
|---|
| 5827 | points={{0.0,60.0},{0.0,90.0}}),
|
|---|
| 5828 | Ellipse(origin={-0.0,-30.0},
|
|---|
| 5829 | fillColor={64,64,64},
|
|---|
| 5830 | pattern=LinePattern.None,
|
|---|
| 5831 | fillPattern=FillPattern.Solid,
|
|---|
| 5832 | extent={{-10.0,-10.0},{10.0,10.0}}),
|
|---|
| 5833 | Polygon(
|
|---|
| 5834 | origin={-0.0,-30.0},
|
|---|
| 5835 | rotation=-35.0,
|
|---|
| 5836 | fillColor={64,64,64},
|
|---|
| 5837 | pattern=LinePattern.None,
|
|---|
| 5838 | fillPattern=FillPattern.Solid,
|
|---|
| 5839 | points={{-7.0,0.0},{-3.0,85.0},{0.0,90.0},{3.0,85.0},{7.0,0.0}})}),
|
|---|
| 5840 | Documentation(info="<html>
|
|---|
| 5841 | <p>This icon indicates a package containing sensors.</p>
|
|---|
| 5842 | </html>"));
|
|---|
| 5843 | end SensorsPackage;
|
|---|
| 5844 |
|
|---|
| 5845 | partial package TypesPackage
|
|---|
| 5846 | "Icon for packages containing type definitions"
|
|---|
| 5847 | extends Modelica.Icons.Package;
|
|---|
| 5848 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5849 | -100},{100,100}}), graphics={Polygon(
|
|---|
| 5850 | origin={-12.167,-23},
|
|---|
| 5851 | fillColor={128,128,128},
|
|---|
| 5852 | pattern=LinePattern.None,
|
|---|
| 5853 | fillPattern=FillPattern.Solid,
|
|---|
| 5854 | points={{12.167,65},{14.167,93},{36.167,89},{24.167,20},{4.167,-30},
|
|---|
| 5855 | {14.167,-30},{24.167,-30},{24.167,-40},{-5.833,-50},{-15.833,
|
|---|
| 5856 | -30},{4.167,20},{12.167,65}},
|
|---|
| 5857 | smooth=Smooth.Bezier,
|
|---|
| 5858 | lineColor={0,0,0}), Polygon(
|
|---|
| 5859 | origin={2.7403,1.6673},
|
|---|
| 5860 | fillColor={128,128,128},
|
|---|
| 5861 | pattern=LinePattern.None,
|
|---|
| 5862 | fillPattern=FillPattern.Solid,
|
|---|
| 5863 | points={{49.2597,22.3327},{31.2597,24.3327},{7.2597,18.3327},{-26.7403,
|
|---|
| 5864 | 10.3327},{-46.7403,14.3327},{-48.7403,6.3327},{-32.7403,0.3327},{-6.7403,
|
|---|
| 5865 | 4.3327},{33.2597,14.3327},{49.2597,14.3327},{49.2597,22.3327}},
|
|---|
| 5866 | smooth=Smooth.Bezier)}));
|
|---|
| 5867 | end TypesPackage;
|
|---|
| 5868 |
|
|---|
| 5869 | partial package IconsPackage "Icon for packages containing icons"
|
|---|
| 5870 | extends Modelica.Icons.Package;
|
|---|
| 5871 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5872 | -100},{100,100}}), graphics={Polygon(
|
|---|
| 5873 | origin={-8.167,-17},
|
|---|
| 5874 | fillColor={128,128,128},
|
|---|
| 5875 | pattern=LinePattern.None,
|
|---|
| 5876 | fillPattern=FillPattern.Solid,
|
|---|
| 5877 | points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
|
|---|
| 5878 | 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
|
|---|
| 5879 | -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
|
|---|
| 5880 | smooth=Smooth.Bezier,
|
|---|
| 5881 | lineColor={0,0,0}), Ellipse(
|
|---|
| 5882 | origin={-0.5,56.5},
|
|---|
| 5883 | fillColor={128,128,128},
|
|---|
| 5884 | pattern=LinePattern.None,
|
|---|
| 5885 | fillPattern=FillPattern.Solid,
|
|---|
| 5886 | extent={{-12.5,-12.5},{12.5,12.5}},
|
|---|
| 5887 | lineColor={0,0,0})}));
|
|---|
| 5888 | end IconsPackage;
|
|---|
| 5889 |
|
|---|
| 5890 | partial package MaterialPropertiesPackage
|
|---|
| 5891 | "Icon for package containing property classes"
|
|---|
| 5892 | extends Modelica.Icons.Package;
|
|---|
| 5893 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5894 | -100},{100,100}}), graphics={
|
|---|
| 5895 | Ellipse(
|
|---|
| 5896 | lineColor={102,102,102},
|
|---|
| 5897 | fillColor={204,204,204},
|
|---|
| 5898 | pattern=LinePattern.None,
|
|---|
| 5899 | fillPattern=FillPattern.Sphere,
|
|---|
| 5900 | extent={{-60.0,-60.0},{60.0,60.0}})}),
|
|---|
| 5901 | Documentation(info="<html>
|
|---|
| 5902 | <p>This icon indicates a package that contains properties</p>
|
|---|
| 5903 | </html>"));
|
|---|
| 5904 | end MaterialPropertiesPackage;
|
|---|
| 5905 |
|
|---|
| 5906 | partial class RotationalSensor
|
|---|
| 5907 | "Icon representing a round measurement device"
|
|---|
| 5908 |
|
|---|
| 5909 | annotation (
|
|---|
| 5910 | Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5911 | Ellipse(
|
|---|
| 5912 | fillColor={245,245,245},
|
|---|
| 5913 | fillPattern=FillPattern.Solid,
|
|---|
| 5914 | extent={{-70.0,-70.0},{70.0,70.0}}),
|
|---|
| 5915 | Line(points={{0.0,70.0},{0.0,40.0}}),
|
|---|
| 5916 | Line(points={{22.9,32.8},{40.2,57.3}}),
|
|---|
| 5917 | Line(points={{-22.9,32.8},{-40.2,57.3}}),
|
|---|
| 5918 | Line(points={{37.6,13.7},{65.8,23.9}}),
|
|---|
| 5919 | Line(points={{-37.6,13.7},{-65.8,23.9}}),
|
|---|
| 5920 | Ellipse(
|
|---|
| 5921 | lineColor={64,64,64},
|
|---|
| 5922 | fillColor={255,255,255},
|
|---|
| 5923 | extent={{-12.0,-12.0},{12.0,12.0}}),
|
|---|
| 5924 | Polygon(
|
|---|
| 5925 | origin={0,0},
|
|---|
| 5926 | rotation=-17.5,
|
|---|
| 5927 | fillColor={64,64,64},
|
|---|
| 5928 | pattern=LinePattern.None,
|
|---|
| 5929 | fillPattern=FillPattern.Solid,
|
|---|
| 5930 | points={{-5.0,0.0},{-2.0,60.0},{0.0,65.0},{2.0,60.0},{5.0,0.0}}),
|
|---|
| 5931 | Ellipse(
|
|---|
| 5932 | fillColor={64,64,64},
|
|---|
| 5933 | pattern=LinePattern.None,
|
|---|
| 5934 | fillPattern=FillPattern.Solid,
|
|---|
| 5935 | extent={{-7.0,-7.0},{7.0,7.0}})}),
|
|---|
| 5936 | Documentation(info="<html>
|
|---|
| 5937 | <p>
|
|---|
| 5938 | This icon is designed for a <b>rotational sensor</b> model.
|
|---|
| 5939 | </p>
|
|---|
| 5940 | </html>"));
|
|---|
| 5941 | end RotationalSensor;
|
|---|
| 5942 |
|
|---|
| 5943 | partial function Function "Icon for functions"
|
|---|
| 5944 |
|
|---|
| 5945 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5946 | Text(
|
|---|
| 5947 | lineColor={0,0,255},
|
|---|
| 5948 | extent={{-150,105},{150,145}},
|
|---|
| 5949 | textString="%name"),
|
|---|
| 5950 | Ellipse(
|
|---|
| 5951 | lineColor= {108,88,49},
|
|---|
| 5952 | fillColor= {255,215,136},
|
|---|
| 5953 | fillPattern= FillPattern.Solid,
|
|---|
| 5954 | extent= {{-100,-100},{100,100}}),
|
|---|
| 5955 | Text(
|
|---|
| 5956 | lineColor={108,88,49},
|
|---|
| 5957 | extent={{-90.0,-90.0},{90.0,90.0}},
|
|---|
| 5958 | textString="f")}),
|
|---|
| 5959 | Documentation(info="<html>
|
|---|
| 5960 | <p>This icon indicates Modelica functions.</p>
|
|---|
| 5961 | </html>"));
|
|---|
| 5962 | end Function;
|
|---|
| 5963 |
|
|---|
| 5964 | partial record Record "Icon for records"
|
|---|
| 5965 |
|
|---|
| 5966 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 5967 | Text(
|
|---|
| 5968 | lineColor={0,0,255},
|
|---|
| 5969 | extent={{-150,60},{150,100}},
|
|---|
| 5970 | textString="%name"),
|
|---|
| 5971 | Rectangle(
|
|---|
| 5972 | origin={0.0,-25.0},
|
|---|
| 5973 | lineColor={64,64,64},
|
|---|
| 5974 | fillColor={255,215,136},
|
|---|
| 5975 | fillPattern=FillPattern.Solid,
|
|---|
| 5976 | extent={{-100.0,-75.0},{100.0,75.0}},
|
|---|
| 5977 | radius=25.0),
|
|---|
| 5978 | Line(
|
|---|
| 5979 | points={{-100.0,0.0},{100.0,0.0}},
|
|---|
| 5980 | color={64,64,64}),
|
|---|
| 5981 | Line(
|
|---|
| 5982 | origin={0.0,-50.0},
|
|---|
| 5983 | points={{-100.0,0.0},{100.0,0.0}},
|
|---|
| 5984 | color={64,64,64}),
|
|---|
| 5985 | Line(
|
|---|
| 5986 | origin={0.0,-25.0},
|
|---|
| 5987 | points={{0.0,75.0},{0.0,-75.0}},
|
|---|
| 5988 | color={64,64,64})}), Documentation(info="<html>
|
|---|
| 5989 | <p>
|
|---|
| 5990 | This icon is indicates a record.
|
|---|
| 5991 | </p>
|
|---|
| 5992 | </html>"));
|
|---|
| 5993 | end Record;
|
|---|
| 5994 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 5995 | -100},{100,100}}), graphics={Polygon(
|
|---|
| 5996 | origin={-8.167,-17},
|
|---|
| 5997 | fillColor={128,128,128},
|
|---|
| 5998 | pattern=LinePattern.None,
|
|---|
| 5999 | fillPattern=FillPattern.Solid,
|
|---|
| 6000 | points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
|
|---|
| 6001 | 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
|
|---|
| 6002 | -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
|
|---|
| 6003 | smooth=Smooth.Bezier,
|
|---|
| 6004 | lineColor={0,0,0}), Ellipse(
|
|---|
| 6005 | origin={-0.5,56.5},
|
|---|
| 6006 | fillColor={128,128,128},
|
|---|
| 6007 | pattern=LinePattern.None,
|
|---|
| 6008 | fillPattern=FillPattern.Solid,
|
|---|
| 6009 | extent={{-12.5,-12.5},{12.5,12.5}},
|
|---|
| 6010 | lineColor={0,0,0})}), Documentation(info="<html>
|
|---|
| 6011 | <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 "extends" or by directly copying the "icon" layer. </p>
|
|---|
| 6012 |
|
|---|
| 6013 | <h4>Main Authors:</h4>
|
|---|
| 6014 |
|
|---|
| 6015 | <dl>
|
|---|
| 6016 | <dt><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a></dt>
|
|---|
| 6017 | <dd>Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)</dd>
|
|---|
| 6018 | <dd>Oberpfaffenhofen</dd>
|
|---|
| 6019 | <dd>Postfach 1116</dd>
|
|---|
| 6020 | <dd>D-82230 Wessling</dd>
|
|---|
| 6021 | <dd>email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
|
|---|
| 6022 | <dt>Christian Kral</dt>
|
|---|
| 6023 | <dd><a href=\"http://www.ait.ac.at/\">Austrian Institute of Technology, AIT</a></dd>
|
|---|
| 6024 | <dd>Mobility Department</dd><dd>Giefinggasse 2</dd>
|
|---|
| 6025 | <dd>1210 Vienna, Austria</dd>
|
|---|
| 6026 | <dd>email: <a href=\"mailto:dr.christian.kral@gmail.com\">dr.christian.kral@gmail.com</a></dd>
|
|---|
| 6027 | <dt>Johan Andreasson</dt>
|
|---|
| 6028 | <dd><a href=\"http://www.modelon.se/\">Modelon AB</a></dd>
|
|---|
| 6029 | <dd>Ideon Science Park</dd>
|
|---|
| 6030 | <dd>22370 Lund, Sweden</dd>
|
|---|
| 6031 | <dd>email: <a href=\"mailto:johan.andreasson@modelon.se\">johan.andreasson@modelon.se</a></dd>
|
|---|
| 6032 | </dl>
|
|---|
| 6033 |
|
|---|
| 6034 | <p>Copyright © 1998-2013, Modelica Association, DLR, AIT, and Modelon AB. </p>
|
|---|
| 6035 | <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>
|
|---|
| 6036 | </html>"));
|
|---|
| 6037 | end Icons;
|
|---|
| 6038 |
|
|---|
| 6039 | package SIunits
|
|---|
| 6040 | "Library of type and unit definitions based on SI units according to ISO 31-1992"
|
|---|
| 6041 | extends Modelica.Icons.Package;
|
|---|
| 6042 |
|
|---|
| 6043 | package Icons "Icons for SIunits"
|
|---|
| 6044 | extends Modelica.Icons.IconsPackage;
|
|---|
| 6045 |
|
|---|
| 6046 | partial function Conversion "Base icon for conversion functions"
|
|---|
| 6047 |
|
|---|
| 6048 | annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 6049 | -100},{100,100}}), graphics={
|
|---|
| 6050 | Rectangle(
|
|---|
| 6051 | extent={{-100,100},{100,-100}},
|
|---|
| 6052 | lineColor={191,0,0},
|
|---|
| 6053 | fillColor={255,255,255},
|
|---|
| 6054 | fillPattern=FillPattern.Solid),
|
|---|
| 6055 | Line(points={{-90,0},{30,0}}, color={191,0,0}),
|
|---|
| 6056 | Polygon(
|
|---|
| 6057 | points={{90,0},{30,20},{30,-20},{90,0}},
|
|---|
| 6058 | lineColor={191,0,0},
|
|---|
| 6059 | fillColor={191,0,0},
|
|---|
| 6060 | fillPattern=FillPattern.Solid),
|
|---|
| 6061 | Text(
|
|---|
| 6062 | extent={{-115,155},{115,105}},
|
|---|
| 6063 | textString="%name",
|
|---|
| 6064 | lineColor={0,0,255})}));
|
|---|
| 6065 | end Conversion;
|
|---|
| 6066 | end Icons;
|
|---|
| 6067 |
|
|---|
| 6068 | package Conversions
|
|---|
| 6069 | "Conversion functions to/from non SI units and type definitions of non SI units"
|
|---|
| 6070 | extends Modelica.Icons.Package;
|
|---|
| 6071 |
|
|---|
| 6072 | package NonSIunits "Type definitions of non SI units"
|
|---|
| 6073 | extends Modelica.Icons.Package;
|
|---|
| 6074 |
|
|---|
| 6075 | type Temperature_degC = Real (final quantity="ThermodynamicTemperature",
|
|---|
| 6076 | final unit="degC")
|
|---|
| 6077 | "Absolute temperature in degree Celsius (for relative temperature use SIunits.TemperatureDifference)"
|
|---|
| 6078 | annotation(absoluteValue=true);
|
|---|
| 6079 |
|
|---|
| 6080 | type AngularVelocity_rpm = Real (final quantity="AngularVelocity", final unit=
|
|---|
| 6081 | "1/min")
|
|---|
| 6082 | "Angular velocity in revolutions per minute. Alias unit names that are outside of the SI system: rpm, r/min, rev/min";
|
|---|
| 6083 |
|
|---|
| 6084 | type Pressure_bar = Real (final quantity="Pressure", final unit="bar")
|
|---|
| 6085 | "Absolute pressure in bar";
|
|---|
| 6086 | annotation (Documentation(info="<HTML>
|
|---|
| 6087 | <p>
|
|---|
| 6088 | This package provides predefined types, such as <b>Angle_deg</b> (angle in
|
|---|
| 6089 | degree), <b>AngularVelocity_rpm</b> (angular velocity in revolutions per
|
|---|
| 6090 | minute) or <b>Temperature_degF</b> (temperature in degree Fahrenheit),
|
|---|
| 6091 | which are in common use but are not part of the international standard on
|
|---|
| 6092 | units according to ISO 31-1992 \"General principles concerning quantities,
|
|---|
| 6093 | units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
|
|---|
| 6094 | the use of their multiples and of certain other units\".</p>
|
|---|
| 6095 | <p>If possible, the types in this package should not be used. Use instead
|
|---|
| 6096 | types of package Modelica.SIunits. For more information on units, see also
|
|---|
| 6097 | the book of Francois Cardarelli <b>Scientific Unit Conversion - A
|
|---|
| 6098 | Practical Guide to Metrication</b> (Springer 1997).</p>
|
|---|
| 6099 | <p>Some units, such as <b>Temperature_degC/Temp_C</b> are both defined in
|
|---|
| 6100 | Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
|
|---|
| 6101 | definitions have been placed erroneously in Modelica.SIunits although they
|
|---|
| 6102 | are not SIunits. For backward compatibility, these type definitions are
|
|---|
| 6103 | still kept in Modelica.SIunits.</p>
|
|---|
| 6104 | </html>"), Icon(coordinateSystem(extent={{-100,-100},{100,100}}), graphics={
|
|---|
| 6105 | Text(
|
|---|
| 6106 | origin={15.0,51.8518},
|
|---|
| 6107 | extent={{-105.0,-86.8518},{75.0,-16.8518}},
|
|---|
| 6108 | lineColor={0,0,0},
|
|---|
| 6109 | textString="[km/h]")}));
|
|---|
| 6110 | end NonSIunits;
|
|---|
| 6111 |
|
|---|
| 6112 | function to_degC "Convert from Kelvin to degCelsius"
|
|---|
| 6113 | extends Modelica.SIunits.Icons.Conversion;
|
|---|
| 6114 | input Temperature Kelvin "Kelvin value";
|
|---|
| 6115 | output NonSIunits.Temperature_degC Celsius "Celsius value";
|
|---|
| 6116 | algorithm
|
|---|
| 6117 | Celsius := Kelvin + Modelica.Constants.T_zero;
|
|---|
| 6118 | annotation (Inline=true,Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 6119 | -100},{100,100}}), graphics={Text(
|
|---|
| 6120 | extent={{-20,100},{-100,20}},
|
|---|
| 6121 | lineColor={0,0,0},
|
|---|
| 6122 | textString="K"), Text(
|
|---|
| 6123 | extent={{100,-20},{20,-100}},
|
|---|
| 6124 | lineColor={0,0,0},
|
|---|
| 6125 | textString="degC")}));
|
|---|
| 6126 | end to_degC;
|
|---|
| 6127 |
|
|---|
| 6128 | function from_degC "Convert from degCelsius to Kelvin"
|
|---|
| 6129 | extends Modelica.SIunits.Icons.Conversion;
|
|---|
| 6130 | input NonSIunits.Temperature_degC Celsius "Celsius value";
|
|---|
| 6131 | output Temperature Kelvin "Kelvin value";
|
|---|
| 6132 | algorithm
|
|---|
| 6133 | Kelvin := Celsius - Modelica.Constants.T_zero;
|
|---|
| 6134 | annotation (Inline=true,Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 6135 | -100},{100,100}}), graphics={Text(
|
|---|
| 6136 | extent={{-20,100},{-100,20}},
|
|---|
| 6137 | lineColor={0,0,0},
|
|---|
| 6138 | textString="degC"), Text(
|
|---|
| 6139 | extent={{100,-20},{20,-100}},
|
|---|
| 6140 | lineColor={0,0,0},
|
|---|
| 6141 | textString="K")}));
|
|---|
| 6142 | end from_degC;
|
|---|
| 6143 |
|
|---|
| 6144 | function to_rpm
|
|---|
| 6145 | "Convert from radian per second to revolutions per minute"
|
|---|
| 6146 | extends Modelica.SIunits.Icons.Conversion;
|
|---|
| 6147 | input AngularVelocity rs "radian per second value";
|
|---|
| 6148 | output NonSIunits.AngularVelocity_rpm rpm
|
|---|
| 6149 | "revolutions per minute value";
|
|---|
| 6150 | algorithm
|
|---|
| 6151 | rpm := (30/Modelica.Constants.pi)*rs;
|
|---|
| 6152 | annotation (Inline=true,Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 6153 | -100},{100,100}}), graphics={Text(
|
|---|
| 6154 | extent={{30,100},{-100,50}},
|
|---|
| 6155 | lineColor={0,0,0},
|
|---|
| 6156 | textString="rad/s"), Text(
|
|---|
| 6157 | extent={{100,-52},{-40,-98}},
|
|---|
| 6158 | lineColor={0,0,0},
|
|---|
| 6159 | textString="1/min")}));
|
|---|
| 6160 | end to_rpm;
|
|---|
| 6161 |
|
|---|
| 6162 | function to_bar "Convert from Pascal to bar"
|
|---|
| 6163 | extends Modelica.SIunits.Icons.Conversion;
|
|---|
| 6164 | input Pressure Pa "Pascal value";
|
|---|
| 6165 | output NonSIunits.Pressure_bar bar "bar value";
|
|---|
| 6166 | algorithm
|
|---|
| 6167 | bar := Pa/1e5;
|
|---|
| 6168 | annotation (Inline=true,Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,
|
|---|
| 6169 | -100},{100,100}}), graphics={Text(
|
|---|
| 6170 | extent={{-12,100},{-100,56}},
|
|---|
| 6171 | lineColor={0,0,0},
|
|---|
| 6172 | textString="Pa"), Text(
|
|---|
| 6173 | extent={{98,-52},{-4,-100}},
|
|---|
| 6174 | lineColor={0,0,0},
|
|---|
| 6175 | textString="bar")}));
|
|---|
| 6176 | end to_bar;
|
|---|
| 6177 | annotation ( Documentation(info="<HTML>
|
|---|
| 6178 | <p>This package provides conversion functions from the non SI Units
|
|---|
| 6179 | defined in package Modelica.SIunits.Conversions.NonSIunits to the
|
|---|
| 6180 | corresponding SI Units defined in package Modelica.SIunits and vice
|
|---|
| 6181 | versa. It is recommended to use these functions in the following
|
|---|
| 6182 | way (note, that all functions have one Real input and one Real output
|
|---|
| 6183 | argument):</p>
|
|---|
| 6184 | <pre>
|
|---|
| 6185 | <b>import</b> SI = Modelica.SIunits;
|
|---|
| 6186 | <b>import</b> Modelica.SIunits.Conversions.*;
|
|---|
| 6187 | ...
|
|---|
| 6188 | <b>parameter</b> SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin
|
|---|
| 6189 | <b>parameter</b> SI.Angle phi = from_deg(180); // convert 180 degree to radian
|
|---|
| 6190 | <b>parameter</b> SI.AngularVelocity w = from_rpm(3600); // convert 3600 revolutions per minutes
|
|---|
| 6191 | // to radian per seconds
|
|---|
| 6192 | </pre>
|
|---|
| 6193 |
|
|---|
| 6194 | </html>"));
|
|---|
| 6195 | end Conversions;
|
|---|
| 6196 |
|
|---|
| 6197 | type Angle = Real (
|
|---|
| 6198 | final quantity="Angle",
|
|---|
| 6199 | final unit="rad",
|
|---|
| 6200 | displayUnit="deg");
|
|---|
| 6201 |
|
|---|
| 6202 | type Area = Real (final quantity="Area", final unit="m2");
|
|---|
| 6203 |
|
|---|
| 6204 | type Volume = Real (final quantity="Volume", final unit="m3");
|
|---|
| 6205 |
|
|---|
| 6206 | type Time = Real (final quantity="Time", final unit="s");
|
|---|
| 6207 |
|
|---|
| 6208 | type AngularVelocity = Real (
|
|---|
| 6209 | final quantity="AngularVelocity",
|
|---|
| 6210 | final unit="rad/s");
|
|---|
| 6211 |
|
|---|
| 6212 | type Velocity = Real (final quantity="Velocity", final unit="m/s");
|
|---|
| 6213 |
|
|---|
| 6214 | type Frequency = Real (final quantity="Frequency", final unit="Hz");
|
|---|
| 6215 |
|
|---|
| 6216 | type Mass = Real (
|
|---|
| 6217 | quantity="Mass",
|
|---|
| 6218 | final unit="kg",
|
|---|
| 6219 | min=0);
|
|---|
| 6220 |
|
|---|
| 6221 | type Density = Real (
|
|---|
| 6222 | final quantity="Density",
|
|---|
| 6223 | final unit="kg/m3",
|
|---|
| 6224 | displayUnit="g/cm3",
|
|---|
| 6225 | min=0.0);
|
|---|
| 6226 |
|
|---|
| 6227 | type MomentOfInertia = Real (final quantity="MomentOfInertia", final unit=
|
|---|
| 6228 | "kg.m2");
|
|---|
| 6229 |
|
|---|
| 6230 | type Torque = Real (final quantity="Torque", final unit="N.m");
|
|---|
| 6231 |
|
|---|
| 6232 | type Pressure = Real (
|
|---|
| 6233 | final quantity="Pressure",
|
|---|
| 6234 | final unit="Pa",
|
|---|
| 6235 | displayUnit="bar");
|
|---|
| 6236 |
|
|---|
| 6237 | type AbsolutePressure = Pressure (min=0.0, nominal = 1e5);
|
|---|
| 6238 |
|
|---|
| 6239 | type DynamicViscosity = Real (
|
|---|
| 6240 | final quantity="DynamicViscosity",
|
|---|
| 6241 | final unit="Pa.s",
|
|---|
| 6242 | min=0);
|
|---|
| 6243 |
|
|---|
| 6244 | type Power = Real (final quantity="Power", final unit="W");
|
|---|
| 6245 |
|
|---|
| 6246 | type MassFlowRate = Real (quantity="MassFlowRate", final unit="kg/s");
|
|---|
| 6247 |
|
|---|
| 6248 | type ThermodynamicTemperature = Real (
|
|---|
| 6249 | final quantity="ThermodynamicTemperature",
|
|---|
| 6250 | final unit="K",
|
|---|
| 6251 | min = 0.0,
|
|---|
| 6252 | start = 288.15,
|
|---|
| 6253 | nominal = 300,
|
|---|
| 6254 | displayUnit="degC")
|
|---|
| 6255 | "Absolute temperature (use type TemperatureDifference for relative temperatures)"
|
|---|
| 6256 | annotation(absoluteValue=true);
|
|---|
| 6257 |
|
|---|
| 6258 | type Temp_K = ThermodynamicTemperature;
|
|---|
| 6259 |
|
|---|
| 6260 | type Temperature = ThermodynamicTemperature;
|
|---|
| 6261 |
|
|---|
| 6262 | type Compressibility = Real (final quantity="Compressibility", final unit=
|
|---|
| 6263 | "1/Pa");
|
|---|
| 6264 |
|
|---|
| 6265 | type IsothermalCompressibility = Compressibility;
|
|---|
| 6266 |
|
|---|
| 6267 | type Heat = Real (final quantity="Energy", final unit="J");
|
|---|
| 6268 |
|
|---|
| 6269 | type ThermalConductivity = Real (final quantity="ThermalConductivity", final unit=
|
|---|
| 6270 | "W/(m.K)");
|
|---|
| 6271 |
|
|---|
| 6272 | type CoefficientOfHeatTransfer = Real (final quantity=
|
|---|
| 6273 | "CoefficientOfHeatTransfer", final unit="W/(m2.K)");
|
|---|
| 6274 |
|
|---|
| 6275 | type HeatCapacity = Real (final quantity="HeatCapacity", final unit="J/K");
|
|---|
| 6276 |
|
|---|
| 6277 | type SpecificHeatCapacity = Real (final quantity="SpecificHeatCapacity",
|
|---|
| 6278 | final unit="J/(kg.K)");
|
|---|
| 6279 |
|
|---|
| 6280 | type RatioOfSpecificHeatCapacities = Real (final quantity=
|
|---|
| 6281 | "RatioOfSpecificHeatCapacities", final unit="1");
|
|---|
| 6282 |
|
|---|
| 6283 | type SpecificEntropy = Real (final quantity="SpecificEntropy",
|
|---|
| 6284 | final unit="J/(kg.K)");
|
|---|
| 6285 |
|
|---|
| 6286 | type InternalEnergy = Heat;
|
|---|
| 6287 |
|
|---|
| 6288 | type SpecificEnergy = Real (final quantity="SpecificEnergy",
|
|---|
| 6289 | final unit="J/kg");
|
|---|
| 6290 |
|
|---|
| 6291 | type SpecificEnthalpy = SpecificEnergy;
|
|---|
| 6292 |
|
|---|
| 6293 | type DerDensityByEnthalpy = Real (final unit="kg.s2/m5");
|
|---|
| 6294 |
|
|---|
| 6295 | type DerDensityByPressure = Real (final unit="s2/m2");
|
|---|
| 6296 |
|
|---|
| 6297 | type DerDensityByTemperature = Real (final unit="kg/(m3.K)");
|
|---|
| 6298 |
|
|---|
| 6299 | type MolarMass = Real (final quantity="MolarMass", final unit="kg/mol",min=0);
|
|---|
| 6300 |
|
|---|
| 6301 | type MolarVolume = Real (final quantity="MolarVolume", final unit="m3/mol", min=0);
|
|---|
| 6302 |
|
|---|
| 6303 | type MassFraction = Real (final quantity="MassFraction", final unit="1",
|
|---|
| 6304 | min=0, max=1);
|
|---|
| 6305 |
|
|---|
| 6306 | type MoleFraction = Real (final quantity="MoleFraction", final unit="1",
|
|---|
| 6307 | min = 0, max = 1);
|
|---|
| 6308 |
|
|---|
| 6309 | type PrandtlNumber = Real (final quantity="PrandtlNumber", final unit="1");
|
|---|
| 6310 | annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
|
|---|
| 6311 | -100},{100,100}}), graphics={
|
|---|
| 6312 | Line(
|
|---|
| 6313 | points={{-66,78},{-66,-40}},
|
|---|
| 6314 | color={64,64,64},
|
|---|
| 6315 | smooth=Smooth.None),
|
|---|
| 6316 | Ellipse(
|
|---|
| 6317 | extent={{12,36},{68,-38}},
|
|---|
| 6318 | lineColor={64,64,64},
|
|---|
| 6319 | fillColor={175,175,175},
|
|---|
| 6320 | fillPattern=FillPattern.Solid),
|
|---|
| 6321 | Rectangle(
|
|---|
| 6322 | extent={{-74,78},{-66,-40}},
|
|---|
| 6323 | lineColor={64,64,64},
|
|---|
| 6324 | fillColor={175,175,175},
|
|---|
| 6325 | fillPattern=FillPattern.Solid),
|
|---|
| 6326 | Polygon(
|
|---|
| 6327 | points={{-66,-4},{-66,6},{-16,56},{-16,46},{-66,-4}},
|
|---|
| 6328 | lineColor={64,64,64},
|
|---|
| 6329 | smooth=Smooth.None,
|
|---|
| 6330 | fillColor={175,175,175},
|
|---|
| 6331 | fillPattern=FillPattern.Solid),
|
|---|
| 6332 | Polygon(
|
|---|
| 6333 | points={{-46,16},{-40,22},{-2,-40},{-10,-40},{-46,16}},
|
|---|
| 6334 | lineColor={64,64,64},
|
|---|
| 6335 | smooth=Smooth.None,
|
|---|
| 6336 | fillColor={175,175,175},
|
|---|
| 6337 | fillPattern=FillPattern.Solid),
|
|---|
| 6338 | Ellipse(
|
|---|
| 6339 | extent={{22,26},{58,-28}},
|
|---|
| 6340 | lineColor={64,64,64},
|
|---|
| 6341 | fillColor={255,255,255},
|
|---|
| 6342 | fillPattern=FillPattern.Solid),
|
|---|
| 6343 | Polygon(
|
|---|
| 6344 | points={{68,2},{68,-46},{64,-60},{58,-68},{48,-72},{18,-72},{18,-64},
|
|---|
| 6345 | {46,-64},{54,-60},{58,-54},{60,-46},{60,-26},{64,-20},{68,-6},{68,
|
|---|
| 6346 | 2}},
|
|---|
| 6347 | lineColor={64,64,64},
|
|---|
| 6348 | smooth=Smooth.Bezier,
|
|---|
| 6349 | fillColor={175,175,175},
|
|---|
| 6350 | fillPattern=FillPattern.Solid)}), Documentation(info="<html>
|
|---|
| 6351 | <p>This package provides predefined types, such as <i>Mass</i>,
|
|---|
| 6352 | <i>Angle</i>, <i>Time</i>, based on the international standard
|
|---|
| 6353 | on units, e.g.,
|
|---|
| 6354 | </p>
|
|---|
| 6355 |
|
|---|
| 6356 | <pre> <b>type</b> Angle = Real(<b>final</b> quantity = \"Angle\",
|
|---|
| 6357 | <b>final</b> unit = \"rad\",
|
|---|
| 6358 | displayUnit = \"deg\");
|
|---|
| 6359 | </pre>
|
|---|
| 6360 |
|
|---|
| 6361 | <p>
|
|---|
| 6362 | as well as conversion functions from non SI-units to SI-units
|
|---|
| 6363 | and vice versa in subpackage
|
|---|
| 6364 | <a href=\"modelica://Modelica.SIunits.Conversions\">Conversions</a>.
|
|---|
| 6365 | </p>
|
|---|
| 6366 |
|
|---|
| 6367 | <p>
|
|---|
| 6368 | For an introduction how units are used in the Modelica standard library
|
|---|
| 6369 | with package SIunits, have a look at:
|
|---|
| 6370 | <a href=\"modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
|
|---|
| 6371 | </p>
|
|---|
| 6372 |
|
|---|
| 6373 | <p>
|
|---|
| 6374 | Copyright © 1998-2013, Modelica Association and DLR.
|
|---|
| 6375 | </p>
|
|---|
| 6376 | <p>
|
|---|
| 6377 | <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>
|
|---|
| 6378 | </p>
|
|---|
| 6379 | </html>", revisions="<html>
|
|---|
| 6380 | <ul>
|
|---|
| 6381 | <li><i>May 25, 2011</i> by Stefan Wischhusen:<br/>Added molar units for energy and enthalpy.</li>
|
|---|
| 6382 | <li><i>Jan. 27, 2010</i> by Christian Kral:<br/>Added complex units.</li>
|
|---|
| 6383 | <li><i>Dec. 14, 2005</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Add User';s Guide and removed "min" values for Resistance and Conductance.</li>
|
|---|
| 6384 | <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>
|
|---|
| 6385 | <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 "final" removed from min and max values in order that these values can still be changed to narrow the allowed range of values.<br/>Quantity="Stress" removed from type "Stress", in order that a type "Stress" can be connected to a type "Pressure".</li>
|
|---|
| 6386 | <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>
|
|---|
| 6387 | <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>
|
|---|
| 6388 | <li><i>Aug 12, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Type "Pressure" renamed to "AbsolutePressure" and introduced a new type "Pressure" 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>
|
|---|
| 6389 | <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 "Compressibility" removed and appropriate "extends Heat" clause introduced in package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
|
|---|
| 6390 | <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>
|
|---|
| 6391 | <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>
|
|---|
| 6392 | </ul>
|
|---|
| 6393 | </html>"));
|
|---|
| 6394 | end SIunits;
|
|---|
| 6395 | annotation (
|
|---|
| 6396 | preferredView="info",
|
|---|
| 6397 | version="3.2.1",
|
|---|
| 6398 | versionBuild=2,
|
|---|
| 6399 | versionDate="2013-08-14",
|
|---|
| 6400 | dateModified = "2013-08-14 08:44:41Z",
|
|---|
| 6401 | revisionId="$Id:: package.mo 6947 2013-08-23 07:41:37Z #$",
|
|---|
| 6402 | uses(Complex(version="3.2.1"), ModelicaServices(version="3.2.1")),
|
|---|
| 6403 | conversion(
|
|---|
| 6404 | noneFromVersion="3.2",
|
|---|
| 6405 | noneFromVersion="3.1",
|
|---|
| 6406 | noneFromVersion="3.0.1",
|
|---|
| 6407 | noneFromVersion="3.0",
|
|---|
| 6408 | from(version="2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
|
|---|
| 6409 | from(version="2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
|
|---|
| 6410 | from(version="2.2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
|
|---|
| 6411 | from(version="2.2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")),
|
|---|
| 6412 | Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
|
|---|
| 6413 | Polygon(
|
|---|
| 6414 | origin={-6.9888,20.048},
|
|---|
| 6415 | fillColor={0,0,0},
|
|---|
| 6416 | pattern=LinePattern.None,
|
|---|
| 6417 | fillPattern=FillPattern.Solid,
|
|---|
| 6418 | 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.897,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.368,-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.092,-52.387},{-0.684,-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.047,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.939},{-77.678,-74.612},{-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}},
|
|---|
| 6419 | smooth=Smooth.Bezier),
|
|---|
| 6420 | Ellipse(
|
|---|
| 6421 | origin={40.8208,-37.7602},
|
|---|
| 6422 | fillColor={161,0,4},
|
|---|
| 6423 | pattern=LinePattern.None,
|
|---|
| 6424 | fillPattern=FillPattern.Solid,
|
|---|
| 6425 | extent={{-17.8562,-17.8563},{17.8563,17.8562}})}),
|
|---|
| 6426 | Documentation(info="<HTML>
|
|---|
| 6427 | <p>
|
|---|
| 6428 | Package <b>Modelica®</b> is a <b>standardized</b> and <b>free</b> package
|
|---|
| 6429 | that is developed together with the Modelica® language from the
|
|---|
| 6430 | Modelica Association, see
|
|---|
| 6431 | <a href=\"https://www.Modelica.org\">https://www.Modelica.org</a>.
|
|---|
| 6432 | It is also called <b>Modelica Standard Library</b>.
|
|---|
| 6433 | It provides model components in many domains that are based on
|
|---|
| 6434 | standardized interface definitions. Some typical examples are shown
|
|---|
| 6435 | in the next figure:
|
|---|
| 6436 | </p>
|
|---|
| 6437 |
|
|---|
| 6438 | <p>
|
|---|
| 6439 | <img src=\"modelica://Modelica/Resources/Images/UsersGuide/ModelicaLibraries.png\">
|
|---|
| 6440 | </p>
|
|---|
| 6441 |
|
|---|
| 6442 | <p>
|
|---|
| 6443 | For an introduction, have especially a look at:
|
|---|
| 6444 | </p>
|
|---|
| 6445 | <ul>
|
|---|
| 6446 | <li> <a href=\"modelica://Modelica.UsersGuide.Overview\">Overview</a>
|
|---|
| 6447 | provides an overview of the Modelica Standard Library
|
|---|
| 6448 | inside the <a href=\"modelica://Modelica.UsersGuide\">User's Guide</a>.</li>
|
|---|
| 6449 | <li><a href=\"modelica://Modelica.UsersGuide.ReleaseNotes\">Release Notes</a>
|
|---|
| 6450 | summarizes the changes of new versions of this package.</li>
|
|---|
| 6451 | <li> <a href=\"modelica://Modelica.UsersGuide.Contact\">Contact</a>
|
|---|
| 6452 | lists the contributors of the Modelica Standard Library.</li>
|
|---|
| 6453 | <li> The <b>Examples</b> packages in the various libraries, demonstrate
|
|---|
| 6454 | how to use the components of the corresponding sublibrary.</li>
|
|---|
| 6455 | </ul>
|
|---|
| 6456 |
|
|---|
| 6457 | <p>
|
|---|
| 6458 | This version of the Modelica Standard Library consists of
|
|---|
| 6459 | </p>
|
|---|
| 6460 | <ul>
|
|---|
| 6461 | <li><b>1360</b> models and blocks, and</li>
|
|---|
| 6462 | <li><b>1280</b> functions</li>
|
|---|
| 6463 | </ul>
|
|---|
| 6464 | <p>
|
|---|
| 6465 | that are directly usable (= number of public, non-partial classes). It is fully compliant
|
|---|
| 6466 | to <a href=\"https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf\">Modelica Specification Version 3.2 Revision 2</a>
|
|---|
| 6467 | and it has been tested with Modelica tools from different vendors.
|
|---|
| 6468 | </p>
|
|---|
| 6469 |
|
|---|
| 6470 | <p>
|
|---|
| 6471 | <b>Licensed by the Modelica Association under the Modelica License 2</b><br>
|
|---|
| 6472 | Copyright © 1998-2013, ABB, AIT, T. Bödrich, DLR, Dassault Systèmes AB, Fraunhofer, A.Haumer, ITI, Modelon,
|
|---|
| 6473 | TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation.
|
|---|
| 6474 | </p>
|
|---|
| 6475 |
|
|---|
| 6476 | <p>
|
|---|
| 6477 | <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>
|
|---|
| 6478 | </p>
|
|---|
| 6479 |
|
|---|
| 6480 | <p>
|
|---|
| 6481 | <b>Modelica®</b> is a registered trademark of the Modelica Association.
|
|---|
| 6482 | </p>
|
|---|
| 6483 | </html>"));
|
|---|
| 6484 | end Modelica;
|
|---|
| 6485 |
|
|---|
| 6486 |
|
|---|
| 6487 | package ThermoPower "Open library for thermal power plant simulation"
|
|---|
| 6488 | extends Modelica.Icons.Package;
|
|---|
| 6489 | import Modelica.Math.*;
|
|---|
| 6490 | import Modelica.SIunits.*;
|
|---|
| 6491 |
|
|---|
| 6492 | model System "System wide properties"
|
|---|
| 6493 | // Assumptions
|
|---|
| 6494 | parameter Boolean allowFlowReversal=true
|
|---|
| 6495 | "= false to restrict to design flow direction (flangeA -> flangeB)"
|
|---|
| 6496 | annotation (Evaluate=true);
|
|---|
| 6497 | parameter ThermoPower.Choices.System.Dynamics Dynamics=ThermoPower.Choices.System.Dynamics.DynamicFreeInitial;
|
|---|
| 6498 | annotation (
|
|---|
| 6499 | defaultComponentName="system",
|
|---|
| 6500 | defaultComponentPrefixes="inner",
|
|---|
| 6501 | Icon(graphics={Polygon(
|
|---|
| 6502 | points={{-100,60},{-60,100},{60,100},{100,60},{100,-60},{60,-100},{-60,
|
|---|
| 6503 | -100},{-100,-60},{-100,60}},
|
|---|
| 6504 | lineColor={0,0,255},
|
|---|
| 6505 | smooth=Smooth.None,
|
|---|
| 6506 | fillColor={170,213,255},
|
|---|
| 6507 | fillPattern=FillPattern.Solid), Text(
|
|---|
| 6508 | extent={{-80,40},{80,-20}},
|
|---|
| 6509 | lineColor={0,0,255},
|
|---|
| 6510 | textString="system")}));
|
|---|
| 6511 | end System;
|
|---|
| 6512 |
|
|---|
| 6513 | package Icons "Icons for ThermoPower library"
|
|---|
| 6514 | extends Modelica.Icons.Package;
|
|---|
| 6515 |
|
|---|
| 6516 | package Gas "Icons for component using water/steam as working fluid"
|
|---|
| 6517 | extends Modelica.Icons.Package;
|
|---|
| 6518 |
|
|---|
| 6519 | partial model SourceP
|
|---|
| 6520 |
|
|---|
| 6521 | annotation (Icon(graphics={
|
|---|
| 6522 | Ellipse(
|
|---|
| 6523 | extent={{-80,80},{80,-80}},
|
|---|
| 6524 | lineColor={128,128,128},
|
|---|
| 6525 | fillColor={159,159,223},
|
|---|
| 6526 | fillPattern=FillPattern.Solid),
|
|---|
| 6527 | Text(
|
|---|
| 6528 | extent={{-20,34},{28,-26}},
|
|---|
| 6529 | lineColor={255,255,255},
|
|---|
| 6530 | textString="P"),
|
|---|
| 6531 | Text(extent={{-100,-78},{100,-106}}, textString="%name")}));
|
|---|
| 6532 | end SourceP;
|
|---|
| 6533 |
|
|---|
| 6534 | partial model SourceW
|
|---|
| 6535 |
|
|---|
| 6536 | annotation (Icon(graphics={
|
|---|
| 6537 | Rectangle(
|
|---|
| 6538 | extent={{-80,40},{80,-40}},
|
|---|
| 6539 | lineColor={128,128,128},
|
|---|
| 6540 | fillColor={159,159,223},
|
|---|
| 6541 | fillPattern=FillPattern.Solid),
|
|---|
| 6542 | Polygon(
|
|---|
| 6543 | points={{-12,-20},{66,0},{-12,20},{34,0},{-12,-20}},
|
|---|
| 6544 | lineColor={128,128,128},
|
|---|
| 6545 | fillColor={0,0,0},
|
|---|
| 6546 | fillPattern=FillPattern.Solid),
|
|---|
| 6547 | Text(extent={{-100,-52},{100,-80}}, textString="%name")}));
|
|---|
| 6548 | end SourceW;
|
|---|
| 6549 |
|
|---|
| 6550 | partial model Tube
|
|---|
| 6551 |
|
|---|
| 6552 | annotation (Icon(graphics={Rectangle(
|
|---|
| 6553 | extent={{-80,40},{80,-40}},
|
|---|
| 6554 | lineColor={0,0,0},
|
|---|
| 6555 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 6556 | fillColor={159,159,223})}), Diagram(graphics));
|
|---|
| 6557 | end Tube;
|
|---|
| 6558 |
|
|---|
| 6559 | partial model Mixer
|
|---|
| 6560 |
|
|---|
| 6561 | annotation (Icon(graphics={Ellipse(
|
|---|
| 6562 | extent={{80,80},{-80,-80}},
|
|---|
| 6563 | lineColor={128,128,128},
|
|---|
| 6564 | fillColor={159,159,223},
|
|---|
| 6565 | fillPattern=FillPattern.Solid), Text(extent={{-100,-84},{100,-110}},
|
|---|
| 6566 | textString="%name")}), Diagram(graphics));
|
|---|
| 6567 | end Mixer;
|
|---|
| 6568 |
|
|---|
| 6569 | partial model Compressor
|
|---|
| 6570 |
|
|---|
| 6571 | annotation (Icon(graphics={
|
|---|
| 6572 | Polygon(
|
|---|
| 6573 | points={{24,26},{30,26},{30,76},{60,76},{60,82},{24,82},{24,26}},
|
|---|
| 6574 | lineColor={128,128,128},
|
|---|
| 6575 | lineThickness=0.5,
|
|---|
| 6576 | fillColor={159,159,223},
|
|---|
| 6577 | fillPattern=FillPattern.Solid),
|
|---|
| 6578 | Polygon(
|
|---|
| 6579 | points={{-30,76},{-30,56},{-24,56},{-24,82},{-60,82},{-60,76},{-30,
|
|---|
| 6580 | 76}},
|
|---|
| 6581 | lineColor={128,128,128},
|
|---|
| 6582 | lineThickness=0.5,
|
|---|
| 6583 | fillColor={159,159,223},
|
|---|
| 6584 | fillPattern=FillPattern.Solid),
|
|---|
| 6585 | Rectangle(
|
|---|
| 6586 | extent={{-60,8},{60,-8}},
|
|---|
| 6587 | lineColor={0,0,0},
|
|---|
| 6588 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 6589 | fillColor={160,160,164}),
|
|---|
| 6590 | Polygon(
|
|---|
| 6591 | points={{-30,60},{-30,-60},{30,-26},{30,26},{-30,60}},
|
|---|
| 6592 | lineColor={128,128,128},
|
|---|
| 6593 | lineThickness=0.5,
|
|---|
| 6594 | fillColor={159,159,223},
|
|---|
| 6595 | fillPattern=FillPattern.Solid)}), Diagram(graphics));
|
|---|
| 6596 |
|
|---|
| 6597 | end Compressor;
|
|---|
| 6598 |
|
|---|
| 6599 | partial model Turbine
|
|---|
| 6600 |
|
|---|
| 6601 | annotation (Icon(graphics={
|
|---|
| 6602 | Polygon(
|
|---|
| 6603 | points={{-28,76},{-28,28},{-22,28},{-22,82},{-60,82},{-60,76},{-28,
|
|---|
| 6604 | 76}},
|
|---|
| 6605 | lineColor={128,128,128},
|
|---|
| 6606 | lineThickness=0.5,
|
|---|
| 6607 | fillColor={159,159,223},
|
|---|
| 6608 | fillPattern=FillPattern.Solid),
|
|---|
| 6609 | Polygon(
|
|---|
| 6610 | points={{26,56},{32,56},{32,76},{60,76},{60,82},{26,82},{26,56}},
|
|---|
| 6611 | lineColor={128,128,128},
|
|---|
| 6612 | lineThickness=0.5,
|
|---|
| 6613 | fillColor={159,159,223},
|
|---|
| 6614 | fillPattern=FillPattern.Solid),
|
|---|
| 6615 | Rectangle(
|
|---|
| 6616 | extent={{-60,8},{60,-8}},
|
|---|
| 6617 | lineColor={0,0,0},
|
|---|
| 6618 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 6619 | fillColor={160,160,164}),
|
|---|
| 6620 | Polygon(
|
|---|
| 6621 | points={{-28,28},{-28,-26},{32,-60},{32,60},{-28,28}},
|
|---|
| 6622 | lineColor={128,128,128},
|
|---|
| 6623 | lineThickness=0.5,
|
|---|
| 6624 | fillColor={159,159,223},
|
|---|
| 6625 | fillPattern=FillPattern.Solid)}), Diagram(graphics));
|
|---|
| 6626 |
|
|---|
| 6627 | end Turbine;
|
|---|
| 6628 | end Gas;
|
|---|
| 6629 | end Icons;
|
|---|
| 6630 |
|
|---|
| 6631 | package Functions "Miscellaneous functions"
|
|---|
| 6632 | extends Modelica.Icons.Package;
|
|---|
| 6633 |
|
|---|
| 6634 | function squareReg
|
|---|
| 6635 | "Anti-symmetric square approximation with non-zero derivative in the origin"
|
|---|
| 6636 | extends Modelica.Icons.Function;
|
|---|
| 6637 | input Real x;
|
|---|
| 6638 | input Real delta=0.01 "Range of significant deviation from x^2*sgn(x)";
|
|---|
| 6639 | output Real y;
|
|---|
| 6640 | algorithm
|
|---|
| 6641 | y := x*sqrt(x*x + delta*delta);
|
|---|
| 6642 |
|
|---|
| 6643 | annotation (Documentation(info="<html>
|
|---|
| 6644 | This function approximates x^2*sgn(x), such that the derivative is non-zero in x=0.
|
|---|
| 6645 | </p>
|
|---|
| 6646 | <p>
|
|---|
| 6647 | <table border=1 cellspacing=0 cellpadding=2>
|
|---|
| 6648 | <tr><th>Function</th><th>Approximation</th><th>Range</th></tr>
|
|---|
| 6649 | <tr><td>y = regSquare(x)</td><td>y ~= x^2*sgn(x)</td><td>abs(x) >> delta</td></tr>
|
|---|
| 6650 | <tr><td>y = regSquare(x)</td><td>y ~= x*delta</td><td>abs(x) << delta</td></tr>
|
|---|
| 6651 | </table>
|
|---|
| 6652 | <p>
|
|---|
| 6653 | 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.
|
|---|
| 6654 | </p>
|
|---|
| 6655 | </p>
|
|---|
| 6656 | </html>", revisions="<html>
|
|---|
| 6657 | <ul>
|
|---|
| 6658 | <li><i>15 Mar 2005</i>
|
|---|
| 6659 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 6660 | Created. </li>
|
|---|
| 6661 | </ul>
|
|---|
| 6662 | </html>"));
|
|---|
| 6663 | end squareReg;
|
|---|
| 6664 | annotation (Documentation(info="<HTML>
|
|---|
| 6665 | This package contains general-purpose functions and models
|
|---|
| 6666 | </HTML>"));
|
|---|
| 6667 | end Functions;
|
|---|
| 6668 |
|
|---|
| 6669 | package Electrical "Simplified models of electric power components"
|
|---|
| 6670 | extends Modelica.Icons.Package;
|
|---|
| 6671 |
|
|---|
| 6672 | connector PowerConnection "Electrical power connector"
|
|---|
| 6673 | flow Power W "Active power";
|
|---|
| 6674 | Frequency f "Frequency";
|
|---|
| 6675 | annotation (Icon(graphics={Rectangle(
|
|---|
| 6676 | extent={{-100,100},{100,-100}},
|
|---|
| 6677 | lineColor={0,0,255},
|
|---|
| 6678 | pattern=LinePattern.None,
|
|---|
| 6679 | lineThickness=0.5,
|
|---|
| 6680 | fillColor={255,0,0},
|
|---|
| 6681 | fillPattern=FillPattern.Solid)}));
|
|---|
| 6682 | end PowerConnection;
|
|---|
| 6683 |
|
|---|
| 6684 | model Generator "Active power generator"
|
|---|
| 6685 | import Modelica.SIunits.Conversions.NonSIunits.*;
|
|---|
| 6686 | parameter Real eta=1 "Conversion efficiency";
|
|---|
| 6687 | parameter Modelica.SIunits.MomentOfInertia J=0 "Moment of inertia";
|
|---|
| 6688 | parameter Integer Np=2 "Number of electrical poles";
|
|---|
| 6689 | parameter Modelica.SIunits.Frequency fstart=50
|
|---|
| 6690 | "Start value of the electrical frequency"
|
|---|
| 6691 | annotation (Dialog(tab="Initialization"));
|
|---|
| 6692 | parameter ThermoPower.Choices.Init.Options initOpt=ThermoPower.Choices.Init.Options.noInit
|
|---|
| 6693 | "Initialization option"
|
|---|
| 6694 | annotation (Dialog(tab="Initialization"));
|
|---|
| 6695 | Modelica.SIunits.Power Pm "Mechanical power";
|
|---|
| 6696 | Modelica.SIunits.Power Pe "Electrical Power";
|
|---|
| 6697 | Modelica.SIunits.Power Ploss "Inertial power Loss";
|
|---|
| 6698 | Modelica.SIunits.Torque tau "Torque at shaft";
|
|---|
| 6699 | Modelica.SIunits.AngularVelocity omega_m(start=2*Modelica.Constants.pi*
|
|---|
| 6700 | fstart/Np) "Angular velocity of the shaft";
|
|---|
| 6701 | Modelica.SIunits.AngularVelocity omega_e
|
|---|
| 6702 | "Angular velocity of the e.m.f. rotating frame";
|
|---|
| 6703 | AngularVelocity_rpm n "Rotational speed";
|
|---|
| 6704 | Modelica.SIunits.Frequency f "Electrical frequency";
|
|---|
| 6705 | PowerConnection powerConnection annotation (Placement(transformation(extent=
|
|---|
| 6706 | {{72,-14},{100,14}}, rotation=0)));
|
|---|
| 6707 | Modelica.Mechanics.Rotational.Interfaces.Flange_a shaft annotation (
|
|---|
| 6708 | Placement(transformation(extent={{-100,-14},{-72,14}}, rotation=0)));
|
|---|
| 6709 | equation
|
|---|
| 6710 | omega_m = der(shaft.phi) "Mechanical boundary condition";
|
|---|
| 6711 | omega_e = omega_m*Np;
|
|---|
| 6712 | f = omega_e/(2*Modelica.Constants.pi) "Electrical frequency";
|
|---|
| 6713 | n = Modelica.SIunits.Conversions.to_rpm(omega_m) "Rotational speed in rpm";
|
|---|
| 6714 | Pm = omega_m*tau;
|
|---|
| 6715 | if J > 0 then
|
|---|
| 6716 | Ploss = J*der(omega_m)*omega_m;
|
|---|
| 6717 | else
|
|---|
| 6718 | Ploss = 0;
|
|---|
| 6719 | end if annotation (Diagram);
|
|---|
| 6720 | Pm = Pe/eta + Ploss "Energy balance";
|
|---|
| 6721 | // Boundary conditions
|
|---|
| 6722 | f = powerConnection.f;
|
|---|
| 6723 | Pe = -powerConnection.W;
|
|---|
| 6724 | tau = shaft.tau;
|
|---|
| 6725 | initial equation
|
|---|
| 6726 | if initOpt == ThermoPower.Choices.Init.Options.noInit then
|
|---|
| 6727 | // do nothing
|
|---|
| 6728 | elseif initOpt == ThermoPower.Choices.Init.Options.steadyState then
|
|---|
| 6729 | der(omega_m) = 0;
|
|---|
| 6730 | else
|
|---|
| 6731 | assert(false, "Unsupported initialisation option");
|
|---|
| 6732 | end if;
|
|---|
| 6733 | annotation (
|
|---|
| 6734 | Icon(graphics={Rectangle(
|
|---|
| 6735 | extent={{-72,6},{-48,-8}},
|
|---|
| 6736 | lineColor={0,0,0},
|
|---|
| 6737 | fillPattern=FillPattern.HorizontalCylinder,
|
|---|
| 6738 | fillColor={160,160,164}),Ellipse(
|
|---|
| 6739 | extent={{50,-50},{-50,50}},
|
|---|
| 6740 | lineColor={0,0,0},
|
|---|
| 6741 | lineThickness=0.5,
|
|---|
| 6742 | fillColor={255,255,255},
|
|---|
| 6743 | fillPattern=FillPattern.Solid),Line(points={{50,0},{72,0}},
|
|---|
| 6744 | color={0,0,0}),Text(
|
|---|
| 6745 | extent={{-26,24},{28,-28}},
|
|---|
| 6746 | lineColor={0,0,0},
|
|---|
| 6747 | fillColor={255,255,255},
|
|---|
| 6748 | fillPattern=FillPattern.Solid,
|
|---|
| 6749 | textString="G")}),
|
|---|
| 6750 | Documentation(info="<html>
|
|---|
| 6751 | <p>This model describes the conversion between mechanical power and electrical power in an ideal synchronous generator.
|
|---|
| 6752 | The frequency in the electrical connector is the e.m.f. of generator.
|
|---|
| 6753 | <p>It is possible to consider the generator inertia in the model, by setting the parameter <tt>J > 0</tt>.
|
|---|
| 6754 | </html>"));
|
|---|
| 6755 | end Generator;
|
|---|
| 6756 |
|
|---|
| 6757 | partial model Network1portBase "Base class for one-port network"
|
|---|
| 6758 | parameter Boolean hasBreaker=false
|
|---|
| 6759 | "Model includes a breaker controlled by external input";
|
|---|
| 6760 | parameter Modelica.SIunits.Angle deltaStart=0
|
|---|
| 6761 | "Start value of the load angle"
|
|---|
| 6762 | annotation (Dialog(tab="Initialization"));
|
|---|
| 6763 | parameter ThermoPower.Choices.Init.Options initOpt=ThermoPower.Choices.Init.Options.noInit
|
|---|
| 6764 | "Initialization option"
|
|---|
| 6765 | annotation (Dialog(tab="Initialization"));
|
|---|
| 6766 | parameter Modelica.SIunits.Power C "Max. power transfer";
|
|---|
| 6767 | Modelica.SIunits.Power Pe "Net electrical power";
|
|---|
| 6768 | Modelica.SIunits.Power Ploss "Electrical power loss";
|
|---|
| 6769 | Modelica.SIunits.AngularVelocity omega "Angular velocity";
|
|---|
| 6770 | Modelica.SIunits.AngularVelocity omegaRef "Angular velocity reference";
|
|---|
| 6771 | Modelica.SIunits.Angle delta(stateSelect=StateSelect.prefer, start=
|
|---|
| 6772 | deltaStart) "Load angle";
|
|---|
| 6773 |
|
|---|
| 6774 | PowerConnection powerConnection annotation (Placement(transformation(extent=
|
|---|
| 6775 | {{-114,-14},{-86,14}}, rotation=0)));
|
|---|
| 6776 | Modelica.Blocks.Interfaces.BooleanInput closed if hasBreaker annotation (
|
|---|
| 6777 | Placement(transformation(
|
|---|
| 6778 | origin={0,97},
|
|---|
| 6779 | extent={{-15,-16},{15,16}},
|
|---|
| 6780 | rotation=270)));
|
|---|
| 6781 | protected
|
|---|
| 6782 | Modelica.Blocks.Interfaces.BooleanInput closedInternal annotation (
|
|---|
| 6783 | Placement(transformation(
|
|---|
| 6784 | origin={0,49},
|
|---|
| 6785 | extent={{-9,-8},{9,8}},
|
|---|
| 6786 | rotation=270)));
|
|---|
| 6787 | public
|
|---|
| 6788 | Modelica.Blocks.Interfaces.RealOutput delta_out annotation (Placement(
|
|---|
| 6789 | transformation(
|
|---|
| 6790 | origin={0,-90},
|
|---|
| 6791 | extent={{-10,-10},{10,10}},
|
|---|
| 6792 | rotation=270)));
|
|---|
| 6793 | equation
|
|---|
| 6794 | // Load angle
|
|---|
| 6795 | der(delta) = omega - omegaRef;
|
|---|
| 6796 | // Power flow
|
|---|
| 6797 | if closedInternal then
|
|---|
| 6798 | Pe = homotopy(C*Modelica.Math.sin(delta), C*delta);
|
|---|
| 6799 | else
|
|---|
| 6800 | Pe = 0;
|
|---|
| 6801 | end if;
|
|---|
| 6802 | // Boundary conditions
|
|---|
| 6803 | Pe + Ploss = powerConnection.W;
|
|---|
| 6804 | omega = 2*Modelica.Constants.pi*powerConnection.f;
|
|---|
| 6805 | if not hasBreaker then
|
|---|
| 6806 | closedInternal = true;
|
|---|
| 6807 | end if;
|
|---|
| 6808 | connect(closed, closedInternal);
|
|---|
| 6809 | //Output signal
|
|---|
| 6810 | delta_out = delta;
|
|---|
| 6811 | initial equation
|
|---|
| 6812 | if initOpt == ThermoPower.Choices.Init.Options.noInit then
|
|---|
| 6813 | // do nothing
|
|---|
| 6814 | elseif initOpt == ThermoPower.Choices.Init.Options.steadyState then
|
|---|
| 6815 | der(delta) = 0;
|
|---|
| 6816 | else
|
|---|
| 6817 | assert(false, "Unsupported initialisation option");
|
|---|
| 6818 | end if;
|
|---|
| 6819 | annotation (
|
|---|
| 6820 | Diagram(graphics),
|
|---|
| 6821 | Icon(graphics={Ellipse(
|
|---|
| 6822 | extent={{-80,80},{80,-80}},
|
|---|
| 6823 | lineColor={0,0,0},
|
|---|
| 6824 | fillColor={255,255,255},
|
|---|
| 6825 | fillPattern=FillPattern.Solid)}),
|
|---|
| 6826 | Documentation(info="<html>
|
|---|
| 6827 | <p>Basic interface of the Network models with one electrical port for the connection to the generator, containing the common parameters, variables and connectors.</p>
|
|---|
| 6828 | <p><b>Modelling options</b>
|
|---|
| 6829 | <p>The net electrical power is defined by the following relationship:
|
|---|
| 6830 | <ul><tt>Pe = C*sin(delta)</tt></ul>
|
|---|
| 6831 | <p><tt>delta</tt> is the load angle, defined by the following relationship:
|
|---|
| 6832 | <ul><tt>der(delta) = omega - omegaRef</tt></ul>
|
|---|
| 6833 | <p>where <tt>omega</tt> is related to the frequency on the power connector (generator frequency), and <tt>omegaRef</tt> is the reference angular velocity of the network embedded in the model.
|
|---|
| 6834 | <p>The electrical power losses are described by the variable <tt>Ploss</tt>.
|
|---|
| 6835 | <p>If <tt>hasBreaker</tt> is true, the model provides a circuit breaker, controlled by the boolean input signal, to describe the connection/disconnection of the electrical port from the grid; otherwise it is assumed that the electrical port is always connected to the grid.
|
|---|
| 6836 | </html>", revisions="<html>
|
|---|
| 6837 | <ul>
|
|---|
| 6838 | <li><i>15 Jul 2008</i>
|
|---|
| 6839 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco
|
|---|
| 6840 | Casella</a> and <a> Luca Savoldelli </a>:<br>
|
|---|
| 6841 | First release.</li>
|
|---|
| 6842 | </ul>
|
|---|
| 6843 | </html>"));
|
|---|
| 6844 | end Network1portBase;
|
|---|
| 6845 |
|
|---|
| 6846 | model NetworkGrid_Pmax
|
|---|
| 6847 | extends ThermoPower.Electrical.Network1portBase(final C=Pmax);
|
|---|
| 6848 | parameter Modelica.SIunits.Power Pmax "Maximum power transfer";
|
|---|
| 6849 | parameter Modelica.SIunits.Frequency fnom=50 "Nominal frequency of network";
|
|---|
| 6850 | parameter Modelica.SIunits.MomentOfInertia J=0
|
|---|
| 6851 | "Moment of inertia of the generator/shaft system (for damping term calculation)"
|
|---|
| 6852 | annotation (Dialog(group="Generator"));
|
|---|
| 6853 | parameter Real r=0.2 "Electrical damping of generator/shaft system"
|
|---|
| 6854 | annotation (dialog(enable=if J > 0 then true else false, group=
|
|---|
| 6855 | "Generator"));
|
|---|
| 6856 | parameter Integer Np=2 "Number of electrical poles" annotation (dialog(
|
|---|
| 6857 | enable=if J > 0 then true else false, group="Generator"));
|
|---|
| 6858 | Real D "Electrical damping coefficient";
|
|---|
| 6859 | equation
|
|---|
| 6860 | // Definition of the reference
|
|---|
| 6861 | omegaRef = 2*Modelica.Constants.pi*fnom;
|
|---|
| 6862 | // Definition of damping power loss
|
|---|
| 6863 | if J > 0 then
|
|---|
| 6864 | D = 2*r*sqrt(C*J*(2*Modelica.Constants.pi*fnom*Np)/(Np^2));
|
|---|
| 6865 | else
|
|---|
| 6866 | D = 0;
|
|---|
| 6867 | end if;
|
|---|
| 6868 | if closedInternal then
|
|---|
| 6869 | Ploss = D*der(delta);
|
|---|
| 6870 | else
|
|---|
| 6871 | Ploss = 0;
|
|---|
| 6872 | end if;
|
|---|
| 6873 | annotation (Icon(graphics={Rectangle(
|
|---|
| 6874 | extent={{-54,6},{-28,-6}},
|
|---|
| 6875 | lineColor={0,0,0},
|
|---|
| 6876 | fillColor={255,255,255},
|
|---|
| 6877 | fillPattern=FillPattern.Solid),Line(points={{-54,0},{-92,0}},
|
|---|
| 6878 | color={0,0,0}),Line(points={{-28,0},{-10,0},{18,16}}, color={0,0,0}),
|
|---|
| 6879 | Line(points={{20,0},{46,0}}, color={0,0,0}),Line(
|
|---|
| 6880 | points={{46,40},{46,-40}},
|
|---|
| 6881 | color={0,0,0},
|
|---|
| 6882 | thickness=0.5)}), Documentation(info="<html>
|
|---|
| 6883 | <p>This model extends <tt>Network1portBase</tt> partial model, by directly defining the maximum power that can be transferred between the electrical port and the grid <tt>Pmax</tt>.
|
|---|
| 6884 | <p>The power losses are represented by a linear dissipative term. It is possible to directly set the damping coefficient <tt>r</tt> of the generator/shaft system.
|
|---|
| 6885 | If <tt>J</tt> is zero, zero damping is assumed. Note that <tt>J</tt> is only used to compute the dissipative term and should refer to the total inertia of the generator-shaft system; the network model does not add any inertial effects.
|
|---|
| 6886 | </html>", revisions="<html>
|
|---|
| 6887 | <ul>
|
|---|
| 6888 | <li><i>15 Jul 2008</i>
|
|---|
| 6889 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco
|
|---|
| 6890 | Casella</a> and <a> Luca Savoldelli </a>:<br>
|
|---|
| 6891 | First release.</li>
|
|---|
| 6892 | </ul>
|
|---|
| 6893 | </html>"));
|
|---|
| 6894 | end NetworkGrid_Pmax;
|
|---|
| 6895 | annotation (Documentation(info="<html>
|
|---|
| 6896 | <p>This package allows to describe the flow of active power between a synchronous generator and a grid, through simplified power transmission line models, assuming ideal voltage control. </p>
|
|---|
| 6897 | <p>These models are meant to be used as simplified boundary conditions for a thermal power plant model, rather than for fully modular description of three-phase networks. Specialized libraries should be used for this purpose; bear in mind, however, that full three-phase models of electrical machinery and power lines could make the power plant simulation substantially heavier, if special numeric integration strategies are not adopted.
|
|---|
| 6898 | </html>"));
|
|---|
| 6899 | end Electrical;
|
|---|
| 6900 |
|
|---|
| 6901 | package Choices "Choice enumerations for ThermoPower models"
|
|---|
| 6902 | extends Modelica.Icons.Package;
|
|---|
| 6903 |
|
|---|
| 6904 | package PressDrop
|
|---|
| 6905 |
|
|---|
| 6906 | type FFtypes = enumeration(
|
|---|
| 6907 | Kf "Kf friction factor",
|
|---|
| 6908 | OpPoint "Friction factor defined by operating point",
|
|---|
| 6909 | Kinetic "Kinetic friction factor")
|
|---|
| 6910 | "Type, constants and menu choices to select the friction factor";
|
|---|
| 6911 | end PressDrop;
|
|---|
| 6912 |
|
|---|
| 6913 | package TurboMachinery
|
|---|
| 6914 |
|
|---|
| 6915 | type TableTypes = enumeration(
|
|---|
| 6916 | matrix "Explicitly supplied as parameter matrix table",
|
|---|
| 6917 | file "Read from a file")
|
|---|
| 6918 | "Type, constants and menu choices to select the representation of table matrix";
|
|---|
| 6919 | end TurboMachinery;
|
|---|
| 6920 |
|
|---|
| 6921 | package Init "Options for initialisation"
|
|---|
| 6922 |
|
|---|
| 6923 | type Options = enumeration(
|
|---|
| 6924 | noInit "No initial equations",
|
|---|
| 6925 | steadyState "Steady-state initialisation",
|
|---|
| 6926 | steadyStateNoP "Steady-state initialisation except pressures",
|
|---|
| 6927 | steadyStateNoT "Steady-state initialisation except temperatures",
|
|---|
| 6928 | steadyStateNoPT
|
|---|
| 6929 | "Steady-state initialisation except pressures and temperatures")
|
|---|
| 6930 | "Type, constants and menu choices to select the initialisation options";
|
|---|
| 6931 | end Init;
|
|---|
| 6932 |
|
|---|
| 6933 | package System
|
|---|
| 6934 |
|
|---|
| 6935 | type Dynamics = enumeration(
|
|---|
| 6936 | DynamicFreeInitial
|
|---|
| 6937 | "DynamicFreeInitial -- Dynamic balance, Initial guess value",
|
|---|
| 6938 | FixedInitial "FixedInitial -- Dynamic balance, Initial value fixed",
|
|---|
| 6939 | SteadyStateInitial
|
|---|
| 6940 | "SteadyStateInitial -- Dynamic balance, Steady state initial with guess value",
|
|---|
| 6941 |
|
|---|
| 6942 | SteadyState
|
|---|
| 6943 | "SteadyState -- Steady state balance, Initial guess value")
|
|---|
| 6944 | "Enumeration to define definition of balance equations";
|
|---|
| 6945 |
|
|---|
| 6946 | end System;
|
|---|
| 6947 | end Choices;
|
|---|
| 6948 |
|
|---|
| 6949 | package Examples "Application examples"
|
|---|
| 6950 | extends Modelica.Icons.ExamplesPackage;
|
|---|
| 6951 |
|
|---|
| 6952 | package RankineCycle "Steam power plant"
|
|---|
| 6953 | extends Modelica.Icons.Package;
|
|---|
| 6954 |
|
|---|
| 6955 | package Models
|
|---|
| 6956 | extends Modelica.Icons.Package;
|
|---|
| 6957 |
|
|---|
| 6958 | model PID "PID controller with anti-windup"
|
|---|
| 6959 | parameter Real Kp "Proportional gain (normalised units)";
|
|---|
| 6960 | parameter Modelica.SIunits.Time Ti "Integral time";
|
|---|
| 6961 | parameter Boolean integralAction = true "Use integral action";
|
|---|
| 6962 | parameter Modelica.SIunits.Time Td=0 "Derivative time";
|
|---|
| 6963 | parameter Real Nd=1 "Derivative action up to Nd / Td rad/s";
|
|---|
| 6964 | parameter Real Ni=1
|
|---|
| 6965 | "Ni*Ti is the time constant of anti-windup compensation";
|
|---|
| 6966 | parameter Real b=1 "Setpoint weight on proportional action";
|
|---|
| 6967 | parameter Real c=0 "Setpoint weight on derivative action";
|
|---|
| 6968 | parameter Real PVmin "Minimum value of process variable for scaling";
|
|---|
| 6969 | parameter Real PVmax "Maximum value of process variable for scaling";
|
|---|
| 6970 | parameter Real CSmin "Minimum value of control signal for scaling";
|
|---|
| 6971 | parameter Real CSmax "Maximum value of control signal for scaling";
|
|---|
| 6972 | parameter Real PVstart=0.5 "Start value of PV (scaled)";
|
|---|
| 6973 | parameter Real CSstart=0.5 "Start value of CS (scaled)";
|
|---|
| 6974 | parameter Boolean holdWhenSimplified=false
|
|---|
| 6975 | "Hold CSs at start value when homotopy=simplified";
|
|---|
| 6976 | parameter Boolean steadyStateInit=false "Initialize in steady state";
|
|---|
| 6977 | Real CSs_hom
|
|---|
| 6978 | "Control signal scaled in per units, used when homotopy=simplified";
|
|---|
| 6979 |
|
|---|
| 6980 | Real P "Proportional action / Kp";
|
|---|
| 6981 | Real I(start=CSstart/Kp) "Integral action / Kp";
|
|---|
| 6982 | Real D "Derivative action / Kp";
|
|---|
| 6983 | Real Dx(start=c*PVstart - PVstart) "State of approximated derivator";
|
|---|
| 6984 | Real PVs "Process variable scaled in per unit";
|
|---|
| 6985 | Real SPs "Setpoint variable scaled in per unit";
|
|---|
| 6986 | Real CSs(start=CSstart) "Control signal scaled in per unit";
|
|---|
| 6987 | Real CSbs(start=CSstart)
|
|---|
| 6988 | "Control signal scaled in per unit before saturation";
|
|---|
| 6989 | Real track "Tracking signal for anti-windup integral action";
|
|---|
| 6990 |
|
|---|
| 6991 | Modelica.Blocks.Interfaces.RealInput PV "Process variable signal"
|
|---|
| 6992 | annotation (Placement(transformation(extent={{-112,-52},{-88,-28}},
|
|---|
| 6993 | rotation=0)));
|
|---|
| 6994 | Modelica.Blocks.Interfaces.RealOutput CS "Control signal" annotation (
|
|---|
| 6995 | Placement(transformation(extent={{88,-12},{112,12}}, rotation=0)));
|
|---|
| 6996 | Modelica.Blocks.Interfaces.RealInput SP "Set point signal" annotation (
|
|---|
| 6997 | Placement(transformation(extent={{-112,28},{-88,52}}, rotation=0)));
|
|---|
| 6998 | equation
|
|---|
| 6999 | // Scaling
|
|---|
| 7000 | SPs = (SP - PVmin)/(PVmax - PVmin);
|
|---|
| 7001 | PVs = (PV - PVmin)/(PVmax - PVmin);
|
|---|
| 7002 | CS = CSmin + CSs*(CSmax - CSmin);
|
|---|
| 7003 | // Controller actions
|
|---|
| 7004 | P = b*SPs - PVs;
|
|---|
| 7005 | if integralAction then
|
|---|
| 7006 | assert(Ti>0, "Integral time must be positive");
|
|---|
| 7007 | Ti*der(I) = SPs - PVs + track;
|
|---|
| 7008 | else
|
|---|
| 7009 | I = 0;
|
|---|
| 7010 | end if;
|
|---|
| 7011 | if Td > 0 then
|
|---|
| 7012 | Td/Nd*der(Dx) + Dx = c*SPs - PVs
|
|---|
| 7013 | "State equation of approximated derivator";
|
|---|
| 7014 | D = Nd*((c*SPs - PVs) - Dx)
|
|---|
| 7015 | "Output equation of approximated derivator";
|
|---|
| 7016 | else
|
|---|
| 7017 | Dx = 0;
|
|---|
| 7018 | D = 0;
|
|---|
| 7019 | end if;
|
|---|
| 7020 | if holdWhenSimplified then
|
|---|
| 7021 | CSs_hom = CSstart;
|
|---|
| 7022 | else
|
|---|
| 7023 | CSs_hom = CSbs;
|
|---|
| 7024 | end if;
|
|---|
| 7025 | CSbs = Kp*(P + I + D) "Control signal before saturation";
|
|---|
| 7026 | CSs = homotopy(smooth(0, if CSbs > 1 then 1 else if CSbs < 0 then 0 else
|
|---|
| 7027 | CSbs), CSs_hom) "Saturated control signal";
|
|---|
| 7028 | track = (CSs - CSbs)/(Kp*Ni);
|
|---|
| 7029 | initial equation
|
|---|
| 7030 | if steadyStateInit then
|
|---|
| 7031 | if Ti > 0 then
|
|---|
| 7032 | der(I) = 0;
|
|---|
| 7033 | end if;
|
|---|
| 7034 | if Td > 0 then
|
|---|
| 7035 | D = 0;
|
|---|
| 7036 | end if;
|
|---|
| 7037 | end if;
|
|---|
| 7038 | annotation (Diagram(graphics), Icon(graphics={
|
|---|
| 7039 | Rectangle(
|
|---|
| 7040 | extent={{-100,100},{100,-100}},
|
|---|
| 7041 | lineColor={0,0,255},
|
|---|
| 7042 | fillColor={255,255,255},
|
|---|
| 7043 | fillPattern=FillPattern.Solid),
|
|---|
| 7044 | Text(
|
|---|
| 7045 | extent={{-54,40},{52,-34}},
|
|---|
| 7046 | lineColor={0,0,255},
|
|---|
| 7047 | textString="PID"),
|
|---|
| 7048 | Text(
|
|---|
| 7049 | extent={{-110,-108},{110,-142}},
|
|---|
| 7050 | lineColor={0,0,255},
|
|---|
| 7051 | lineThickness=0.5,
|
|---|
| 7052 | textString="%name")}));
|
|---|
| 7053 | end PID;
|
|---|
| 7054 | end Models;
|
|---|
| 7055 | annotation (Documentation(info="<html>
|
|---|
| 7056 | <p>This package contains models of a simple Rankine cycle and its main components.
|
|---|
| 7057 | </html>", revisions="<html>
|
|---|
| 7058 | <ul>
|
|---|
| 7059 | <li><i>10 Dec 2008</i>
|
|---|
| 7060 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7061 | Package created.</li>
|
|---|
| 7062 | </ul>
|
|---|
| 7063 | </html>"));
|
|---|
| 7064 | end RankineCycle;
|
|---|
| 7065 |
|
|---|
| 7066 | package BraytonCycle "Gas power plant"
|
|---|
| 7067 | extends Modelica.Icons.Package;
|
|---|
| 7068 |
|
|---|
| 7069 | model Plant
|
|---|
| 7070 | parameter Real tableEtaC[6, 4]=[0, 95, 100, 105; 1, 82.5e-2, 81e-2,
|
|---|
| 7071 | 80.5e-2; 2, 84e-2, 82.9e-2, 82e-2; 3, 83.2e-2, 82.2e-2, 81.5e-2; 4,
|
|---|
| 7072 | 82.5e-2, 81.2e-2, 79e-2; 5, 79.5e-2, 78e-2, 76.5e-2];
|
|---|
| 7073 | parameter Real tablePhicC[6, 4]=[0, 95, 100, 105; 1, 38.3e-3, 43e-3,
|
|---|
| 7074 | 46.8e-3; 2, 39.3e-3, 43.8e-3, 47.9e-3; 3, 40.6e-3, 45.2e-3, 48.4e-3;
|
|---|
| 7075 | 4, 41.6e-3, 46.1e-3, 48.9e-3; 5, 42.3e-3, 46.6e-3, 49.3e-3];
|
|---|
| 7076 | parameter Real tablePR[6, 4]=[0, 95, 100, 105; 1, 22.6, 27, 32; 2, 22,
|
|---|
| 7077 | 26.6, 30.8; 3, 20.8, 25.5, 29; 4, 19, 24.3, 27.1; 5, 17, 21.5, 24.2];
|
|---|
| 7078 | parameter Real tablePhicT[5, 4]=[1, 90, 100, 110; 2.36, 4.68e-3, 4.68e-3,
|
|---|
| 7079 | 4.68e-3; 2.88, 4.68e-3, 4.68e-3, 4.68e-3; 3.56, 4.68e-3, 4.68e-3,
|
|---|
| 7080 | 4.68e-3; 4.46, 4.68e-3, 4.68e-3, 4.68e-3];
|
|---|
| 7081 | parameter Real tableEtaT[5, 4]=[1, 90, 100, 110; 2.36, 89e-2, 89.5e-2,
|
|---|
| 7082 | 89.3e-2; 2.88, 90e-2, 90.6e-2, 90.5e-2; 3.56, 90.5e-2, 90.6e-2,
|
|---|
| 7083 | 90.5e-2; 4.46, 90.2e-2, 90.3e-2, 90e-2];
|
|---|
| 7084 | Electrical.Generator generator(initOpt=ThermoPower.Choices.Init.Options.steadyState, J=30)
|
|---|
| 7085 | annotation (Placement(transformation(extent={{92,-80},{132,-40}},
|
|---|
| 7086 | rotation=0)));
|
|---|
| 7087 | Electrical.NetworkGrid_Pmax network(
|
|---|
| 7088 | deltaStart=0.4,
|
|---|
| 7089 | initOpt=ThermoPower.Choices.Init.Options.steadyState,
|
|---|
| 7090 | Pmax=10e6,
|
|---|
| 7091 | J=30000) annotation (Placement(transformation(extent={{148,-72},{172,-48}},
|
|---|
| 7092 | rotation=0)));
|
|---|
| 7093 | Modelica.Blocks.Interfaces.RealInput fuelFlowRate annotation (
|
|---|
| 7094 | Placement(transformation(extent={{-210,-10},{-190,10}}, rotation=0)));
|
|---|
| 7095 | Modelica.Blocks.Interfaces.RealOutput generatedPower annotation (
|
|---|
| 7096 | Placement(transformation(extent={{196,-10},{216,10}}, rotation=0)));
|
|---|
| 7097 | Gas.Compressor compressor(
|
|---|
| 7098 | redeclare package Medium = Media.Air,
|
|---|
| 7099 | tablePhic=tablePhicC,
|
|---|
| 7100 | tableEta=tableEtaC,
|
|---|
| 7101 | pstart_in=0.343e5,
|
|---|
| 7102 | pstart_out=8.3e5,
|
|---|
| 7103 | Tstart_in=244.4,
|
|---|
| 7104 | tablePR=tablePR,
|
|---|
| 7105 | Table=ThermoPower.Choices.TurboMachinery.TableTypes.matrix,
|
|---|
| 7106 | Tstart_out=600.4,
|
|---|
| 7107 | explicitIsentropicEnthalpy=true,
|
|---|
| 7108 | Tdes_in=244.4,
|
|---|
| 7109 | Ndesign=157.08) annotation (Placement(transformation(extent={{-158,-90},
|
|---|
| 7110 | {-98,-30}}, rotation=0)));
|
|---|
| 7111 | Gas.Turbine turbine(
|
|---|
| 7112 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7113 | pstart_in=7.85e5,
|
|---|
| 7114 | pstart_out=1.52e5,
|
|---|
| 7115 | tablePhic=tablePhicT,
|
|---|
| 7116 | tableEta=tableEtaT,
|
|---|
| 7117 | Table=ThermoPower.Choices.TurboMachinery.TableTypes.matrix,
|
|---|
| 7118 | Tstart_out=800,
|
|---|
| 7119 | Tdes_in=1400,
|
|---|
| 7120 | Tstart_in=1370,
|
|---|
| 7121 | Ndesign=157.08) annotation (Placement(transformation(extent={{-6,-90},{
|
|---|
| 7122 | 54,-30}}, rotation=0)));
|
|---|
| 7123 | Gas.CombustionChamber CombustionChamber1(
|
|---|
| 7124 | gamma=1,
|
|---|
| 7125 | Cm=1,
|
|---|
| 7126 | pstart=8.11e5,
|
|---|
| 7127 | Tstart=1370,
|
|---|
| 7128 | V=0.05,
|
|---|
| 7129 | S=0.05,
|
|---|
| 7130 | initOpt=ThermoPower.Choices.Init.Options.steadyState,
|
|---|
| 7131 | HH=41.6e6) annotation (Placement(transformation(extent={{-72,20},{-32,
|
|---|
| 7132 | 60}}, rotation=0)));
|
|---|
| 7133 | Gas.SourcePressure
|
|---|
| 7134 | SourceP1(
|
|---|
| 7135 | redeclare package Medium = Media.Air,
|
|---|
| 7136 | p0=0.343e5,
|
|---|
| 7137 | T=244.4) annotation (Placement(transformation(extent={{-188,-30},{-168,
|
|---|
| 7138 | -10}}, rotation=0)));
|
|---|
| 7139 | Gas.SinkPressure
|
|---|
| 7140 | SinkP1(
|
|---|
| 7141 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7142 | p0=1.52e5,
|
|---|
| 7143 | T=800) annotation (Placement(transformation(extent={{94,-10},{114,10}},
|
|---|
| 7144 | rotation=0)));
|
|---|
| 7145 | Gas.SourceMassFlow
|
|---|
| 7146 | SourceW1(
|
|---|
| 7147 | redeclare package Medium = Media.NaturalGas,
|
|---|
| 7148 | w0=2.02,
|
|---|
| 7149 | p0=811000,
|
|---|
| 7150 | T=300,
|
|---|
| 7151 | use_in_w0=true)
|
|---|
| 7152 | annotation (Placement(transformation(extent={{-100,70},{-80,90}},
|
|---|
| 7153 | rotation=0)));
|
|---|
| 7154 | Gas.PressDrop PressDrop1(
|
|---|
| 7155 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7156 | FFtype=ThermoPower.Choices.PressDrop.FFtypes.OpPoint,
|
|---|
| 7157 | wnom=102,
|
|---|
| 7158 | rhonom=2,
|
|---|
| 7159 | dpnom=26000,
|
|---|
| 7160 | pstart=811000,
|
|---|
| 7161 | Tstart=1370)
|
|---|
| 7162 | annotation (Placement(transformation(
|
|---|
| 7163 | origin={0,8},
|
|---|
| 7164 | extent={{-10,-10},{10,10}},
|
|---|
| 7165 | rotation=270)));
|
|---|
| 7166 | Gas.PressDrop PressDrop2(
|
|---|
| 7167 | pstart=8.3e5,
|
|---|
| 7168 | FFtype=ThermoPower.Choices.PressDrop.FFtypes.OpPoint,
|
|---|
| 7169 | A=1,
|
|---|
| 7170 | redeclare package Medium = Media.Air,
|
|---|
| 7171 | dpnom=0.19e5,
|
|---|
| 7172 | wnom=100,
|
|---|
| 7173 | rhonom=4.7,
|
|---|
| 7174 | Tstart=600) annotation (Placement(transformation(
|
|---|
| 7175 | origin={-104,10},
|
|---|
| 7176 | extent={{-10,-10},{10,10}},
|
|---|
| 7177 | rotation=90)));
|
|---|
| 7178 | Modelica.Mechanics.Rotational.Sensors.PowerSensor powerSensor annotation (
|
|---|
| 7179 | Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0)));
|
|---|
| 7180 | Modelica.Blocks.Continuous.FirstOrder gasFlowActuator(
|
|---|
| 7181 | k=1,
|
|---|
| 7182 | T=4,
|
|---|
| 7183 | y_start=500,
|
|---|
| 7184 | initType=Modelica.Blocks.Types.Init.SteadyState) annotation (Placement(
|
|---|
| 7185 | transformation(extent={{-138,92},{-122,108}}, rotation=0)));
|
|---|
| 7186 | Modelica.Blocks.Continuous.FirstOrder powerSensor1(
|
|---|
| 7187 | k=1,
|
|---|
| 7188 | T=1,
|
|---|
| 7189 | y_start=56.8e6,
|
|---|
| 7190 | initType=Modelica.Blocks.Types.Init.SteadyState) annotation (Placement(
|
|---|
| 7191 | transformation(extent={{146,-118},{162,-102}}, rotation=0)));
|
|---|
| 7192 | PowerPlants.HRSG.Components.StateReader_gas stateInletCC(
|
|---|
| 7193 | redeclare package Medium = Media.Air) annotation (Placement(transformation(
|
|---|
| 7194 | extent={{-100,30},{-80,50}}, rotation=0)));
|
|---|
| 7195 | PowerPlants.HRSG.Components.StateReader_gas stateOutletCC(
|
|---|
| 7196 | redeclare package Medium = Media.FlueGas) annotation (Placement(transformation(
|
|---|
| 7197 | extent={{-24,30},{-4,50}}, rotation=0)));
|
|---|
| 7198 | inner System system(allowFlowReversal=false)
|
|---|
| 7199 | annotation (Placement(transformation(extent={{158,160},{178,180}})));
|
|---|
| 7200 | equation
|
|---|
| 7201 | connect(network.powerConnection, generator.powerConnection) annotation (
|
|---|
| 7202 | Line(
|
|---|
| 7203 | points={{148,-60},{129.2,-60}},
|
|---|
| 7204 | pattern=LinePattern.None,
|
|---|
| 7205 | thickness=0.5));
|
|---|
| 7206 | connect(SourceW1.flange, CombustionChamber1.inf) annotation (Line(
|
|---|
| 7207 | points={{-80,80},{-52,80},{-52,60}},
|
|---|
| 7208 | color={159,159,223},
|
|---|
| 7209 | thickness=0.5));
|
|---|
| 7210 | connect(turbine.outlet, SinkP1.flange) annotation (Line(
|
|---|
| 7211 | points={{48,-36},{48,0},{94,0}},
|
|---|
| 7212 | color={159,159,223},
|
|---|
| 7213 | thickness=0.5));
|
|---|
| 7214 | connect(SourceP1.flange, compressor.inlet) annotation (Line(
|
|---|
| 7215 | points={{-168,-20},{-152,-20},{-152,-36}},
|
|---|
| 7216 | color={159,159,223},
|
|---|
| 7217 | thickness=0.5));
|
|---|
| 7218 | connect(PressDrop1.outlet, turbine.inlet) annotation (Line(
|
|---|
| 7219 | points={{-1.83697e-015,-2},{-1.83697e-015,-36},{0,-36}},
|
|---|
| 7220 | color={159,159,223},
|
|---|
| 7221 | thickness=0.5));
|
|---|
| 7222 | connect(compressor.outlet, PressDrop2.inlet) annotation (Line(
|
|---|
| 7223 | points={{-104,-36},{-104,0}},
|
|---|
| 7224 | color={159,159,223},
|
|---|
| 7225 | thickness=0.5));
|
|---|
| 7226 | connect(compressor.shaft_b, turbine.shaft_a) annotation (Line(
|
|---|
| 7227 | points={{-110,-60},{6,-60}},
|
|---|
| 7228 | color={0,0,0},
|
|---|
| 7229 | thickness=0.5));
|
|---|
| 7230 | connect(powerSensor.flange_a, turbine.shaft_b) annotation (Line(
|
|---|
| 7231 | points={{60,-60},{42,-60}},
|
|---|
| 7232 | color={0,0,0},
|
|---|
| 7233 | thickness=0.5));
|
|---|
| 7234 | connect(gasFlowActuator.u, fuelFlowRate) annotation (Line(points={
|
|---|
| 7235 | {-139.6,100},{-166,100},{-166,0},{-200,0}}, color={0,0,127}));
|
|---|
| 7236 | connect(gasFlowActuator.y, SourceW1.in_w0) annotation (Line(points={{-121.2,
|
|---|
| 7237 | 100},{-96,100},{-96,85}}, color={0,0,127}));
|
|---|
| 7238 | connect(powerSensor.power, powerSensor1.u) annotation (Line(points={{62,-71},
|
|---|
| 7239 | {62,-110},{144.4,-110}}, color={0,0,127}));
|
|---|
| 7240 | connect(powerSensor1.y, generatedPower) annotation (Line(points={{162.8,-110},
|
|---|
| 7241 | {184.4,-110},{184.4,0},{206,0}}, color={0,0,127}));
|
|---|
| 7242 | connect(CombustionChamber1.ina, stateInletCC.outlet) annotation (Line(
|
|---|
| 7243 | points={{-72,40},{-84,40}},
|
|---|
| 7244 | color={159,159,223},
|
|---|
| 7245 | thickness=0.5));
|
|---|
| 7246 | connect(stateInletCC.inlet, PressDrop2.outlet) annotation (Line(
|
|---|
| 7247 | points={{-96,40},{-104,40},{-104,20}},
|
|---|
| 7248 | color={159,159,223},
|
|---|
| 7249 | thickness=0.5));
|
|---|
| 7250 | connect(stateOutletCC.inlet, CombustionChamber1.out) annotation (Line(
|
|---|
| 7251 | points={{-20,40},{-32,40}},
|
|---|
| 7252 | color={159,159,223},
|
|---|
| 7253 | thickness=0.5));
|
|---|
| 7254 | connect(stateOutletCC.outlet, PressDrop1.inlet) annotation (Line(
|
|---|
| 7255 | points={{-8,40},{1.83697e-015,40},{1.83697e-015,18}},
|
|---|
| 7256 | color={159,159,223},
|
|---|
| 7257 | thickness=0.5));
|
|---|
| 7258 | connect(generator.shaft, powerSensor.flange_b) annotation (Line(
|
|---|
| 7259 | points={{94.8,-60},{80,-60}},
|
|---|
| 7260 | color={0,0,0},
|
|---|
| 7261 | thickness=0.5));
|
|---|
| 7262 | annotation (
|
|---|
| 7263 | Diagram(coordinateSystem(
|
|---|
| 7264 | preserveAspectRatio=false,
|
|---|
| 7265 | extent={{-200,-200},{200,200}},
|
|---|
| 7266 | initialScale=0.1), graphics),
|
|---|
| 7267 | Icon(coordinateSystem(
|
|---|
| 7268 | preserveAspectRatio=false,
|
|---|
| 7269 | extent={{-200,-200},{200,200}},
|
|---|
| 7270 | initialScale=0.1), graphics={Rectangle(
|
|---|
| 7271 | extent={{-200,200},{200,-200}},
|
|---|
| 7272 | lineColor={170,170,255},
|
|---|
| 7273 | fillColor={255,255,255},
|
|---|
| 7274 | fillPattern=FillPattern.Solid), Text(
|
|---|
| 7275 | extent={{-140,140},{140,-140}},
|
|---|
| 7276 | lineColor={170,170,255},
|
|---|
| 7277 | textString="P")}),
|
|---|
| 7278 | Documentation(revisions="<html>
|
|---|
| 7279 | <ul>
|
|---|
| 7280 | <li><i>10 Dec 2008</i>
|
|---|
| 7281 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7282 | First release.</li>
|
|---|
| 7283 | </ul>
|
|---|
| 7284 | </html>", info="<html>
|
|---|
| 7285 | <p>This model contains the gas turbine, generator and network models. The network model is based on swing equation.
|
|---|
| 7286 | </html>"));
|
|---|
| 7287 | end Plant;
|
|---|
| 7288 |
|
|---|
| 7289 | model Plant2
|
|---|
| 7290 | parameter Real tableEtaC[6, 4]=[0, 95, 100, 105; 1, 82.5e-2, 81e-2,
|
|---|
| 7291 | 80.5e-2; 2, 84e-2, 82.9e-2, 82e-2; 3, 83.2e-2, 82.2e-2, 81.5e-2; 4,
|
|---|
| 7292 | 82.5e-2, 81.2e-2, 79e-2; 5, 79.5e-2, 78e-2, 76.5e-2];
|
|---|
| 7293 | parameter Real tablePhicC[6, 4]=[0, 95, 100, 105; 1, 38.3e-3, 43e-3,
|
|---|
| 7294 | 46.8e-3; 2, 39.3e-3, 43.8e-3, 47.9e-3; 3, 40.6e-3, 45.2e-3, 48.4e-3;
|
|---|
| 7295 | 4, 41.6e-3, 46.1e-3, 48.9e-3; 5, 42.3e-3, 46.6e-3, 49.3e-3];
|
|---|
| 7296 | parameter Real tablePR[6, 4]=[0, 95, 100, 105; 1, 22.6, 27, 32; 2, 22,
|
|---|
| 7297 | 26.6, 30.8; 3, 20.8, 25.5, 29; 4, 19, 24.3, 27.1; 5, 17, 21.5, 24.2];
|
|---|
| 7298 | parameter Real tablePhicT[5, 4]=[1, 90, 100, 110; 2.36, 4.68e-3, 4.68e-3,
|
|---|
| 7299 | 4.68e-3; 2.88, 4.68e-3, 4.68e-3, 4.68e-3; 3.56, 4.68e-3, 4.68e-3,
|
|---|
| 7300 | 4.68e-3; 4.46, 4.68e-3, 4.68e-3, 4.68e-3];
|
|---|
| 7301 | parameter Real tableEtaT[5, 4]=[1, 90, 100, 110; 2.36, 89e-2, 89.5e-2,
|
|---|
| 7302 | 89.3e-2; 2.88, 90e-2, 90.6e-2, 90.5e-2; 3.56, 90.5e-2, 90.6e-2,
|
|---|
| 7303 | 90.5e-2; 4.46, 90.2e-2, 90.3e-2, 90e-2];
|
|---|
| 7304 | Electrical.Generator generator(initOpt=ThermoPower.Choices.Init.Options.steadyState, J=30)
|
|---|
| 7305 | annotation (Placement(transformation(extent={{92,-80},{132,-40}},
|
|---|
| 7306 | rotation=0)));
|
|---|
| 7307 | Electrical.NetworkGrid_Pmax network(
|
|---|
| 7308 | deltaStart=0.4,
|
|---|
| 7309 | initOpt=ThermoPower.Choices.Init.Options.steadyState,
|
|---|
| 7310 | Pmax=10e6,
|
|---|
| 7311 | J=30000) annotation (Placement(transformation(extent={{148,-72},{172,-48}},
|
|---|
| 7312 | rotation=0)));
|
|---|
| 7313 | Modelica.Blocks.Interfaces.RealInput fuelFlowRate annotation (
|
|---|
| 7314 | Placement(transformation(extent={{-210,-10},{-190,10}}, rotation=0)));
|
|---|
| 7315 | Modelica.Blocks.Interfaces.RealOutput generatedPower annotation (
|
|---|
| 7316 | Placement(transformation(extent={{196,-10},{216,10}}, rotation=0)));
|
|---|
| 7317 | Gas.Compressor compressor(
|
|---|
| 7318 | redeclare package Medium = Media.Air,
|
|---|
| 7319 | tablePhic=tablePhicC,
|
|---|
| 7320 | tableEta=tableEtaC,
|
|---|
| 7321 | pstart_in=0.343e5,
|
|---|
| 7322 | pstart_out=8.3e5,
|
|---|
| 7323 | Tstart_in=244.4,
|
|---|
| 7324 | tablePR=tablePR,
|
|---|
| 7325 | Table=ThermoPower.Choices.TurboMachinery.TableTypes.matrix,
|
|---|
| 7326 | Tstart_out=600.4,
|
|---|
| 7327 | explicitIsentropicEnthalpy=true,
|
|---|
| 7328 | Tdes_in=244.4,
|
|---|
| 7329 | Ndesign=157.08) annotation (Placement(transformation(extent={{-158,-90},
|
|---|
| 7330 | {-98,-30}}, rotation=0)));
|
|---|
| 7331 | Gas.Turbine turbine(
|
|---|
| 7332 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7333 | pstart_in=7.85e5,
|
|---|
| 7334 | pstart_out=1.52e5,
|
|---|
| 7335 | tablePhic=tablePhicT,
|
|---|
| 7336 | tableEta=tableEtaT,
|
|---|
| 7337 | Table=ThermoPower.Choices.TurboMachinery.TableTypes.matrix,
|
|---|
| 7338 | Tstart_out=800,
|
|---|
| 7339 | Tdes_in=1400,
|
|---|
| 7340 | Tstart_in=1370,
|
|---|
| 7341 | Ndesign=157.08) annotation (Placement(transformation(extent={{-6,-90},{
|
|---|
| 7342 | 54,-30}}, rotation=0)));
|
|---|
| 7343 | Gas.CombustionChamber CombustionChamber1(
|
|---|
| 7344 | gamma=1,
|
|---|
| 7345 | Cm=1,
|
|---|
| 7346 | pstart=8.11e5,
|
|---|
| 7347 | Tstart=1370,
|
|---|
| 7348 | V=0.05,
|
|---|
| 7349 | S=0.05,
|
|---|
| 7350 | initOpt=ThermoPower.Choices.Init.Options.steadyState,
|
|---|
| 7351 | HH=41.6e6) annotation (Placement(transformation(extent={{-72,20},{-32,
|
|---|
| 7352 | 60}}, rotation=0)));
|
|---|
| 7353 | Gas.SourcePressure
|
|---|
| 7354 | SourceP1(
|
|---|
| 7355 | redeclare package Medium = Media.Air,
|
|---|
| 7356 | p0=0.343e5,
|
|---|
| 7357 | T=244.4) annotation (Placement(transformation(extent={{-188,-30},{-168,
|
|---|
| 7358 | -10}}, rotation=0)));
|
|---|
| 7359 | Gas.SinkPressure
|
|---|
| 7360 | SinkP1(
|
|---|
| 7361 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7362 | p0=1.52e5,
|
|---|
| 7363 | T=800) annotation (Placement(transformation(extent={{94,-10},{114,10}},
|
|---|
| 7364 | rotation=0)));
|
|---|
| 7365 | Gas.SourceMassFlow
|
|---|
| 7366 | SourceW1(
|
|---|
| 7367 | redeclare package Medium = Media.NaturalGas,
|
|---|
| 7368 | w0=2.02,
|
|---|
| 7369 | p0=811000,
|
|---|
| 7370 | T=300,
|
|---|
| 7371 | use_in_w0=true)
|
|---|
| 7372 | annotation (Placement(transformation(extent={{-100,70},{-80,90}},
|
|---|
| 7373 | rotation=0)));
|
|---|
| 7374 | Gas.PressDrop PressDrop1(
|
|---|
| 7375 | redeclare package Medium = Media.FlueGas,
|
|---|
| 7376 | FFtype=ThermoPower.Choices.PressDrop.FFtypes.OpPoint,
|
|---|
| 7377 | wnom=102,
|
|---|
| 7378 | rhonom=2,
|
|---|
| 7379 | dpnom=26000,
|
|---|
| 7380 | pstart=811000,
|
|---|
| 7381 | Tstart=1370)
|
|---|
| 7382 | annotation (Placement(transformation(
|
|---|
| 7383 | origin={0,8},
|
|---|
| 7384 | extent={{-10,-10},{10,10}},
|
|---|
| 7385 | rotation=270)));
|
|---|
| 7386 | Modelica.Mechanics.Rotational.Sensors.PowerSensor powerSensor annotation (
|
|---|
| 7387 | Placement(transformation(extent={{60,-70},{80,-50}}, rotation=0)));
|
|---|
| 7388 | Modelica.Blocks.Continuous.FirstOrder gasFlowActuator(
|
|---|
| 7389 | k=1,
|
|---|
| 7390 | T=4,
|
|---|
| 7391 | y_start=500,
|
|---|
| 7392 | initType=Modelica.Blocks.Types.Init.SteadyState) annotation (Placement(
|
|---|
| 7393 | transformation(extent={{-138,92},{-122,108}}, rotation=0)));
|
|---|
| 7394 | Modelica.Blocks.Continuous.FirstOrder powerSensor1(
|
|---|
| 7395 | k=1,
|
|---|
| 7396 | T=1,
|
|---|
| 7397 | y_start=56.8e6,
|
|---|
| 7398 | initType=Modelica.Blocks.Types.Init.SteadyState) annotation (Placement(
|
|---|
| 7399 | transformation(extent={{146,-118},{162,-102}}, rotation=0)));
|
|---|
| 7400 | PowerPlants.HRSG.Components.StateReader_gas stateInletCC(
|
|---|
| 7401 | redeclare package Medium = Media.Air) annotation (Placement(transformation(
|
|---|
| 7402 | extent={{-100,30},{-80,50}}, rotation=0)));
|
|---|
| 7403 | PowerPlants.HRSG.Components.StateReader_gas stateOutletCC(
|
|---|
| 7404 | redeclare package Medium = Media.FlueGas) annotation (Placement(transformation(
|
|---|
| 7405 | extent={{-24,30},{-4,50}}, rotation=0)));
|
|---|
| 7406 | inner System system(allowFlowReversal=false)
|
|---|
| 7407 | annotation (Placement(transformation(extent={{158,160},{178,180}})));
|
|---|
| 7408 | equation
|
|---|
| 7409 | connect(network.powerConnection, generator.powerConnection) annotation (
|
|---|
| 7410 | Line(
|
|---|
| 7411 | points={{148,-60},{129.2,-60}},
|
|---|
| 7412 | pattern=LinePattern.None,
|
|---|
| 7413 | thickness=0.5));
|
|---|
| 7414 | connect(SourceW1.flange, CombustionChamber1.inf) annotation (Line(
|
|---|
| 7415 | points={{-80,80},{-52,80},{-52,60}},
|
|---|
| 7416 | color={159,159,223},
|
|---|
| 7417 | thickness=0.5));
|
|---|
| 7418 | connect(turbine.outlet, SinkP1.flange) annotation (Line(
|
|---|
| 7419 | points={{48,-36},{48,0},{94,0}},
|
|---|
| 7420 | color={159,159,223},
|
|---|
| 7421 | thickness=0.5));
|
|---|
| 7422 | connect(SourceP1.flange, compressor.inlet) annotation (Line(
|
|---|
| 7423 | points={{-168,-20},{-152,-20},{-152,-36}},
|
|---|
| 7424 | color={159,159,223},
|
|---|
| 7425 | thickness=0.5));
|
|---|
| 7426 | connect(PressDrop1.outlet, turbine.inlet) annotation (Line(
|
|---|
| 7427 | points={{-1.83697e-015,-2},{-1.83697e-015,-36},{0,-36}},
|
|---|
| 7428 | color={159,159,223},
|
|---|
| 7429 | thickness=0.5));
|
|---|
| 7430 | connect(compressor.shaft_b, turbine.shaft_a) annotation (Line(
|
|---|
| 7431 | points={{-110,-60},{6,-60}},
|
|---|
| 7432 | color={0,0,0},
|
|---|
| 7433 | thickness=0.5));
|
|---|
| 7434 | connect(powerSensor.flange_a, turbine.shaft_b) annotation (Line(
|
|---|
| 7435 | points={{60,-60},{42,-60}},
|
|---|
| 7436 | color={0,0,0},
|
|---|
| 7437 | thickness=0.5));
|
|---|
| 7438 | connect(gasFlowActuator.u, fuelFlowRate) annotation (Line(points={
|
|---|
| 7439 | {-139.6,100},{-166,100},{-166,0},{-200,0}}, color={0,0,127}));
|
|---|
| 7440 | connect(gasFlowActuator.y, SourceW1.in_w0) annotation (Line(points={{-121.2,
|
|---|
| 7441 | 100},{-96,100},{-96,85}}, color={0,0,127}));
|
|---|
| 7442 | connect(powerSensor.power, powerSensor1.u) annotation (Line(points={{62,-71},
|
|---|
| 7443 | {62,-110},{144.4,-110}}, color={0,0,127}));
|
|---|
| 7444 | connect(powerSensor1.y, generatedPower) annotation (Line(points={{162.8,-110},
|
|---|
| 7445 | {184.4,-110},{184.4,0},{206,0}}, color={0,0,127}));
|
|---|
| 7446 | connect(CombustionChamber1.ina, stateInletCC.outlet) annotation (Line(
|
|---|
| 7447 | points={{-72,40},{-84,40}},
|
|---|
| 7448 | color={159,159,223},
|
|---|
| 7449 | thickness=0.5));
|
|---|
| 7450 | connect(stateOutletCC.inlet, CombustionChamber1.out) annotation (Line(
|
|---|
| 7451 | points={{-20,40},{-32,40}},
|
|---|
| 7452 | color={159,159,223},
|
|---|
| 7453 | thickness=0.5));
|
|---|
| 7454 | connect(stateOutletCC.outlet, PressDrop1.inlet) annotation (Line(
|
|---|
| 7455 | points={{-8,40},{1.83697e-015,40},{1.83697e-015,18}},
|
|---|
| 7456 | color={159,159,223},
|
|---|
| 7457 | thickness=0.5));
|
|---|
| 7458 | connect(generator.shaft, powerSensor.flange_b) annotation (Line(
|
|---|
| 7459 | points={{94.8,-60},{80,-60}},
|
|---|
| 7460 | color={0,0,0},
|
|---|
| 7461 | thickness=0.5));
|
|---|
| 7462 | connect(compressor.outlet, stateInletCC.inlet) annotation (Line(
|
|---|
| 7463 | points={{-104,-36},{-104,36},{-96,36},{-96,40}},
|
|---|
| 7464 | color={159,159,223},
|
|---|
| 7465 | smooth=Smooth.None));
|
|---|
| 7466 | annotation (
|
|---|
| 7467 | Diagram(coordinateSystem(
|
|---|
| 7468 | preserveAspectRatio=false,
|
|---|
| 7469 | extent={{-200,-200},{200,200}},
|
|---|
| 7470 | initialScale=0.1), graphics),
|
|---|
| 7471 | Icon(coordinateSystem(
|
|---|
| 7472 | preserveAspectRatio=false,
|
|---|
| 7473 | extent={{-200,-200},{200,200}},
|
|---|
| 7474 | initialScale=0.1), graphics={Rectangle(
|
|---|
| 7475 | extent={{-200,200},{200,-200}},
|
|---|
| 7476 | lineColor={170,170,255},
|
|---|
| 7477 | fillColor={255,255,255},
|
|---|
| 7478 | fillPattern=FillPattern.Solid), Text(
|
|---|
| 7479 | extent={{-140,140},{140,-140}},
|
|---|
| 7480 | lineColor={170,170,255},
|
|---|
| 7481 | textString="P")}),
|
|---|
| 7482 | Documentation(revisions="<html>
|
|---|
| 7483 | <ul>
|
|---|
| 7484 | <li><i>10 Dec 2008</i>
|
|---|
| 7485 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7486 | First release.</li>
|
|---|
| 7487 | </ul>
|
|---|
| 7488 | </html>", info="<html>
|
|---|
| 7489 | <p>This model contains the gas turbine, generator and network models. The network model is based on swing equation.
|
|---|
| 7490 | </html>"));
|
|---|
| 7491 | end Plant2;
|
|---|
| 7492 |
|
|---|
| 7493 | model OpenLoopSimulator
|
|---|
| 7494 |
|
|---|
| 7495 | Plant plant annotation (Placement(transformation(extent={{20,-20},{60,20}},
|
|---|
| 7496 | rotation=0)));
|
|---|
| 7497 | Modelica.Blocks.Sources.Step fuelFlowRate(
|
|---|
| 7498 | offset=2.02,
|
|---|
| 7499 | height=0.3,
|
|---|
| 7500 | startTime=500) annotation (Placement(transformation(extent={{-40,-10},{
|
|---|
| 7501 | -20,10}}, rotation=0)));
|
|---|
| 7502 | inner System system
|
|---|
| 7503 | annotation (Placement(transformation(extent={{80,80},{100,100}})));
|
|---|
| 7504 | equation
|
|---|
| 7505 | connect(plant.fuelFlowRate, fuelFlowRate.y)
|
|---|
| 7506 | annotation (Line(points={{20,0},{-19,0}}, color={0,0,127}));
|
|---|
| 7507 | annotation (
|
|---|
| 7508 | Diagram(graphics),
|
|---|
| 7509 | experiment(
|
|---|
| 7510 | StopTime=1000,
|
|---|
| 7511 | __Dymola_NumberOfIntervals=5000,
|
|---|
| 7512 | Tolerance=1e-006),
|
|---|
| 7513 | Documentation(revisions="<html>
|
|---|
| 7514 | <ul>
|
|---|
| 7515 | <li><i>10 Dec 2008</i>
|
|---|
| 7516 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7517 | First release.</li>
|
|---|
| 7518 | </ul>
|
|---|
| 7519 | </html>", info="<html>
|
|---|
| 7520 | <p>This model allows to simulate an open loop transients.
|
|---|
| 7521 | </html>"),__Dymola_experimentSetupOutput);
|
|---|
| 7522 | end OpenLoopSimulator;
|
|---|
| 7523 |
|
|---|
| 7524 | model OpenLoopSimulator2
|
|---|
| 7525 |
|
|---|
| 7526 | Plant2 plant
|
|---|
| 7527 | annotation (Placement(transformation(extent={{20,-20},{60,20}},
|
|---|
| 7528 | rotation=0)));
|
|---|
| 7529 | Modelica.Blocks.Sources.Step fuelFlowRate(
|
|---|
| 7530 | offset=2.02,
|
|---|
| 7531 | height=0.3,
|
|---|
| 7532 | startTime=500) annotation (Placement(transformation(extent={{-40,-10},{
|
|---|
| 7533 | -20,10}}, rotation=0)));
|
|---|
| 7534 | inner System system
|
|---|
| 7535 | annotation (Placement(transformation(extent={{80,80},{100,100}})));
|
|---|
| 7536 | equation
|
|---|
| 7537 | connect(plant.fuelFlowRate, fuelFlowRate.y)
|
|---|
| 7538 | annotation (Line(points={{20,0},{-19,0}}, color={0,0,127}));
|
|---|
| 7539 | annotation (
|
|---|
| 7540 | Diagram(graphics),
|
|---|
| 7541 | experiment(
|
|---|
| 7542 | StopTime=1000,
|
|---|
| 7543 | __Dymola_NumberOfIntervals=5000,
|
|---|
| 7544 | Tolerance=1e-006),
|
|---|
| 7545 | Documentation(revisions="<html>
|
|---|
| 7546 | <ul>
|
|---|
| 7547 | <li><i>10 Dec 2008</i>
|
|---|
| 7548 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7549 | First release.</li>
|
|---|
| 7550 | </ul>
|
|---|
| 7551 | </html>", info="<html>
|
|---|
| 7552 | <p>This model allows to simulate an open loop transients.
|
|---|
| 7553 | </html>"),__Dymola_experimentSetupOutput);
|
|---|
| 7554 | end OpenLoopSimulator2;
|
|---|
| 7555 | annotation (Documentation(revisions="<html>
|
|---|
| 7556 | <ul>
|
|---|
| 7557 | <li><i>12 Dec 2008</i>
|
|---|
| 7558 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 7559 | Package created.</li>
|
|---|
| 7560 | </ul>
|
|---|
| 7561 | </html>", info="<html>
|
|---|
| 7562 | <p>This package contains models of a open Brayton cycle and its main components.
|
|---|
| 7563 | </html>"));
|
|---|
| 7564 | end BraytonCycle;
|
|---|
| 7565 | end Examples;
|
|---|
| 7566 |
|
|---|
| 7567 | package Gas "Models of components with ideal gases as working fluid"
|
|---|
| 7568 |
|
|---|
| 7569 | connector Flange "Flange connector for gas flows"
|
|---|
| 7570 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium;
|
|---|
| 7571 | flow Medium.MassFlowRate m_flow
|
|---|
| 7572 | "Mass flow rate from the connection point into the component";
|
|---|
| 7573 | Medium.AbsolutePressure p
|
|---|
| 7574 | "Thermodynamic pressure in the connection point";
|
|---|
| 7575 | stream Medium.SpecificEnthalpy h_outflow
|
|---|
| 7576 | "Specific thermodynamic enthalpy close to the connection point if m_flow < 0";
|
|---|
| 7577 | stream Medium.MassFraction Xi_outflow[Medium.nXi]
|
|---|
| 7578 | "Independent mixture mass fractions m_i/m close to the connection point if m_flow < 0";
|
|---|
| 7579 | stream Medium.ExtraProperty C_outflow[Medium.nC]
|
|---|
| 7580 | "Properties c_i/m close to the connection point if m_flow < 0";
|
|---|
| 7581 | annotation (Icon(graphics), Documentation(info="<HTML>
|
|---|
| 7582 | </HTML>", revisions="<html>
|
|---|
| 7583 | <ul>
|
|---|
| 7584 | <li><i>20 Dec 2004</i>
|
|---|
| 7585 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7586 | Adapted to Modelica.Media.</li>
|
|---|
| 7587 | <li><i>5 Mar 2004</i>
|
|---|
| 7588 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7589 | First release.</li>
|
|---|
| 7590 | </ul>
|
|---|
| 7591 | </html>"));
|
|---|
| 7592 | end Flange;
|
|---|
| 7593 |
|
|---|
| 7594 | connector FlangeA "A-type flange connector for gas flows"
|
|---|
| 7595 | extends Flange;
|
|---|
| 7596 | annotation (Icon(graphics={Ellipse(
|
|---|
| 7597 | extent={{-100,100},{100,-100}},
|
|---|
| 7598 | lineColor={159,159,223},
|
|---|
| 7599 | fillColor={159,159,223},
|
|---|
| 7600 | fillPattern=FillPattern.Solid)}));
|
|---|
| 7601 | end FlangeA;
|
|---|
| 7602 |
|
|---|
| 7603 | connector FlangeB "B-type flange connector for gas flows"
|
|---|
| 7604 | extends Flange;
|
|---|
| 7605 | annotation (Icon(graphics={Ellipse(
|
|---|
| 7606 | extent={{-100,100},{100,-100}},
|
|---|
| 7607 | lineColor={159,159,223},
|
|---|
| 7608 | fillColor={159,159,223},
|
|---|
| 7609 | fillPattern=FillPattern.Solid), Ellipse(
|
|---|
| 7610 | extent={{-40,40},{40,-40}},
|
|---|
| 7611 | lineColor={159,159,223},
|
|---|
| 7612 | fillColor={255,255,255},
|
|---|
| 7613 | fillPattern=FillPattern.Solid)}));
|
|---|
| 7614 | end FlangeB;
|
|---|
| 7615 | extends Modelica.Icons.Package;
|
|---|
| 7616 |
|
|---|
| 7617 | model SourcePressure "Pressure source for gas flows"
|
|---|
| 7618 | extends Icons.Gas.SourceP;
|
|---|
| 7619 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 7620 | annotation(choicesAllMatching = true);
|
|---|
| 7621 | Medium.BaseProperties gas(
|
|---|
| 7622 | p(start=p0),
|
|---|
| 7623 | T(start=T),
|
|---|
| 7624 | Xi(start=Xnom[1:Medium.nXi]));
|
|---|
| 7625 | parameter Pressure p0=101325 "Nominal pressure";
|
|---|
| 7626 | parameter HydraulicResistance R=0 "Hydraulic resistance";
|
|---|
| 7627 | parameter AbsoluteTemperature T=300 "Nominal temperature";
|
|---|
| 7628 | parameter MassFraction Xnom[Medium.nX]=Medium.reference_X
|
|---|
| 7629 | "Nominal gas composition";
|
|---|
| 7630 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 7631 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 7632 | parameter Boolean use_in_p0 = false
|
|---|
| 7633 | "Use connector input for the pressure" annotation(Dialog(group="External inputs"));
|
|---|
| 7634 | parameter Boolean use_in_T = false
|
|---|
| 7635 | "Use connector input for the temperature" annotation(Dialog(group="External inputs"));
|
|---|
| 7636 | parameter Boolean use_in_X = false
|
|---|
| 7637 | "Use connector input for the composition" annotation(Dialog(group="External inputs"));
|
|---|
| 7638 |
|
|---|
| 7639 | outer ThermoPower.System system "System wide properties";
|
|---|
| 7640 |
|
|---|
| 7641 | FlangeB flange(redeclare package Medium = Medium, m_flow(max=if
|
|---|
| 7642 | allowFlowReversal then +Modelica.Constants.inf else 0)) annotation (
|
|---|
| 7643 | Placement(transformation(extent={{80,-20},{120,20}}, rotation=0)));
|
|---|
| 7644 | Modelica.Blocks.Interfaces.RealInput in_p0 if use_in_p0 annotation (Placement(
|
|---|
| 7645 | transformation(
|
|---|
| 7646 | origin={-60,64},
|
|---|
| 7647 | extent={{-10,-10},{10,10}},
|
|---|
| 7648 | rotation=270)));
|
|---|
| 7649 | Modelica.Blocks.Interfaces.RealInput in_T if use_in_T annotation (Placement(
|
|---|
| 7650 | transformation(
|
|---|
| 7651 | origin={0,90},
|
|---|
| 7652 | extent={{-10,-10},{10,10}},
|
|---|
| 7653 | rotation=270)));
|
|---|
| 7654 | Modelica.Blocks.Interfaces.RealInput in_X[Medium.nX] if use_in_X annotation (Placement(
|
|---|
| 7655 | transformation(
|
|---|
| 7656 | origin={60,62},
|
|---|
| 7657 | extent={{-10,-10},{10,10}},
|
|---|
| 7658 | rotation=270)));
|
|---|
| 7659 | protected
|
|---|
| 7660 | Modelica.Blocks.Interfaces.RealInput in_p0_internal;
|
|---|
| 7661 | Modelica.Blocks.Interfaces.RealInput in_T_internal;
|
|---|
| 7662 | Modelica.Blocks.Interfaces.RealInput in_X_internal[Medium.nX];
|
|---|
| 7663 |
|
|---|
| 7664 | equation
|
|---|
| 7665 | if R == 0 then
|
|---|
| 7666 | flange.p = gas.p;
|
|---|
| 7667 | else
|
|---|
| 7668 | flange.p = gas.p + flange.m_flow*R;
|
|---|
| 7669 | end if;
|
|---|
| 7670 |
|
|---|
| 7671 | gas.p = in_p0_internal;
|
|---|
| 7672 | if not use_in_p0 then
|
|---|
| 7673 | in_p0_internal = p0 "Pressure set by parameter";
|
|---|
| 7674 | end if;
|
|---|
| 7675 |
|
|---|
| 7676 | gas.T = in_T_internal;
|
|---|
| 7677 | if not use_in_T then
|
|---|
| 7678 | in_T_internal = T "Temperature set by parameter";
|
|---|
| 7679 | end if;
|
|---|
| 7680 |
|
|---|
| 7681 | gas.Xi = in_X_internal[1:Medium.nXi];
|
|---|
| 7682 | if not use_in_X then
|
|---|
| 7683 | in_X_internal = Xnom "Composition set by parameter";
|
|---|
| 7684 | end if;
|
|---|
| 7685 |
|
|---|
| 7686 | flange.h_outflow = gas.h;
|
|---|
| 7687 | flange.Xi_outflow = gas.Xi;
|
|---|
| 7688 |
|
|---|
| 7689 | // Connect protected connectors to public conditional connectors
|
|---|
| 7690 | connect(in_p0, in_p0_internal);
|
|---|
| 7691 | connect(in_T, in_T_internal);
|
|---|
| 7692 | connect(in_X, in_X_internal);
|
|---|
| 7693 | annotation (
|
|---|
| 7694 | Icon(graphics),
|
|---|
| 7695 | Diagram(graphics),
|
|---|
| 7696 | Documentation(info="<html>
|
|---|
| 7697 | <p><b>Modelling options</b></p>
|
|---|
| 7698 | <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> .
|
|---|
| 7699 | <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>
|
|---|
| 7700 | <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>
|
|---|
| 7701 | <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>
|
|---|
| 7702 | <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>
|
|---|
| 7703 | </html>", revisions="<html>
|
|---|
| 7704 | <ul>
|
|---|
| 7705 | <li><i>19 Nov 2004</i>
|
|---|
| 7706 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7707 | 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
|
|---|
| 7708 | <li><i>1 Oct 2003</i>
|
|---|
| 7709 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7710 | First release.</li>
|
|---|
| 7711 | </ul>
|
|---|
| 7712 | </html>
|
|---|
| 7713 | "));
|
|---|
| 7714 | end SourcePressure;
|
|---|
| 7715 |
|
|---|
| 7716 | model SinkPressure "Pressure sink for gas flows"
|
|---|
| 7717 | extends Icons.Gas.SourceP;
|
|---|
| 7718 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 7719 | annotation(choicesAllMatching = true);
|
|---|
| 7720 | Medium.BaseProperties gas(
|
|---|
| 7721 | p(start=p0),
|
|---|
| 7722 | T(start=T),
|
|---|
| 7723 | Xi(start=Xnom[1:Medium.nXi]));
|
|---|
| 7724 | parameter Pressure p0=101325 "Nominal pressure";
|
|---|
| 7725 | parameter AbsoluteTemperature T=300 "Nominal temperature";
|
|---|
| 7726 | parameter MassFraction Xnom[Medium.nX]=Medium.reference_X
|
|---|
| 7727 | "Nominal gas composition";
|
|---|
| 7728 | parameter HydraulicResistance R=0 "Hydraulic Resistance";
|
|---|
| 7729 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 7730 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 7731 | parameter Boolean use_in_p0 = false
|
|---|
| 7732 | "Use connector input for the pressure" annotation(Dialog(group="External inputs"));
|
|---|
| 7733 | parameter Boolean use_in_T = false
|
|---|
| 7734 | "Use connector input for the temperature" annotation(Dialog(group="External inputs"));
|
|---|
| 7735 | parameter Boolean use_in_X = false
|
|---|
| 7736 | "Use connector input for the composition" annotation(Dialog(group="External inputs"));
|
|---|
| 7737 |
|
|---|
| 7738 | outer ThermoPower.System system "System wide properties";
|
|---|
| 7739 |
|
|---|
| 7740 | FlangeA flange(redeclare package Medium = Medium, m_flow(min=if
|
|---|
| 7741 | allowFlowReversal then -Modelica.Constants.inf else 0)) annotation (
|
|---|
| 7742 | Placement(transformation(extent={{-120,-20},{-80,20}}, rotation=0)));
|
|---|
| 7743 | Modelica.Blocks.Interfaces.RealInput in_p0 if use_in_p0 annotation (Placement(
|
|---|
| 7744 | transformation(
|
|---|
| 7745 | origin={-64.5,59.5},
|
|---|
| 7746 | extent={{-12.5,-12.5},{12.5,12.5}},
|
|---|
| 7747 | rotation=270)));
|
|---|
| 7748 | Modelica.Blocks.Interfaces.RealInput in_T if use_in_T annotation (Placement(
|
|---|
| 7749 | transformation(
|
|---|
| 7750 | origin={0,90},
|
|---|
| 7751 | extent={{-10,-12},{10,12}},
|
|---|
| 7752 | rotation=270)));
|
|---|
| 7753 | Modelica.Blocks.Interfaces.RealInput in_X[Medium.nX] if use_in_X annotation (Placement(
|
|---|
| 7754 | transformation(
|
|---|
| 7755 | origin={66,59},
|
|---|
| 7756 | extent={{-13,-14},{13,14}},
|
|---|
| 7757 | rotation=270)));
|
|---|
| 7758 | protected
|
|---|
| 7759 | Modelica.Blocks.Interfaces.RealInput in_p0_internal;
|
|---|
| 7760 | Modelica.Blocks.Interfaces.RealInput in_T_internal;
|
|---|
| 7761 | Modelica.Blocks.Interfaces.RealInput in_X_internal[Medium.nX];
|
|---|
| 7762 | equation
|
|---|
| 7763 | if R == 0 then
|
|---|
| 7764 | flange.p = gas.p;
|
|---|
| 7765 | else
|
|---|
| 7766 | flange.p = gas.p + flange.m_flow*R;
|
|---|
| 7767 | end if;
|
|---|
| 7768 |
|
|---|
| 7769 | gas.p = in_p0_internal;
|
|---|
| 7770 | if not use_in_p0 then
|
|---|
| 7771 | in_p0_internal = p0 "Pressure set by parameter";
|
|---|
| 7772 | end if;
|
|---|
| 7773 |
|
|---|
| 7774 | gas.T = in_T_internal;
|
|---|
| 7775 | if not use_in_T then
|
|---|
| 7776 | in_T_internal = T "Temperature set by parameter";
|
|---|
| 7777 | end if;
|
|---|
| 7778 |
|
|---|
| 7779 | gas.Xi = in_X_internal[1:Medium.nXi];
|
|---|
| 7780 | if not use_in_X then
|
|---|
| 7781 | in_X_internal = Xnom "Composition set by parameter";
|
|---|
| 7782 | end if;
|
|---|
| 7783 |
|
|---|
| 7784 | flange.h_outflow = gas.h;
|
|---|
| 7785 | flange.Xi_outflow = gas.Xi;
|
|---|
| 7786 |
|
|---|
| 7787 | // Connect protected connectors to public conditional connectors
|
|---|
| 7788 | connect(in_p0, in_p0_internal);
|
|---|
| 7789 | connect(in_T, in_T_internal);
|
|---|
| 7790 | connect(in_X, in_X_internal);
|
|---|
| 7791 |
|
|---|
| 7792 | annotation (Documentation(info="<html>
|
|---|
| 7793 | <p><b>Modelling options</b></p>
|
|---|
| 7794 | <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> .
|
|---|
| 7795 | <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>
|
|---|
| 7796 | <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>
|
|---|
| 7797 | <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>
|
|---|
| 7798 | <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>
|
|---|
| 7799 | </html>", revisions="<html>
|
|---|
| 7800 | <ul>
|
|---|
| 7801 | <li><i>19 Nov 2004</i>
|
|---|
| 7802 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7803 | Removed <tt>p0fix</tt> and <tt>Tfix</tt> and <tt>Xfix</tt>; the connection of external signals is now detected automatically.</li>
|
|---|
| 7804 | <br> Adapted to Modelica.Media
|
|---|
| 7805 | <li><i>1 Oct 2003</i>
|
|---|
| 7806 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7807 | First release.</li>
|
|---|
| 7808 | </ul>
|
|---|
| 7809 | </html>"));
|
|---|
| 7810 | end SinkPressure;
|
|---|
| 7811 |
|
|---|
| 7812 | model SourceMassFlow "Flow rate source for gas flows"
|
|---|
| 7813 | extends Icons.Gas.SourceW;
|
|---|
| 7814 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 7815 | annotation(choicesAllMatching = true);
|
|---|
| 7816 | Medium.BaseProperties gas(
|
|---|
| 7817 | p(start=p0),
|
|---|
| 7818 | T(start=T),
|
|---|
| 7819 | Xi(start=Xnom[1:Medium.nXi]));
|
|---|
| 7820 | parameter Pressure p0=101325 "Nominal pressure";
|
|---|
| 7821 | parameter AbsoluteTemperature T=300 "Nominal temperature";
|
|---|
| 7822 | parameter MassFraction Xnom[Medium.nX]=Medium.reference_X
|
|---|
| 7823 | "Nominal gas composition";
|
|---|
| 7824 | parameter MassFlowRate w0=0 "Nominal mass flowrate";
|
|---|
| 7825 | parameter HydraulicConductance G=0 "HydraulicConductance";
|
|---|
| 7826 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 7827 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 7828 | parameter Boolean use_in_w0 = false
|
|---|
| 7829 | "Use connector input for the nominal flow rate" annotation(Dialog(group="External inputs"));
|
|---|
| 7830 | parameter Boolean use_in_T = false
|
|---|
| 7831 | "Use connector input for the temperature" annotation(Dialog(group="External inputs"));
|
|---|
| 7832 | parameter Boolean use_in_X = false
|
|---|
| 7833 | "Use connector input for the composition" annotation(Dialog(group="External inputs"));
|
|---|
| 7834 | outer ThermoPower.System system "System wide properties";
|
|---|
| 7835 |
|
|---|
| 7836 | MassFlowRate w "Nominal mass flow rate";
|
|---|
| 7837 |
|
|---|
| 7838 | FlangeB flange(redeclare package Medium = Medium, m_flow(max=if
|
|---|
| 7839 | allowFlowReversal then +Modelica.Constants.inf else 0)) annotation (
|
|---|
| 7840 | Placement(transformation(extent={{80,-20},{120,20}}, rotation=0)));
|
|---|
| 7841 | Modelica.Blocks.Interfaces.RealInput in_w0 if use_in_w0 annotation (Placement(
|
|---|
| 7842 | transformation(
|
|---|
| 7843 | origin={-60,50},
|
|---|
| 7844 | extent={{-10,-10},{10,10}},
|
|---|
| 7845 | rotation=270)));
|
|---|
| 7846 | Modelica.Blocks.Interfaces.RealInput in_T if use_in_T annotation (Placement(
|
|---|
| 7847 | transformation(
|
|---|
| 7848 | origin={0,50},
|
|---|
| 7849 | extent={{10,-10},{-10,10}},
|
|---|
| 7850 | rotation=90)));
|
|---|
| 7851 | Modelica.Blocks.Interfaces.RealInput in_X[Medium.nX] if use_in_X annotation (Placement(
|
|---|
| 7852 | transformation(
|
|---|
| 7853 | origin={60,50},
|
|---|
| 7854 | extent={{-10,-10},{10,10}},
|
|---|
| 7855 | rotation=270)));
|
|---|
| 7856 | protected
|
|---|
| 7857 | Modelica.Blocks.Interfaces.RealInput in_w0_internal;
|
|---|
| 7858 | Modelica.Blocks.Interfaces.RealInput in_T_internal;
|
|---|
| 7859 | Modelica.Blocks.Interfaces.RealInput in_X_internal[Medium.nX];
|
|---|
| 7860 |
|
|---|
| 7861 | equation
|
|---|
| 7862 | if G == 0 then
|
|---|
| 7863 | flange.m_flow = -w;
|
|---|
| 7864 | else
|
|---|
| 7865 | flange.m_flow = -w + (flange.p - p0)*G;
|
|---|
| 7866 | end if;
|
|---|
| 7867 |
|
|---|
| 7868 | w = in_w0_internal;
|
|---|
| 7869 |
|
|---|
| 7870 | if not use_in_w0 then
|
|---|
| 7871 | in_w0_internal = w0 "Flow rate set by parameter";
|
|---|
| 7872 | end if;
|
|---|
| 7873 |
|
|---|
| 7874 | gas.T = in_T_internal;
|
|---|
| 7875 | if not use_in_T then
|
|---|
| 7876 | in_T_internal = T "Temperature set by parameter";
|
|---|
| 7877 | end if;
|
|---|
| 7878 |
|
|---|
| 7879 | gas.Xi = in_X_internal[1:Medium.nXi];
|
|---|
| 7880 | if not use_in_X then
|
|---|
| 7881 | in_X_internal = Xnom "Composition set by parameter";
|
|---|
| 7882 | end if;
|
|---|
| 7883 |
|
|---|
| 7884 | flange.p = gas.p;
|
|---|
| 7885 | flange.h_outflow = gas.h;
|
|---|
| 7886 | flange.Xi_outflow = gas.Xi;
|
|---|
| 7887 |
|
|---|
| 7888 | // Connect protected connectors to public conditional connectors
|
|---|
| 7889 | connect(in_w0, in_w0_internal);
|
|---|
| 7890 | connect(in_T, in_T_internal);
|
|---|
| 7891 | connect(in_X, in_X_internal);
|
|---|
| 7892 |
|
|---|
| 7893 | annotation (Documentation(info="<html>
|
|---|
| 7894 | <p><b>Modelling options</b></p>
|
|---|
| 7895 | <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> .
|
|---|
| 7896 | <p>If <tt>G</tt> is set to zero, the flowrate source is ideal; otherwise, the outgoing flowrate decreases proportionally to the outlet pressure.</p>
|
|---|
| 7897 | <p>If the <tt>in_w0</tt> connector is wired, then the source massflowrate is given by the corresponding signal, otherwise it is fixed to <tt>w0</tt>.</p>
|
|---|
| 7898 | <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>
|
|---|
| 7899 | <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>
|
|---|
| 7900 | </html>", revisions="<html>
|
|---|
| 7901 | <ul>
|
|---|
| 7902 | <li><i>19 Nov 2004</i>
|
|---|
| 7903 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7904 | Removed <tt>w0fix</tt> and <tt>Tfix</tt> and <tt>Xfix</tt>; the connection of external signals is now detected automatically.</li> <br> Adapted to Modelica.Media
|
|---|
| 7905 | <li><i>1 Oct 2003</i>
|
|---|
| 7906 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 7907 | First release.</li>
|
|---|
| 7908 | </ul>
|
|---|
| 7909 | </html>"), Diagram(graphics));
|
|---|
| 7910 | end SourceMassFlow;
|
|---|
| 7911 |
|
|---|
| 7912 | model PressDrop "Pressure drop for gas flows"
|
|---|
| 7913 | extends Icons.Gas.Tube;
|
|---|
| 7914 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 7915 | annotation(choicesAllMatching = true);
|
|---|
| 7916 | Medium.BaseProperties gas(
|
|---|
| 7917 | p(start=pstart),
|
|---|
| 7918 | T(start=Tstart),
|
|---|
| 7919 | Xi(start=Xstart[1:Medium.nXi]));
|
|---|
| 7920 | parameter MassFlowRate wnom "Nominal mass flowrate";
|
|---|
| 7921 | parameter Pressure dpnom "Nominal pressure drop";
|
|---|
| 7922 | parameter ThermoPower.Choices.PressDrop.FFtypes FFtype= ThermoPower.Choices.PressDrop.FFtypes.Kf
|
|---|
| 7923 | "Friction factor type";
|
|---|
| 7924 | parameter Real Kf = 0
|
|---|
| 7925 | "Hydraulic resistance coefficient (DP = Kf*w^2/rho)"
|
|---|
| 7926 | annotation(Dialog(enable = (FFtype == ThermoPower.Choices.PressDrop.FFtypes.Kf)));
|
|---|
| 7927 | parameter Density rhonom=0 "Nominal density"
|
|---|
| 7928 | annotation(Dialog(enable = (FFtype == ThermoPower.Choices.PressDrop.FFtypes.OpPoint)));
|
|---|
| 7929 | parameter Real K=0
|
|---|
| 7930 | "Kinetic resistance coefficient (DP=K*rho*velocity2/2)"
|
|---|
| 7931 | annotation(Dialog(enable = (FFtype == ThermoPower.Choices.PressDrop.FFtypes.Kinetic)));
|
|---|
| 7932 | parameter Area A=0 "Cross-section"
|
|---|
| 7933 | annotation(Dialog(enable = (FFtype == ThermoPower.Choices.PressDrop.FFtypes.Kinetic)));
|
|---|
| 7934 | parameter Real wnf=0.01
|
|---|
| 7935 | "Fraction of nominal flow rate at which linear friction equals turbulent friction";
|
|---|
| 7936 | parameter Real Kfc=1 "Friction factor correction coefficient";
|
|---|
| 7937 | final parameter Real Kf_a(fixed = false)
|
|---|
| 7938 | "Actual hydraulic resistance coefficient";
|
|---|
| 7939 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 7940 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 7941 | outer ThermoPower.System system "System wide properties";
|
|---|
| 7942 | parameter Pressure pstart=101325 "Start pressure value"
|
|---|
| 7943 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 7944 | parameter AbsoluteTemperature Tstart=300 "Start temperature value"
|
|---|
| 7945 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 7946 | parameter MassFraction Xstart[Medium.nX]=Medium.reference_X
|
|---|
| 7947 | "Start gas composition" annotation (Dialog(tab="Initialisation"));
|
|---|
| 7948 | function squareReg = ThermoPower.Functions.squareReg;
|
|---|
| 7949 | MassFlowRate w "Mass flow rate in the inlet";
|
|---|
| 7950 | Pressure pin "Inlet pressure";
|
|---|
| 7951 | Pressure pout "Outlet pressure";
|
|---|
| 7952 | Pressure dp "Pressure drop";
|
|---|
| 7953 |
|
|---|
| 7954 | FlangeA inlet(redeclare package Medium = Medium, m_flow(start=wnom, min=if
|
|---|
| 7955 | allowFlowReversal then -Modelica.Constants.inf else 0)) annotation (
|
|---|
| 7956 | Placement(transformation(extent={{-120,-20},{-80,20}}, rotation=0)));
|
|---|
| 7957 | FlangeB outlet(redeclare package Medium = Medium, m_flow(start=-wnom, max=
|
|---|
| 7958 | if allowFlowReversal then +Modelica.Constants.inf else 0))
|
|---|
| 7959 | annotation (Placement(transformation(extent={{80,-20},{120,20}}, rotation=
|
|---|
| 7960 | 0)));
|
|---|
| 7961 | initial equation
|
|---|
| 7962 | if FFtype == ThermoPower.Choices.PressDrop.FFtypes.Kf then
|
|---|
| 7963 | Kf_a = Kf*Kfc;
|
|---|
| 7964 | elseif FFtype == ThermoPower.Choices.PressDrop.FFtypes.OpPoint then
|
|---|
| 7965 | Kf_a = dpnom*rhonom/wnom^2*Kfc;
|
|---|
| 7966 | elseif FFtype == ThermoPower.Choices.PressDrop.FFtypes.Kinetic then
|
|---|
| 7967 | Kf_a = K/(2*A^2)*Kfc;
|
|---|
| 7968 | else
|
|---|
| 7969 | Kf_a = 0;
|
|---|
| 7970 | assert(false, "Unsupported FFtype");
|
|---|
| 7971 | end if;
|
|---|
| 7972 | equation
|
|---|
| 7973 | assert(dpnom > 0,
|
|---|
| 7974 | "dpnom=0 not supported, it is also used in the homotopy trasformation during the inizialization");
|
|---|
| 7975 | // Set fluid properties
|
|---|
| 7976 | gas.p = homotopy(if not allowFlowReversal then pin else if inlet.m_flow >=
|
|---|
| 7977 | 0 then pin else pout, pin);
|
|---|
| 7978 | gas.h = homotopy(if not allowFlowReversal then inStream(inlet.h_outflow)
|
|---|
| 7979 | else actualStream(inlet.h_outflow), inStream(inlet.h_outflow));
|
|---|
| 7980 | gas.Xi = homotopy(if not allowFlowReversal then inStream(inlet.Xi_outflow)
|
|---|
| 7981 | else actualStream(inlet.Xi_outflow), inStream(inlet.Xi_outflow));
|
|---|
| 7982 |
|
|---|
| 7983 | pin - pout = homotopy(smooth(1, Kf*squareReg(w, wnom*wnf))/gas.d, dpnom/
|
|---|
| 7984 | wnom*w) "Flow characteristics";
|
|---|
| 7985 |
|
|---|
| 7986 | //Boundary conditions
|
|---|
| 7987 | w = inlet.m_flow;
|
|---|
| 7988 | pin = inlet.p;
|
|---|
| 7989 | pout = outlet.p;
|
|---|
| 7990 | dp = pin - pout;
|
|---|
| 7991 |
|
|---|
| 7992 | // Mass balance
|
|---|
| 7993 | inlet.m_flow + outlet.m_flow = 0;
|
|---|
| 7994 |
|
|---|
| 7995 | // Energy balance
|
|---|
| 7996 | inlet.h_outflow = inStream(outlet.h_outflow);
|
|---|
| 7997 | inStream(inlet.h_outflow) = outlet.h_outflow;
|
|---|
| 7998 |
|
|---|
| 7999 | // Independent component mass balances
|
|---|
| 8000 | inlet.Xi_outflow = inStream(outlet.Xi_outflow);
|
|---|
| 8001 | inStream(inlet.Xi_outflow) = outlet.Xi_outflow;
|
|---|
| 8002 | annotation (
|
|---|
| 8003 | Icon(graphics={Text(extent={{-100,-40},{100,-80}}, textString="%name")}),
|
|---|
| 8004 | Diagram(graphics),
|
|---|
| 8005 | Documentation(info="<html>
|
|---|
| 8006 | <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>
|
|---|
| 8007 | <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).
|
|---|
| 8008 | <p><b>Modelling options</b></p>
|
|---|
| 8009 | <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>.
|
|---|
| 8010 | <p>The following options are available to specify the friction coefficient:
|
|---|
| 8011 | <ul><li><tt>FFtype = 0</tt>: the hydraulic friction coefficient <tt>Kf</tt> is used directly.</li>
|
|---|
| 8012 | <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>
|
|---|
| 8013 | <li><tt>FFtype = 2</tt>: the pressure drop is <tt>K</tt> times the kinetic pressure.</li></ul>
|
|---|
| 8014 | </html>", revisions="<html>
|
|---|
| 8015 | <ul>
|
|---|
| 8016 | <li><i>19 Nov 2004</i>
|
|---|
| 8017 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8018 | Adapted to Modelica.Media.</li>
|
|---|
| 8019 | <br> <tt>Kfnom</tt> removed, <tt>Kf</tt> can now be set directly.</li>
|
|---|
| 8020 | <li><i>5 Mar 2004</i>
|
|---|
| 8021 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8022 | First release.</li>
|
|---|
| 8023 | </ul>
|
|---|
| 8024 | </html>"));
|
|---|
| 8025 | end PressDrop;
|
|---|
| 8026 |
|
|---|
| 8027 | partial model CombustionChamberBase "Combustion Chamber"
|
|---|
| 8028 | extends Icons.Gas.Mixer;
|
|---|
| 8029 | replaceable package Air = Modelica.Media.Interfaces.PartialMedium;
|
|---|
| 8030 | replaceable package Fuel = Modelica.Media.Interfaces.PartialMedium;
|
|---|
| 8031 | replaceable package Exhaust = Modelica.Media.Interfaces.PartialMedium;
|
|---|
| 8032 | parameter Volume V "Inner volume";
|
|---|
| 8033 | parameter Area S=0 "Inner surface";
|
|---|
| 8034 | parameter CoefficientOfHeatTransfer gamma=0 "Heat Transfer Coefficient"
|
|---|
| 8035 | annotation (Evaluate=true);
|
|---|
| 8036 | parameter HeatCapacity Cm=0 "Metal Heat Capacity" annotation (Evaluate=true);
|
|---|
| 8037 | parameter Temperature Tmstart=300 "Metal wall start temperature"
|
|---|
| 8038 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8039 | parameter SpecificEnthalpy HH "Lower Heating value of fuel";
|
|---|
| 8040 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 8041 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 8042 | outer ThermoPower.System system "System wide properties";
|
|---|
| 8043 | parameter Pressure pstart=101325 "Pressure start value"
|
|---|
| 8044 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8045 | parameter AbsoluteTemperature Tstart=300 "Temperature start value"
|
|---|
| 8046 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8047 | parameter MassFraction Xstart[Exhaust.nX]=Exhaust.reference_X
|
|---|
| 8048 | "Start flue gas composition" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8049 | parameter Choices.Init.Options initOpt=Choices.Init.Options.noInit
|
|---|
| 8050 | "Initialisation option" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8051 | Exhaust.BaseProperties fluegas(
|
|---|
| 8052 | p(start=pstart),
|
|---|
| 8053 | T(start=Tstart),
|
|---|
| 8054 | Xi(start=Xstart[1:Exhaust.nXi]));
|
|---|
| 8055 | Mass M "Gas total mass";
|
|---|
| 8056 | Mass MX[Exhaust.nXi] "Partial flue gas masses";
|
|---|
| 8057 | InternalEnergy E "Gas total energy";
|
|---|
| 8058 | AbsoluteTemperature Tm(start=Tmstart) "Wall temperature";
|
|---|
| 8059 | Air.SpecificEnthalpy hia "Air specific enthalpy";
|
|---|
| 8060 | Fuel.SpecificEnthalpy hif "Fuel specific enthalpy";
|
|---|
| 8061 | Exhaust.SpecificEnthalpy ho "Outlet specific enthalpy";
|
|---|
| 8062 | Power HR "Heat rate";
|
|---|
| 8063 |
|
|---|
| 8064 | Time Tr "Residence time";
|
|---|
| 8065 | FlangeA ina(redeclare package Medium = Air, m_flow(min=if allowFlowReversal
|
|---|
| 8066 | then -Modelica.Constants.inf else 0)) "inlet air" annotation (
|
|---|
| 8067 | Placement(transformation(extent={{-120,-20},{-80,20}}, rotation=0)));
|
|---|
| 8068 | FlangeA inf(redeclare package Medium = Fuel, m_flow(min=if
|
|---|
| 8069 | allowFlowReversal then -Modelica.Constants.inf else 0))
|
|---|
| 8070 | "inlet fuel" annotation (Placement(transformation(extent={{-20,80},{20,
|
|---|
| 8071 | 120}}, rotation=0)));
|
|---|
| 8072 | FlangeB out(redeclare package Medium = Exhaust, m_flow(max=if
|
|---|
| 8073 | allowFlowReversal then +Modelica.Constants.inf else 0))
|
|---|
| 8074 | "flue gas"
|
|---|
| 8075 | annotation (Placement(transformation(extent={{80,-20},{120,20}}, rotation=
|
|---|
| 8076 | 0)));
|
|---|
| 8077 | equation
|
|---|
| 8078 | M = fluegas.d*V "Gas mass";
|
|---|
| 8079 | E = fluegas.u*M "Gas energy";
|
|---|
| 8080 | MX = fluegas.Xi*M "Component masses";
|
|---|
| 8081 | HR = inf.m_flow*HH;
|
|---|
| 8082 | der(M) = ina.m_flow + inf.m_flow + out.m_flow "Gas mass balance";
|
|---|
| 8083 | der(E) = ina.m_flow*hia + inf.m_flow*hif + out.m_flow*ho + HR - gamma*S*(
|
|---|
| 8084 | fluegas.T - Tm) "Gas energy balance";
|
|---|
| 8085 | if Cm > 0 and gamma > 0 then
|
|---|
| 8086 | Cm*der(Tm) = gamma*S*(fluegas.T - Tm) "Metal wall energy balance";
|
|---|
| 8087 | else
|
|---|
| 8088 | Tm = fluegas.T;
|
|---|
| 8089 | end if;
|
|---|
| 8090 |
|
|---|
| 8091 | // Set gas properties
|
|---|
| 8092 | out.p = fluegas.p;
|
|---|
| 8093 | out.h_outflow = fluegas.h;
|
|---|
| 8094 | out.Xi_outflow = fluegas.Xi;
|
|---|
| 8095 |
|
|---|
| 8096 | // Boundary conditions
|
|---|
| 8097 | ina.p = fluegas.p;
|
|---|
| 8098 | ina.h_outflow = 0;
|
|---|
| 8099 | ina.Xi_outflow = Air.reference_X[1:Air.nXi];
|
|---|
| 8100 | inf.p = fluegas.p;
|
|---|
| 8101 | inf.h_outflow = 0;
|
|---|
| 8102 | inf.Xi_outflow = Fuel.reference_X[1:Fuel.nXi];
|
|---|
| 8103 | assert(ina.m_flow >= 0, "The model does not support flow reversal");
|
|---|
| 8104 | hia = inStream(ina.h_outflow);
|
|---|
| 8105 | assert(inf.m_flow >= 0, "The model does not support flow reversal");
|
|---|
| 8106 | hif = inStream(inf.h_outflow);
|
|---|
| 8107 | assert(out.m_flow <= 0, "The model does not support flow reversal");
|
|---|
| 8108 | ho = fluegas.h;
|
|---|
| 8109 |
|
|---|
| 8110 | Tr = noEvent(M/max(abs(out.m_flow), Modelica.Constants.eps));
|
|---|
| 8111 | initial equation
|
|---|
| 8112 | // Initial conditions
|
|---|
| 8113 | if initOpt == Choices.Init.Options.noInit then
|
|---|
| 8114 | // do nothing
|
|---|
| 8115 | elseif initOpt == Choices.Init.Options.steadyState then
|
|---|
| 8116 | der(fluegas.p) = 0;
|
|---|
| 8117 | der(fluegas.T) = 0;
|
|---|
| 8118 | der(fluegas.Xi) = zeros(Exhaust.nXi);
|
|---|
| 8119 | if (Cm > 0 and gamma > 0) then
|
|---|
| 8120 | der(Tm) = 0;
|
|---|
| 8121 | end if;
|
|---|
| 8122 | elseif initOpt == Choices.Init.Options.steadyStateNoP then
|
|---|
| 8123 | der(fluegas.T) = 0;
|
|---|
| 8124 | der(fluegas.Xi) = zeros(Exhaust.nXi);
|
|---|
| 8125 | if (Cm > 0 and gamma > 0) then
|
|---|
| 8126 | der(Tm) = 0;
|
|---|
| 8127 | end if;
|
|---|
| 8128 | else
|
|---|
| 8129 | assert(false, "Unsupported initialisation option");
|
|---|
| 8130 | end if;
|
|---|
| 8131 |
|
|---|
| 8132 | annotation (Documentation(info="<html>
|
|---|
| 8133 | This is the model-base of a Combustion Chamber, with a constant volume.
|
|---|
| 8134 | <p>The metal wall temperature and the heat transfer coefficient between the wall and the fluid are uniform. The wall is thermally insulated from the outside. It has been assumed that inlet gases are premixed before entering in the volume.
|
|---|
| 8135 | <p><b>Modelling options</b></p>
|
|---|
| 8136 | <p>This model has three different Medium models to characterize the inlet air, fuel, and flue gas exhaust.
|
|---|
| 8137 | <p>If <tt>gamma = 0</tt>, the thermal effects of the surrounding walls are neglected.
|
|---|
| 8138 | </p>
|
|---|
| 8139 | </html>", revisions="<html>
|
|---|
| 8140 | <ul>
|
|---|
| 8141 | <li><i>30 May 2005</i>
|
|---|
| 8142 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8143 | Initialisation support added.</li>
|
|---|
| 8144 | <li><i>31 Jan 2005</i>
|
|---|
| 8145 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8146 | CombustionChamber model restructured using inheritance.
|
|---|
| 8147 | <p> First release.</li>
|
|---|
| 8148 | </ul>
|
|---|
| 8149 | </html>
|
|---|
| 8150 | "), Diagram(graphics));
|
|---|
| 8151 | end CombustionChamberBase;
|
|---|
| 8152 |
|
|---|
| 8153 | model CombustionChamber "Combustion Chamber"
|
|---|
| 8154 | extends CombustionChamberBase(
|
|---|
| 8155 | redeclare package Air = Media.Air "O2, H2O, Ar, N2",
|
|---|
| 8156 | redeclare package Fuel = Media.NaturalGas "N2, CO2, CH4",
|
|---|
| 8157 | redeclare package Exhaust = Media.FlueGas "O2, Ar, H2O, CO2, N2");
|
|---|
| 8158 | Real wcomb(final quantity="MolarFlowRate", unit="mol/s")
|
|---|
| 8159 | "Molar Combustion rate (CH4)";
|
|---|
| 8160 | Real lambda
|
|---|
| 8161 | "Stoichiometric ratio (>1 if air flow is greater than stoichiometric)";
|
|---|
| 8162 | protected
|
|---|
| 8163 | Real ina_X[Air.nXi]=inStream(ina.Xi_outflow);
|
|---|
| 8164 | Real inf_X[Fuel.nXi]=inStream(inf.Xi_outflow);
|
|---|
| 8165 |
|
|---|
| 8166 | equation
|
|---|
| 8167 | wcomb = inf.m_flow*inf_X[3]/Fuel.data[3].MM "Combustion molar flow rate";
|
|---|
| 8168 | lambda = (ina.m_flow*ina_X[1]/Air.data[1].MM)/(2*wcomb);
|
|---|
| 8169 | assert(lambda >= 1, "Not enough oxygen flow");
|
|---|
| 8170 | der(MX[1]) = ina.m_flow*ina_X[1] + out.m_flow*fluegas.X[1] - 2*wcomb*
|
|---|
| 8171 | Exhaust.data[1].MM "oxygen";
|
|---|
| 8172 | der(MX[2]) = ina.m_flow*ina_X[3] + out.m_flow*fluegas.X[2] "argon";
|
|---|
| 8173 | der(MX[3]) = ina.m_flow*ina_X[2] + out.m_flow*fluegas.X[3] + 2*wcomb*
|
|---|
| 8174 | Exhaust.data[3].MM "water";
|
|---|
| 8175 | der(MX[4]) = inf.m_flow*inf_X[2] + out.m_flow*fluegas.X[4] + wcomb*Exhaust.data[
|
|---|
| 8176 | 4].MM "carbondioxide";
|
|---|
| 8177 | der(MX[5]) = ina.m_flow*ina_X[4] + out.m_flow*fluegas.X[5] + inf.m_flow*
|
|---|
| 8178 | inf_X[1] "nitrogen";
|
|---|
| 8179 | annotation (Icon(graphics), Documentation(info="<html>
|
|---|
| 8180 | This model extends the CombustionChamber Base model, with the definition of the gases.
|
|---|
| 8181 | <p>In particular, the air inlet uses the <tt>Media.Air</tt> medium model, the fuel input uses the <tt>Media.NaturalGas</tt> medium model, and the flue gas outlet uses the <tt>Medium.FlueGas</tt> medium model.
|
|---|
| 8182 | <p>The composition of the outgoing gas is determined by the mass balance of every component, taking into account the combustion reaction CH4+2O2--->2H2O+CO2.</p>
|
|---|
| 8183 | <p>The model assumes complete combustion, so that it is only valid if the oxygen flow at the air inlet is greater than the stoichiometric flow corresponding to the flow at the fuel inlet.</p>
|
|---|
| 8184 |
|
|---|
| 8185 | </html>", revisions="<html>
|
|---|
| 8186 | <ul>
|
|---|
| 8187 | <li><i>31 Jan 2005</i>
|
|---|
| 8188 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8189 | Combustion Chamber model restructured using inheritance.
|
|---|
| 8190 | <p> First release.
|
|---|
| 8191 | </li>
|
|---|
| 8192 | </ul>
|
|---|
| 8193 | </html>"));
|
|---|
| 8194 | end CombustionChamber;
|
|---|
| 8195 |
|
|---|
| 8196 | partial model CompressorBase "Gas compressor"
|
|---|
| 8197 | extends ThermoPower.Icons.Gas.Compressor;
|
|---|
| 8198 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 8199 | annotation(choicesAllMatching = true);
|
|---|
| 8200 | parameter Boolean explicitIsentropicEnthalpy=true
|
|---|
| 8201 | "isentropicEnthalpy function used";
|
|---|
| 8202 | parameter Real eta_mech=0.98 "mechanical efficiency";
|
|---|
| 8203 | parameter Modelica.SIunits.Pressure pstart_in "inlet start pressure"
|
|---|
| 8204 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8205 | parameter Modelica.SIunits.Pressure pstart_out "outlet start pressure"
|
|---|
| 8206 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8207 | parameter ThermoPower.AbsoluteTemperature Tdes_in
|
|---|
| 8208 | "inlet design temperature";
|
|---|
| 8209 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 8210 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 8211 | outer ThermoPower.System system "System wide properties";
|
|---|
| 8212 | parameter ThermoPower.AbsoluteTemperature Tstart_in=Tdes_in
|
|---|
| 8213 | "inlet start temperature" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8214 | parameter ThermoPower.AbsoluteTemperature Tstart_out
|
|---|
| 8215 | "outlet start temperature" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8216 | parameter Modelica.SIunits.MassFraction Xstart[Medium.nX]=Medium.reference_X
|
|---|
| 8217 | "start gas composition" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8218 | Medium.BaseProperties gas_in(
|
|---|
| 8219 | p(start=pstart_in),
|
|---|
| 8220 | T(start=Tstart_in),
|
|---|
| 8221 | Xi(start=Xstart[1:Medium.nXi]));
|
|---|
| 8222 | Medium.BaseProperties gas_iso(
|
|---|
| 8223 | p(start=pstart_out),
|
|---|
| 8224 | T(start=Tstart_out),
|
|---|
| 8225 | Xi(start=Xstart[1:Medium.nXi]));
|
|---|
| 8226 | Medium.SpecificEnthalpy hout_iso "Outlet isentropic enthalpy";
|
|---|
| 8227 | Medium.SpecificEnthalpy hout "Outlet enthaply";
|
|---|
| 8228 | Medium.SpecificEntropy s_in "Inlet specific entropy";
|
|---|
| 8229 | Medium.AbsolutePressure pout(start=pstart_out) "Outlet pressure";
|
|---|
| 8230 |
|
|---|
| 8231 | Modelica.SIunits.MassFlowRate w "Gas flow rate";
|
|---|
| 8232 | Modelica.SIunits.Angle phi "shaft rotation angle";
|
|---|
| 8233 | Modelica.SIunits.AngularVelocity omega "shaft angular velocity";
|
|---|
| 8234 | Modelica.SIunits.Torque tau "net torque acting on the compressor";
|
|---|
| 8235 |
|
|---|
| 8236 | Real eta "isentropic efficiency";
|
|---|
| 8237 | Real PR "pressure ratio";
|
|---|
| 8238 |
|
|---|
| 8239 | FlangeA inlet(redeclare package Medium = Medium, m_flow(min=if
|
|---|
| 8240 | allowFlowReversal then -Modelica.Constants.inf else 0)) annotation (
|
|---|
| 8241 | Placement(transformation(extent={{-100,60},{-60,100}}, rotation=0)));
|
|---|
| 8242 | FlangeB outlet(redeclare package Medium = Medium, m_flow(max=if
|
|---|
| 8243 | allowFlowReversal then +Modelica.Constants.inf else 0)) annotation (
|
|---|
| 8244 | Placement(transformation(extent={{60,60},{100,100}}, rotation=0)));
|
|---|
| 8245 | Modelica.Mechanics.Rotational.Interfaces.Flange_a shaft_a annotation (
|
|---|
| 8246 | Placement(transformation(extent={{-72,-12},{-48,12}}, rotation=0)));
|
|---|
| 8247 | Modelica.Mechanics.Rotational.Interfaces.Flange_b shaft_b annotation (
|
|---|
| 8248 | Placement(transformation(extent={{48,-12},{72,12}}, rotation=0)));
|
|---|
| 8249 |
|
|---|
| 8250 | equation
|
|---|
| 8251 | w = inlet.m_flow;
|
|---|
| 8252 | assert(w >= 0, "The compressor model does not support flow reversal");
|
|---|
| 8253 | inlet.m_flow + outlet.m_flow = 0 "Mass balance";
|
|---|
| 8254 |
|
|---|
| 8255 | // Set inlet gas properties
|
|---|
| 8256 | gas_in.p = inlet.p;
|
|---|
| 8257 | gas_in.h = inStream(inlet.h_outflow);
|
|---|
| 8258 | gas_in.Xi = inStream(inlet.Xi_outflow);
|
|---|
| 8259 |
|
|---|
| 8260 | // Set outlet gas properties
|
|---|
| 8261 | outlet.p = pout;
|
|---|
| 8262 | outlet.h_outflow = hout;
|
|---|
| 8263 | outlet.Xi_outflow = gas_in.Xi;
|
|---|
| 8264 |
|
|---|
| 8265 | // Equations for reverse flow (not used)
|
|---|
| 8266 | inlet.h_outflow = inStream(outlet.h_outflow);
|
|---|
| 8267 | inlet.Xi_outflow = inStream(outlet.Xi_outflow);
|
|---|
| 8268 |
|
|---|
| 8269 | // Component mass balances
|
|---|
| 8270 | gas_iso.Xi = gas_in.Xi;
|
|---|
| 8271 |
|
|---|
| 8272 | if explicitIsentropicEnthalpy then
|
|---|
| 8273 | hout_iso = Medium.isentropicEnthalpy(outlet.p, gas_in.state)
|
|---|
| 8274 | "Approximated isentropic enthalpy";
|
|---|
| 8275 | hout - gas_in.h = 1/eta*(hout_iso - gas_in.h);
|
|---|
| 8276 | // dummy assignments
|
|---|
| 8277 | s_in = 0;
|
|---|
| 8278 | gas_iso.p = 1e5;
|
|---|
| 8279 | gas_iso.T = 300;
|
|---|
| 8280 | else
|
|---|
| 8281 | // Properties of the gas after isentropic transformation
|
|---|
| 8282 | gas_iso.p = pout;
|
|---|
| 8283 | s_in = Medium.specificEntropy(gas_in.state);
|
|---|
| 8284 | s_in = Medium.specificEntropy(gas_iso.state);
|
|---|
| 8285 | hout - gas_in.h = 1/eta*(gas_iso.h - gas_in.h);
|
|---|
| 8286 | // dummy assignment
|
|---|
| 8287 | hout_iso = 0;
|
|---|
| 8288 | end if;
|
|---|
| 8289 |
|
|---|
| 8290 | w*(hout - gas_in.h) = tau*omega*eta_mech "Energy balance";
|
|---|
| 8291 | PR = pout/gas_in.p "Pressure ratio";
|
|---|
| 8292 |
|
|---|
| 8293 | // Mechanical boundary conditions
|
|---|
| 8294 | shaft_a.phi = phi;
|
|---|
| 8295 | shaft_b.phi = phi;
|
|---|
| 8296 | shaft_a.tau + shaft_b.tau = tau;
|
|---|
| 8297 | der(phi) = omega;
|
|---|
| 8298 | annotation (
|
|---|
| 8299 | Documentation(info="<html>
|
|---|
| 8300 | <p>This is the base model for a compressor, including the interface and all equations except the actual computation of the performance characteristics. Reverse flow conditions are not supported.</p>
|
|---|
| 8301 | <p>This model does not include any shaft inertia by itself; if that is needed, connect a Modelica.Mechanics.Rotational.Inertia model to one of the shaft connectors.</p>
|
|---|
| 8302 | <p>As a base-model, it can be used both for axial and centrifugal compressors.
|
|---|
| 8303 | <p><b>Modelling options</b></p>
|
|---|
| 8304 | <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>.
|
|---|
| 8305 | <p>The following options are available to calculate the enthalpy of the outgoing gas:
|
|---|
| 8306 | <ul><li><tt>explicitIsentropicEnthalpy = true</tt>: the isentropic enthalpy <tt>hout_iso</tt> is calculated by the <tt>Medium.isentropicEnthalpy</tt> function. <li><tt>explicitIsentropicEnthalpy = false</tt>: the isentropic enthalpy is obtained by equating the specific entropy of the inlet gas <tt>gas_in</tt> and of a fictious gas state <tt>gas_iso</tt>, with the same pressure of the outgoing gas; both are computed with the function <tt>Medium.specificEntropy</tt>.</pp></ul>
|
|---|
| 8307 | </html>", revisions="<html>
|
|---|
| 8308 | <ul>
|
|---|
| 8309 | <li><i>13 Apr 2005</i>
|
|---|
| 8310 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8311 | Medium.BaseProperties <tt>gas_out</tt>removed.</li>
|
|---|
| 8312 | </li>
|
|---|
| 8313 | <li><i>14 Jan 2005</i>
|
|---|
| 8314 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8315 | Adapted to Modelica.Media.</li>
|
|---|
| 8316 | <br> Compressor model restructured using inheritance.
|
|---|
| 8317 | </li>
|
|---|
| 8318 | <li><i>5 Mar 2004</i>
|
|---|
| 8319 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8320 | First release.</li>
|
|---|
| 8321 | </ul>
|
|---|
| 8322 | </html>
|
|---|
| 8323 | "), Diagram(graphics),
|
|---|
| 8324 | Icon(graphics={Text(
|
|---|
| 8325 | extent={{-128,-60},{128,-100}},
|
|---|
| 8326 | lineColor={0,0,255},
|
|---|
| 8327 | textString="%name")}));
|
|---|
| 8328 | end CompressorBase;
|
|---|
| 8329 |
|
|---|
| 8330 | model Compressor "Gas compressor"
|
|---|
| 8331 | extends CompressorBase;
|
|---|
| 8332 | import ThermoPower.Choices.TurboMachinery.TableTypes;
|
|---|
| 8333 | parameter AngularVelocity Ndesign "Design velocity";
|
|---|
| 8334 | parameter Real tablePhic[:, :]=fill(
|
|---|
| 8335 | 0,
|
|---|
| 8336 | 0,
|
|---|
| 8337 | 2) "Table for phic(N_T,beta)";
|
|---|
| 8338 | parameter Real tableEta[:, :]=fill(
|
|---|
| 8339 | 0,
|
|---|
| 8340 | 0,
|
|---|
| 8341 | 2) "Table for eta(N_T,beta)";
|
|---|
| 8342 | parameter Real tablePR[:, :]=fill(
|
|---|
| 8343 | 0,
|
|---|
| 8344 | 0,
|
|---|
| 8345 | 2) "Table for eta(N_T,beta)";
|
|---|
| 8346 | parameter String fileName="noName" "File where matrix is stored";
|
|---|
| 8347 | parameter TableTypes Table
|
|---|
| 8348 | "Selection of the way of definition of table matrix";
|
|---|
| 8349 | Modelica.Blocks.Tables.CombiTable2D Eta(
|
|---|
| 8350 | tableOnFile=if (Table == TableTypes.matrix) then false else true,
|
|---|
| 8351 | table=tableEta,
|
|---|
| 8352 | tableName=if (Table == TableTypes.matrix) then "NoName" else "tabEta",
|
|---|
| 8353 | fileName=if (Table == TableTypes.matrix) then "NoName" else fileName,
|
|---|
| 8354 | smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
|
|---|
| 8355 | annotation (Placement(transformation(extent={{-12,60},{8,80}}, rotation=0)));
|
|---|
| 8356 | Modelica.Blocks.Tables.CombiTable2D PressRatio(
|
|---|
| 8357 | tableOnFile=if (Table == TableTypes.matrix) then false else true,
|
|---|
| 8358 | table=tablePR,
|
|---|
| 8359 | tableName=if (Table == TableTypes.matrix) then "NoName" else "tabPR",
|
|---|
| 8360 | fileName=if (Table == TableTypes.matrix) then "NoName" else fileName,
|
|---|
| 8361 | smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
|
|---|
| 8362 | annotation (Placement(transformation(extent={{-12,0},{8,20}}, rotation=0)));
|
|---|
| 8363 | Modelica.Blocks.Tables.CombiTable2D Phic(
|
|---|
| 8364 | tableOnFile=if (Table == TableTypes.matrix) then false else true,
|
|---|
| 8365 | table=tablePhic,
|
|---|
| 8366 | tableName=if (Table == TableTypes.matrix) then "NoName" else "tabPhic",
|
|---|
| 8367 | fileName=if (Table == TableTypes.matrix) then "NoName" else fileName,
|
|---|
| 8368 | smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
|
|---|
| 8369 | annotation (Placement(transformation(extent={{-12,30},{8,50}}, rotation=0)));
|
|---|
| 8370 | Real N_T "Referred speed ";
|
|---|
| 8371 | Real N_T_design "Referred design velocity";
|
|---|
| 8372 | Real phic "Flow number ";
|
|---|
| 8373 | Real beta(start=integer(size(tablePhic, 1)/2)) "Number of beta line";
|
|---|
| 8374 |
|
|---|
| 8375 | equation
|
|---|
| 8376 | N_T_design = Ndesign/sqrt(Tdes_in) "Referred design velocity";
|
|---|
| 8377 | N_T = 100*omega/(sqrt(gas_in.T)*N_T_design)
|
|---|
| 8378 | "Referred speed definition, as percentage of design velocity";
|
|---|
| 8379 | phic = w*sqrt(gas_in.T)/(gas_in.p) "Flow number definition";
|
|---|
| 8380 |
|
|---|
| 8381 | // phic = Phic(beta, N_T)
|
|---|
| 8382 | Phic.u1 = beta;
|
|---|
| 8383 | Phic.u2 = N_T;
|
|---|
| 8384 | phic = Phic.y;
|
|---|
| 8385 |
|
|---|
| 8386 | // eta = Eta(beta, N_T)
|
|---|
| 8387 | Eta.u1 = beta;
|
|---|
| 8388 | Eta.u2 = N_T;
|
|---|
| 8389 | eta = Eta.y;
|
|---|
| 8390 |
|
|---|
| 8391 | // PR = PressRatio(beta, N_T)
|
|---|
| 8392 | PressRatio.u1 = beta;
|
|---|
| 8393 | PressRatio.u2 = N_T;
|
|---|
| 8394 | PR = PressRatio.y;
|
|---|
| 8395 | annotation (Documentation(info="<html>
|
|---|
| 8396 | This model adds the performance characteristics to the Compressor_Base model, by means of 2D interpolation tables.</p>
|
|---|
| 8397 | <p>The perfomance characteristics are specified by two characteristic equations: the first relates the flow number <tt>phic</tt>, the pressure ratio <tt>PR</tt> and the referred speed <tt>N_T</tt>; the second relates the efficiency <tt>eta</tt>, the flow number <tt>phic</tt>, and the referred speed <tt>N_T</tt> [1]. To avoid singularities, the two characteristic equations are expressed in parametric form by adding a further variable <tt>beta</tt> (method of beta lines [2]).
|
|---|
| 8398 | <p>The performance maps are thus tabulated into three differents tables, <tt>tablePhic</tt>, <tt>tablePR</tt> and <tt>tableEta</tt>, which express <tt>phic</tt>, <tt>PR</tt> and <tt>eta</tt> as a function of <tt>N_T</tt> and <tt>beta</tt>, respectively, where <tt>N_T</tt> is the first row while <tt>beta</tt> is the first column. The referred speed <tt>N_T</tt> is defined as a percentage of the design referred speed and <tt>beta</tt> are arbitrary lines, usually drawn parallel to the surge-line on the performance maps.
|
|---|
| 8399 | <p><tt>Modelica.Blocks.Tables.CombiTable2D</tt> interpolates the tables to obtain values of referred flow, pressure ratio and efficiency at given levels of referred speed and beta.
|
|---|
| 8400 | <p><b>Modelling options</b></p>
|
|---|
| 8401 | <p>The following options are available to determine how the table is defined:
|
|---|
| 8402 | <ul><li><tt>Table = 0</tt>: the table is explicitly supplied as matrix parameter.
|
|---|
| 8403 | <li><tt>Table = 1</tt>: the table is read from a file; the string <tt>fileName</tt> contains the path to the files where the tables are stored, either in ASCII or Matlab binary format.
|
|---|
| 8404 | </ul>
|
|---|
| 8405 | <p><b>References:</b></p>
|
|---|
| 8406 | <ol>
|
|---|
| 8407 | <li>S. L. Dixon: <i>Fluid mechanics, thermodynamics of turbomachinery</i>, Oxford, Pergamon press, 1966, pp. 213.
|
|---|
| 8408 | <li>P. P. Walsh, P. Fletcher: <i>Gas Turbine Performance</i>, 2nd ed., Oxford, Blackwell, 2004, pp. 646.
|
|---|
| 8409 | </ol>
|
|---|
| 8410 | </html>", revisions="<html>
|
|---|
| 8411 | <ul>
|
|---|
| 8412 | <li><i>13 Apr 2005</i>
|
|---|
| 8413 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8414 | New method for calculating performance parameters using tables.</li>
|
|---|
| 8415 | </li>
|
|---|
| 8416 | <li><i>14 Jan 2005</i>
|
|---|
| 8417 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8418 | Adapted to Modelica.Media.</li>
|
|---|
| 8419 | <br> Compressor model restructured using inheritance.
|
|---|
| 8420 | </li>
|
|---|
| 8421 | <li><i>5 Mar 2004</i>
|
|---|
| 8422 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8423 | First release.</li>
|
|---|
| 8424 | </ul>
|
|---|
| 8425 | </html>"));
|
|---|
| 8426 | end Compressor;
|
|---|
| 8427 |
|
|---|
| 8428 | partial model TurbineBase "Gas Turbine"
|
|---|
| 8429 | extends ThermoPower.Icons.Gas.Turbine;
|
|---|
| 8430 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
|
|---|
| 8431 | annotation(choicesAllMatching = true);
|
|---|
| 8432 | parameter Boolean explicitIsentropicEnthalpy=true
|
|---|
| 8433 | "isentropicEnthalpy function used";
|
|---|
| 8434 | parameter Real eta_mech=0.98 "mechanical efficiency";
|
|---|
| 8435 | parameter ThermoPower.AbsoluteTemperature Tdes_in
|
|---|
| 8436 | "inlet design temperature";
|
|---|
| 8437 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 8438 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 8439 | outer ThermoPower.System system "System wide properties";
|
|---|
| 8440 | parameter Modelica.SIunits.Pressure pstart_in "inlet start pressure"
|
|---|
| 8441 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8442 | parameter Modelica.SIunits.Pressure pstart_out "outlet start pressure"
|
|---|
| 8443 | annotation (Dialog(tab="Initialisation"));
|
|---|
| 8444 | parameter ThermoPower.AbsoluteTemperature Tstart_in=Tdes_in
|
|---|
| 8445 | "inlet start temperature" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8446 | parameter ThermoPower.AbsoluteTemperature Tstart_out
|
|---|
| 8447 | "outlet start temperature" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8448 | parameter Modelica.SIunits.MassFraction Xstart[Medium.nX]=Medium.reference_X
|
|---|
| 8449 | "start gas composition" annotation (Dialog(tab="Initialisation"));
|
|---|
| 8450 |
|
|---|
| 8451 | Medium.BaseProperties gas_in(
|
|---|
| 8452 | p(start=pstart_in),
|
|---|
| 8453 | T(start=Tstart_in),
|
|---|
| 8454 | Xi(start=Xstart[1:Medium.nXi]));
|
|---|
| 8455 | Medium.BaseProperties gas_iso(
|
|---|
| 8456 | p(start=pstart_out),
|
|---|
| 8457 | T(start=Tstart_out),
|
|---|
| 8458 | Xi(start=Xstart[1:Medium.nXi]));
|
|---|
| 8459 |
|
|---|
| 8460 | Modelica.SIunits.Angle phi "shaft rotation angle";
|
|---|
| 8461 | Modelica.SIunits.Torque tau "net torque acting on the turbine";
|
|---|
| 8462 | Modelica.SIunits.AngularVelocity omega "shaft angular velocity";
|
|---|
| 8463 | Modelica.SIunits.MassFlowRate w "Gas flow rate";
|
|---|
| 8464 | Medium.SpecificEntropy s_in "Inlet specific entropy";
|
|---|
| 8465 | Medium.SpecificEnthalpy hout_iso "Outlet isentropic enthalpy";
|
|---|
| 8466 | Medium.SpecificEnthalpy hout "Outlet enthalpy";
|
|---|
| 8467 | Medium.AbsolutePressure pout(start=pstart_out) "Outlet pressure";
|
|---|
| 8468 | Real PR "pressure ratio";
|
|---|
| 8469 | Real eta "isoentropic efficiency";
|
|---|
| 8470 |
|
|---|
| 8471 | Modelica.Mechanics.Rotational.Interfaces.Flange_a shaft_a annotation (
|
|---|
| 8472 | Placement(transformation(extent={{-72,-12},{-48,12}}, rotation=0)));
|
|---|
| 8473 | Modelica.Mechanics.Rotational.Interfaces.Flange_b shaft_b annotation (
|
|---|
| 8474 | Placement(transformation(extent={{48,-12},{72,12}}, rotation=0)));
|
|---|
| 8475 | FlangeA inlet(redeclare package Medium = Medium, m_flow(min=if
|
|---|
| 8476 | allowFlowReversal then -Modelica.Constants.inf else 0)) annotation (
|
|---|
| 8477 | Placement(transformation(extent={{-100,60},{-60,100}}, rotation=0)));
|
|---|
| 8478 | FlangeB outlet(redeclare package Medium = Medium, m_flow(max=if
|
|---|
| 8479 | allowFlowReversal then +Modelica.Constants.inf else 0)) annotation (
|
|---|
| 8480 | Placement(transformation(extent={{60,60},{100,100}}, rotation=0)));
|
|---|
| 8481 | equation
|
|---|
| 8482 | w = inlet.m_flow;
|
|---|
| 8483 | assert(w >= 0, "The turbine model does not support flow reversal");
|
|---|
| 8484 | inlet.m_flow + outlet.m_flow = 0 "Mass balance";
|
|---|
| 8485 |
|
|---|
| 8486 | // Set inlet gas properties
|
|---|
| 8487 | gas_in.p = inlet.p;
|
|---|
| 8488 | gas_in.h = inStream(inlet.h_outflow);
|
|---|
| 8489 | gas_in.Xi = inStream(inlet.Xi_outflow);
|
|---|
| 8490 |
|
|---|
| 8491 | // Set outlet gas properties
|
|---|
| 8492 | outlet.p = pout;
|
|---|
| 8493 | outlet.h_outflow = hout;
|
|---|
| 8494 | outlet.Xi_outflow = gas_in.Xi;
|
|---|
| 8495 |
|
|---|
| 8496 | // Equations for reverse flow (not used)
|
|---|
| 8497 | inlet.h_outflow = inStream(outlet.h_outflow);
|
|---|
| 8498 | inlet.Xi_outflow = inStream(outlet.Xi_outflow);
|
|---|
| 8499 |
|
|---|
| 8500 | // Component mass balances
|
|---|
| 8501 | gas_iso.Xi = gas_in.Xi;
|
|---|
| 8502 |
|
|---|
| 8503 | if explicitIsentropicEnthalpy then
|
|---|
| 8504 | hout_iso = Medium.isentropicEnthalpy(outlet.p, gas_in.state)
|
|---|
| 8505 | "Approximated isentropic enthalpy";
|
|---|
| 8506 | hout - gas_in.h = eta*(hout_iso - gas_in.h) "Enthalpy change";
|
|---|
| 8507 | //dummy assignments
|
|---|
| 8508 | s_in = 0;
|
|---|
| 8509 | gas_iso.p = 1e5;
|
|---|
| 8510 | gas_iso.T = 300;
|
|---|
| 8511 | else
|
|---|
| 8512 | // Properties of the gas after isentropic transformation
|
|---|
| 8513 | gas_iso.p = pout;
|
|---|
| 8514 | s_in = Medium.specificEntropy(gas_in.state);
|
|---|
| 8515 | s_in = Medium.specificEntropy(gas_iso.state);
|
|---|
| 8516 | hout - gas_in.h = eta*(gas_iso.h - gas_in.h) "Enthalpy change";
|
|---|
| 8517 | //dummy assignment
|
|---|
| 8518 | hout_iso = 0;
|
|---|
| 8519 | end if;
|
|---|
| 8520 |
|
|---|
| 8521 | w*(hout - gas_in.h)*eta_mech = tau*omega "Energy balance";
|
|---|
| 8522 | PR = gas_in.p/pout "Pressure ratio";
|
|---|
| 8523 |
|
|---|
| 8524 | // Mechanical boundary conditions
|
|---|
| 8525 | shaft_a.phi = phi;
|
|---|
| 8526 | shaft_b.phi = phi;
|
|---|
| 8527 | shaft_a.tau + shaft_b.tau = tau;
|
|---|
| 8528 | der(phi) = omega;
|
|---|
| 8529 | annotation (
|
|---|
| 8530 | Documentation(info="<html>
|
|---|
| 8531 | <p>This is the base model for a turbine, including the interface and all equations except the actual computation of the performance characteristics. Reverse flow conditions are not supported.</p>
|
|---|
| 8532 | <p>This model does not include any shaft inertia by itself; if that is needed, connect a Modelica.Mechanics.Rotational.Inertia model to one of the shaft connectors.</p>
|
|---|
| 8533 | <p>As a base-model, it can be used both for axial and radial turbines.
|
|---|
| 8534 | <p><b>Modelling options</b></p>
|
|---|
| 8535 | <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>.
|
|---|
| 8536 | <p>The following options are available to calculate the enthalpy of the outgoing gas:
|
|---|
| 8537 | <ul><li><tt>explicitIsentropicEnthalpy = true</tt>: the isentropic enthalpy <tt>hout_iso</tt> is calculated by the <tt>Medium.isentropicEnthalpy</tt> function. <li><tt>explicitIsentropicEnthalpy = false</tt>: the isentropic enthalpy is determined by equating the specific entropy of the inlet gas <tt>gas_in</tt> and of a fictious gas state <tt>gas_iso</tt>, with the same pressure of the outgoing gas; both are computed with the function <tt>Medium.specificEntropy</tt>.</pp></ul>
|
|---|
| 8538 | </html>", revisions="<html>
|
|---|
| 8539 | <ul>
|
|---|
| 8540 | <li><i>13 Apr 2005</i>
|
|---|
| 8541 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8542 | Medium.BaseProperties <tt>gas_out</tt>removed.</li>
|
|---|
| 8543 | </li>
|
|---|
| 8544 | <li><i>14 Jan 2005</i>
|
|---|
| 8545 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8546 | Adapted to Modelica.Media.</li>
|
|---|
| 8547 | <br> Turbine model restructured using inheritance.
|
|---|
| 8548 | </li>
|
|---|
| 8549 | <li><i>5 Mar 2004</i>
|
|---|
| 8550 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8551 | First release.</li>
|
|---|
| 8552 | </ul>
|
|---|
| 8553 | </html>"),
|
|---|
| 8554 | Icon(graphics={Text(
|
|---|
| 8555 | extent={{-128,-60},{128,-100}},
|
|---|
| 8556 | lineColor={0,0,255},
|
|---|
| 8557 | textString="%name")}),
|
|---|
| 8558 | Diagram(graphics));
|
|---|
| 8559 | end TurbineBase;
|
|---|
| 8560 |
|
|---|
| 8561 | model Turbine "Gas Turbine"
|
|---|
| 8562 | extends TurbineBase;
|
|---|
| 8563 | import ThermoPower.Choices.TurboMachinery.TableTypes;
|
|---|
| 8564 | parameter AngularVelocity Ndesign "Design speed";
|
|---|
| 8565 | parameter Real tablePhic[:, :]=fill(
|
|---|
| 8566 | 0,
|
|---|
| 8567 | 0,
|
|---|
| 8568 | 2) "Table for phic(N_T,PR)";
|
|---|
| 8569 | parameter Real tableEta[:, :]=fill(
|
|---|
| 8570 | 0,
|
|---|
| 8571 | 0,
|
|---|
| 8572 | 2) "Table for eta(N_T,PR)";
|
|---|
| 8573 | parameter String fileName="NoName" "File where matrix is stored";
|
|---|
| 8574 | parameter TableTypes Table
|
|---|
| 8575 | "Selection of the way of definition of table matrix";
|
|---|
| 8576 |
|
|---|
| 8577 | Real N_T "Referred speed";
|
|---|
| 8578 | Real N_T_design "Referred design speed";
|
|---|
| 8579 | Real phic "Flow number";
|
|---|
| 8580 | Modelica.Blocks.Tables.CombiTable2D Phic(
|
|---|
| 8581 | tableOnFile=if (Table == TableTypes.matrix) then false else true,
|
|---|
| 8582 | table=tablePhic,
|
|---|
| 8583 | tableName=if (Table == TableTypes.matrix) then "NoName" else "tabPhic",
|
|---|
| 8584 | fileName=if (Table == TableTypes.matrix) then "NoName" else fileName,
|
|---|
| 8585 | smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
|
|---|
| 8586 | annotation (Placement(transformation(extent={{-10,10},{10,30}}, rotation=
|
|---|
| 8587 | 0)));
|
|---|
| 8588 | Modelica.Blocks.Tables.CombiTable2D Eta(
|
|---|
| 8589 | tableOnFile=if (Table == TableTypes.matrix) then false else true,
|
|---|
| 8590 | table=tableEta,
|
|---|
| 8591 | tableName=if (Table == TableTypes.matrix) then "NoName" else "tabEta",
|
|---|
| 8592 | fileName=if (Table == TableTypes.matrix) then "NoName" else fileName,
|
|---|
| 8593 | smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative)
|
|---|
| 8594 | annotation (Placement(transformation(extent={{-10,50},{10,70}}, rotation=
|
|---|
| 8595 | 0)));
|
|---|
| 8596 | equation
|
|---|
| 8597 | N_T_design = Ndesign/sqrt(Tdes_in) "Referred design velocity";
|
|---|
| 8598 | N_T = 100*omega/(sqrt(gas_in.T)*N_T_design)
|
|---|
| 8599 | "Referred speed definition as percentage of design velocity";
|
|---|
| 8600 | phic = w*sqrt(gas_in.T)/(gas_in.p) "Flow number definition";
|
|---|
| 8601 |
|
|---|
| 8602 | // phic = Phic(PR, N_T)
|
|---|
| 8603 | Phic.u1 = PR;
|
|---|
| 8604 | Phic.u2 = N_T;
|
|---|
| 8605 | phic = (Phic.y);
|
|---|
| 8606 |
|
|---|
| 8607 | // eta = Eta(PR, N_T)
|
|---|
| 8608 | Eta.u1 = PR;
|
|---|
| 8609 | Eta.u2 = N_T;
|
|---|
| 8610 | eta = Eta.y;
|
|---|
| 8611 | annotation (Documentation(info="<html>
|
|---|
| 8612 | This model adds the performance characteristics to the Turbine_Base model, by means of 2D interpolation tables.
|
|---|
| 8613 | <p>The performance characteristics are described by two characteristic equations: the first relates the flow number <tt>phic</tt>, the pressure ratio <tt>PR</tt> and the referred speed <tt>N_T</tt>; the second relates the efficiency <tt>eta</tt>, the flow number <tt>phic</tt>, and the referred speed <tt>N_T</tt> [1]. </p>
|
|---|
| 8614 | <p>The performance maps are tabulated into two differents tables, <tt>tablePhic</tt> and <tt>tableEta</tt> which express <tt>phic</tt> and <tt>eta</tt> as a function of <tt>N_T</tt> and <tt>PR</tt> respectively, where <tt>N_T</tt> represents the first row and <tt>PR</tt> the first column [2]. The referred speed <tt>N_T</tt> is defined as a percentage of the design referred speed.
|
|---|
| 8615 | <p>The <tt>Modelica.Blocks.Tables.CombiTable2D</tt> interpolates the tables to obtain values of referred flow and efficiency at given levels of referred speed.
|
|---|
| 8616 | <p><b>Modelling options</b></p>
|
|---|
| 8617 | <p>The following options are available to determine how the table is defined:
|
|---|
| 8618 | <ul><li><tt>Table = 0</tt>: the table is explicitly supplied as matrix parameter.
|
|---|
| 8619 | <li><tt>Table = 1</tt>: the table is read from a file; the string <tt>fileName</tt> contains the path to the files where tables are stored, either in ASCII or Matlab binary format.
|
|---|
| 8620 | </ul>
|
|---|
| 8621 | <p><b>References:</b></p>
|
|---|
| 8622 | <ol>
|
|---|
| 8623 | <li>S. L. Dixon: <i>Fluid mechanics, thermodynamics of turbomachinery</i>, Oxford, Pergamon press, 1966, pp. 213.
|
|---|
| 8624 | <li>P. P. Walsh, P. Fletcher: <i>Gas Turbine Performance</i>, 2nd ed., Oxford, Blackwell, 2004, pp. 646.
|
|---|
| 8625 | </ol>
|
|---|
| 8626 | </html>", revisions="<html>
|
|---|
| 8627 | <ul>
|
|---|
| 8628 | <li><i>13 Apr 2005</i>
|
|---|
| 8629 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8630 | New method for calculating performance parameters using tables.</li>
|
|---|
| 8631 | </li>
|
|---|
| 8632 | <li><i>14 Jan 2005</i>
|
|---|
| 8633 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8634 | Adapted to Modelica.Media.</li>
|
|---|
| 8635 | <br> Turbine model restructured using inheritance.
|
|---|
| 8636 | </li>
|
|---|
| 8637 | <li><i>5 Mar 2004</i>
|
|---|
| 8638 | by <a href=\"mailto:francesco.casella@polimi.it\">Francesco Casella</a>:<br>
|
|---|
| 8639 | First release.</li>
|
|---|
| 8640 | </ul>
|
|---|
| 8641 | </html>"), Diagram(graphics));
|
|---|
| 8642 | end Turbine;
|
|---|
| 8643 | annotation (Documentation(info="<HTML>
|
|---|
| 8644 | This package contains models of physical processes and components using ideal gases as working fluid.
|
|---|
| 8645 | <p>All models with dynamic equations provide initialisation support. Set the <tt>initOpt</tt> parameter to the appropriate value:
|
|---|
| 8646 | <ul>
|
|---|
| 8647 | <li><tt>Choices.Init.Options.noInit</tt>: no initialisation
|
|---|
| 8648 | <li><tt>Choices.Init.Options.steadyState</tt>: full steady-state initialisation
|
|---|
| 8649 | <li><tt>Choices.Init.Options.steadyStateNoP</tt>: steady-state initialisation (except pressure)
|
|---|
| 8650 | <li><tt>Choices.Init.Options.steadyStateNoT</tt>: steady-state initialisation (except temperature)
|
|---|
| 8651 | </ul>
|
|---|
| 8652 | 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.
|
|---|
| 8653 | </HTML>"));
|
|---|
| 8654 | end Gas;
|
|---|
| 8655 |
|
|---|
| 8656 | package Media "Medium models for the ThermoPower library"
|
|---|
| 8657 | extends Modelica.Icons.Package;
|
|---|
| 8658 |
|
|---|
| 8659 | package Air "Air as mixture of O2, N2, Ar and H2O"
|
|---|
| 8660 | extends Modelica.Media.IdealGases.Common.MixtureGasNasa(
|
|---|
| 8661 | mediumName="Air",
|
|---|
| 8662 | data={Modelica.Media.IdealGases.Common.SingleGasesData.O2,
|
|---|
| 8663 | Modelica.Media.IdealGases.Common.SingleGasesData.H2O,
|
|---|
| 8664 | Modelica.Media.IdealGases.Common.SingleGasesData.Ar,
|
|---|
| 8665 | Modelica.Media.IdealGases.Common.SingleGasesData.N2},
|
|---|
| 8666 | fluidConstants={
|
|---|
| 8667 | Modelica.Media.IdealGases.Common.FluidData.O2,
|
|---|
| 8668 | Modelica.Media.IdealGases.Common.FluidData.H2O,
|
|---|
| 8669 | Modelica.Media.IdealGases.Common.FluidData.Ar,
|
|---|
| 8670 | Modelica.Media.IdealGases.Common.FluidData.N2},
|
|---|
| 8671 | substanceNames={"Oxygen","Water","Argon","Nitrogen"},
|
|---|
| 8672 | reference_X={0.23,0.015,0.005,0.75});
|
|---|
| 8673 | end Air;
|
|---|
| 8674 |
|
|---|
| 8675 | package NaturalGas "Mixture of N2, CO2, and CH4"
|
|---|
| 8676 | extends Modelica.Media.IdealGases.Common.MixtureGasNasa(
|
|---|
| 8677 | mediumName="NaturalGas",
|
|---|
| 8678 | data={Modelica.Media.IdealGases.Common.SingleGasesData.N2,
|
|---|
| 8679 | Modelica.Media.IdealGases.Common.SingleGasesData.CO2,
|
|---|
| 8680 | Modelica.Media.IdealGases.Common.SingleGasesData.CH4},
|
|---|
| 8681 | fluidConstants={
|
|---|
| 8682 | Modelica.Media.IdealGases.Common.FluidData.N2,
|
|---|
| 8683 | Modelica.Media.IdealGases.Common.FluidData.CO2,
|
|---|
| 8684 | Modelica.Media.IdealGases.Common.FluidData.CH4},
|
|---|
| 8685 | substanceNames={"Nitrogen","Carbondioxide","Methane"},
|
|---|
| 8686 | reference_X={0.02,0.012,0.968});
|
|---|
| 8687 |
|
|---|
| 8688 | end NaturalGas;
|
|---|
| 8689 |
|
|---|
| 8690 | package FlueGas "flue gas"
|
|---|
| 8691 | extends Modelica.Media.IdealGases.Common.MixtureGasNasa(
|
|---|
| 8692 | mediumName="FlueGas",
|
|---|
| 8693 | data={Modelica.Media.IdealGases.Common.SingleGasesData.O2,
|
|---|
| 8694 | Modelica.Media.IdealGases.Common.SingleGasesData.Ar,
|
|---|
| 8695 | Modelica.Media.IdealGases.Common.SingleGasesData.H2O,
|
|---|
| 8696 | Modelica.Media.IdealGases.Common.SingleGasesData.CO2,
|
|---|
| 8697 | Modelica.Media.IdealGases.Common.SingleGasesData.N2},
|
|---|
| 8698 | fluidConstants={
|
|---|
| 8699 | Modelica.Media.IdealGases.Common.FluidData.O2,
|
|---|
| 8700 | Modelica.Media.IdealGases.Common.FluidData.Ar,
|
|---|
| 8701 | Modelica.Media.IdealGases.Common.FluidData.H2O,
|
|---|
| 8702 | Modelica.Media.IdealGases.Common.FluidData.CO2,
|
|---|
| 8703 | Modelica.Media.IdealGases.Common.FluidData.N2},
|
|---|
| 8704 | substanceNames={"Oxygen","Argon","Water","Carbondioxide","Nitrogen"},
|
|---|
| 8705 | reference_X={0.23,0.02,0.01,0.04,0.7});
|
|---|
| 8706 |
|
|---|
| 8707 | end FlueGas;
|
|---|
| 8708 | end Media;
|
|---|
| 8709 |
|
|---|
| 8710 | package PowerPlants "Models of thermoelectrical power plants components"
|
|---|
| 8711 | extends Modelica.Icons.Package;
|
|---|
| 8712 | import SI = Modelica.SIunits;
|
|---|
| 8713 | import ThermoPower.Choices.Init.Options;
|
|---|
| 8714 |
|
|---|
| 8715 | package HRSG "Models and tests of the HRSG and its main components"
|
|---|
| 8716 | extends Modelica.Icons.Package;
|
|---|
| 8717 |
|
|---|
| 8718 | package Components "HRSG component models"
|
|---|
| 8719 | extends Modelica.Icons.Package;
|
|---|
| 8720 |
|
|---|
| 8721 | model BaseReader_gas
|
|---|
| 8722 | "Base reader for the visualization of the state in the simulation (gas)"
|
|---|
| 8723 | replaceable package Medium = Modelica.Media.Interfaces.PartialMedium;
|
|---|
| 8724 | parameter Boolean allowFlowReversal=system.allowFlowReversal
|
|---|
| 8725 | "= true to allow flow reversal, false restricts to design direction";
|
|---|
| 8726 | outer ThermoPower.System system "System wide properties";
|
|---|
| 8727 | Gas.FlangeA inlet(redeclare package Medium = Medium, m_flow(min=if
|
|---|
| 8728 | allowFlowReversal then -Modelica.Constants.inf else 0))
|
|---|
| 8729 | annotation (Placement(transformation(extent={{-80,-20},{-40,20}},
|
|---|
| 8730 | rotation=0)));
|
|---|
| 8731 | Gas.FlangeB outlet(redeclare package Medium = Medium, m_flow(max=if
|
|---|
| 8732 | allowFlowReversal then +Modelica.Constants.inf else 0))
|
|---|
| 8733 | annotation (Placement(transformation(extent={{40,-20},{80,20}},
|
|---|
| 8734 | rotation=0)));
|
|---|
| 8735 | equation
|
|---|
| 8736 | inlet.m_flow + outlet.m_flow = 0 "Mass balance";
|
|---|
| 8737 | inlet.p = outlet.p "Momentum balance";
|
|---|
| 8738 | // Energy balance
|
|---|
| 8739 | inlet.h_outflow = inStream(outlet.h_outflow);
|
|---|
| 8740 | inStream(inlet.h_outflow) = outlet.h_outflow;
|
|---|
| 8741 | // Independent composition mass balances
|
|---|
| 8742 | inlet.Xi_outflow = inStream(outlet.Xi_outflow);
|
|---|
| 8743 | inStream(inlet.Xi_outflow) = outlet.Xi_outflow;
|
|---|
| 8744 | annotation (Diagram(graphics), Icon(graphics={Polygon(
|
|---|
| 8745 | points={{-80,0},{0,30},{80,0},{0,-30},{-80,0}},
|
|---|
| 8746 | lineColor={170,170,255},
|
|---|
| 8747 | fillColor={170,170,255},
|
|---|
| 8748 | fillPattern=FillPattern.Solid),Text(
|
|---|
| 8749 | extent={{-80,20},{80,-20}},
|
|---|
| 8750 | lineColor={255,255,255},
|
|---|
| 8751 | fillColor={170,170,255},
|
|---|
| 8752 | fillPattern=FillPattern.Solid,
|
|---|
| 8753 | textString="S")}));
|
|---|
| 8754 | end BaseReader_gas;
|
|---|
| 8755 |
|
|---|
| 8756 | model StateReader_gas
|
|---|
| 8757 | "State reader for the visualization of the state in the simulation (gas)"
|
|---|
| 8758 | extends BaseReader_gas;
|
|---|
| 8759 | Medium.BaseProperties gas;
|
|---|
| 8760 | SI.Temperature T "Temperature";
|
|---|
| 8761 | SI.Pressure p "Pressure";
|
|---|
| 8762 | SI.SpecificEnthalpy h "Specific enthalpy";
|
|---|
| 8763 | SI.MassFlowRate w "Mass flow rate";
|
|---|
| 8764 |
|
|---|
| 8765 | equation
|
|---|
| 8766 | // Set gas properties
|
|---|
| 8767 | inlet.p = gas.p;
|
|---|
| 8768 |
|
|---|
| 8769 | gas.h = homotopy(if not allowFlowReversal then inStream(inlet.h_outflow)
|
|---|
| 8770 | else actualStream(inlet.h_outflow), inStream(inlet.h_outflow));
|
|---|
| 8771 | gas.Xi = homotopy(if not allowFlowReversal then inStream(inlet.Xi_outflow)
|
|---|
| 8772 | else actualStream(inlet.Xi_outflow), inStream(inlet.Xi_outflow));
|
|---|
| 8773 |
|
|---|
| 8774 | T = gas.T;
|
|---|
| 8775 | p = gas.p;
|
|---|
| 8776 | h = gas.h;
|
|---|
| 8777 | w = inlet.m_flow;
|
|---|
| 8778 | end StateReader_gas;
|
|---|
| 8779 | end Components;
|
|---|
| 8780 | annotation (Documentation(revisions="<html>
|
|---|
| 8781 | <ul>
|
|---|
| 8782 | <li><i>15 Apr 2008</i>
|
|---|
| 8783 | by <a>Luca Savoldelli</a>:<br>
|
|---|
| 8784 | First release.</li>
|
|---|
| 8785 | </ul>
|
|---|
| 8786 | </html>"));
|
|---|
| 8787 | end HRSG;
|
|---|
| 8788 | annotation (Documentation(revisions="<html>
|
|---|
| 8789 | </html>"));
|
|---|
| 8790 | end PowerPlants;
|
|---|
| 8791 |
|
|---|
| 8792 | type HydraulicConductance = Real (final quantity="HydraulicConductance", final
|
|---|
| 8793 | unit="(kg/s)/Pa");
|
|---|
| 8794 |
|
|---|
| 8795 | type HydraulicResistance = Real (final quantity="HydraulicResistance", final
|
|---|
| 8796 | unit="Pa/(kg/s)");
|
|---|
| 8797 |
|
|---|
| 8798 | type Density = Modelica.SIunits.Density (start=40) "generic start value";
|
|---|
| 8799 |
|
|---|
| 8800 | type AbsoluteTemperature = Temperature (start=300, nominal=500)
|
|---|
| 8801 | "generic temperature";
|
|---|
| 8802 | annotation (
|
|---|
| 8803 | Documentation(info="<html>
|
|---|
| 8804 | <b>General Information</b>
|
|---|
| 8805 | <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>
|
|---|
| 8806 | <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>
|
|---|
| 8807 | <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>
|
|---|
| 8808 | <ul>
|
|---|
| 8809 | <li>Conversion to Modelica 3.x (new graphical annotations, use of enumerations) </li>
|
|---|
| 8810 | <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>
|
|---|
| 8811 | <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>
|
|---|
| 8812 | <li>Bugfixing</li>
|
|---|
| 8813 | </ul>
|
|---|
| 8814 | <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>
|
|---|
| 8815 | If you are running Windows, we recommend using the excellent <a href=\"http://tortoisesvn.net/\">TortoiseSVN</a> client to checkout the library.</p>
|
|---|
| 8816 | <p>Since 2013, the development started focusing on three main lines.
|
|---|
| 8817 | <ol>
|
|---|
| 8818 | <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>
|
|---|
| 8819 | <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>
|
|---|
| 8820 | <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>
|
|---|
| 8821 | </ol></p>
|
|---|
| 8822 | <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>
|
|---|
| 8823 | <p>To give you an idea on the structure and content of the library, the automatically generated documentation of the 2.1 release can be browsed on-line <a href=\"http://thermopower.sourceforge.net/help/ThermoPower.html\">here</a>.</p>
|
|---|
| 8824 | <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>
|
|---|
| 8825 | <p><b>References</b></p>
|
|---|
| 8826 | <p>A general description of the library and on the modelling principles can be found in the papers: </p>
|
|---|
| 8827 | <p><ul>
|
|---|
| 8828 | <li>F. Casella, A. Leva, "Modelling of distributed thermo-hydraulic processes using Modelica", <i>Proceedings of the MathMod '03 Conference</i>, Wien , Austria, February 2003. </li>
|
|---|
| 8829 | <li>F. Casella, A. Leva, "Modelica open library for power plant simulation: design and experimental validation", <i>Proceedings of the 2003 Modelica Conference</i>, Linköping, Sweden, November 2003, pp. 41-50. (<a href=\"http://www.modelica.org/Conference2003/papers/h08_Leva.pdf\">Available online</a>) </li>
|
|---|
| 8830 | <li>F. Casella, A. Leva, "Simulazione di impianti termoidraulici con strumenti object-oriented", <i>Atti convegno ANIPLA Enersis 2004,</i> Milano, Italy, April 2004 (in Italian). </li>
|
|---|
| 8831 | <li>F. Casella, A. Leva, "Object-oriented library for thermal power plant simulation", <i>Proceedings of the Eurosis Industrial Simulation Conference 2004 (ISC-2004)</i>, Malaga, Spain, June 2004. </li>
|
|---|
| 8832 | <li>F. Casella, A. Leva, "Simulazione object-oriented di impianti di generazione termoidraulici per studi di sistema", <i>Atti convegno nazionale ANIPLA 2004</i>, Milano, Italy, September 2004 (in Italian).</li>
|
|---|
| 8833 | <li>Francesco Casella and Alberto Leva, “Modelling of Thermo-Hydraulic Power Generation Processes Using Modelica”. <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>
|
|---|
| 8834 | <li>Francesco Casella, J. G. van Putten and Piero Colonna, “Dynamic Simulation of a Biomass-Fired Power Plant: a Comparison Between Causal and A-Causal Modular Modeling”. 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>
|
|---|
| 8835 | </ul></p>
|
|---|
| 8836 | <p><br/>Other papers about the library and its applications:</p>
|
|---|
| 8837 | <p><ul>
|
|---|
| 8838 | <li>F. Casella, F. Schiavo, "Modelling and Simulation of Heat Exchangers in Modelica with Finite Element Methods", <i>Proceedings of the 2003 Modelica Conference</i>, Linköping, Sweden, 2003, pp. 343-352. (<a href=\"http://www.modelica.org/Conference2003/papers/h22_Schiavo.pdf\">Available online</a>) </li>
|
|---|
| 8839 | <li>A. Cammi, M.E. Ricotti, F. Casella, F. Schiavo, "New modelling strategy for IRIS dynamic response simulation", <i>Proc. 5th International Conference on Nuclear Option in Countries with Small and Medium Electricity Grids</i>, Dubrovnik, Croatia, May 2004.</li>
|
|---|
| 8840 | <li>A. Cammi, F. Casella, M.E. Ricotti, F. Schiavo, "Object-oriented Modelling for Integral Nuclear Reactors Dynamic Dimulation", <i>Proceedings of the International Conference on Integrated Modeling & Analysis in Applied Control & Automation</i>, Genova, Italy, October 2004. </li>
|
|---|
| 8841 | <li>Antonio Cammi, Francesco Casella, Marco Ricotti and Francesco Schiavo, “Object-Oriented Modeling, Simulation and Control of the IRIS Nuclear Power Plant with Modelica”. 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>
|
|---|
| 8842 | <li>A. Cammi, F. Casella, M. E. Ricotti, F. Schiavo, G. D. Storrick, "Object-oriented Simulation for the Control of the IRIS Nuclear Power Plant", <i>Proceedings of the IFAC World Congress, </i>Prague, Czech Republic, July 2005 </li>
|
|---|
| 8843 | <li>Francesco Casella and Francesco Pretolani, “Fast Start-up of a Combined-Cycle Power Plant: a Simulation Study with Modelica”. 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>
|
|---|
| 8844 | <li>Francesco Casella, “Object-Oriented Modelling of Two-Phase Fluid Flows by the Finite Volume Method”. In <i>Proceedings 5th Mathmod Vienna</i>, Vienna, Austria, Feb. 8-10, 2006. </li>
|
|---|
| 8845 | <li>Andrea Bartolini, Francesco Casella, Alberto Leva and Valeria Motterle, “A Simulation Study of the Flue Gas Path Control System in a Coal-Fired Power Plant”. In <i>Proceedings ANIPLA International Congress 2006</i>, Rome, Italy,vNov. 13-15, 2006. </li>
|
|---|
| 8846 | <li>Francesco Schiavo and Francesco Casella, “Object-oriented modelling and simulation of heat exchangers with finite element methods”. <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>
|
|---|
| 8847 | <li>Laura Savoldi Richard, Francesco Casella, Barbara Fiori and Roberto Zanino, “Development of the Cryogenic Circuit Conductor and Coil (4C) Code for thermal-hydraulic modelling of ITER superconducting coils”. In <i>Presented at the 22nd International Cryogenic Engineering Conference ICEC22</i>, Seoul, Korea, July 21-25, 2008. </li>
|
|---|
| 8848 | <li>Francesco Casella, “Object-Oriented Modelling of Power Plants: a Structured Approach”. In <i>Proceedings of the IFAC Symposium on Power Plants and Power Systems Control</i>, Tampere, Finland, July 5-8, 2009. </li>
|
|---|
| 8849 | <li>Laura Savoldi Richard, Francesco Casella, Barbara Fiori and Roberto Zanino, “The 4C code for the cryogenic circuit conductor and coil modeling in ITER”. <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>
|
|---|
| 8850 | <li>Antonio Cammi, Francesco Casella, Marco Enrico Ricotti and Francesco Schiavo, “An object-oriented approach to simulation of IRIS dynamic response”. <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>
|
|---|
| 8851 | <li>Francesco Casella and Piero Colonna, “Development of a Modelica dynamic model of solar supercritical CO2 Brayton cycle power plants for control studies”. 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>
|
|---|
| 8852 | <li>Roberto Bonifetto, Francesco Casella, Laura Savoldi Richard and Roberto Zanino, “Dynamic modeling of a SHe closed loop with the 4C code”. 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>
|
|---|
| 8853 | <li>Roberto Zanino, Roberto Bonifetto, Francesco Casella and Laura Savoldi Richard, “Validation of the 4C code against data from the HELIOS loop at CEA Grenoble”. <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>
|
|---|
| 8854 | <li>Francesco Casella and Piero Colonna, “Dynamic modelling of IGCC power plants”. <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>
|
|---|
| 8855 | </ul></p>
|
|---|
| 8856 |
|
|---|
| 8857 | <b>Release notes:</b>
|
|---|
| 8858 | <p><b></font><font style=\"font-size: 10pt; \">Version 2.1 (<i>6 Jul 2009</i>)</b></p>
|
|---|
| 8859 | <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>
|
|---|
| 8860 | <li><ul>
|
|---|
| 8861 | <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>
|
|---|
| 8862 | <li>New examples cases in the Examples package. </li>
|
|---|
| 8863 | <li>New components in the Electrical package, to model the generator-grid connection by the swing equation </li>
|
|---|
| 8864 | <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>
|
|---|
| 8865 | <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>
|
|---|
| 8866 | <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. </li>
|
|---|
| 8867 | <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>
|
|---|
| 8868 | </ul></li>
|
|---|
| 8869 | </ul></p>
|
|---|
| 8870 | <p><b>Version 2.0 (<i>10 Jun 2005</i>)</b></p>
|
|---|
| 8871 | <li><ul>
|
|---|
| 8872 | <li>The new Modelica 2.2 standard library is used. </li>
|
|---|
| 8873 | <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>
|
|---|
| 8874 | <li>Fully functional gas components are now available, including model for gas compressors and turbines, as well as compact gas turbine unit models. </li>
|
|---|
| 8875 | <li>Steady-state initialisation support has been added to all dynamic models. </li>
|
|---|
| 8876 | <li>Some components are still under development, and could be changed in the final 2.0 release: </li>
|
|---|
| 8877 | <li><ul>
|
|---|
| 8878 | <li>Moving boundary model for two-phase flow in once-through evaporators. </li>
|
|---|
| 8879 | <li>Stress models for headers and turbines. </li>
|
|---|
| 8880 | </ul></li>
|
|---|
| 8881 | </ul></li>
|
|---|
| 8882 | </ul></p>
|
|---|
| 8883 | <p><b>Version 1.2 (<i>18 Nov 2004</i>)</b></p>
|
|---|
| 8884 | <li><ul>
|
|---|
| 8885 | <li>Valve and pump models restructured using inheritance. </li>
|
|---|
| 8886 | <li>Simple model of a steam turbine unit added (requires the Modelica.Media library). </li>
|
|---|
| 8887 | <li>CISE example restructured and moved to the <code>Examples</code> package. </li>
|
|---|
| 8888 | <li>Preliminary version of gas components added in the <code>Gas</code> package. </li>
|
|---|
| 8889 | <li>Finite element model of thermohydraulic two-phase flow added. </li>
|
|---|
| 8890 | <li>Simplified models for the connection to the power system added in the <code>Electrical</code> package. </li>
|
|---|
| 8891 | </ul></li>
|
|---|
| 8892 | </ul></p>
|
|---|
| 8893 | <p><b>Version 1.1 (<i>15 Feb 2004</i>)</b></p>
|
|---|
| 8894 | <li><ul>
|
|---|
| 8895 | <li>No default values for parameters whose values must be set explicitly by the user. </li>
|
|---|
| 8896 | <li>Description of the meaning of the model variables added. </li>
|
|---|
| 8897 | <li><code>Pump</code>, <code>PumpMech</code>, <code>Accumulator</code> models added. </li>
|
|---|
| 8898 | <li>More rational geometric parameters for <code>Flow1D*</code> models. </li>
|
|---|
| 8899 | <li><code>Flow1D</code> model corrected to avoid numerical problems when the phase transition boundaries cross the nodes. </li>
|
|---|
| 8900 | <li><code>Flow1D2phDB</code> model updated. </li>
|
|---|
| 8901 | <li><code>Flow1D2phChen</code> models with two-phase heat transfer added. </li>
|
|---|
| 8902 | </ul></li>
|
|---|
| 8903 | </ul></p>
|
|---|
| 8904 | <p><b>Version 1.0 (<i>20 Oct 2003</i>)</b></p>
|
|---|
| 8905 | <li><ul>
|
|---|
| 8906 | <li>First release in the public domain</li>
|
|---|
| 8907 | </ul></li>
|
|---|
| 8908 | </ul></p>
|
|---|
| 8909 | <p><b></font><font style=\"font-size: 12pt; \">License agreement</b></p>
|
|---|
| 8910 | <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>
|
|---|
| 8911 | <p><h4>Copyright © 2002-2013, Politecnico di Milano.</h4></p>
|
|---|
| 8912 | </html>"),
|
|---|
| 8913 | uses(Modelica(version="3.2.1")),
|
|---|
| 8914 | version="3.1");
|
|---|
| 8915 | end ThermoPower;
|
|---|
| 8916 |
|
|---|
| 8917 | package ThermoPower_Examples_BraytonCycle
|
|---|
| 8918 | extends ThermoPower.Examples.BraytonCycle;
|
|---|
| 8919 | annotation(experiment(
|
|---|
| 8920 | StopTime=1,
|
|---|
| 8921 | __Dymola_NumberOfIntervals=500,
|
|---|
| 8922 | Tolerance=0.0001,
|
|---|
| 8923 | __Dymola_Algorithm="dassl"),uses(ThermoPower(version="3.1")));
|
|---|
| 8924 | end ThermoPower_Examples_BraytonCycle;
|
|---|