Changeset 1099
- Timestamp:
- 03/04/08 08:33:20 (6 months ago)
- Files:
-
- 1 modified
-
trunk/ModelicaReference/package.mo (modified) (108 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ModelicaReference/package.mo
- Property svn:keywords set to Author Date Id Revision
r953 r1099 1 1 within ; 2 2 package ModelicaReference "Modelica Reference" 3 annotation (DocumentationClass=true, Documentation(info="<html> 4 <p> 5 This package is a reference to Modelica keywords and Modelica builtin 6 operators and is based on the 3 annotation (DocumentationClass=true, 4 versionBuild="$Rev$", 5 versionDate="$Date:: $", 6 Documentation(info="<html> 7 <p> 8 This package is a reference to Modelica keywords and Modelica builtin 9 operators and is based on the 7 10 <a href=\"http://www.modelica.org/documents/ModelicaSpec30.pdf\">Modelica Language Specification version 3.0</a> from Sept. 2007. 8 11 … … 23 26 </p> 24 27 <p> 25 <i>The <b>ModelicaReference</b> package is <b>free</b> software; 28 <i>The <b>ModelicaReference</b> package is <b>free</b> software; 26 29 it can be redistributed and/or modified 27 30 under the terms of the <b>Modelica license</b>, see the license conditions 28 and the accompanying <b>disclaimer</b> 31 and the accompanying <b>disclaimer</b> 29 32 <a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i> 30 33 </p><br> … … 58 61 <h4><font color=\"#008000\">Examples</font></h4> 59 62 60 <pre><b>replaceable model</b> MyResistor=Resistor 63 <pre><b>replaceable model</b> MyResistor=Resistor 61 64 <b>annotation</b>(choices( 62 65 choice(redeclare MyResistor=lib2.Resistor(a={2}) \"...\"), 63 66 choice(redeclare MyResistor=lib2.Resistor2 \"...\"))); 64 67 65 <b>replaceable</b> Resistor Load(R=2) constrainedby TwoPin 68 <b>replaceable</b> Resistor Load(R=2) constrainedby TwoPin 66 69 <b>annotation</b>(choices( 67 70 choice(redeclare lib2.Resistor Load(a={2}) \"...\"), … … 91 94 92 95 <p> 93 A declaration can have an annotation \"choices\" containing modifiers on choice, where each of them indicates a suitable redeclaration or modifications of the element. 96 A declaration can have an annotation \"choices\" containing modifiers on choice, where each of them indicates a suitable redeclaration or modifications of the element. 94 97 This 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 98 </p> … … 198 201 </p> 199 202 200 <pre> function foo0 203 <pre> function foo0 201 204 ... 202 205 input Real x; … … 208 211 end foo0; 209 212 210 function foo1 213 function foo1 211 214 ... 212 215 input Real x; … … 219 222 annotation(derivative(order=2)=foo2); 220 223 end foo1; 221 222 function foo2 224 225 function foo2 223 226 ... 224 227 input Real x; … … 256 259 The derivative function is only valid if input_var1 is independent 257 260 of the variables the function call is differentiated with respect to 258 (i.e. that the derivative of input_var1 is \"zero\"). 261 (i.e. that the derivative of input_var1 is \"zero\"). 259 262 The derivative of input_var1 is excluded from the argument list of the derivative-function. 260 263 Assume that function f takes a matrix and a scalar. Since the matrix argument is … … 266 269 input Real y[:, 2]; 267 270 output Real z; 268 annotation(derivative(zeroDerivative=y) = f_der, 271 annotation(derivative(zeroDerivative=y) = f_der, 269 272 derivative=f_general_der); 270 273 algorithm … … 289 292 algorithm 290 293 ... 291 end f_general_der; 294 end f_general_der; 292 295 293 296 </pre></li> … … 297 300 is computed as f(input_var1, ...). The derivative of input_var2 298 301 is excluded from the argument list of the derivative-function. 299 Assume that function fg is defined as a composition f(x, g(x)). 302 Assume that function fg is defined as a composition f(x, g(x)). 300 303 When differentiating f it is useful to give the derivative under the 301 304 assumption that the second argument is defined in this way: … … 303 306 input Real x; 304 307 output Real z; 305 algorithm 308 algorithm 306 309 z := f(x, g(x)); 307 310 end fg; … … 313 316 annotation(derivative(noDerivative(y = g(x))) = f_der); 314 317 algorithm 315 ... 318 ... 316 319 end f; 317 320 … … 322 325 output Real z_der; 323 326 algorithm 324 ... 327 ... 325 328 end f_der; 326 329 </pre> … … 344 347 <b>parameter</b> Boolean animation = true; 345 348 <b>parameter</b> Modelica.SIunits.Length length \"Length of shape\" 346 <b>annotation</b>(Dialog(enable = animation, tab = \"Animation\", 349 <b>annotation</b>(Dialog(enable = animation, tab = \"Animation\", 347 350 group = \"Shape definition\")); 348 351 ... … … 386 389 387 390 <pre>documentation_annotation: 388 <b>annotation</b>\"(\" Documentation \"(\" \"info\" \"=\" STRING 391 <b>annotation</b>\"(\" Documentation \"(\" \"info\" \"=\" STRING 389 392 [\",\" \"revisions\" \"=\" STRING ] \")\" \")\" 390 393 </pre> … … 419 422 annotation (Documentation(info="<html> 420 423 <p> 421 Define schematic animation of diagram layer 424 Define schematic animation of diagram layer 422 425 </p> 423 426 … … 431 434 <pre><b>annotation</b>( 432 435 Icon(graphics={Rectangle( 433 extent=<b>DynamicSelect</b>({{0,0},{20,20}},{{0,0},{20,level}}), 434 fillColor=<b>DynamicSelect</b>({0,0,255}, 436 extent=<b>DynamicSelect</b>({{0,0},{20,20}},{{0,0},{20,level}}), 437 fillColor=<b>DynamicSelect</b>({0,0,255}, 435 438 <b>if</b> overflow <b>then</b> {255,0,0} <b>else</b> {0,0,255}))} 436 439 ); … … 460 463 <h4><font color=\"#008000\">Syntax</font></h4> 461 464 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> 469 Has only an effect for a declaration with the prefix parameter. 470 </p> 471 472 <p> 473 If 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. 465 <pre> <b>annotation</b>\"(\" Evaluate \"=\" ( <b>false</b> | <b>true</b> ) \") 466 </pre> 467 468 469 <h4><font color=\"#008000\">Description</font></h4> 470 471 <p> 472 Has only an effect for a declaration with the prefix parameter. 473 </p> 474 475 <p> 476 If 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 477 </p> 475 478 … … 489 492 annotation (Documentation(info="<html> 490 493 <p> 491 Define default experiment parameters 494 Define default experiment parameters 492 495 </p> 493 496 … … 504 507 505 508 experimentOption: 506 StartTime \"=\" [\"+\" | \"-\"] UNSIGNED_NUMBER | 509 StartTime \"=\" [\"+\" | \"-\"] UNSIGNED_NUMBER | 507 510 StopTime \"=\" [\"+\" | \"-\"] UNSIGNED_NUMBER | 508 511 Tolerance \"=\" UNSIGNED_NUMBER … … 513 516 514 517 <p> 515 The 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. 518 The 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 519 </p> 517 520 … … 528 531 <h4><font color=\"#008000\">Syntax</font></h4> 529 532 530 <pre> <b>annotation</b>\"(\" HideResult \"=\" ( <b>false</b> | <b>true</b> ) \") 533 <pre> <b>annotation</b>\"(\" HideResult \"=\" ( <b>false</b> | <b>true</b> ) \") 531 534 </pre> 532 535 … … 558 561 <h4><font color=\"#008000\">Syntax</font></h4> 559 562 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> 567 Has only an effect within a function declaration. 563 <pre> <b>annotation</b>\"(\" Inline \"=\" ( <b>false</b> | <b>true</b> ) \") 564 </pre> 565 566 567 <h4><font color=\"#008000\">Description</font></h4> 568 569 <p> 570 Has only an effect within a function declaration. 568 571 </p> 569 572 … … 574 577 575 578 <p> 576 If \"Inline = false\", the model developer proposes to not inline the function. 579 If \"Inline = false\", the model developer proposes to not inline the function. 577 580 </p> 578 581 … … 593 596 <h4><font color=\"#008000\">Syntax</font></h4> 594 597 595 <pre> <b>annotation</b>\"(\" LateInline \"=\" ( <b>false</b> | <b>true</b> ) \") 598 <pre> <b>annotation</b>\"(\" LateInline \"=\" ( <b>false</b> | <b>true</b> ) \") 596 599 </pre> 597 600 … … 603 606 </p> 604 607 605 <p> 606 If \"LateInline = true\", the model developer proposes to inline the function after all symbolic transformations have been performed, but before common subexpression elimination takes place. 608 <p> 609 If \"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 610 </p> 608 611 … … 660 663 661 664 <pre>preferred view_annotation: 662 <b>annotation</b>\"(\" preferredView \"=\" (\"info\" | \"diagram\" | \"text\") \")\" 665 <b>annotation</b>\"(\" preferredView \"=\" (\"info\" | \"diagram\" | \"text\") \")\" 663 666 </pre> 664 667 … … 682 685 <h4><font color=\"#008000\">Syntax</font></h4> 683 686 684 <pre> <b>annotation</b>\"(\" smoothOrder \"=\" UNSIGNED_INTEGER \")\" 687 <pre> <b>annotation</b>\"(\" smoothOrder \"=\" UNSIGNED_INTEGER \")\" 685 688 </pre> 686 689 … … 721 724 722 725 <b>model</b> A 723 <b>annotation</b>(version=\"1.0\", 726 <b>annotation</b>(version=\"1.0\", 724 727 uses(Modelica(version=\"1.5\"))); 725 728 ... … … 759 762 760 763 <p> 761 The 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. 764 The 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 765 </p> 763 766 … … 776 779 777 780 <li> <code>conversion ( from (version = VERSION-NUMBER, script = \"?\") ) </code><br> 778 Defines that user models using the VERSION-NUMBER can be upgraded to 781 Defines that user models using the VERSION-NUMBER can be upgraded to 779 782 the CURRENT-VERSION-NUMBER of the current class by applying the given 780 783 script. The semantics of the conversion script is not defined.<br> </li> … … 818 821 <h4><font color=\"#008000\">Examples</font></h4> 819 822 820 <pre><b>connector</b> Frame \"Frame of a mechanical system\" 823 <pre><b>connector</b> Frame \"Frame of a mechanical system\" 821 824 ... 822 <b>flow</b> Modelica.SIunits.Force f[3] <b>annotation</b>(unassignedMessage = 825 <b>flow</b> Modelica.SIunits.Force f[3] <b>annotation</b>(unassignedMessage = 823 826 \"All Forces cannot be uniquely calculated. The reason could be that the 824 mechanism contains a planar loop or that joints constrain the same motion. 825 For planar loops, use in one revolute joint per loop the option 827 mechanism contains a planar loop or that joints constrain the same motion. 828 For planar loops, use in one revolute joint per loop the option 826 829 PlanarCutJoint=true in the Advanced menu. 827 830 \"); … … 882 885 A block class is the same as a model class 883 886 with the restriction that each connector component of a block must 884 have prefixes input and/or output for all connector variables. 887 have prefixes input and/or output for all connector variables. 885 888 The purpose is to model input/output blocks of block diagrams. 886 889 Due to the restrictions on input and output prefixes, … … 961 964 in connect statements. In connectors, no equations are allowed in the 962 965 definition or in any of its components. 963 With respect to \"class\", it is enhanced to allow connect(..) to components 966 With respect to \"class\", it is enhanced to allow connect(..) to components 964 967 of connector classes. 965 968 </P> … … 1006 1009 1007 1010 <p> 1008 The syntax and semantics of a function have many similarities to those of the block 1009 specialized class. A function has many of the properties of a general class, 1011 The syntax and semantics of a function have many similarities to those of the block 1012 specialized class. A function has many of the properties of a general class, 1010 1013 e.g. being able to inherit other functions, or to redeclare or modify 1011 1014 elements of a function declaration. 1012 1015 </p> 1013 1016 1014 <p> 1015 Modelica functions have the following restrictions compared to a 1017 <p> 1018 Modelica functions have the following restrictions compared to a 1016 1019 general Modelica class: 1017 1020 </p> … … 1022 1025 by the keyword output. All public variables are formal parameters.</li> 1023 1026 1024 <li> Input formal parameters are read-only after being bound to the 1027 <li> Input formal parameters are read-only after being bound to the 1025 1028 actual arguments or default values, i.e., they may not be assigned 1026 1029 values in the body of the function.</li> … … 1037 1040 its body, and it may not be partial.</li> 1038 1041 1039 <li> A function cannot contain calls to the Modelica built-in operators 1042 <li> A function cannot contain calls to the Modelica built-in operators 1040 1043 der, initial, terminal, sample, pre, edge, change, reinit, delay, 1041 1044 cardinality, to the operators of the built-in package Connections, … … 1059 1062 1060 1063 <p> 1061 Modelica functions have the following enhancements compared to a general Modelica class: 1064 Modelica functions have the following enhancements compared to a general Modelica class: 1062 1065 </p> 1063 1066 … … 1123 1126 <P> 1124 1127 The keyword model is identical to the keyword class, i.e., 1125 no restrictions and no enhancements. 1128 no restrictions and no enhancements. 1126 1129 </P> 1127 1130 </html>")); … … 1214 1217 order to group variables. Only public sections are allowed in the definition 1215 1218 or in any of its components (i.e., equation, algorithm, initial equation, 1216 initial algorithm and protected sections are not allowed). May not be used in 1217 connections. The elements of a record may not have prefixes input, output, inner, outer, 1218 or flow. Enhanced with implicitly available record constructor function. 1219 initial algorithm and protected sections are not allowed). May not be used in 1220 connections. The elements of a record may not have prefixes input, output, inner, outer, 1221 or flow. Enhanced with implicitly available record constructor function. 1219 1222 Additionally, record components can be used as component references in 1220 1223 expressions and in the left hand side of assignments, subject to … … 1307 1310 <tr><td>.*, ./, .^</td> 1308 1311 <td>a .* b</td> 1309 <td>element-wise multiplication, division and exponentation of 1312 <td>element-wise multiplication, division and exponentation of 1310 1313 scalars and arrays</td></tr> 1311 1314 … … 1471 1474 valign=\"top\"> 1472 1475 <p><span 1473 class=\"CODE\"><span 1476 class=\"CODE\"><span 1474 1477 >{2,3} [5,6]</span></span></p> 1475 1478 <p><span 1476 class=\"CODE\"><span 1479 class=\"CODE\"><span 1477 1480 >[2,3; 7,8]</span></span></p> 1478 1481 </td> … … 1521 1524 <p><span class=\"CODE\"><span>a+b</span></span><span>,</span><span class=\"CODE\"><span> 1522 1525 a-b, +a, -a</span></span></p> 1523 <p><span class=\"CODE\"><span 1526 <p><span class=\"CODE\"><span 1524 1527 >[1,2;3,4].+[2,3;5,6]</span></span></p> 1525 1528 </td> … … 1530 1533 </td> 1531 1534 <td valign=\"top\"> 1532 <p><span class=\"CODE\"><span 1535 <p><span class=\"CODE\"><span 1533 1536 ><</span></span><span 1534 class=\"CODE\"><span 1537 class=\"CODE\"><span 1535 1538 > <=</span></span><span 1536 class=\"CODE\"><span 1539 class=\"CODE\"><span 1537 1540 > ></span></span><span 1538 class=\"CODE\"><span 1541 class=\"CODE\"><span 1539 1542 > >=</span></span><span 1540 class=\"CODE\"><span 1543 class=\"CODE\"><span 1541 1544 > ==</span></span><span 1542 class=\"CODE\"><span 1545 class=\"CODE\"><span 1543 1546 > <></span></span></p> 1544 1547 </td> 1545 1548 <td valign=\"top\"> 1546 <p><span class=\"CODE\"><span 1549 <p><span class=\"CODE\"><span 1547 1550 >a<b</span></span><span 1548 1551 >,</span><span class=\"CODE\"><span … … 1554 1557 <td valign=\"top\"> 1555 1558 <p><span 1556 class=\"CODE\"><span 1559 class=\"CODE\"><span 1557 1560 >...</span></span></p> 1558 1561 </td> … … 1571 1574 </td> 1572 1575 <td valign=\"top\"> 1573 <p><span class=\"CODE\"><span 1576 <p><span class=\"CODE\"><span 1574 1577 >not</span></span><span 1575 class=\"CODE\"><span 1578 class=\"CODE\"><span 1576 1579 > </span></span><i><span 1577 1580 >expr</span></i></p> 1578 1581 </td> 1579 1582 <td valign=\"top\"> 1580 <p><span class=\"CODE\"><span 1583 <p><span class=\"CODE\"><span 1581 1584 >not b1</span></span></p> 1582 1585 </td> … … 1587 1590 </td> 1588 1591 <td valign=\"top\"> 1589 <p><span class=\"CODE\"><span 1592 <p><span class=\"CODE\"><span 1590 1593 >and</span></span></p> 1591 1594 </td> 1592 1595 <td valign=\"top\"> 1593 <p><span class=\"CODE\"><span 1596 <p><span class=\"CODE\"><span 1594 1597 >b1 and b2</span></span></p> 1595 1598 </td> … … 1600 1603 </td> 1601 1604 <td valign=\"top\"> 1602 <p><span class=\"CODE\"><span 1605 <p><span class=\"CODE\"><span 1603 1606 >or</span></span></p> 1604 1607 </td> 1605 1608 <td valign=\"top\"> 1606 <p><span class=\"CODE\"><span 1609 <p><span class=\"CODE\"><span 1607 1610 >b1 or b2</span></span></p> 1608 1611 </td> … … 1617 1620 >:</span></span><span 1618 1621 > <i>expr</i> </span><span 1619 class=\"CODE\"><span 1622 class=\"CODE\"><span 1620 1623 >:</span></span><span > 1621 1624 <i>expr</i></span></p> 1622 1625 </td> 1623 1626 <td valign=\"top\"> 1624 <p><span class=\"CODE\"><span 1627 <p><span class=\"CODE\"><span 1625 1628 >1:5</span></span><span 1626 1629 >,</span><span class=\"CODE\"><span … … 1634 1637 </td> 1635 1638 <td valign=\"top\"> 1636 <p><span class=\"CODE\"><span 1639 <p><span class=\"CODE\"><span 1637 1640 >if</span></span><span 1638 1641 > <i>expr</i> … … 1645 1648 </td> 1646 1649 <td valign=\"top\"> 1647 <p><span class=\"CODE\"><span 1650 <p><span class=\"CODE\"><span 1648 1651 >if b then 3 else x</span></span></p> 1649 1652 </td> … … 1658 1661 </td> 1659 1662 <td valign=\"top\"> 1660 <p><span class=\"CODE\"><span 1663 <p><span class=\"CODE\"><span 1661 1664 >x = 2.26</span></span></p> 1662 1665 </td> … … 1669 1672 >=</span></span><span 1670 1673 > and assignment </span><span 1671 class=\"CODE\"><span 1674 class=\"CODE\"><span 1672 1675 >:=</span></span><span 1673 1676 > are not expression operators since they are … … 1698 1701 Elementary operators, such as \"+\" or \"-\" are overloaded and 1699 1702 operate on scalar and array variables. Other operators 1700 have the same syntax as a 1703 have the same syntax as a 1701 1704 <a href=\"Modelica:ModelicaReference.Classes.Function\">Modelica function</a> 1702 call. However, they do not behave as a Modelica function, 1703 either because the result depends not only on the input arguments but 1705 call. However, they do not behave as a Modelica function, 1706 either because the result depends not only on the input arguments but 1704 1707 also on the status of the simulation (such as \"pre(..)\"), or 1705 1708 the function operates on input arguments of different types 1706 1709 (such as \"String(..)\"). Neither of these \"functions\" 1707 can be defined with a \"standard\" Modelica function and are 1710 can be defined with a \"standard\" Modelica function and are 1708 1711 therefore builtin operators of the Modelica language 1709 1712 (with exception of the basic mathematical functions, … … 1809 1812 <ul> 1810 1813 <li> level = AssertionLevel.error:<br> 1811 The current evaluation is aborted. The simulation may 1814 The current evaluation is aborted. The simulation may 1812 1815 continue with another evaluation [e.g., with a shorter step-size, 1813 1816 or by changing the values of iteration variables]. … … 1819 1822 terminal()=true triggers an assert, the analysis failed. </li> 1820 1823 <li> level = AssertionLevel.warning:<br> 1821 The current evaluation is not aborted. message indicates 1822 the cause of the warning [It is recommended to report the 1824 The current evaluation is not aborted. message indicates 1825 the cause of the warning [It is recommended to report the 1823 1826 warning only once when the condition becomes false, and it is 1824 1827 reported that the condition is no longer violated when the … … 2067 2070 </p> 2068 2071 <blockquote><pre> 2069 <b>cross</b>(x,y) = <b>vector</b>( [ x[2]*y[3]-x[3]*y[2]; 2070 x[3]*y[1]-x[1]*y[3]; 2072 <b>cross</b>(x,y) = <b>vector</b>( [ x[2]*y[3]-x[3]*y[2]; 2073 x[3]*y[1]-x[1]*y[3]; 2071 2074
