Hi, I'm using PythonFMU to create a FMI-based co-simulation driving simulator. Roughfly, the setup consists of esmini acting as the scenario controller, a driver, and a simple vehicle kinematic model.
esmini -> Driver FMU -> Vehicle FMU
^ |
| |
+------------+
where:
- omsimulator is the orchestrator
- esmini provides the scenario and surrounding traffic information.
- The Driver FMU receives vehicle and environment information (speed, position, lane information, traffic participants, etc.).
- The Driver FMU computes driving actions (steering, throttle, brake, trajectory updates, etc.).
- The Vehicle FMU receives these actions and updates the vehicle state.
- The updated vehicle state is fed back to the Driver FMU.
This creates a feedback loop between the Driver FMU and Vehicle FMU.
The issue is that PythonFMU generates output entries such as:
<ModelStructure>
<Outputs>
<Unknown index="1"/>
</Outputs>
</ModelStructure>
Since the dependencies attribute is omitted, omsimulator assumes that an output depends on all current inputs as per standard
If not present, it must be assumed that the Unknown depends on all Knowns. (p 61 in https://fmi-standard.org/assets/releases/FMI_for_ModelExchange_and_CoSimulation_v2.0.pdf)
, but this does not apply here. The driver, in fact, gets inputs from the Vehicle FMU and esmini, internal state is updated during do_step(), and outputs are produced from the driver's internal state. There is no direct feedthrough from current inputs to current outputs within the FMU. The outputs are effectively based on information from the previous communication step.
Current workaround
After building the FMU, we patch modelDescription.xml and change:
to:
<Unknown index="1" dependencies=""/>
for outputs that have no direct feedthrough.
This prevents false algebraic-loop detection.
Request
Would it be possible to expose output dependency information in PythonFMU?
For example:
Real(
"steering",
causality=Fmi2Causality.output,
dependencies=[]
)
or some equivalent mechanism.
This would allow FMU authors to provide accurate ModelStructure information and avoid the need to patch the generated FMU after the build process.
Is there already a supported way to specify output dependencies in PythonFMU that I may have missed? If not, would you consider adding support for explicit output dependencies?
Hi, I'm using PythonFMU to create a FMI-based co-simulation driving simulator. Roughfly, the setup consists of esmini acting as the scenario controller, a driver, and a simple vehicle kinematic model.
where:
This creates a feedback loop between the Driver FMU and Vehicle FMU.
The issue is that PythonFMU generates output entries such as:
Since the
dependenciesattribute is omitted, omsimulator assumes that an output depends on all current inputs as per standard, but this does not apply here. The driver, in fact, gets inputs from the Vehicle FMU and esmini, internal state is updated during
do_step(), and outputs are produced from the driver's internal state. There is no direct feedthrough from current inputs to current outputs within the FMU. The outputs are effectively based on information from the previous communication step.Current workaround
After building the FMU, we patch
modelDescription.xmland change:to:
for outputs that have no direct feedthrough.
This prevents false algebraic-loop detection.
Request
Would it be possible to expose output dependency information in PythonFMU?
For example:
or some equivalent mechanism.
This would allow FMU authors to provide accurate ModelStructure information and avoid the need to patch the generated FMU after the build process.
Is there already a supported way to specify output dependencies in PythonFMU that I may have missed? If not, would you consider adding support for explicit output dependencies?