Struggling with FMU Exporting Simscape components, they work fine in simscape, but when I export to FMU and resimulate to test, the model fails.
I’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciatedI’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciated I’m currently making a simple physical system (Gas, Mechanical in Simscape, consisting of a reservoir, two Compressors (G) (with an ideal angular velocity source), a Pipe (G) with a controlled heat flow source providing cooling, and a reservoir downstream to sink to. It’s a very simple system and more just being used as a high level model to test out FMU exports. None of the components are changed from default except for the Reservoirs, Heat Flow Sources providing some BCs, and the Compressor has Analytical parameterization and is being set to a specific design point based on a compressor data set that’s being used.
The model works fine in Simscape, I have a controller that admittedly takes a while to reach steady state but aside from that I’ve not seen any issues. When I export this model as an FMU, the model seems to break. I use the inputs that I’ve had before but they seem to break the model and give the following error:
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logAll, status:fmi2OK] CommunicationPoint=0, communicationStepSize=100.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2DoStep(Output): : The co-simulation model block ‘FMU_Testbed/FMU’ is not running.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2FreeInstance: The following error occurred while simulating model ‘PASS_nodata_fmu_draft’ : Initial conditions solve failed to converge.
…Here is the set of components with unconverged equations:
‘PASS_nodata_fmu_draft/Pipe (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/simscape/library/m/+foundation/+gas/+elements/pipe.ssc’ (line 351)
‘PASS_nodata_fmu_draft/Compressor (G)1’
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no line number info)
Equation location is:
‘C:/Program Files/MATLAB/R2024a/toolbox/physmod/fluids/fluids/+fluids/+gas/+turbomachinery/compressor.sscp'(no l
Component:Simulink | Category:Model
An error occurred during simulation and the simulation was terminated
Caused by:
Error in supplied FMU: An error occurred in function ‘fmi2DoStep’ for block ‘FMU_Testbed/FMU’ during simulation. For more information, see the FMU troubleshooting documentation.
Component:Simulink | Category:Block error
One theory I have is that because I’ve used Analytical mode as opposed to Tabulated parameterization, the compressor is struggling. This would explain why the FMU does seem to work after I increase the Speed, but the results are inaccurate (going from 0.3 kg/s to 14.3, and going from 101.3kPa to 10*4kPa)
Original Simscape Model:
FMU Block test (Constant inputs from Simscape were turned into inports and I’ve just been testing the FMU to see if they work):
Produces error mentioned earlier
FMU Block test, increased Speed:
Any help here would be appreciated compressor (g), matlab, simscape, fluids, simulink, fmu, export MATLAB Answers — New Questions