0
votes

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!

Could you provide more information on the FMU? How is it created? Could you share it or its modeldescription.xml-file? Looks as if the FMU expects a fixed timestep and throws a warning as due to numerical inaccuracies this does not seem to be fulfilled. - Christian Bertsch
Unfortunately I cannot share the FMU, but I've added the relevant part of the .xml-file to my post. You were right, the FMU at least runs on a fixed step. However the Modelica model running in co-simulation with that FMU would only run with a variable step solver in Dymola. So is there anything which can be done to avoid this sync problem? - Karin