CATIA-Systems / FMIKit-Simulink

Import and export Functional Mock-up Units with Simulink
Other
157 stars 50 forks source link

Provide meaningful start values for inputs #350

Open chrbertsch opened 2 years ago

chrbertsch commented 2 years ago

The FMI standard requires, that you provide meaningful start values for inputs. https://github.com/modelica/fmi-guides/issues/31

However, when one exports FMUs with FMI-Kit, the start values for inputs are set to 0, which could e.g. lead to division by zero errors for inputs that are assumed to be nonzero.

Is there a way so set meaningful start values for inputs of such FMUs? (Workaround: set the input start value with an IC block directly after the input)

t-sommer commented 2 years ago

when one exports FMUs with FMI-Kit, the start values for inputs are set to 0

This reflects the actual start value in the binary.

(Workaround: set the input start value with an IC block directly after the input)

This is not really a solution as it overrides the input for the first step regardless whether or not it has been set.

Is there a way so set meaningful start values for inputs of such FMUs?

Currently not.

t-sommer commented 2 years ago

@chrbertsch, can you share an example to reproduce the issue?

chrbertsch commented 2 years ago

@chrbertsch, can you share an example to reproduce the issue?

grafik

Is it possible to specify a nonzero start value for In1 for FMU export?

Currently the start value is generated as zero:

    <!-- Inputs -->
    <ScalarVariable name="In1" valueReference="2" causality="input">
      <Real start="0"/>
    </ScalarVariable>

Otherwise the generated FMU will have a division by zero error during initialization in some tools, even if the Input is connected to a nonzero source.

t-sommer commented 2 years ago

Is it possible to specify a nonzero start value for In1 for FMU export?

No.