Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndreasHofmann217 opened this issue Nov 29, 2023 · 1 comment

Comments

@AndreasHofmann217
Copy link

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

@AndreasHofmann217 AndreasHofmann217 changed the title FMIKit 3.1 ME-FMU generation error Matlab 2020b (working with FMIKit 3.0) FMIKit 3.1 ME-FMU generation error Matlab 2020b (working with FMIKit 3.0) (RTWSFCN) Nov 29, 2023
@MKarvy
Copy link

MKarvy commented Jul 10, 2024

I have the same issue only in Matlab 2021a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants