CATIA-Systems / FMIKit-Simulink

Import and export Functional Mock-up Units with Simulink
Other
155 stars 50 forks source link

FMIKit 3.1 ME-FMU generation error Matlab 2020b (working with FMIKit 3.0) (RTWSFCN) #464

Open AndreasHofmann217 opened 7 months ago

AndreasHofmann217 commented 7 months ago

Trying to generate a simple input -> gainblock -> output ME-FMU using Matlab/Simulink 2020b fails. Error rises from CreateSimStructForFMI as mdlInfoSLSIze is not part of S->blkInfo.blkInfo2 respectively _ssBlkInfo2 struct in simstrc_def.h.

SimStruct` *CreateSimStructForFMI(const char* instanceName)
{   SimStruct *S = (SimStruct*)calloc(1, sizeof(SimStruct));

    if (S == NULL) {
        return NULL;
    }

    S->mdlInfo = (struct _ssMdlInfo*)calloc(1, sizeof(struct _ssMdlInfo));

    if (S->mdlInfo == NULL) {
        return NULL;
    }

    S->blkInfo.blkInfo2 = (struct _ssBlkInfo2*)calloc(1, sizeof(struct _ssBlkInfo2));

    if (S->blkInfo.blkInfo2 == NULL) {
        return NULL;
    }

    S->blkInfo.blkInfo2->mdlInfoSLSize = (struct _ssMdlInfoSLSize*)calloc(1, sizeof(struct _ssMdlInfoSLSize));

    if (S->blkInfo.blkInfo2->mdlInfoSLSize == NULL) {
        return NULL;
    }

    _ssSetRootSS(S, S);
...

Model does work fine with FMIKit 3.0 and Matlab/Simulink 2020b as the part is missing

SimStruct *CreateSimStructForFMI(const char* instanceName)
{
    SimStruct *S = (SimStruct*)calloc(1, sizeof(SimStruct));
    if (S == NULL) {
        return NULL;
    }
    S->mdlInfo = (struct _ssMdlInfo*)calloc(1, sizeof(struct _ssMdlInfo));
    if (S->mdlInfo == NULL) {
        return NULL;
    }

    _ssSetRootSS(S, S);
...

Not an issue for my application, since FMIKit 3.0 should be good enough. Wanted to give feedback anyways.

Best regards, Andreas