Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Clock dependency info to attribute #1375

Merged
merged 2 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/2_2_common_mechanisms.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ In some clock semantics (e.g. <<MLS12>>), a clocked variable has a value only wh
However, <<get-and-set-variable-values,`fmi3Get{VariableType}`>> will return the value computed at the last Clock activation time.
Before the first Clock tick, clocked variables have their initial value.

The association between <<clocked-variable,clocked variables>> and their <<Clock,Clocks>> is defined by the <<model-dependencies,model dependency>> elements <<ClockElement>>.
The association between <<clocked-variable,clocked variables>> and their <<Clock,Clocks>> is defined by the attribute <<clocks>>.
<<clocked-variable,Clocked variables>> can depend on multiple Clocks.
_[For example, a global counter could be incremented by multiple tasks, each controlled by a different Clock.]_

Expand Down
32 changes: 12 additions & 20 deletions docs/2_4_common_schema.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1077,12 +1077,19 @@ The default value of this attribute is `false`.
|
[[previous,`previous`]]
If present, this variable is a <<ClockedState>> and this attribute is a value reference to the variable with the previous value.
Only clocked variables (they are listed in at least one of the <<clockedVariables>> lists) may have the <<previous>> attribute.
Only clocked variables (i.e. variables with the attribute <<clocks>>) may have the <<previous>> attribute.
Only variables with <<variability,`variability == discrete`>> may have a previous value.

_[For example, if `previous == 3` for variable `8`, then variable `3` is the previous value of variable `8`. See also <<fmi3UpdateDiscreteStates>>._
_Note: This is reverse compared to the <<derivative>> attribute.]_

|`clocks`
|
[[clocks,`clocks`]]
If present, this variable is clocked.
The value of <<clocks>> is a list of value references of <<Clock>> variables this variable depends on.
Only discrete variables can have this attribute.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only discrete variables can have this attribute.

We need the information also for tunable parameters, i.e. discrete variables and tunable parameters can have this attribute.

_[More rigorous importers requiring a variable to be dependent on a single clock can reject FMUs violating this restriction.]_
|====

If <<initial>> is not present, its value is defined by <<table-definition-initial>> based on the values of <<causality>> and <<variability>> (default [.underline]#underlined#):
Expand Down Expand Up @@ -1690,8 +1697,8 @@ latexmath:[{\dot{\mathbf{x}_c} := \mathbf{f}_{\mathit{der}}(\mathbf{x}_c, \mathb
|`ClockedState`
|
[[ClockedState,`<ClockedState>`]]
A <<ClockedState>> is part of the discrete state of a model partition and represented by a <<ClockElement,clocked>> variable.
To which clock or clocks it belongs is described in <<ClockElement>>.
A <<ClockedState>> is part of the discrete state of a model partition and represented by a clocked variable.
To which Clock or Clocks it belongs is described by the attribute <<clocks>>.
Each <<ClockedState>> must have the attribute <<previous>> to represent the previous value of this <<ClockedState>>.
All <<ClockedState,clocked states>> must have <<variability,`variability == discrete`>>.

Expand Down Expand Up @@ -1735,20 +1742,11 @@ _The ordering of the variables in this list is defined by the exporting tool.]_

For Co-Simulation, elements <<EventIndicator>> are ignored.
_[If an FMU supports both Model Exchange and Co-Simulation, then the <<EventIndicator>> elements might be present, since it is needed for Model Exchange.]_

|`Clock`
|
[[ClockElement,`<Clock>`]]
List of all clocks and their clocked variables.
All variables referenced by these lists must have <<variability,`variability == discrete`>>.
A clocked variable my depend on multiple clocks and may therefore be listed in multiple <<ClockElement>> elements.
_[More rigorous importers requiring a variable to be dependent on a single clock can reject FMUs violating this restriction.]_

|====

Elements <<Output>>, <<ContinuousStateDerivative>>, <<ClockedState>>, <<InitialUnknown>>, <<EventIndicator>> and <<ClockElement>> have (partially) the following attributes:
Elements <<Output>>, <<ContinuousStateDerivative>>, <<ClockedState>>, <<InitialUnknown>>, and <<EventIndicator>> have (partially) the following attributes:

.<<Output>>, <<ContinuousStateDerivative>>, <<ClockedState>>, <<InitialUnknown>>, <<EventIndicator>> and <<ClockElement>> attribute details.
.<<Output>>, <<ContinuousStateDerivative>>, <<ClockedState>>, <<InitialUnknown>>, and <<EventIndicator>> attribute details.
[[table-output-der-initialUknown-details]]
[cols="1,5", options="header"]
|====
Expand Down Expand Up @@ -1809,12 +1807,6 @@ Only for floating point type unknowns latexmath:[{\mathbf{v}_{\mathit{unknown}}}
`=` <<tunable>>: tunable factor, latexmath:[{p \cdot \mathbf{v}_{\mathit{known},i}}] where latexmath:[{p}] is an expression that is evaluated before <<fmi3ExitInitializationMode>> is called and in <<EventMode>> due to event handling (ME) or at a communication point (CS and SE)

`=` <<discrete>>: discrete factor, latexmath:[{d \cdot \mathbf{v}_{\mathit{known},i}}] where latexmath:[{d}] is an expression that is evaluated before <<fmi3ExitInitializationMode>> is called and in <<EventMode>> due to an external or internal event or at a communication point (CS and SE).

|`clockedVariables`
|
[[clockedVariables, `clockedVariables`]]
This element is only available with the <<ClockElement>> element and is a list of value references indicating clocked variables depending on this clock.

|====

_[Example 1:_
Expand Down
Binary file modified docs/images/schema/Binary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/Boolean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/Clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/Enumeration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/Float64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/Int32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/ModelStructure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/schema/fmi3VariableBase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions schema/fmi3ModelDescription.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<xs:attribute name="valueReference" type="xs:unsignedInt" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Clock" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="Annotations" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="valueReference" type="xs:unsignedInt" use="required"/>
<xs:attribute name="clockedVariables">
<xs:simpleType>
<xs:list itemType="xs:unsignedInt"/>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Expand Down
5 changes: 5 additions & 0 deletions schema/fmi3Variable.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<xs:attribute name="canHandleMultipleSetPerTimeInstant" type="xs:boolean"/>
<xs:attribute name="intermediateUpdate" type="xs:boolean"/>
<xs:attribute name="previous" type="xs:unsignedInt"/>
<xs:attribute name="clocks">
<xs:simpleType>
<xs:list itemType="xs:unsignedInt"/>
</xs:simpleType>
</xs:attribute>
</xs:complexType>

<xs:group name="fmi3Variable">
Expand Down