Ticket #6183: TestEnvironment2Total.mo

File TestEnvironment2Total.mo, 62.6 KB (added by vwaurich, 3 years ago)

minimal test model

Line 
1package Modelica "Modelica Standard Library - Version 3.2.3"
2extends Modelica.Icons.Package;
3
4  package Blocks
5  "Library of basic input/output control blocks (continuous, discrete, logical, table blocks)"
6  import SI = Modelica.SIunits;
7  extends Modelica.Icons.Package;
8
9    package Interfaces
10    "Library of connectors and partial models for input/output blocks"
11      import Modelica.SIunits;
12      extends Modelica.Icons.InterfacesPackage;
13
14      connector RealInput = input Real "'input Real' as connector" annotation (
15        defaultComponentName="u",
16        Icon(graphics={
17          Polygon(
18            lineColor={0,0,127},
19            fillColor={0,0,127},
20            fillPattern=FillPattern.Solid,
21            points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})},
22          coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}},
23            preserveAspectRatio=true,
24            initialScale=0.2)),
25        Diagram(
26          coordinateSystem(preserveAspectRatio=true,
27            initialScale=0.2,
28            extent={{-100.0,-100.0},{100.0,100.0}}),
29            graphics={
30          Polygon(
31            lineColor={0,0,127},
32            fillColor={0,0,127},
33            fillPattern=FillPattern.Solid,
34            points={{0.0,50.0},{100.0,0.0},{0.0,-50.0},{0.0,50.0}}),
35          Text(
36            lineColor={0,0,127},
37            extent={{-10.0,60.0},{-10.0,85.0}},
38            textString="%name")}),
39        Documentation(info="<html>
40<p>
41Connector with one input signal of type Real.
42</p>
43</html>"));
44
45      connector RealOutput = output Real "'output Real' as connector" annotation (
46        defaultComponentName="y",
47        Icon(
48          coordinateSystem(preserveAspectRatio=true,
49            extent={{-100.0,-100.0},{100.0,100.0}}),
50            graphics={
51          Polygon(
52            lineColor={0,0,127},
53            fillColor={255,255,255},
54            fillPattern=FillPattern.Solid,
55            points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}),
56        Diagram(
57          coordinateSystem(preserveAspectRatio=true,
58            extent={{-100.0,-100.0},{100.0,100.0}}),
59            graphics={
60          Polygon(
61            lineColor={0,0,127},
62            fillColor={255,255,255},
63            fillPattern=FillPattern.Solid,
64            points={{-100.0,50.0},{0.0,0.0},{-100.0,-50.0}}),
65          Text(
66            lineColor={0,0,127},
67            extent={{30.0,60.0},{30.0,110.0}},
68            textString="%name")}),
69        Documentation(info="<html>
70<p>
71Connector with one output signal of type Real.
72</p>
73</html>"));
74
75      partial block SO "Single Output continuous control block"
76        extends Modelica.Blocks.Icons.Block;
77
78        RealOutput y "Connector of Real output signal" annotation (Placement(
79              transformation(extent={{100,-10},{120,10}})));
80        annotation (Documentation(info="<html>
81<p>
82Block has one continuous Real output signal.
83</p>
84</html>"));
85
86      end SO;
87      annotation (Documentation(info="<html>
88<p>
89This package contains interface definitions for
90<strong>continuous</strong> input/output blocks with Real,
91Integer and Boolean signals. Furthermore, it contains
92partial models for continuous and discrete blocks.
93</p>
94
95</html>",     revisions="<html>
96<ul>
97<li><em>Oct. 21, 2002</em>
98       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
99       and Christian Schweiger:<br>
100       Added several new interfaces.</li>
101<li><em>Oct. 24, 1999</em>
102       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
103       RealInputSignal renamed to RealInput. RealOutputSignal renamed to
104       output RealOutput. GraphBlock renamed to BlockIcon. SISOreal renamed to
105       SISO. SOreal renamed to SO. I2SOreal renamed to M2SO.
106       SignalGenerator renamed to SignalSource. Introduced the following
107       new models: MIMO, MIMOs, SVcontrol, MVcontrol, DiscreteBlockIcon,
108       DiscreteBlock, DiscreteSISO, DiscreteMIMO, DiscreteMIMOs,
109       BooleanBlockIcon, BooleanSISO, BooleanSignalSource, MI2BooleanMOs.</li>
110<li><em>June 30, 1999</em>
111       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
112       Realized a first version, based on an existing Dymola library
113       of Dieter Moormann and Hilding Elmqvist.</li>
114</ul>
115</html>"));
116    end Interfaces;
117
118    package Sources
119    "Library of signal source blocks generating Real, Integer and Boolean signals"
120      import Modelica.Blocks.Interfaces;
121      import Modelica.SIunits;
122      extends Modelica.Icons.SourcesPackage;
123
124      block Constant "Generate constant signal of type Real"
125        parameter Real k(start=1) "Constant output value"
126        annotation(Dialog(groupImage="modelica://Modelica/Resources/Images/Blocks/Sources/Constant.png"));
127        extends Interfaces.SO;
128
129      equation
130        y = k;
131        annotation (
132          defaultComponentName="const",
133          Icon(coordinateSystem(
134              preserveAspectRatio=true,
135              extent={{-100,-100},{100,100}}), graphics={
136              Line(points={{-80,68},{-80,-80}}, color={192,192,192}),
137              Polygon(
138                points={{-80,90},{-88,68},{-72,68},{-80,90}},
139                lineColor={192,192,192},
140                fillColor={192,192,192},
141                fillPattern=FillPattern.Solid),
142              Line(points={{-90,-70},{82,-70}}, color={192,192,192}),
143              Polygon(
144                points={{90,-70},{68,-62},{68,-78},{90,-70}},
145                lineColor={192,192,192},
146                fillColor={192,192,192},
147                fillPattern=FillPattern.Solid),
148              Line(points={{-80,0},{80,0}}),
149              Text(
150                extent={{-150,-150},{150,-110}},
151                textString="k=%k")}),
152          Diagram(coordinateSystem(
153              preserveAspectRatio=true,
154              extent={{-100,-100},{100,100}}), graphics={
155              Polygon(
156                points={{-80,90},{-86,68},{-74,68},{-80,90}},
157                lineColor={95,95,95},
158                fillColor={95,95,95},
159                fillPattern=FillPattern.Solid),
160              Line(points={{-80,68},{-80,-80}}, color={95,95,95}),
161              Line(
162                points={{-80,0},{80,0}},
163                color={0,0,255},
164                thickness=0.5),
165              Line(points={{-90,-70},{82,-70}}, color={95,95,95}),
166              Polygon(
167                points={{90,-70},{68,-64},{68,-76},{90,-70}},
168                lineColor={95,95,95},
169                fillColor={95,95,95},
170                fillPattern=FillPattern.Solid),
171              Text(
172                extent={{-83,92},{-30,74}},
173                textString="y"),
174              Text(
175                extent={{70,-80},{94,-100}},
176                textString="time"),
177              Text(
178                extent={{-101,8},{-81,-12}},
179                textString="k")}),
180          Documentation(info="<html>
181<p>
182The Real output y is a constant signal:
183</p>
184
185<p>
186<img src=\"modelica://Modelica/Resources/Images/Blocks/Sources/Constant.png\"
187     alt=\"Constant.png\">
188</p>
189</html>"));
190      end Constant;
191      annotation (Documentation(info="<html>
192<p>
193This package contains <strong>source</strong> components, i.e., blocks which
194have only output signals. These blocks are used as signal generators
195for Real, Integer and Boolean signals.
196</p>
197
198<p>
199All Real source signals (with the exception of the Constant source)
200have at least the following two parameters:
201</p>
202
203<table border=1 cellspacing=0 cellpadding=2>
204  <tr><td><strong>offset</strong></td>
205      <td>Value which is added to the signal</td>
206  </tr>
207  <tr><td><strong>startTime</strong></td>
208      <td>Start time of signal. For time &lt; startTime,
209                the output y is set to offset.</td>
210  </tr>
211</table>
212
213<p>
214The <strong>offset</strong> parameter is especially useful in order to shift
215the corresponding source, such that at initial time the system
216is stationary. To determine the corresponding value of offset,
217usually requires a trimming calculation.
218</p>
219</html>",     revisions="<html>
220<ul>
221<li><em>October 21, 2002</em>
222       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
223       and Christian Schweiger:<br>
224       Integer sources added. Step, TimeTable and BooleanStep slightly changed.</li>
225<li><em>Nov. 8, 1999</em>
226       by <a href=\"mailto:christoph@clauss-it.com\">Christoph Clau&szlig;</a>,
227       <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
228       <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
229       New sources: Exponentials, TimeTable. Trapezoid slightly enhanced
230       (nperiod=-1 is an infinite number of periods).</li>
231<li><em>Oct. 31, 1999</em>
232       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
233       <a href=\"mailto:christoph@clauss-it.com\">Christoph Clau&szlig;</a>,
234       <a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>,
235       All sources vectorized. New sources: ExpSine, Trapezoid,
236       BooleanConstant, BooleanStep, BooleanPulse, SampleTrigger.
237       Improved documentation, especially detailed description of
238       signals in diagram layer.</li>
239<li><em>June 29, 1999</em>
240       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
241       Realized a first version, based on an existing Dymola library
242       of Dieter Moormann and Hilding Elmqvist.</li>
243</ul>
244</html>"));
245    end Sources;
246
247    package Icons "Icons for Blocks"
248        extends Modelica.Icons.IconsPackage;
249
250        partial block Block "Basic graphical layout of input/output block"
251
252          annotation (
253            Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
254                  100,100}}), graphics={Rectangle(
255                extent={{-100,-100},{100,100}},
256                lineColor={0,0,127},
257                fillColor={255,255,255},
258                fillPattern=FillPattern.Solid), Text(
259                extent={{-150,150},{150,110}},
260                textString="%name",
261                lineColor={0,0,255})}),
262          Documentation(info="<html>
263<p>
264Block that has only the basic icon for an input/output
265block (no declarations, no equations). Most blocks
266of package Modelica.Blocks inherit directly or indirectly
267from this block.
268</p>
269</html>"));
270
271        end Block;
272    end Icons;
273  annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
274        Rectangle(
275          origin={0.0,35.1488},
276          fillColor={255,255,255},
277          extent={{-30.0,-20.1488},{30.0,20.1488}}),
278        Rectangle(
279          origin={0.0,-34.8512},
280          fillColor={255,255,255},
281          extent={{-30.0,-20.1488},{30.0,20.1488}}),
282        Line(
283          origin={-51.25,0.0},
284          points={{21.25,-35.0},{-13.75,-35.0},{-13.75,35.0},{6.25,35.0}}),
285        Polygon(
286          origin={-40.0,35.0},
287          pattern=LinePattern.None,
288          fillPattern=FillPattern.Solid,
289          points={{10.0,0.0},{-5.0,5.0},{-5.0,-5.0}}),
290        Line(
291          origin={51.25,0.0},
292          points={{-21.25,35.0},{13.75,35.0},{13.75,-35.0},{-6.25,-35.0}}),
293        Polygon(
294          origin={40.0,-35.0},
295          pattern=LinePattern.None,
296          fillPattern=FillPattern.Solid,
297          points={{-10.0,0.0},{5.0,5.0},{5.0,-5.0}})}), Documentation(info="<html>
298<p>
299This library contains input/output blocks to build up block diagrams.
300</p>
301
302<dl>
303<dt><strong>Main Author:</strong></dt>
304<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
305    Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
306    Oberpfaffenhofen<br>
307    Postfach 1116<br>
308    D-82230 Wessling<br>
309    email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a><br></dd>
310</dl>
311<p>
312Copyright &copy; 1998-2019, Modelica Association and contributors
313</p>
314</html>",   revisions="<html>
315<ul>
316<li><em>June 23, 2004</em>
317       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
318       Introduced new block connectors and adapted all blocks to the new connectors.
319       Included subpackages Continuous, Discrete, Logical, Nonlinear from
320       package ModelicaAdditions.Blocks.
321       Included subpackage ModelicaAdditions.Table in Modelica.Blocks.Sources
322       and in the new package Modelica.Blocks.Tables.
323       Added new blocks to Blocks.Sources and Blocks.Logical.
324       </li>
325<li><em>October 21, 2002</em>
326       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
327       and Christian Schweiger:<br>
328       New subpackage Examples, additional components.
329       </li>
330<li><em>June 20, 2000</em>
331       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
332       Michael Tiller:<br>
333       Introduced a replaceable signal type into
334       Blocks.Interfaces.RealInput/RealOutput:
335<pre>
336   replaceable type SignalType = Real
337</pre>
338       in order that the type of the signal of an input/output block
339       can be changed to a physical type, for example:
340<pre>
341   Sine sin1(outPort(redeclare type SignalType=Modelica.SIunits.Torque))
342</pre>
343      </li>
344<li><em>Sept. 18, 1999</em>
345       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
346       Renamed to Blocks. New subpackages Math, Nonlinear.
347       Additional components in subpackages Interfaces, Continuous
348       and Sources.</li>
349<li><em>June 30, 1999</em>
350       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
351       Realized a first version, based on an existing Dymola library
352       of Dieter Moormann and Hilding Elmqvist.</li>
353</ul>
354</html>"));
355  end Blocks;
356
357  package Mechanics
358  "Library of 1-dim. and 3-dim. mechanical components (multi-body, rotational, translational)"
359  extends Modelica.Icons.Package;
360
361    package MultiBody "Library to model 3-dimensional mechanical systems"
362      extends Modelica.Icons.Package;
363    import SI = Modelica.SIunits;
364    import Cv = Modelica.SIunits.Conversions;
365    import C = Modelica.Constants;
366
367      package Types
368      "Constants and types with choices, especially to build menus"
369        extends Modelica.Icons.TypesPackage;
370
371        type Color = Modelica.Icons.TypeInteger[3] (each min=0, each max=255)
372          "RGB representation of color"
373          annotation (
374            Dialog(colorSelector=true),
375            choices(
376              choice={0,0,0} "{0,0,0}       \"black\"",
377              choice={155,0,0} "{155,0,0}     \"dark red\"",
378              choice={255,0,0} "{255,0,0 }    \"red\"",
379              choice={255,65,65} "{255,65,65}   \"light red\"",
380              choice={0,128,0} "{0,128,0}     \"dark green\"",
381              choice={0,180,0} "{0,180,0}     \"green\"",
382              choice={0,230,0} "{0,230,0}     \"light green\"",
383              choice={0,0,200} "{0,0,200}     \"dark blue\"",
384              choice={0,0,255} "{0,0,255}     \"blue\"",
385              choice={0,128,255} "{0,128,255}   \"light blue\"",
386              choice={255,255,0} "{255,255,0}   \"yellow\"",
387              choice={255,0,255} "{255,0,255}   \"pink\"",
388              choice={100,100,100} "{100,100,100} \"dark grey\"",
389              choice={155,155,155} "{155,155,155} \"grey\"",
390              choice={255,255,255} "{255,255,255} \"white\""),
391          Documentation(info="<html>
392<p>
393Type <strong>Color</strong> is an Integer vector with 3 elements,
394{r, g, b}, and specifies the color of a shape.
395{r,g,b} are the \"red\", \"green\" and \"blue\" color parts.
396Note, r g, b are given in the range 0 .. 255.
397</p>
398</html>"));
399        annotation (Documentation(info="<html>
400<p>
401In this package <strong>types</strong> and <strong>constants</strong> are defined that are used in the
402MultiBody library. The types have additional annotation choices
403definitions that define the menus to be built up in the graphical
404user interface when the type is used as parameter in a declaration.
405</p>
406</html>"));
407      end Types;
408    annotation (
409      Documentation(info="<html>
410<p>
411Library <strong>MultiBody</strong> is a <strong>free</strong> Modelica package providing
4123-dimensional mechanical components to model in a convenient way
413<strong>mechanical systems</strong>, such as robots, mechanisms, vehicles.
414Typical animations generated with this library are shown
415in the next figure:
416</p>
417
418<p>
419<img src=\"modelica://Modelica/Resources/Images/Mechanics/MultiBody/MultiBody.png\">
420</p>
421
422<p>
423For an introduction, have especially a look at:
424</p>
425<ul>
426<li> <a href=\"modelica://Modelica.Mechanics.MultiBody.UsersGuide\">MultiBody.UsersGuide</a>
427     discusses the most important aspects how to use this library.</li>
428<li> <a href=\"modelica://Modelica.Mechanics.MultiBody.Examples\">MultiBody.Examples</a>
429     contains examples that demonstrate the usage of this library.</li>
430</ul>
431
432<p>
433Copyright &copy; 1998-2019, Modelica Association and contributors
434</p>
435</html>"),     Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
436                {100,100}}), graphics={
437            Polygon(
438              points={{-58,76},{6,76},{-26,50},{-58,76}},
439              lineColor={95,95,95},
440              fillColor={255,255,255},
441              fillPattern=FillPattern.Solid),
442            Line(
443              points={{-26,50},{28,-50}}),
444            Ellipse(
445              extent={{-4,-14},{60,-78}},
446              lineColor={135,135,135},
447              fillPattern=FillPattern.Sphere,
448              fillColor={255,255,255})}));
449    end MultiBody;
450  annotation (
451    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
452        Rectangle(
453          origin={8.6,63.3333},
454          lineColor={64,64,64},
455          fillColor={192,192,192},
456          fillPattern=FillPattern.HorizontalCylinder,
457          extent={{-4.6,-93.3333},{41.4,-53.3333}}),
458        Ellipse(
459          origin={9.0,46.0},
460          extent={{-90.0,-60.0},{-80.0,-50.0}}),
461        Line(
462          origin={9.0,46.0},
463          points={{-85.0,-55.0},{-60.0,-21.0}},
464          thickness=0.5),
465        Ellipse(
466          origin={9.0,46.0},
467          extent={{-65.0,-26.0},{-55.0,-16.0}}),
468        Line(
469          origin={9.0,46.0},
470          points={{-60.0,-21.0},{9.0,-55.0}},
471          thickness=0.5),
472        Ellipse(
473          origin={9.0,46.0},
474          fillPattern=FillPattern.Solid,
475          extent={{4.0,-60.0},{14.0,-50.0}}),
476        Line(
477          origin={9.0,46.0},
478          points={{-10.0,-26.0},{72.0,-26.0},{72.0,-86.0},{-10.0,-86.0}})}),
479    Documentation(info="<html>
480<p>
481This package contains components to model the movement
482of 1-dim. rotational, 1-dim. translational, and
4833-dim. <strong>mechanical systems</strong>.
484</p>
485
486<p>
487Note, all <strong>dissipative</strong> components of the Modelica.Mechanics library have
488an optional <strong>heatPort</strong> connector to which the
489dissipated energy is transported in form of heat. This connector is enabled
490via parameter \"useHeatPort\". If the heatPort connector is enabled,
491it must be connected, and if it is not enabled, it must not be connected.
492Independently, whether the heatPort is enabled or not,
493the dissipated power is available from variable \"<strong>lossPower</strong>\" (which is
494positive if heat is flowing out of the heatPort).
495</p>
496</html>"));
497  end Mechanics;
498
499  package Math
500  "Library of mathematical functions (e.g., sin, cos) and of functions operating on vectors and matrices"
501  import SI = Modelica.SIunits;
502  extends Modelica.Icons.Package;
503
504  package Icons "Icons for Math"
505    extends Modelica.Icons.IconsPackage;
506
507    partial function AxisCenter
508      "Basic icon for mathematical function with y-axis in the center"
509
510      annotation (
511        Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
512                100}}), graphics={
513            Rectangle(
514              extent={{-100,100},{100,-100}},
515              fillColor={255,255,255},
516              fillPattern=FillPattern.Solid),
517            Line(points={{0,-80},{0,68}}, color={192,192,192}),
518            Polygon(
519              points={{0,90},{-8,68},{8,68},{0,90}},
520              lineColor={192,192,192},
521              fillColor={192,192,192},
522              fillPattern=FillPattern.Solid),
523            Text(
524              extent={{-150,150},{150,110}},
525              textString="%name",
526              lineColor={0,0,255})}),
527        Diagram(graphics={Line(points={{0,80},{-8,80}}, color={95,95,95}),Line(
528              points={{0,-80},{-8,-80}}, color={95,95,95}),Line(points={{0,-90},{
529              0,84}}, color={95,95,95}),Text(
530                  extent={{5,104},{25,84}},
531                  lineColor={95,95,95},
532                  textString="y"),Polygon(
533                  points={{0,98},{-6,82},{6,82},{0,98}},
534                  lineColor={95,95,95},
535                  fillColor={95,95,95},
536                  fillPattern=FillPattern.Solid)}),
537        Documentation(info="<html>
538<p>
539Icon for a mathematical function, consisting of an y-axis in the middle.
540It is expected, that an x-axis is added and a plot of the function.
541</p>
542</html>"));
543    end AxisCenter;
544  end Icons;
545
546  function asin "Inverse sine (-1 <= u <= 1)"
547    extends Modelica.Math.Icons.AxisCenter;
548    input Real u;
549    output SI.Angle y;
550
551  external "builtin" y = asin(u);
552    annotation (
553      Icon(coordinateSystem(
554          preserveAspectRatio=true,
555          extent={{-100,-100},{100,100}}), graphics={
556          Line(points={{-90,0},{68,0}}, color={192,192,192}),
557          Polygon(
558            points={{90,0},{68,8},{68,-8},{90,0}},
559            lineColor={192,192,192},
560            fillColor={192,192,192},
561            fillPattern=FillPattern.Solid),
562          Line(points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
563                -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
564                52.7},{75.2,62.2},{77.6,67.5},{80,80}}),
565          Text(
566            extent={{-88,78},{-16,30}},
567            lineColor={192,192,192},
568            textString="asin")}),
569      Diagram(coordinateSystem(
570          preserveAspectRatio=true,
571          extent={{-100,-100},{100,100}}), graphics={Text(
572              extent={{-40,-72},{-15,-88}},
573              textString="-pi/2",
574              lineColor={0,0,255}),Text(
575              extent={{-38,88},{-13,72}},
576              textString=" pi/2",
577              lineColor={0,0,255}),Text(
578              extent={{68,-9},{88,-29}},
579              textString="+1",
580              lineColor={0,0,255}),Text(
581              extent={{-90,21},{-70,1}},
582              textString="-1",
583              lineColor={0,0,255}),Line(points={{-100,0},{84,0}}, color={95,95,95}),
584            Polygon(
585              points={{98,0},{82,6},{82,-6},{98,0}},
586              lineColor={95,95,95},
587              fillColor={95,95,95},
588              fillPattern=FillPattern.Solid),Line(
589              points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
590              -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
591              52.7},{75.2,62.2},{77.6,67.5},{80,80}},
592              color={0,0,255},
593              thickness=0.5),Text(
594              extent={{82,24},{102,4}},
595              lineColor={95,95,95},
596              textString="u"),Line(
597              points={{0,80},{86,80}},
598              color={175,175,175}),Line(
599              points={{80,86},{80,-10}},
600              color={175,175,175})}),
601      Documentation(info="<html>
602<p>
603This function returns y = asin(u), with -1 &le; u &le; +1:
604</p>
605
606<p>
607<img src=\"modelica://Modelica/Resources/Images/Math/asin.png\">
608</p>
609</html>"));
610  end asin;
611  annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
612            {100,100}}), graphics={Line(points={{-80,0},{-68.7,34.2},{-61.5,53.1},
613              {-55.1,66.4},{-49.4,74.6},{-43.8,79.1},{-38.2,79.8},{-32.6,76.6},{
614              -26.9,69.7},{-21.3,59.4},{-14.9,44.1},{-6.83,21.2},{10.1,-30.8},{17.3,
615              -50.2},{23.7,-64.2},{29.3,-73.1},{35,-78.4},{40.6,-80},{46.2,-77.6},
616              {51.9,-71.5},{57.5,-61.9},{63.9,-47.2},{72,-24.8},{80,0}}, color={
617              0,0,0}, smooth=Smooth.Bezier)}), Documentation(info="<html>
618<p>
619This package contains <strong>basic mathematical functions</strong> (such as sin(..)),
620as well as functions operating on
621<a href=\"modelica://Modelica.Math.Vectors\">vectors</a>,
622<a href=\"modelica://Modelica.Math.Matrices\">matrices</a>,
623<a href=\"modelica://Modelica.Math.Nonlinear\">nonlinear functions</a>, and
624<a href=\"modelica://Modelica.Math.BooleanVectors\">Boolean vectors</a>.
625</p>
626
627<h4>Main Authors</h4>
628<p><a href=\"http://www.robotic.dlr.de/Martin.Otter/\"><strong>Martin Otter</strong></a>
629and <strong>Marcus Baur</strong><br>
630Deutsches Zentrum f&uuml;r Luft- und Raumfahrt e.V. (DLR)<br>
631Institut f&uuml;r Systemdynamik und Regelungstechnik (DLR-SR)<br>
632Forschungszentrum Oberpfaffenhofen<br>
633D-82234 Wessling<br>
634Germany<br>
635email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a>
636</p>
637
638<p>
639Copyright &copy; 1998-2019, Modelica Association and contributors
640</p>
641</html>",   revisions="<html>
642<ul>
643<li><em>August 24, 2016</em>
644       by Christian Kral: added wrapAngle</li>
645<li><em>October 21, 2002</em>
646       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
647       and Christian Schweiger:<br>
648       Function tempInterpol2 added.</li>
649<li><em>Oct. 24, 1999</em>
650       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
651       Icons for icon and diagram level introduced.</li>
652<li><em>June 30, 1999</em>
653       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
654       Realized.</li>
655</ul>
656
657</html>"));
658  end Math;
659
660  package Constants
661  "Library of mathematical constants and constants of nature (e.g., pi, eps, R, sigma)"
662    import SI = Modelica.SIunits;
663    import NonSI = Modelica.SIunits.Conversions.NonSIunits;
664    extends Modelica.Icons.Package;
665
666    final constant Real pi=2*Modelica.Math.asin(1.0);
667    annotation (
668      Documentation(info="<html>
669<p>
670This package provides often needed constants from mathematics, machine
671dependent constants and constants from nature. The latter constants
672(name, value, description) are from the following source:
673</p>
674
675<dl>
676<dt>Peter J. Mohr, David B. Newell, and Barry N. Taylor:</dt>
677<dd><strong>CODATA Recommended Values of the Fundamental Physical Constants: 2014</strong>.
678<a href= \"http://dx.doi.org/10.5281/zenodo.22826\">http://dx.doi.org/10.5281/zenodo.22826</a>, 2015. See also <a href=
679\"http://physics.nist.gov/cuu/Constants/index.html\">http://physics.nist.gov/cuu/Constants/index.html</a></dd>
680</dl>
681
682<p>CODATA is the Committee on Data for Science and Technology.</p>
683
684<dl>
685<dt><strong>Main Author:</strong></dt>
686<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
687    Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
688    Oberpfaffenhofen<br>
689    Postfach 1116<br>
690    D-82230 We&szlig;ling<br>
691    email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
692</dl>
693
694<p>
695Copyright &copy; 1998-2019, Modelica Association and contributors
696</p>
697</html>",   revisions="<html>
698<ul>
699<li><em>Nov 4, 2015</em>
700       by Thomas Beutlich:<br>
701       Constants updated according to 2014 CODATA values.</li>
702<li><em>Nov 8, 2004</em>
703       by Christian Schweiger:<br>
704       Constants updated according to 2002 CODATA values.</li>
705<li><em>Dec 9, 1999</em>
706       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
707       Constants updated according to 1998 CODATA values. Using names, values
708       and description text from this source. Included magnetic and
709       electric constant.</li>
710<li><em>Sep 18, 1999</em>
711       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
712       Constants eps, inf, small introduced.</li>
713<li><em>Nov 15, 1997</em>
714       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
715       Realized.</li>
716</ul>
717</html>"),
718      Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
719        Polygon(
720          origin={-9.2597,25.6673},
721          fillColor={102,102,102},
722          pattern=LinePattern.None,
723          fillPattern=FillPattern.Solid,
724          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}},
725          smooth=Smooth.Bezier),
726        Polygon(
727          origin={-19.9923,-8.3993},
728          fillColor={102,102,102},
729          pattern=LinePattern.None,
730          fillPattern=FillPattern.Solid,
731          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}},
732          smooth=Smooth.Bezier),
733        Polygon(
734          origin={23.753,-11.5422},
735          fillColor={102,102,102},
736          pattern=LinePattern.None,
737          fillPattern=FillPattern.Solid,
738          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}},
739          smooth=Smooth.Bezier)}));
740  end Constants;
741
742  package Icons "Library of icons"
743    extends Icons.Package;
744
745    partial package Package "Icon for standard packages"
746      annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
747            Rectangle(
748              lineColor={200,200,200},
749              fillColor={248,248,248},
750              fillPattern=FillPattern.HorizontalCylinder,
751              extent={{-100.0,-100.0},{100.0,100.0}},
752              radius=25.0),
753            Rectangle(
754              lineColor={128,128,128},
755              extent={{-100.0,-100.0},{100.0,100.0}},
756              radius=25.0)}), Documentation(info="<html>
757<p>Standard package icon.</p>
758</html>"));
759    end Package;
760
761    partial package InterfacesPackage "Icon for packages containing interfaces"
762      extends Modelica.Icons.Package;
763      annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
764                -100},{100,100}}), graphics={
765            Polygon(origin={20.0,0.0},
766              lineColor={64,64,64},
767              fillColor={255,255,255},
768              fillPattern=FillPattern.Solid,
769              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}}),
770            Polygon(fillColor={102,102,102},
771              pattern=LinePattern.None,
772              fillPattern=FillPattern.Solid,
773              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}})}),
774                                Documentation(info="<html>
775<p>This icon indicates packages containing interfaces.</p>
776</html>"));
777    end InterfacesPackage;
778
779    partial package SourcesPackage "Icon for packages containing sources"
780      extends Modelica.Icons.Package;
781      annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
782                -100},{100,100}}), graphics={
783            Polygon(origin={23.3333,0.0},
784              fillColor={128,128,128},
785              pattern=LinePattern.None,
786              fillPattern=FillPattern.Solid,
787              points={{-23.333,30.0},{46.667,0.0},{-23.333,-30.0}}),
788            Rectangle(
789              fillColor = {128,128,128},
790              pattern = LinePattern.None,
791              fillPattern = FillPattern.Solid,
792              extent = {{-70,-4.5},{0,4.5}})}),
793                                Documentation(info="<html>
794<p>This icon indicates a package which contains sources.</p>
795</html>"));
796    end SourcesPackage;
797
798    partial package TypesPackage
799    "Icon for packages containing type definitions"
800      extends Modelica.Icons.Package;
801      annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
802                -100},{100,100}}), graphics={Polygon(
803              origin={-12.167,-23},
804              fillColor={128,128,128},
805              pattern=LinePattern.None,
806              fillPattern=FillPattern.Solid,
807              points={{12.167,65},{14.167,93},{36.167,89},{24.167,20},{4.167,-30},
808                  {14.167,-30},{24.167,-30},{24.167,-40},{-5.833,-50},{-15.833,
809                  -30},{4.167,20},{12.167,65}},
810              smooth=Smooth.Bezier), Polygon(
811              origin={2.7403,1.6673},
812              fillColor={128,128,128},
813              pattern=LinePattern.None,
814              fillPattern=FillPattern.Solid,
815              points={{49.2597,22.3327},{31.2597,24.3327},{7.2597,18.3327},{-26.7403,
816                10.3327},{-46.7403,14.3327},{-48.7403,6.3327},{-32.7403,0.3327},{-6.7403,
817                4.3327},{33.2597,14.3327},{49.2597,14.3327},{49.2597,22.3327}},
818              smooth=Smooth.Bezier)}));
819    end TypesPackage;
820
821    partial package IconsPackage "Icon for packages containing icons"
822      extends Modelica.Icons.Package;
823      annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
824                -100},{100,100}}), graphics={Polygon(
825              origin={-8.167,-17},
826              fillColor={128,128,128},
827              pattern=LinePattern.None,
828              fillPattern=FillPattern.Solid,
829              points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
830                  4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
831                  -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
832              smooth=Smooth.Bezier), Ellipse(
833              origin={-0.5,56.5},
834              fillColor={128,128,128},
835              pattern=LinePattern.None,
836              fillPattern=FillPattern.Solid,
837              extent={{-12.5,-12.5},{12.5,12.5}})}));
838    end IconsPackage;
839
840    type TypeInteger "Icon for Integer types"
841        extends Integer;
842        annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
843              Rectangle(
844                lineColor={160,160,164},
845                fillColor={160,160,164},
846                fillPattern=FillPattern.Solid,
847                extent={{-100.0,-100.0},{100.0,100.0}},
848                radius=25.0),
849              Text(
850                lineColor={255,255,255},
851                extent={{-90.0,-50.0},{90.0,50.0}},
852                textString="I")}),Documentation(info="<html>
853<p>
854This icon is designed for an <strong>Integer</strong> type.
855</p>
856</html>"));
857    end TypeInteger;
858    annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
859                -100},{100,100}}), graphics={Polygon(
860              origin={-8.167,-17},
861              fillColor={128,128,128},
862              pattern=LinePattern.None,
863              fillPattern=FillPattern.Solid,
864              points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
865                  4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
866                  -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
867              smooth=Smooth.Bezier), Ellipse(
868              origin={-0.5,56.5},
869              fillColor={128,128,128},
870              pattern=LinePattern.None,
871              fillPattern=FillPattern.Solid,
872              extent={{-12.5,-12.5},{12.5,12.5}})}), Documentation(info="<html>
873<p>This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using &quot;extends&quot; or by directly copying the &quot;icon&quot; layer.</p>
874
875<h4>Main Authors:</h4>
876
877<dl>
878<dt><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a></dt>
879    <dd>Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)</dd>
880    <dd>Oberpfaffenhofen</dd>
881    <dd>Postfach 1116</dd>
882    <dd>D-82230 Wessling</dd>
883    <dd>email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
884<dt>Christian Kral</dt>
885
886    <dd>  <a href=\"https://christiankral.net/\">Electric Machines, Drives and Systems</a><br>
887</dd>
888    <dd>1060 Vienna, Austria</dd>
889    <dd>email: <a href=\"mailto:dr.christian.kral@gmail.com\">dr.christian.kral@gmail.com</a></dd>
890<dt>Johan Andreasson</dt>
891    <dd><a href=\"http://www.modelon.se/\">Modelon AB</a></dd>
892    <dd>Ideon Science Park</dd>
893    <dd>22370 Lund, Sweden</dd>
894    <dd>email: <a href=\"mailto:johan.andreasson@modelon.se\">johan.andreasson@modelon.se</a></dd>
895</dl>
896
897<p>
898Copyright &copy; 1998-2019, Modelica Association and contributors
899</p>
900</html>"));
901  end Icons;
902
903  package SIunits
904  "Library of type and unit definitions based on SI units according to ISO 31-1992"
905    extends Modelica.Icons.Package;
906
907    package Conversions
908    "Conversion functions to/from non SI units and type definitions of non SI units"
909      extends Modelica.Icons.Package;
910
911      package NonSIunits "Type definitions of non SI units"
912        extends Modelica.Icons.Package;
913        annotation (Documentation(info="<html>
914<p>
915This package provides predefined types, such as <strong>Angle_deg</strong> (angle in
916degree), <strong>AngularVelocity_rpm</strong> (angular velocity in revolutions per
917minute) or <strong>Temperature_degF</strong> (temperature in degree Fahrenheit),
918which are in common use but are not part of the international standard on
919units according to ISO 31-1992 \"General principles concerning quantities,
920units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
921the use of their multiples and of certain other units\".</p>
922<p>If possible, the types in this package should not be used. Use instead
923types of package Modelica.SIunits. For more information on units, see also
924the book of Francois Cardarelli <strong>Scientific Unit Conversion - A
925Practical Guide to Metrication</strong> (Springer 1997).</p>
926<p>Some units, such as <strong>Temperature_degC/Temp_C</strong> are both defined in
927Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
928definitions have been placed erroneously in Modelica.SIunits although they
929are not SIunits. For backward compatibility, these type definitions are
930still kept in Modelica.SIunits.</p>
931</html>"),   Icon(coordinateSystem(extent={{-100,-100},{100,100}}), graphics={
932        Text(
933          origin={15.0,51.8518},
934          extent={{-105.0,-86.8518},{75.0,-16.8518}},
935          textString="[km/h]")}));
936      end NonSIunits;
937      annotation (Documentation(info="<html>
938<p>This package provides conversion functions from the non SI Units
939defined in package Modelica.SIunits.Conversions.NonSIunits to the
940corresponding SI Units defined in package Modelica.SIunits and vice
941versa. It is recommended to use these functions in the following
942way (note, that all functions have one Real input and one Real output
943argument):</p>
944<pre>
945  <strong>import</strong> SI = Modelica.SIunits;
946  <strong>import</strong> Modelica.SIunits.Conversions.*;
947     ...
948  <strong>parameter</strong> SI.Temperature     T   = from_degC(25);   // convert 25 degree Celsius to Kelvin
949  <strong>parameter</strong> SI.Angle           phi = from_deg(180);   // convert 180 degree to radian
950  <strong>parameter</strong> SI.AngularVelocity w   = from_rpm(3600);  // convert 3600 revolutions per minutes
951                                                      // to radian per seconds
952</pre>
953
954</html>"));
955    end Conversions;
956
957    type Angle = Real (
958        final quantity="Angle",
959        final unit="rad",
960        displayUnit="deg");
961
962    type Length = Real (final quantity="Length", final unit="m");
963    annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
964              -100},{100,100}}), graphics={
965        Polygon(
966          fillColor = {128,128,128},
967          pattern = LinePattern.None,
968          fillPattern = FillPattern.Solid,
969          points = {{-80,-40},{-80,-40},{-55,50},{-52.5,62.5},{-65,60},{-65,65},{-35,77.5},{-32.5,60},{-50,0},{-50,0},{-30,15},{-20,27.5},{-32.5,27.5},{-32.5,27.5},{-32.5,32.5},{-32.5,32.5},{2.5,32.5},{2.5,32.5},{2.5,27.5},{2.5,27.5},{-7.5,27.5},{-30,7.5},{-30,7.5},{-25,-25},{-17.5,-28.75},{-10,-25},{-5,-26.25},{-5,-32.5},{-16.25,-41.25},{-31.25,-43.75},{-40,-33.75},{-45,-5},{-45,-5},{-52.5,-10},{-52.5,-10},{-60,-40},{-60,-40}},
970          smooth = Smooth.Bezier),
971        Polygon(
972          fillColor = {128,128,128},
973          pattern = LinePattern.None,
974          fillPattern = FillPattern.Solid,
975          points = {{87.5,30},{62.5,30},{62.5,30},{55,33.75},{36.25,35},{16.25,25},{7.5,6.25},{11.25,-7.5},{22.5,-12.5},{22.5,-12.5},{6.25,-22.5},{6.25,-35},{16.25,-38.75},{16.25,-38.75},{21.25,-41.25},{21.25,-41.25},{45,-48.75},{47.5,-61.25},{32.5,-70},{12.5,-65},{7.5,-51.25},{21.25,-41.25},{21.25,-41.25},{16.25,-38.75},{16.25,-38.75},{6.25,-41.25},{-6.25,-50},{-3.75,-68.75},{30,-76.25},{65,-62.5},{63.75,-35},{27.5,-26.25},{22.5,-20},{27.5,-15},{27.5,-15},{30,-7.5},{30,-7.5},{27.5,-2.5},{28.75,11.25},{36.25,27.5},{47.5,30},{53.75,22.5},{51.25,8.75},{45,-6.25},{35,-11.25},{30,-7.5},{30,-7.5},{27.5,-15},{27.5,-15},{43.75,-16.25},{65,-6.25},{72.5,10},{70,20},{70,20},{80,20}},
976          smooth = Smooth.Bezier)}), Documentation(info="<html>
977<p>This package provides predefined types, such as <em>Mass</em>,
978<em>Angle</em>, <em>Time</em>, based on the international standard
979on units, e.g.,
980</p>
981
982<pre>   <strong>type</strong> Angle = Real(<strong>final</strong> quantity = \"Angle\",
983                     <strong>final</strong> unit     = \"rad\",
984                     displayUnit    = \"deg\");
985</pre>
986
987<p>
988Some of the types are derived SI units that are utilized in package Modelica
989(such as ComplexCurrent, which is a complex number where both the real and imaginary
990part have the SI unit Ampere).
991</p>
992
993<p>
994Furthermore, conversion functions from non SI-units to SI-units and vice versa
995are provided in subpackage
996<a href=\"modelica://Modelica.SIunits.Conversions\">Conversions</a>.
997</p>
998
999<p>
1000For an introduction how units are used in the Modelica standard library
1001with package SIunits, have a look at:
1002<a href=\"modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
1003</p>
1004
1005<p>
1006Copyright &copy; 1998-2019, Modelica Association and contributors
1007</p>
1008</html>",   revisions="<html>
1009<ul>
1010<li><em>May 25, 2011</em> by Stefan Wischhusen:<br/>Added molar units for energy and enthalpy.</li>
1011<li><em>Jan. 27, 2010</em> by Christian Kral:<br/>Added complex units.</li>
1012<li><em>Dec. 14, 2005</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Add User&#39;s Guide and removed &quot;min&quot; values for Resistance and Conductance.</li>
1013<li><em>October 21, 2002</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and Christian Schweiger:<br/>Added new package <strong>Conversions</strong>. Corrected typo <em>Wavelenght</em>.</li>
1014<li><em>June 6, 2000</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Introduced the following new types<br/>type Temperature = ThermodynamicTemperature;<br/>types DerDensityByEnthalpy, DerDensityByPressure, DerDensityByTemperature, DerEnthalpyByPressure, DerEnergyByDensity, DerEnergyByPressure<br/>Attribute &quot;final&quot; removed from min and max values in order that these values can still be changed to narrow the allowed range of values.<br/>Quantity=&quot;Stress&quot; removed from type &quot;Stress&quot;, in order that a type &quot;Stress&quot; can be connected to a type &quot;Pressure&quot;.</li>
1015<li><em>Oct. 27, 1999</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>New types due to electrical library: Transconductance, InversePotential, Damping.</li>
1016<li><em>Sept. 18, 1999</em> 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>
1017<li><em>Aug 12, 1999</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Type &quot;Pressure&quot; renamed to &quot;AbsolutePressure&quot; and introduced a new type &quot;Pressure&quot; which does not contain a minimum of zero in order to allow convenient handling of relative pressure. Redefined BulkModulus as an alias to AbsolutePressure instead of Stress, since needed in hydraulics.</li>
1018<li><em>June 29, 1999</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Bug-fix: Double definition of &quot;Compressibility&quot; removed and appropriate &quot;extends Heat&quot; clause introduced in package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
1019<li><em>April 8, 1998</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and Astrid Jaschinski:<br/>Complete ISO 31 chapters realized.</li>
1020<li><em>Nov. 15, 1997</em> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and Hubertus Tummescheit:<br/>Some chapters realized.</li>
1021</ul>
1022</html>"));
1023  end SIunits;
1024annotation (
1025preferredView="info",
1026version="3.2.3",
1027versionBuild=2,
1028versionDate="2019-01-23",
1029dateModified = "2019-03-20 12:00:00Z",
1030revisionId="8f65f621a 2019-03-20 09:22:19 +0100",
1031uses(Complex(version="3.2.3"), ModelicaServices(version="3.2.3")),
1032conversion(
1033 noneFromVersion="3.2.2",
1034 noneFromVersion="3.2.1",
1035 noneFromVersion="3.2",
1036 noneFromVersion="3.1",
1037 noneFromVersion="3.0.1",
1038 noneFromVersion="3.0",
1039 from(version="2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1040 from(version="2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1041 from(version="2.2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1042 from(version="2.2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")),
1043Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
1044  Polygon(
1045    origin={-6.9888,20.048},
1046    pattern=LinePattern.None,
1047    fillPattern=FillPattern.Solid,
1048    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}},
1049    smooth=Smooth.Bezier),
1050  Ellipse(
1051    origin={40.8208,-37.7602},
1052    fillColor={161,0,4},
1053    pattern=LinePattern.None,
1054    fillPattern=FillPattern.Solid,
1055    extent={{-17.8562,-17.8563},{17.8563,17.8562}})}),
1056Documentation(info="<html>
1057<p>
1058Package <strong>Modelica&reg;</strong> is a <strong>standardized</strong> and <strong>free</strong> package
1059that is developed together with the Modelica&reg; language from the
1060Modelica Association, see
1061<a href=\"https://www.Modelica.org\">https://www.Modelica.org</a>.
1062It is also called <strong>Modelica Standard Library</strong>.
1063It provides model components in many domains that are based on
1064standardized interface definitions. Some typical examples are shown
1065in the next figure:
1066</p>
1067
1068<p>
1069<img src=\"modelica://Modelica/Resources/Images/UsersGuide/ModelicaLibraries.png\">
1070</p>
1071
1072<p>
1073For an introduction, have especially a look at:
1074</p>
1075<ul>
1076<li> <a href=\"modelica://Modelica.UsersGuide.Overview\">Overview</a>
1077  provides an overview of the Modelica Standard Library
1078  inside the <a href=\"modelica://Modelica.UsersGuide\">User's Guide</a>.</li>
1079<li><a href=\"modelica://Modelica.UsersGuide.ReleaseNotes\">Release Notes</a>
1080 summarizes the changes of new versions of this package.</li>
1081<li> <a href=\"modelica://Modelica.UsersGuide.Contact\">Contact</a>
1082  lists the contributors of the Modelica Standard Library.</li>
1083<li> The <strong>Examples</strong> packages in the various libraries, demonstrate
1084  how to use the components of the corresponding sublibrary.</li>
1085</ul>
1086
1087<p>
1088This version of the Modelica Standard Library consists of
1089</p>
1090<ul>
1091<li><strong>1288</strong> component models and blocks,</li>
1092<li><strong>404</strong> example models, and</li>
1093<li><strong>1227</strong> functions</li>
1094</ul>
1095<p>
1096that are directly usable (= number of public, non-partial, non-internal and non-obsolete classes). It is fully compliant
1097to <a href=\"https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf\">Modelica Specification Version 3.2 Revision 2</a>
1098and it has been tested with Modelica tools from different vendors.
1099</p>
1100
1101<p>
1102<strong>Licensed by the Modelica Association under the 3-Clause BSD License</strong><br>
1103Copyright &copy; 1998-2019, Modelica Association and <a href=\"modelica://Modelica.UsersGuide.Contact\">contributors</a>.
1104</p>
1105
1106<p>
1107<em>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 3-Clause BSD license. For license conditions (including the disclaimer of warranty) visit <a href=\"https://modelica.org/licenses/modelica-3-clause-bsd\">https://modelica.org/licenses/modelica-3-clause-bsd</a>.</em>
1108</p>
1109
1110<p>
1111<strong>Modelica&reg;</strong> is a registered trademark of the Modelica Association.
1112</p>
1113</html>"));
1114end Modelica;
1115
1116package BFT
1117  extends Modelica.Icons.Package;
1118
1119  package Environments
1120    extends Modelica.Icons.Package;
1121
1122    package Interfaces
1123      extends Modelica.Icons.InterfacesPackage;
1124
1125      partial model Environment
1126
1127        replaceable partial function get_Ground_Height =
1128            Interfaces.get_Ground_Height;
1129        replaceable partial function get_Contact_Reaction =
1130            Interfaces.get_Contact_Reaction;
1131        replaceable partial function get_Contact_Points =
1132            Interfaces.get_Contact_Points;
1133
1134        parameter Real mue0 = 0.8 "traction coefficient (maximum)";
1135        parameter Integer NumOfInputs = 4 "Number of inputs" annotation(dialog(enable=UseInputs));
1136        parameter Boolean enableAnimation=true "create surface for terrain"
1137            annotation(Dialog(group="Visualisation"));
1138        parameter Modelica.Mechanics.MultiBody.Types.Color color={200,200,200}
1139          "surface color as RGB-tuple"
1140        annotation(Dialog(group="Visualisation",enable=enableAnimation));
1141
1142        Modelica.Blocks.Interfaces.RealInput RoadAltitude[NumOfInputs]( each start=0, each fixed=false) if
1143                                                             UseInputs
1144          annotation (Placement(transformation(extent={{-120,60},{-80,100}})));
1145        Modelica.Blocks.Interfaces.RealInput RoadNormal[3,NumOfInputs]( start={zeros(NumOfInputs), zeros(NumOfInputs), ones(NumOfInputs)}, each fixed=false) if UseInputs
1146          annotation (Placement(transformation(extent={{-120,-20},{-80,20}})));
1147        Modelica.Blocks.Interfaces.RealInput RoadAdhesion[NumOfInputs]( each start=0.8, each fixed=false) if UseInputs
1148          annotation (Placement(transformation(extent={{-120,-100},{-80,-60}})));
1149    protected
1150        parameter Boolean UseInputs = false;
1151        annotation (
1152        missingInnerMessage=
1153              "An inner component called \"environment\" must be defined at the top level!",
1154          defaultComponentName="environment",
1155          defaultAttributes="inner",
1156        Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}),
1157                               graphics={
1158              Rectangle(
1159                extent={{-100,100},{100,-100}},
1160                lineColor={0,0,255},
1161                fillColor={255,255,255},
1162                fillPattern=FillPattern.Solid),
1163              Text(
1164                extent={{-100,100},{100,60}},
1165                lineColor={0,0,255},
1166                fillColor={255,255,255},
1167                fillPattern=FillPattern.Solid,
1168                textString="%name"),
1169              Polygon(
1170                points={{-100,-68},{-100,-32},{-100,-22},{-76,-14},{-64,-14},{-50,-26},
1171                    {-42,-24},{-38,-28},{-30,-32},{-16,-30},{-2,-30},{6,-36},{12,-32},
1172                    {18,-24},{42,-32},{50,-22},{56,-18},{60,-14},{68,-12},{74,-16},{76,
1173                    -22},{82,-20},{88,-24},{98,-32},{100,-32},{100,-50},{100,-88},{-100,
1174                    -88},{-100,-68}},
1175                smooth=Smooth.Bezier,
1176                fillColor={255,128,0},
1177                fillPattern=FillPattern.Solid,
1178                pattern=LinePattern.None,
1179                lineColor={255,128,0}),
1180              Rectangle(
1181                extent={{-100,-36},{100,-100}},
1182                lineColor={255,128,0},
1183                fillColor={255,128,0},
1184                fillPattern=FillPattern.Solid)}),
1185          Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,
1186                  100}}), graphics));
1187
1188      end Environment;
1189
1190      partial function get_Ground_Height
1191        input Integer id "unique tyre id for faster contact point calculation";
1192        input Real x[3]
1193          "guess, for position of contact point w.r.t. world frame (x and y remain fixed)";
1194        output Real z "Road altitude";
1195        output Real n[3] "Road normal";
1196        output Real mue "Road adhesion";
1197      end get_Ground_Height;
1198
1199      partial function get_Contact_Reaction
1200        input Integer id "unique body id to identifying colliding body";
1201        input Real x_0[3] "position of body reference point w.r.t. world frame";
1202        input Real T[3,3] "orientation of body";
1203        input Real v_0[3] "velocity of body reference point w.r.t. world frame";
1204        input Real om_0[3] "angular velocity of body w.r.t. world frame";
1205        output Real f[3] "contact force w.r.t. world frame";
1206        output Real t[3] "contact torque w.r.t. world frame";
1207      end get_Contact_Reaction;
1208
1209      partial function get_Contact_Points
1210
1211        input Real[3] Cr
1212          "Position vector from world frame to C-Frame, resolved in world frame";
1213        input Real[3] Ce_z
1214          "Unit vector in z-direction of C-Frame, resolved in world frame";
1215        input Modelica.SIunits.Length R0 "undeformed tyre radius";
1216        input Real[3] n "Unit vector in direction of spin axis";
1217        input Integer ID
1218          "ID of wheel to identify which altitude of ground should be used";
1219        input Integer Points= 91
1220          "number of discrete contact points. Should be uneven";
1221        input Real step = 2/180*Modelica.Constants.pi
1222          "displacement between contact points";
1223        //input Real mue0 "traction coefficient";
1224        output Real z_Ground;
1225        output Real[3] n_Ground;
1226        output Real mue_Ground;
1227        output Real[3] n_F
1228          "direction vector of each contact point to the center of the rim";
1229
1230    protected
1231        Real[3,points] contactPoint
1232          "Postion vector of contact points relativ to Cr, resolved in world frame";
1233        Integer   points= integer(Points/2)*2+1 "number of discrete contact points";
1234        Real[points] z_Road;
1235        Real[3,points] n_Road;
1236        Real[points] mue_Road;
1237        Real[points] dr;
1238        Real[3,points] contactPoint1;
1239        Real[3,points] A;
1240        Real[3,points] n_F_temp;
1241        Real[3,1] n_F_1;
1242
1243      //   Integer mm;
1244      //   Integer[points+1] index;
1245      //   Real[points+1] alt_temp;
1246      //   Real[points+1] mue_temp = zeros(points+1);
1247      //   Real[3,1] n_temp = zeros(3,points+1);
1248      //   Integer[points+1,2] new_altitude;
1249      //   Integer tt = 1;
1250
1251      end get_Contact_Points;
1252    end Interfaces;
1253
1254    package FromInput "Use signal inputs as definition of terrain"
1255      extends Modelica.Icons.Package;
1256
1257      model Environment
1258
1259         extends Interfaces.Environment(UseInputs = true,
1260            redeclare function get_Ground_Height =
1261              BFT.Environments.FromInput.get_Ground_Height (zGround_Input=RoadAltitude,nGround_Input=RoadNormal, mueGround_Input=RoadAdhesion,NumOfInputs=NumOfInputs),
1262            redeclare function get_Contact_Reaction =
1263              BFT.Environments.FromInput.get_Contact_Reaction,
1264            redeclare function get_Contact_Points =
1265              BFT.Environments.FromInput.get_Contact_Points (zGround_Input = RoadAltitude,nGround_Input = RoadNormal, mueGround_Input=RoadAdhesion,NumOfInputs=NumOfInputs));
1266
1267      annotation(defaultAttributes="inner", Icon(graphics={Text(
1268                extent={{-100,-40},{100,-100}},
1269                lineColor={0,0,0},
1270                textString="Input")}),
1271          Diagram(coordinateSystem(preserveAspectRatio=false,extent={{-100,-100},{100,
1272                  100}}), graphics));
1273      end Environment;
1274
1275      model FlatInput "Provides inputs of flat ground for testing etc."
1276
1277        parameter Integer n=4 "number of inputs";
1278
1279        Modelica.Blocks.Interfaces.RealOutput heights[n] = zeros(n) annotation (Placement(
1280              transformation(
1281              extent={{-10,-10},{10,10}},
1282              rotation=90,
1283              origin={-20,50})));
1284        Modelica.Blocks.Interfaces.RealOutput normals[3, n] = {zeros(n), zeros(n), ones(n)} annotation (Placement(
1285              transformation(
1286              extent={{-10,-10},{10,10}},
1287              rotation=90,
1288              origin={20,50}), iconTransformation(
1289              extent={{-10,-10},{10,10}},
1290              rotation=90,
1291              origin={20,50})));
1292        annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-60,-40},
1293                  {60,40}}), graphics), Icon(coordinateSystem(extent={{-60,-40},{60,40}},
1294                preserveAspectRatio=false), graphics={
1295              Line(
1296                points={{-50,0},{50,0}},
1297                color={0,0,255},
1298                smooth=Smooth.None),
1299              Rectangle(extent={{-60,40},{60,-40}}, lineColor={0,0,255}),
1300              Line(
1301                points={{-38,0},{-46,-12}},
1302                color={0,0,255},
1303                smooth=Smooth.None),
1304              Line(
1305                points={{-32,0},{-40,-12}},
1306                color={0,0,255},
1307                smooth=Smooth.None),
1308              Line(
1309                points={{-26,0},{-34,-12}},
1310                color={0,0,255},
1311                smooth=Smooth.None),
1312              Line(
1313                points={{32,0},{24,-12}},
1314                color={0,0,255},
1315                smooth=Smooth.None),
1316              Line(
1317                points={{38,0},{30,-12}},
1318                color={0,0,255},
1319                smooth=Smooth.None),
1320              Line(
1321                points={{44,0},{36,-12}},
1322                color={0,0,255},
1323                smooth=Smooth.None)}));
1324      end FlatInput;
1325
1326      function get_Ground_Height
1327
1328        extends Interfaces.get_Ground_Height;
1329
1330        input Real[NumOfInputs] zGround_Input;
1331        input Real[NumOfInputs] mueGround_Input;
1332        input Real[3,NumOfInputs] nGround_Input;
1333        input Integer NumOfInputs;
1334
1335      algorithm
1336        z := zGround_Input[id];
1337        mue := mueGround_Input[id];
1338        n := nGround_Input[:,id];
1339
1340        annotation(Inline=true);
1341      end get_Ground_Height;
1342
1343      function get_Contact_Reaction
1344        extends Interfaces.get_Contact_Reaction;
1345      algorithm
1346        f := zeros(3);
1347        t := zeros(3);
1348        annotation(Inline=true);
1349      end get_Contact_Reaction;
1350
1351      function get_Contact_Points
1352
1353        extends BFT.Environments.Interfaces.get_Contact_Points;
1354
1355        input Real[NumOfInputs] zGround_Input;
1356        input Real[NumOfInputs] mueGround_Input;
1357        input Real[3,NumOfInputs] nGround_Input;
1358        input Integer NumOfInputs;
1359
1360      algorithm
1361        contactPoint :=zeros(3, points);
1362
1363        z_Road :=zeros(points);
1364        n_Road :=zeros(3, points);
1365        mue_Road :=zeros(points);
1366        contactPoint1 :=zeros(3, points);
1367        A :=zeros(3, points);
1368        n_F_temp :=zeros(3, points);
1369        dr :=zeros(points);
1370
1371        z_Ground := zGround_Input[ID];
1372        mue_Ground := mueGround_Input[ID];
1373        n_Ground := nGround_Input[:,ID];
1374
1375        // wird irgendwie nur durchgereicht?!
1376        n_F := n_Ground;
1377
1378      end get_Contact_Points;
1379    end FromInput;
1380  end Environments;
1381annotation (uses(Modelica(version="3.2.3")));
1382end BFT;
1383
1384model TestEnvironment2
1385  inner BFT.Environments.FromInput.Environment environment(
1386    NumOfInputs=4,
1387    enableAnimation=false,
1388    mue0=0.8)
1389    annotation (Placement(visible = true, transformation(extent={{48,52},{68,72}},            rotation = 0)));
1390  Modelica.Blocks.Sources.Constant mue[4](each k=0.8)
1391    annotation (Placement(transformation(extent={{4,36},{16,48}})));
1392  BFT.Environments.FromInput.FlatInput flatInput(n=4)    annotation (
1393    Placement(visible = true, transformation(origin={-54,19},    extent = {{-12, -7}, {12, 7}}, rotation = 0)));
1394
1395    Real[3] Cr={0.0,0.0,0.0};
1396    Real[3] Ce_z={0.0,0.0,0.0};
1397    Real R0 = 1.0;
1398    Real[3] n = {0.0,1.0,0.0};
1399    Integer ID = 1;
1400    Integer points = 91;
1401    Real step = 2/180*Modelica.Constants.pi;
1402    Real altitudeGround;
1403    Real[3] We_z;
1404    Real mueGround;
1405    Real[3] n_Contact;
1406
1407algorithm
1408  if
1409    (time>=1) then
1410     (altitudeGround,We_z,mueGround,n_Contact) := environment.get_Contact_Points(Cr,Ce_z,R0,n,ID,points,step);
1411  end if;
1412equation
1413
1414  connect(mue.y,environment. RoadAdhesion) annotation (
1415    Line(points={{16.6,42},{30,42},{30,54},{48,54}},                                 color = {0, 0, 127}, thickness = 0.5));
1416  connect(flatInput.heights, environment.RoadAltitude) annotation (Line(points={
1417          {-58,27.75},{-58,72},{48,72},{48,70}}, color={0,0,127}));
1418  connect(environment.RoadNormal, flatInput.normals)
1419    annotation (Line(points={{48,62},{-50,62},{-50,27.75}}, color={0,0,127}));
1420  annotation (
1421    Icon(coordinateSystem(preserveAspectRatio=false)),
1422    Diagram(coordinateSystem(preserveAspectRatio=false)),
1423    uses(Modelica(version="3.2.3")));
1424end TestEnvironment2;