﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3721	Re: FMI 1.0 co-simulation API skeleton.	michael.kobierski@…	Adeel Asghar	"https://trac.openmodelica.org/OpenModelica/changeset/e87391212dc31770541528ea6c64dcc6489fb04e/OMCompiler

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."	defect	new	high	Future	FMI 1.0	v1.9.4-dev-nightly		model-exchange	
