Export Simscape components to FMU
Show older comments
Hi,
I am currently trying to export single Simscape components as FMUs.
How do i create an interface to e.g. the physical water flow inside a pipe? I can only interface to Simulink signals, which can be converted to Simscape physical signals, but this doesn't help me. I need to create an interface directly to the specific Simscape domain, e.g. water, current, air,....
If i create PMC ports on root level, no interface is created for those in the FMU. There is barely any documentation on how to export Simscape models to FMU, especially single components.
I am aware I can export a whole Simscape model that later works as a black box and only interfaces via Simulink signals, but this doesn't help.
Best regards,
Christian
Answers (1)
Karan Singh
on 4 Sep 2023
0 votes
Hi Christian,
When exporting single Simscape components as FMUs, the interface is typically created through Simulink signals. However, if you need to create an interface directly to the specific Simscape domain, such as water flow in a pipe, you can use the Simscape “Connector” blocks.
The Simscape “Connector” blocks allow you to create custom interfaces for Simscape components. These blocks can be used to connect Simscape physical signals directly to the component, providing a more domain-specific interface.
You can follow the steps below to create an interface to the physical water flow inside a pipe using Simscape “Connector” blocks:
- Open your Simscape model and locate the pipe component you want to export as an FMU.
- Add a Simscape “Connector” block to the model. This block will serve as the interface for the water flow.
- Connect the Simscape “Connector” block to the appropriate ports of the pipe component. The specific connections will depend on the structure of your model and the desired interface.
- Configure the Simscape “Connector” block to match the physical domain and units of the water flow. You can set the port labels, units, and other properties in the block's dialog box.
Once you have created the desired interfaces using Simscape “Connector" blocks, you can export the Simscape component as an “FMU” using the “exportToFMU2CS” function.
Attached below are some documentation links that you may find helpful:
- Simscape Documentation (mathworks.com)
- Connectors and References - MATLAB & Simulink (mathworks.com)
- Export Simulink Model to Standalone FMU - MATLAB & Simulink (mathworks.com)
Hope this helps!
1 Comment
Venkatesh Venkadasamy
on 25 Apr 2024
I could fingure our the simscape connector block. Could you send me sample model?
Categories
Find more on Create Standalone FMU in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!