Skip to content
Open
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
50 changes: 50 additions & 0 deletions docs/examples/modelDescription_CombiTable1Ds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
...
<Float64
name="combiTable1Ds1.u"
valueReference="1711276041"
description="Connector of Real input signal"
declaredType="Modelica.Blocks.Interfaces.RealInput"
unit="s">
<Annotations>
<Annotation
type="com.3ds.dymola">
<DeclarationOrder
order="5 38"/>
</Annotation>
</Annotations>
<Alias
name="realExpression1.y"
description="Value of Real output"/>
</Float64>
<Float64
name="combiTable1Ds1.y"
valueReference="1879048192"
description="Connector of Real output signals"
declaredType="Modelica.Blocks.Interfaces.RealOutput">
<Annotations>
<Annotation
type="com.3ds.dymola">
<DeclarationOrder
order="7"/>
</Annotation>
</Annotations>
<Dimension start="2"/>
</Float64>
<Float64
name="combiTable1Ds1.table"
valueReference="268435457"
description="Table matrix (grid = first column; e.g., table=[0, 0; 1, 1; 2, 4])"
causality="parameter"
variability="fixed"
start="1 2 4 7 2 3 2 5 3 4 1 2">
<Annotations>
<Annotation
type="com.3ds.dymola">
<DeclarationOrder
order="11"/>
</Annotation>
</Annotations>
<Dimension start="3"/>
<Dimension start="4"/>
</Float64>
...
28 changes: 28 additions & 0 deletions docs/examples/terminalsAndIcons_CombiTable1Ds.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<fmiTerminalsAndIcons
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
fmiVersion="3.0.1">
<Terminals>
<Terminal
name="combiTable1Ds1"
terminalKind="org.fmi-standard.fmi-ls-struct.map.rectilinearGrid"
matchingRule="org.fmi-standard.fmi-ls-struct.map">
<TerminalMemberVariable
variableName="combiTable1Ds1.table"
memberName="table"
variableKind="org.fmi-standard.fmi-ls-struct.map.domain"/>
<TerminalMemberVariable
variableName="combiTable1Ds1.u"
memberName="u"
variableKind="org.fmi-standard.fmi-ls-struct.map.domainInput"/>
<TerminalMemberVariable
variableName="combiTable1Ds1.table"
memberName="table"
variableKind="org.fmi-standard.fmi-ls-struct.map.codomain"/>
<TerminalMemberVariable
variableName="combiTable1Ds1.y"
memberName="y"
variableKind="org.fmi-standard.fmi-ls-struct.map.codomainOutput"/>
</Terminal>
</Terminals>
</fmiTerminalsAndIcons>
66 changes: 66 additions & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ for maps defined on the vertices of a rectilinear grid.
for maps defined by unstructured tuples of ("point cloud").



==== `variableKind` attribute values of terminal member variables:

We want to represent a map from a domain set to a codomain by providing points in the domain set and the values they are mapped to.
Expand Down Expand Up @@ -226,8 +227,73 @@ These variables are grouped in a terminal with the terminalKind `org.fmi-standar
include::examples/terminalsAndIcons.xml[]
----

=== Mapping of `CombiTable1Ds` to rectilinear grids
In the Modelica Standard Library, `CombiTable1Ds` is a lookup table (part of the link:https://doc.modelica.org/Modelica%204.0.0/Resources/helpDymola/Modelica_Blocks_Tables.html#Modelica.Blocks.Tables[Modelica.Blocks.Tables] package) used to interpolate data based on one input variable and multiple output variables. It performs univariate interpolation on a table matrix using methods such as constant, linear, or cubic Hermite splines.

Unlike maps sampled on rectilinear grids, a `CombiTable1Ds` instance stores both the domain and codomain data within the **same variable** (the `table` parameter of the link:https://doc.modelica.org/Modelica%204.0.0/Resources/helpDymola/Modelica_Blocks_Tables.html#Modelica.Blocks.Tables.CombiTable1Ds[Modelica.Blocks.Tables.CombiTable1Ds] component). The first column of this matrix defines the domain values, and the remaining columns define the codomain values. This sets the following restrictions on the variableKind for **domain** and **codomain**:

domain::
The first column of the table variable defines the domain values. The corresponding FMU variable must be referenced with `variableKind="org.fmi-standard.fmi-ls-struct.map.domain"`.

codomain::
The remaining columns of the same table variable define the codomain values. The same FMU variable must also be referenced with `variableKind="org.fmi-standard.fmi-ls-struct.map.codomain"`.

=== Example with `CombiTable1Ds`
The following table shows the data layout of a `CombiTable1Ds`:
[[combiTable1D_example]]
[cols="1,1,1,1"]
|====
| x (input) | y (output 1) | y (output 2) | y (output 3)

| 1 | 2 | 4 | 7
| 2 | 3 | 2 | 5
| 3 | 4 | 1 | 2
|====

The corresponding Modelica model uses `Modelica.Blocks.Tables.CombiTable1Ds` to represent the data shown above.
```
model ExampleWithCombi
Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds1(
table={{1,2,4,7},
{2,3,2,5},
{3,4,1,2}},
columns={2,3},
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments) annotation(Placement(transformation(extent={{-70,15},{-50,35}})));
Modelica.Blocks.Sources.RealExpression realExpression1(y=time) annotation(Placement(transformation(extent={{-115,15},{-95,35}})));
equation
connect(realExpression1.y,combiTable1Ds1.u) annotation(Line(
points={{-94,25},{-89,25},{-77,25},{-72,25}},
color={0,0,127}));
annotation(
uses(Modelica(version="4.0.0")),
experiment(
StopTime=3,
StartTime=1,
Interval=0.001));
end ExampleWithCombi;
```
Both the domain and codomain are contained in the matrix:

```
table={{1,2,4,7},
{2,3,2,5},
{3,4,1,2}}.
```
The first column always represents the domain, while the rest of the columns contain the codomain values. The assignment `columns = {2,3}` specifies which columns are interpreted as output variables and interpolated based on the input. Therefore the third output in the table <<combiTable1D_example>> above is omitted.

The variables representing the table, inputs, and outputs are given in the modelDescription.xml:
[source, xml]
----
include::examples/modelDescription_CombiTable1Ds.xml[]
----

The structured representation of the data is defined in `terminalsAndIcons.xml`:
[source, xml]
----
include::examples/terminalsAndIcons_CombiTable1Ds.xml[]
----

Note the `terminalMemberVariable` `combiTable1Ds1.y` is a 2D-array, since the Modelica code specified two outputs with `columns = {2,3}`.

== Maps sampled on irregular grids ("Point Cloud")

Expand Down