You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FMUs packaged with rtwsfcnfmi.tlc from FMIKit 3.1 in MATLAB 2022b crash MATLAB when they are executed.
After a little debugging, I discovered that the error occurs in fmi2functions.c fmi2SetReal():
Replication
I created a test function to demonstrate the error state. Please see the zip file. Here's a snippet of the code:
% Perform a simple test to demonstrate an error state of FMIKit which% causes MATLAB to crash.%% From my testing with FMIKit v3.1, usage of the FMU created with 2021b% works properly, but the one created using 2022b crashes MATLAB.
load_system(model)
cs = getActiveConfigSet(gcs);
switchTarget(cs, 'rtwsfcnfmi.tlc', []);
set_param(model, 'GenerateReport', 'off');
set_param(model, 'FMIType', 'CoSimulation');
set_param(model, 'SolverType', 'Fixed-step');
set_param(model, 'LoadBinaryMEX', loadSfunctionBinary); %Even if no s-Function in "model", this causes a crash when simulated (2022b)
slbuild(model);
close_system(model, 0);
%Now, open a new simulink model and create an FMU block of this and try to%simulate. I used the built-in Simulink FMU block
Problem
FMUs packaged with rtwsfcnfmi.tlc from FMIKit 3.1 in MATLAB 2022b crash MATLAB when they are executed.
After a little debugging, I discovered that the error occurs in fmi2functions.c
fmi2SetReal()
:Replication
I created a test function to demonstrate the error state. Please see the zip file. Here's a snippet of the code:
fmikitErrorExamples.zip
Workaround
Using MATLAB 2021b to create the FMU seems to resolve the problem. Was there an S-Function API change between the versions?
System details:
The text was updated successfully, but these errors were encountered: