You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/UsersGuide/source/porting.rst
+24-15Lines changed: 24 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,18 +83,19 @@ appropriate.
83
83
Access to conditional components
84
84
--------------------------------
85
85
86
-
According to `Section 4.4.5 <https://specification.modelica.org/maint/3.5/class-predefined-types-and-declarations.html#conditional-component-declaration>`_
86
+
Up to Modelica 3.6, according to `Section 4.4.5 <https://specification.modelica.org/maint/3.6/class-predefined-types-and-declarations.html#conditional-component-declaration>`_
87
87
of the language specification, "A component declared with a condition-attribute
88
-
can only be modified and/or used in connections". When dealing, e.g., with
89
-
conditional input connectors, one can use the following patterns:
88
+
can only be modified and/or used in connections". This required to use the following, slightly
89
+
convoluted patterns when dealing, e.g., with conditional input connectors, making use of internal
90
+
auxiliary variables or connectors:
90
91
91
92
.. code-block:: modelica
92
93
93
94
model M
94
95
parameter Boolean activateIn1 = true;
95
96
parameter Boolean activateIn2 = true;
96
97
Modelica.Blocks.Interfaces.RealInput u1_in if activateIn1;
97
-
Modelica.Blocks.Interfaces.RealInput u2_in = u2 if activateIn2;
98
+
Modelica.Blocks.Interfaces.RealInput u2_in = u2 if activateIn2 "binding equation only holds if activateIn2 = true";
98
99
Real u2 "internal variable corresponding to u2_in";
99
100
Real y;
100
101
protected
@@ -110,8 +111,9 @@ conditional input connectors, one can use the following patterns:
110
111
end if;
111
112
end M;
112
113
113
-
where conditional components are only used in connect equations. The following
114
-
patterns instead are not legal:
114
+
where conditional components 'u1_in' and 'u2_in' were only used in connect equations. Other Modelica
115
+
tools accepted code that was more straightforward and easier to understand, but actually not compliant
116
+
with this restriction, causing compatibility issues, e.g.:
115
117
116
118
.. code-block:: modelica
117
119
@@ -120,23 +122,30 @@ patterns instead are not legal:
120
122
parameter Boolean activateIn2 = true;
121
123
Modelica.Blocks.Interfaces.RealInput u1_in if activateIn1;
122
124
Modelica.Blocks.Interfaces.RealInput u2_in if activateIn2;
123
-
Real u1 "internal variable corresponding to u1_in";
124
-
Real u2 "internal variable corresponding to u2_in";
0 commit comments