Reputation: 63
I would like to run a co-simulation FMU (FMI2.0) in Dymola 2022. The co-simulation FMU is connected to some other components modelled in Modelica.
Sometimes the following error message is printed:
[fmi2Warning]: fmu_name: fmi2DoStep: Invalid currentCommunicationPoint = 2.9500000000030000, expected 2.9500000000000002
If this message occured once, simulation then never recovers, there is such a print at every time step. From that point on the simulation results are invalid. This error occurs for a certain combination of boundary conditions and / or system parameters. It occurs for more than one set of combined input values, but there are also a lot of simulation runs which terminate successfully. I could not see any pattern in the input / parameter values that could be responsible for that behaviour.
Can somebody explain this kind of error message to me? Is the problem the master (Dymola) or the slave (FMU)? And - even more important - does anybody have an idea on how to avoid this error?
The relevant part of the modelDescription.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription
fmiVersion="2.0"
guid="{2598dff1-4f88-4838-89e2-ae8ff105e7e9}"
modelName="xxx"
generationTool="Simulink 8.13 (R2017b) 24-Jul-2017 with FMI Kit 2.9 (rtwsfcnfmi.tlc, FixedStepDiscrete, 0.001 s)"
generationDateAndTime="2021-08-10T14:16:18"
author="matlab"
version="1.40"
numberOfEventIndicators="0">
<CoSimulation modelIdentifier="xxx" canHandleVariableCommunicationStepSize="true" canInterpolateInputs="true"/>
<DefaultExperiment
startTime="0.0"
stopTime="500.0"
stepSize="0.001"
/>
Looking forward to any suggestions!
Upvotes: 2
Views: 1349
Reputation: 101
In each communication point you pass the current time and the step length as argument to the fmi2DoStep function. This error message means that in the following step, the time of the communication point t_{i+1} is not exactly equal to t_{i} + delta_t. So, most likely this is a truncation error of the master algorithm.
You could replace the computation of the next communication point by a getReal call to receive the communication time computed by the FMU after each doStep call. If you cannot modify the master algorithm, you have to contact the support to let the developers fix it.
Upvotes: 0
Reputation: 588
I recommoned you open a ticket for this on https://github.com/CATIA-Systems/FMIKit-Simulink . For me
generationTool="Simulink 8.13 (R2017b) 24-Jul-2017 with FMI Kit 2.9 (rtwsfcnfmi.tlc, FixedStepDiscrete, 0.001 s)"
and
<CoSimulation modelIdentifier="xxx" canHandleVariableCommunicationStepSize="true"
seem to be contradictory.
However, the concrete warning seem to be ignorable: the discrepancy to the expected timestep is in the order of 1e-12. So the FMU throws a warning, but continues to simulate
Upvotes: 0