Opened 9 years ago
Last modified 5 years ago
#3721 new defect
Re: FMI 1.0 co-simulation API skeleton.
Reported by: | Owned by: | Adeel Asghar | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | FMI 1.0 | Version: | v1.9.4-dev-nightly |
Keywords: | model-exchange | Cc: |
Description
There is a mistake with the structures which is apparent in FMUs created using the C runtime and FMI1 for model exchange.
The structure fmiCallbackFunctions and fmiStatus are currently as below.
typedef struct { fmiCallbackLogger logger; fmiCallbackAllocateMemory allocateMemory; fmiCallbackFreeMemory freeMemory; fmiStepFinished stepFinished; } fmiCallbackFunctions; typedef enum {fmiOK, fmiWarning, fmiDiscard, fmiError, fmiFatal, fmiPending} fmiStatus;
the fmiStepFinished ONLY exists in the standard for fmi1 co-simulation, yet this same structure is used even for FMUs created for model exchange. An application which supports FMI1 for model exchange will only have the first three callbacks, and this creates a problem when fmiCallbackFunctions is then passed (by value) to fmiInstantiateModel.
DllExport fmiComponent fmiInstantiateModel(fmiString instanceName, fmiString GUID, fmiCallbackFunctions functions, fmiBoolean loggingOn);
A caller will observe that all logs will be created, because what likely happens is that their provided value of loggingOn gets used as a (maybe partially complete) function pointer for step finished, and the value of loggingOn is then some garbage.
These structure are however defined in FMI1 for co-simulation.
tl;dr There must be a mechanism to select the right callback structure depending on whether model-exchange or co-simulation is selected for fmi1 because they are not compatible.
As an aside, I know the CPP runtime is configured correctly for this, but it is not currently an option.
Change History (4)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Milestone: | Future → 2.0.0 |
---|
Not for release 1.9.4.
I will have a look at it after the release.
comment:3 by , 5 years ago
Component: | FMI → FMI 1.0 |
---|
comment:4 by , 5 years ago
Milestone: | 2.0.0 → Future |
---|
Hello, just to follow up, is there anything to be done about this?