Importing MathWorks Simulink components
To import a MathWorks Simulink component, you must do steps in Simulink and in IBM® Engineering Systems Design Rhapsody®.
In MathWorks Simulink
Procedure
In Rhapsody
Procedure
Integration of the Simulink-generated code
About this task
When Simulink components are imported into a Rhapsody model, the .cpp files generated from the Simulink model using Simulink Coder are included as source files in the Rhapsody‑generated makefile.
In terms of Rhapsody‑generated code, SimulinkBlock elements in Rhapsody are
classes that are based on a framework class called OMSimulinkBlock
. The superclass
periodically calls the method doStep()
, which is implemented by the derived class.
This method initializes the input port, calls the step function in the Simulink‑generated .cpp file,
and sets the value of the output after the step. (The output is then relayed through the output flow
port.)
The doStep()
function will be generated once you assign the
SimulinkBlock with a Simulink model and use the Import/Sync Simulink Model menu command. Note
that an Embedded Coder License (ERT) is required for this operation.
Troubleshooting the integration of Simulink models
About this task
- If after importing or synchronizing with your Simulink model, you get an error
message about a missing file, langeng.dll, verify that the MATLAB
\bin\win32
folder is in your PATH environment variable. After adding it, you will have to restart Rhapsody and try reimporting. - If you get compilation errors regarding missing include files, look for them in the MATLAB installation directory. After locating them, you can add them to the include search path for the Rhapsody configuration.