root/branches/maintenance/3.0/ModelicaReference/package.mo

Revision 953, 175.9 kB (checked in by otter, 8 months ago)

ModelicaReference: Microsoft specific html tags removed ( fixes #35 )

Line 
1within ;
2package ModelicaReference "Modelica Reference"
3annotation (DocumentationClass=true, Documentation(info="<html>
4<p>
5This package is a reference to Modelica keywords and Modelica builtin
6operators and is based on the
7<a href=\"http://www.modelica.org/documents/ModelicaSpec30.pdf\">Modelica Language Specification version 3.0</a> from Sept. 2007.
8
9
10<dl>
11<dt><b>Main Author:</b></dt>
12<dd><a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian.Schweiger</a><br>
13    Deutsches Zentrum f&uuml;r Luft und Raumfahrt e.V. (DLR)<br>
14    Institut f&uuml;r Robotik und Mechatronik<br>
15    Postfach 11 16<br>
16    D-82230 Wessling<br>
17    Germany<br>
18    email: <A HREF=\"mailto:Christian.Schweiger@dlr.de\">Christian.Schweiger@dlr.de</A><br></dd>
19</dl>
20
21<p>
22<b>Copyright &copy; 2003-2004, 2008 Modelica Association and DLR.</b>
23</p>
24<p>
25<i>The <b>ModelicaReference</b> package is <b>free</b> software;
26it can be redistributed and/or modified
27under the terms of the <b>Modelica license</b>, see the license conditions
28and the accompanying <b>disclaimer</b> 
29<a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i>
30</p><br>
31</html>", revisions="<html>
32
33<ul>
34<li><i>Jan. 2, 2008</i>
35    by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
36    Adapted to Modelica language version 3.0</li>
37
38<li><i>Sept. 30, 2004</i>
39    by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
40    Moved the content of \"Functions\" into \"Operators\" and updated
41    \"Operators\" according to Modelica 2.1</li>
42
43<li><i>July 10, 2003</i>
44     by <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
45     Implemented.</li>
46</ul>
47</html>"));
48
49
50package Annotations "Annotations"
51  class choices "choices"
52
53    annotation (Documentation(info="<html>
54<p>
55Define graphical layout of choices in a parameter menu
56</p>
57
58<h4><font color=\"#008000\">Examples</font></h4>
59
60<pre><b>replaceable model</b> MyResistor=Resistor
61  <b>annotation</b>(choices(
62              choice(redeclare MyResistor=lib2.Resistor(a={2}) \"...\"),
63              choice(redeclare MyResistor=lib2.Resistor2 \"...\")));
64
65<b>replaceable</b> Resistor Load(R=2) constrainedby TwoPin
66  <b>annotation</b>(choices(
67              choice(redeclare lib2.Resistor Load(a={2}) \"...\"),
68              choice(redeclare Capacitor Load(L=3) \"...\")));
69
70<b>replaceable</b> FrictionFunction a(func=exp) constrainedby Friction
71  <b>annotation</b>(choices(
72             choice(redeclare ConstantFriction a(c=1) \"...\"),
73             choice(redeclare TableFriction a(table=\"...\") \"...\"),
74             choice(redeclare FunctionFriction a(func=exp) \"...\"))));
75
76<b>type</b> KindOfController=Integer(min=1,max=3)
77   <b>annotation</b>(choices(
78                choice=1 \"P\",
79                choice=2 \"PI\",
80                choice=3 \"PID\"));
81
82<b>model</b> A
83  KindOfController x;
84<b>end</b> A;
85A a(x=3 \"PID\");
86</pre>
87
88
89
90<h4><font color=\"#008000\">Description</font></h4>
91
92<p>
93A declaration can have an annotation \"choices\" containing modifiers on choice, where each of them indicates a suitable redeclaration or modifications of the element.
94This is a hint for users of the model, and can also be used by the user interface to suggest reasonable redeclaration, where the string comments on the choice declaration can be used as textual explanations of the choices.  The annotation is not restricted to replaceable elements but can also be applied to non-replaceable elements, enumeration types, and simple variables.
95</p>
96
97</html>"));
98  end choices;
99
100  class defaultComponentName "defaultComponentName"
101
102    annotation (Documentation(info="<html>
103<p>
104Default name when dragging component
105</p>
106
107<h4><font color=\"#008000\">Syntax</font></h4>
108
109<pre>   <b>annotation</b>\"(\" defaultComponentName \"=\" STRING \")\"
110</pre>
111
112
113<h4><font color=\"#008000\">Description</font></h4>
114
115<p>
116When creating a component of the given class, the recommended component name is the
117giving string.
118</p>
119
120</html>"));
121  end defaultComponentName;
122
123  class defaultComponentPrefixes "defaultComponentPrefixes"
124
125    annotation (Documentation(info="<html>
126<p>
127Default prefixes when dragging component
128</p>
129
130<h4><font color=\"#008000\">Examples</font></h4>
131
132<pre><b>annotation</b>(defaultComponentPrefixes=\"inner\",
133           defaultComponentName=\"world\")
134</pre>
135
136<h4><font color=\"#008000\">Syntax</font></h4>
137
138<pre>   <b>annotation</b>\"(\" defaultComponentPrefixes \"=\" STRING \")\"
139</pre>
140
141
142<h4><font color=\"#008000\">Description</font></h4>
143
144<p>
145The following prefixes may be included in the string prefixes: inner, outer, replaceable, constant, parameter, discrete. In combination with defaultComponentName it can be used to make it easy for users to create inner components matching the outer declarations.
146</p>
147
148</html>"));
149  end defaultComponentPrefixes;
150
151  class derivative "derivative"
152
153    annotation (Documentation(info="<html>
154<p>
155Define derivative of function
156</p>
157
158<h4><font color=\"#008000\">Examples</font></h4>
159
160<pre><b>function</b> foo0 <b>annotation</b>(derivative=foo1); <b>end</b> foo0;
161<b>function</b> foo1 <b>annotation</b>(derivative(order=2)=foo2); <b>end</b> foo1;
162<b>function</b> foo2 <b>end</b> foo2;
163</pre>
164
165
166
167<h4><font color=\"#008000\">Description</font></h4>
168
169<p>
170Derivatives of functions can be declared explicitly using the derivative annotation, whereas a function can be defined as a partial derivative of another function using the der-operator in a short function definition.
171</p>
172
173<p>
174A function declaration can have an annotation derivative specifying the derivative function. This can influence simulation time and accuracy and can be applied to both functions written in Modelica and to external functions. A derivative annotation can state that it is only valid under certain restrictions on the input arguments. These restrictions are defined using the following optional attributes: order (only a restriction if order &gt; 1, the default for order is 1), noDerivative, and zeroDerivative. The given derivative-function can only be used to compute the derivative of a function call if these restrictions are satisfied. There may be multiple restrictions on the derivative, in which case they must all be satisfied. The restrictions also imply that some derivatives of some inputs are excluded from the call of the derivative (since they are not necessary). A function may supply multiple derivative functions subject to different restrictions.
175</p>
176
177<p>
178The inputs to the derivative function of order 1 are constructed as follows:
179</p>
180
181<ul>
182<li> First are all inputs to the original function, and after all them we will
183     in order append one derivative for each input containing reals.<br>&nbsp;</li>
184<li> The outputs are constructed by starting with an empty list and then in
185     order appending one derivative for each output containing reals.<br>&nbsp;</li>
186<li> If the Modelica function call is a nth derivative (n>=1), i.e. this
187     function call has been derived from an (n-1)th derivative, an
188     annotation(order=n+1)=?,  specifies the (n+1)th derivative, and the
189     (n+1)th derivative call is constructed as follows:<br>&nbsp;</li>
190<li> The input arguments are appended with the (n+1)th derivative,
191     which are constructed in order from the nth order derivatives.<br>&nbsp;</li>
192<li> The output arguments are similar to the output argument for the
193     nth derivative, but each output is one higher in derivative order.</li>
194</ul>
195
196<p>
197Example: Given the declarations
198</p>
199
200<pre> function foo0
201   ...
202   input Real x;
203   input Boolean linear;
204   input ...;
205   output Real y;
206   ...
207   annotation(derivative=foo1);
208 end foo0;
209
210 function foo1
211   ...
212   input Real x;
213   input Boolean linear;
214   input ...;
215   input Real der_x;
216   ...
217   output Real der_y;
218   ...
219   annotation(derivative(order=2)=foo2);
220 end foo1;
221   
222 function foo2
223   ...
224   input Real x;
225   input Boolean linear;
226   input ...;
227   input Real der_x;
228   ...;
229   input Real der_2_x;
230   ...
231   output Real der_2_y;
232   ...
233</pre>
234
235<p>
236the equation
237</p>
238
239<pre>(...,y(t),...)=foo0(...,x(t),b,...);
240</pre>
241
242<p>
243implies that:
244<p>
245
246<pre>(...,d y(t)/dt,...)=foo1(...,x(t),b,..., ...,d x(t)/dt,...);
247(...,d^2 y(t)/dt^2,...)=foo2(...,x(t),b,...,d x(t)/dt,..., ...,d^2 x(t)/dt^2,...);
248</pre>
249
250<p>
251An input or output to the function may be any simple type (Real, Boolean, Integer, String and enumeration types) or a record, provided the record does not contain both reals and non-reals predefined types. The function must have at least one input containing reals. The output list of the derivative function may not be empty.
252</p>
253
254<ul>
255<li> zeroDerivative=input_var1<br>
256    The derivative function is only valid if input_var1 is independent
257    of the variables the function call is  differentiated with respect to
258    (i.e. that the derivative of input_var1 is \"zero\").
259    The derivative of input_var1 is excluded from the argument list of the derivative-function.
260    Assume that function f takes a matrix and a scalar. Since the matrix argument is
261    usually a parameter expression it is then useful to define the function
262    as follows (the additional derivative = f_general_der is optional and
263    can be used when the derivative of the matrix is non-zero).
264<pre>function f \"Simple table lookup\"
265  input Real x;
266  input Real y[:, 2];
267  output Real z;
268  annotation(derivative(zeroDerivative=y) = f_der,
269             derivative=f_general_der);
270algorithm
271  ...
272end f;
273
274function f_der \"Derivative of simple table lookup\"
275  input Real x;
276  input Real y[:, 2];
277  input Real x_der;
278  output Real z_der;
279algorithm
280  ...
281end f_der;
282
283function f_general_der \"Derivative of table lookup taking into account varying tables\"
284  input Real x;
285  input Real y[:, 2];
286  input Real x_der;
287  input Real y_der[:, 2];
288  output Real z_der;
289algorithm
290  ...
291end f_general_der;
292
293</pre></li>
294
295<li> noDerivative(input_var2 = f(input_var1, ...) )<br>
296    The derivative function is only valid if the input argument input_var2
297    is computed as f(input_var1, ...). The derivative of input_var2
298    is excluded from the argument list of the derivative-function.
299    Assume that function fg is defined as a composition f(x, g(x)).
300    When differentiating f it is useful to give the derivative under the
301    assumption that the second argument is defined in this way:
302<pre>function fg
303  input Real x;
304  output Real z;
305algorithm
306   z := f(x, g(x));
307end fg;
308
309function f
310  input Real x;
311  input Real y;
312  output Real z;
313  annotation(derivative(noDerivative(y = g(x))) = f_der);
314algorithm
315  ...
316end f;
317
318function f_der
319  input Real x;
320  input Real x_der;
321  input Real y;
322  output Real z_der;
323algorithm
324  ...
325end f_der;
326</pre>
327This is useful if g represents the major computational effort of fg).</li>
328</ul>
329
330</html>"));
331  end derivative;
332
333  class Dialog "Dialog"
334
335    annotation (Documentation(info="<html>
336<p>
337Define graphical layout of parameter menu
338</p>
339
340<h4><font color=\"#008000\">Examples</font></h4>
341
342<pre><b>model</b> BodyShape
343  ...
344  <b>parameter</b> Boolean animation = true;
345  <b>parameter</b> Modelica.SIunits.Length length \"Length of shape\"
346     <b>annotation</b>(Dialog(enable = animation, tab = \"Animation\",
347                        group = \"Shape definition\"));
348  ...
349<b>end</b> BodyShape;
350</pre>
351
352<h4><font color=\"#008000\">Syntax</font></h4>
353
354<pre>   <b>annotation</b>(Dialog(enable = parameter-expression, tab = \"tab\", group = \"group\"))
355</pre>
356
357
358<h4><font color=\"#008000\">Description</font></h4>
359
360<p>
361Defines the placement of the component or class parameter in a parameter dialog with optional tab and group specification. If enable is false, the input field may be disabled [and no input can be given]. \"Dialog\" is defined as:
362</p>
363
364<pre>   <b>record</b> Dialog
365     <b>parameter</b> String  tab    = \"General\";
366     <b>parameter</b> String  group  = \"Parameters\";
367     <b>parameter</b> Boolean enable = <b>true</b>;
368   <b>end Dialog;
369</pre>
370
371<p>
372A parameter dialog is a sequence of tabs with a sequence of groups inside them.
373</p>
374
375</html>"));
376  end Dialog;
377
378  class Documentation "Documentation"
379
380    annotation (Documentation(info="<html>
381<p>
382Annotations for documentation
383</p>
384
385<h4><font color=\"#008000\">Syntax</font></h4>
386
387<pre>documentation_annotation:
388   <b>annotation</b>\"(\" Documentation \"(\" \"info\" \"=\" STRING
389                            [\",\" \"revisions\" \"=\" STRING ] \")\" \")\"
390</pre>
391
392<h4><font color=\"#008000\">Description</font></h4>
393<P>
394The \"Documentation\" annotation can contain the \"info\" annotation giving a textual description, the \"revisions\" annotation giving a list of revisions and other annotations defined by a tool [The \"revisions\" documentation may be omitted in printed documentation]. How the tool interprets the information in \"Documentation\" is unspecified. Within a string of the \"Documentation\" annotation, the tags &lt;HTML&gt; and &lt;/HTML&gt; or &lt;html&gt; and &lt;/html&gt; define optionally begin and end of content that is HTML encoded. Links to Modelica classes may be defined with the HTML link command using scheme \"Modelica\", e.g.,
395</p>
396
397<pre>    &lt;a href=\"Modelica://MultiBody.Tutorial\"&gt;MultiBody.Tutorial&lt;/a&gt;
398</pre>
399
400<p>
401Together with scheme \"Modelica\" the (URI)  fragment specifiers #diagram, #info, #text, #icon may be used to reference different layers. Example:
402</p>
403
404<pre>   &lt;a href=\"Modelica://MultiBody.Joints.Revolute#info\"&gt;Revolute&lt;/a&gt;
405</pre>
406
407</html>"));
408  end Documentation;
409
410  annotation (Documentation(info="<html>
411<p>
412In this package annotations are described.
413Annotations are intended for storing extra information about a model, such as graphics, documentation or versioning, etc. A Modelica tool is free to define and use other annotations, in addition to those defined here. The only requirement is that any tool shall save files with all annotations from this chapter and all vendor-specific annotations intact. To ensure this, annotations must be represented with constructs according to the Modelica grammar. The Modelica language specification defines the semantic meaning if a tool implements any of these annotations.
414</p>
415
416</html>"));
417  class DynamicSelect "DynamicSelect"
418
419    annotation (Documentation(info="<html>
420<p>
421Define schematic animation of diagram layer
422</p>
423
424<h4><font color=\"#008000\">Examples</font></h4>
425
426<blockquote>
427<p>
428The level of a tank is animated by a rectangle expanding in vertical direction and its color depending on a variable overflow:
429</p>
430
431<pre><b>annotation</b>(
432  Icon(graphics={Rectangle(
433    extent=<b>DynamicSelect</b>({{0,0},{20,20}},{{0,0},{20,level}}),
434    fillColor=<b>DynamicSelect</b>({0,0,255},
435                            <b>if</b> overflow <b>then</b> {255,0,0} <b>else</b> {0,0,255}))}
436);
437</pre></blockquote>
438
439
440<h4><font color=\"#008000\">Description</font></h4>
441
442<p>
443Any value (coordinates, color, text, etc) in graphical annotations can be dependent on class variables using the DynamicSelect expression. DynamicSelect has the syntax of a function call with two arguments, where the first argument specifies the value of the editing state and the second argument the value of the non-editing state. The first argument must be a literal expression
444and this value is used for the annotation when editing and/or browsing the diagram layer.
445The second argument may contain references to variables to enable a dynamic behavior
446and the actual value is used for the annotation for schematic animation
447of the diagram layer, e.g., after a simulation.
448</p>
449
450</html>"));
451  end DynamicSelect;
452
453  class Evaluate "Evaluate"
454
455    annotation (Documentation(info="<html>
456<p>
457Annotation for code generation (evaluate parameter value)
458</p>
459
460<h4><font color=\"#008000\">Syntax</font></h4>
461
462<pre>   <b>annotation</b>\"(\" Evaluate \"=\" ( <b>false</b> | <b>true</b> ) \") 
463</pre>
464
465
466<h4><font color=\"#008000\">Description</font></h4>
467
468<p>
469Has only an effect for a declaration with the prefix parameter.
470</p>
471
472<p>
473If Evaluate = true, the model developer proposes to utilize the value for the symbolic processing. In that case, it is not possible to change the parameter value after symbolic pre-processing.
474</p>
475
476<p>
477If Evaluate = false, the model developer proposes to not utilize the value of the corresponding parameter for the symbolic processing.
478</p<
479
480<p>
481Evaluate is for example used for axis of rotation parameters in the Modelica.Mechanics.MultiBody library in order to improve the efficiency of the generated code
482</p>
483
484</html>"));
485  end Evaluate;
486
487  class experiment "experiment"
488
489    annotation (Documentation(info="<html>
490<p>
491Define default experiment parameters
492</p>
493
494<h4><font color=\"#008000\">Examples</font></h4>
495
496<pre><b>annotation</b>(experiment(StartTime=0, StopTime=5, Tolerance=1e-6))
497</pre>
498
499
500<h4><font color=\"#008000\">Syntax</font></h4>
501
502<pre>experiment_annotation:
503   <b>annotation</b>\"(\" \"experiment\" \"(\" [experimentOption] {, experimentOption}] \")\"
504
505experimentOption:
506   StartTime  \"=\" [\"+\" | \"-\"] UNSIGNED_NUMBER |
507   StopTime   \"=\" [\"+\" | \"-\"] UNSIGNED_NUMBER |
508   Tolerance  \"=\" UNSIGNED_NUMBER
509</pre>
510
511
512<h4><font color=\"#008000\">Description</font></h4>
513
514<p>
515The experiment annotation defines the default start time (StartTime) in [s], the default stop time (StopTime) in [s], and the default relative integration tolerance (Tolerance) for simulation experiments to be carried out with the model or block at hand.
516</p>
517
518</html>"));
519  end experiment;
520
521  class HideResult "HideResult"
522
523    annotation (Documentation(info="<html>
524<p>
525Annotation for code generation (hide result)
526</p>
527
528<h4><font color=\"#008000\">Syntax</font></h4>
529
530<pre>   <b>annotation</b>\"(\" HideResult \"=\" ( <b>false</b> | <b>true</b> ) \") 
531</pre>
532
533
534<h4><font color=\"#008000\">Description</font></h4>
535
536<p>
537HideResult = true defines that the model developer proposes to not show the simulator results of the corresponding component [e.g., it will not be possible to plot this variable].
538</p>
539
540<p>
541HideResult = false defines that the developer proposes to show the corresponding component [if a variable is declared in a protected section, a tool might not include it in a simulation result. By setting HideResult = false, the modeler would like to have the variable in the simulation result, even if in the protected section].
542</p>
543
544<p>
545HideResult is for example used in the connectors of the Modelica.StateGraph library to not show variables to the modeler that are of no interest to him and would confuse him.
546</p>
547
548</html>"));
549  end HideResult;
550
551  class Inline "Inline"
552
553    annotation (Documentation(info="<html>
554<p>
555Annotation for code generation (inline function body)
556</p>
557
558<h4><font color=\"#008000\">Syntax</font></h4>
559
560<pre>   <b>annotation</b>\"(\" Inline \"=\" ( <b>false</b> | <b>true</b> ) \") 
561</pre>
562
563
564<h4><font color=\"#008000\">Description</font></h4>
565
566<p>
567Has only an effect within a function declaration.
568</p>
569
570<p>
571If \"Inline = true\", the model developer proposes to inline the function.
572This means, that the body of the function is included at all places where the function is called.
573</p>
574
575<p>
576If \"Inline = false\", the model developer proposes to not inline the function.
577</p>
578
579<p>
580Inline = true is for example used in Modelica.Mechanics.MultiBody.Frames and in functions of Modelica.Media to have no overhead for function calls such as resolving a vector in a different coordinate system and at the same time the function can be analytically differentiated, e.g., for index reduction needed for mechanical systems.
581</p>
582
583</html>"));
584  end Inline;
585
586  class LateInline "LateInline"
587
588    annotation (Documentation(info="<html>
589<p>
590Annotation for code generation (inline function body after symbolic processing)
591</p>
592
593<h4><font color=\"#008000\">Syntax</font></h4>
594
595<pre>   <b>annotation</b>\"(\" LateInline \"=\" ( <b>false</b> | <b>true</b> ) \") 
596</pre>
597
598
599<h4><font color=\"#008000\">Description</font></h4>
600
601<p>
602Has only an effect within a function declaration.
603</p>
604
605<p> 
606If \"LateInline = true\", the model developer proposes to inline the function after all symbolic transformations have been performed, but before common subexpression elimination takes place.
607</p>
608
609<p>
610If \"LateInline = false\", the model developer proposes to not inline the function after symbolic transformations have been performed.
611</p>
612
613<p>
614This annotation is for example used in Modelica.Media.Water.IF97_Utilities.T_props_ph to provide in combination with common subexpression elimination the automatic caching of function calls. Furthermore, it is used in order that a tool is able to propagate specific enthalpy over connectors in the Modelica_Fluid library.
615</p>
616
617</html>"));
618  end LateInline;
619
620  class missingInnerMessage "missingInnerMessage"
621
622    annotation (Documentation(info="<html>
623<p>
624Warning message, if inner declaration is missing
625</p>
626
627<h4><font color=\"#008000\">Examples</font></h4>
628
629<pre><b>model</b> World
630  <b>annotation</b>(defaultComponentName     = \"world\",
631             defaultComponentPrefixes = \"inner replaceable\",
632             missingInnerMessage      = \"The World object is missing\");
633  ...
634<b>end</b> World;
635</pre>
636
637<h4><font color=\"#008000\">Syntax</font></h4>
638
639<pre>   <b>annotation</b>\"(\" missingInnerMessage \"=\" STRING \")\"
640</pre>
641
642
643<h4><font color=\"#008000\">Description</font></h4>
644
645<p>
646When an outer component of the class does not have a corresponding inner component, the string message may be used as a diagnostic message.
647</p>
648
649</html>"));
650  end missingInnerMessage;
651
652  class PreferredView "preferredView"
653
654    annotation (Documentation(info="<html>
655<p>
656Define default view when selecting class
657</p>
658
659<h4><font color=\"#008000\">Syntax</font></h4>
660
661<pre>preferred view_annotation:
662   <b>annotation</b>\"(\" preferredView \"=\" (\"info\" | \"diagram\" | \"text\") \")\" 
663</pre>
664
665
666<h4><font color=\"#008000\">Description</font></h4>
667
668<p>
669The preferredView annotation defines the default view when selecting the class. info means info layer, i.e., the documentation of the class, diagram means diagram layer and text means the Modelica text layer.
670</p>
671
672</html>"));
673  end PreferredView;
674
675  class smoothOrder "smoothOrder"
676
677    annotation (Documentation(info="<html>
678<p>
679Define differentiability of function body
680</p>
681
682<h4><font color=\"#008000\">Syntax</font></h4>
683
684<pre>   <b>annotation</b>\"(\" smoothOrder \"=\" UNSIGNED_INTEGER \")\"
685</pre>
686
687
688<h4><font color=\"#008000\">Description</font></h4>
689
690<p>
691This annotation has only an effect within a function declaration.
692</p>
693
694<p>
695smoothOrder defines the minimum number of differentations of the function, in order that all of the differentiated outputs are continuous provided all input arguments and their derivatives up to order smoothOrder are continuous.
696</p>
697
698<p>
699This means that the function is at least C<sup>smoothOrder</sup>. smoothOrder = 1 means that the function can be differentiated at least once in order that all output arguments are still continuous, provided the input arguments are continuous. If a tool needs the derivative of a function, e.g. for index reduction or to compute an analytic Jacobian, the function can be differentiated analytically at least smoothOrder times.
700</p>
701
702</html>"));
703  end smoothOrder;
704
705  class version "version"
706
707    annotation (Documentation(info="<html>
708<p>
709Define version information of package
710</p>
711
712<h4><font color=\"#008000\">Examples</font></h4>
713
714<pre><b>package</b> Modelica
715  <b>annotation</b>(version=\"2.1\",
716             conversion(noneFromVersion=\"2.1 Beta 1\",
717                        from(version=\"1.5\",
718                             script=\"convertFromModelica1_5.mos\")));
719  ...
720<b>end</b> Modelica;
721
722<b>model</b> A
723  <b>annotation</b>(version=\"1.0\",
724     uses(Modelica(version=\"1.5\")));
725  ...
726<b>end</b> A;
727
728<b>model</b> B
729  <b>annotation</b>(uses(Modelica(version=\"2.1 Beta 1\")));
730  ...
731<b>end</b> B;
732</pre>
733
734<p>
735In this example the model A uses an older version of the Modelica library and can be upgraded using the given script, and model B uses an older version of the Modelica library but no changes are required when upgrading.
736</p>
737
738
739
740<h4><font color=\"#008000\">Description</font></h4>
741
742<p>
743Version numbers are of the forms:
744</p>
745
746<ul>
747<li> Main release versions:
748     <pre>\"\"\" UNSIGNED_INTEGER { \".\" UNSIGNED_INTEGER } \"\"\"</pre>
749     Example: <code>\"2.1\"</code><br>&nbsp;</li>
750
751<li> Pre-release versions:
752     <pre>\"\"\" UNSIGNED_INTEGER { \".\" UNSIGNED_INTEGER } \" \" {S-CHAR} \"\"\"</pre>
753     Example: <code>\"2.1 Beta 1\"</code><br>&nbsp;</li>
754
755<li> Un-ordered versions:
756     <pre> \"\"\" NON-DIGIT {S-CHAR} \"\"\" </pre>
757     Example: <code>\"Test 1\"</code></li>
758</ul>
759
760<p>
761The main release versions are ordered using the hierarchical numerical names, and follow the corresponding pre-release versions. The pre-release versions of the same main release version are internally ordered alphabetically.
762</p>
763
764<p>
765In a top-level class, the version number and the dependency to earlier versions of this class are defined using one or more of the following annotations:
766</p>
767
768<ul>
769<li> <code>version = CURRENT-VERSION-NUMBER</code><br>
770     Defines the version number of the model or package.
771     All classes within this top-level class have this version number.<br>&nbsp;</li>
772
773<li> <code>conversion ( noneFromVersion = VERSION-NUMBER)</code><br>
774     Defines that user models using the VERSION-NUMBER can be upgraded to
775     the CURRENT-VERSION-NUMBER of the current class without any changes.<br>&nbsp;</li>
776
777<li> <code>conversion ( from (version = VERSION-NUMBER, script = \"?\") )       </code><br>
778     Defines that user models using the VERSION-NUMBER can be upgraded to
779     the CURRENT-VERSION-NUMBER of the current class by applying the given
780     script. The semantics of the conversion script is not defined.<br>&nbsp;</li>
781
782<li> <code>uses(IDENT (version = VERSION-NUMBER) )</code><br>
783     Defines that classes within this top-level class uses version
784     VERSION-NUMBER of classes within the top-level class IDENT.
785     The annotations uses and conversion may contain several different sub-entries.<li>
786</ul>
787
788<p>
789A top-level class, IDENT, with version VERSION-NUMBER can be stored in one
790of the following ways in a directory given in the MODELICAPATH:
791</p>
792
793<ul>
794<li> The file IDENT \".mo\"<br>
795     Example: Modelica.mo</li>
796<li> The file IDENT \" \" VERSION-NUMBER \".mo\"<br>
797     Example: Modelica 2.1.mo</li>
798<li> The directory IDENT<br>
799     Example: Modelica</li>
800<li> The directory IDENT \" \" VERSION-NUMBER<br>
801     Example: Modelica 2.1</li>
802</ul>
803
804<p>
805This allows a tool to access multiple versions of the same package.
806</p>
807
808</html>"));
809  end version;
810
811  class unassignedMessage "unassignedMessage"
812
813    annotation (Documentation(info="<html>
814<p>
815Error message, if variable is not assigned
816</p>
817
818<h4><font color=\"#008000\">Examples</font></h4>
819
820<pre><b>connector</b> Frame \"Frame of a mechanical system\"
821    ...
822  <b>flow</b> Modelica.SIunits.Force f[3] <b>annotation</b>(unassignedMessage =
823\"All Forces cannot be uniquely calculated. The reason could be that the
824mechanism contains a planar loop or that joints constrain the same motion.
825For planar loops, use in one revolute joint per loop the option
826PlanarCutJoint=true in the Advanced menu.
827\");
828<b>end</b> Frame;
829</pre>
830
831
832<h4><font color=\"#008000\">Syntax</font></h4>
833
834<pre>   <b>annotation</b>\"(\" unassignedMessage \"=\" STRING \")\"
835</pre>
836
837
838<h4><font color=\"#008000\">Description</font></h4>
839
840<p>
841When the variable to which this annotation is attached in the declaration cannot be computed due to the structure of the equations, the string message can be used as a diagnostic message. When using BLT partitioning, this means if a variable \"a\" or one of its aliases \"b = a\", \"b = -a\", cannot be assigned, the message is displayed. This annotation is used to provide library specific error messages.
842</p>
843
844</html>"));
845  end unassignedMessage;
846end Annotations;
847
848
849package Classes "Classes (model, function, ...)"
850  class Block "block"
851
852    annotation (Documentation(info="<html>
853<p>
854Define specialized class <i>block</i>
855</p>
856<h4><font color=\"#008000\">Examples</font></h4>
857
858<pre><b>block</b> Integrator
859  <b>input</b> Real u;
860  <b>output</b> Real y;
861<b>protected</b>
862  Real x;
863<b>equation
864  der</b>(x) = u;
865  y = x;
866<b>end</b> Integrator;</pre>
867
868<h4><font color=\"#008000\">Syntax</font></h4>
869
870<PRE>   [ <B>encapsulated</B> ][ <B>partial </B>] <B>block</B>
871   IDENT class_specifier
872
873class_specifier :
874   string_comment composition <B>end</B> IDENT
875   | \"=\" base_prefix name [ array_subscripts ] [ class_modification ] comment
876   | \"=\" <B>enumeration</B> \"(\" ( [enum_list] | \":\" ) \")\" comment</PRE>
877
878<p>See Modelica Language Specification for further details.</p>
879
880<h4><font color=\"#008000\">Description</font></h4>
881<P>
882A block class is the same as a model class
883with the restriction that each connector component of a block must
884have prefixes input and/or output for all connector variables.
885The purpose is to model input/output blocks of block diagrams.
886Due to the restrictions on input and output prefixes,
887connections between blocks are only possible according
888to block diagram semantic.
889</P>
890</html>"));
891  end Block;
892
893  class Class "class"
894
895    annotation (Documentation(info="<html>
896<p>
897Define class
898</p>
899<h4><font color=\"#008000\">Examples</font></h4>
900
901<pre><b>class</b> MyTable
902  <b>extends</b> ExternalObject;
903  <b>function</b> constructor
904     ...
905  <b>end</b> constructor;
906
907  <b>function</b> destructor
908     ...
909  <b>end</b> destructor;
910<b>end</b> MyTable;</pre>
911
912<h4><font color=\"#008000\">Syntax</font></h4>
913<PRE>   [ <B>encapsulated</B> ][ <B>partial </B>] <B>class</B>
914   IDENT class_specifier
915
916class_specifier :
917   string_comment composition <B>end</B> IDENT
918   | \"=\" base_prefix name [ array_subscripts ] [ class_modification ] comment
919   | \"=\" <B>enumeration</B> \"(\" ( [enum_list] | \":\" ) \")\" comment</PRE>
920
921<p>See Modelica Language Specification for further details.</p>
922
923<h4><font color=\"#008000\">Description</font></h4>
924
925<p>
926The keyword class is used to define general classes (without any restrictions).
927It is identical to the keyword model.
928In most cases, it is recommended to use specialized classes as <b>block</b>,
929<b>connector</b>, <b>model</b>, <b>package</b>, <b>record</b>, <b>function</b>or <b>type</b>.
930\"class\" should only be used to define ExternalObjects.
931</p>
932</html>"));
933  end Class;
934
935  class Connector "connector"
936
937    annotation (Documentation(info="<html>
938<p>
939Define specialized class <i>connector</i>
940</p>
941<h4><font color=\"#008000\">Examples</font></h4>
942
943<pre><b>connector</b> flange
944  Modelica.SIunits.Angle phi;
945  <b>flow</b> Modelica.SIunits.Torque tau;
946<b>end</b> flange;</pre>
947
948<h4><font color=\"#008000\">Syntax</font></h4>
949<PRE>   [ <B>encapsulated</B> ][ <B>partial </B>] <B>connector</B>
950   IDENT class_specifier
951
952class_specifier :
953   string_comment composition <B>end</B> IDENT
954   | \"=\" base_prefix name [ array_subscripts ] [ class_modification ] comment
955   | \"=\" <B>enumeration</B> \"(\" ( [enum_list] | \":\" ) \")\" comment</PRE>
956
957<p>See Modelica Language Specification for further details.</p>
958
959<h4><font color=\"#008000\">Description</font></h4>
960<P>The keyword connector is used to define connectors, which are used
961in connect statements. In connectors, no equations are allowed in the
962definition or in any of its components.
963With respect to \"class\", it is enhanced to allow connect(..) to components
964of connector classes.
965</P>
966</html>"));
967  end Connector;
968
969  class Function "function"
970
971    annotation (Documentation(info="<html>
972<p>
973Define specialized class <i>function</i>
974</p>
975<h4><font color=\"#008000\">Examples</font></h4>
976
977<pre><b>function</b> si
978  <b>input</b> Real x;
979  <b>output</b> Real y;
980<b>algorithm</b>
981  y = <b>if abs</b>(x) &lt; Modelica.Constants.eps <b>then</b> 1 <b>else</b> Modelica.Math.sin(x)/x;
982<b>end</b> si;</pre>