To generate a Simulink model directly from the modeling tool
- Right-click the Block HumidifierSystem and select Tools > Export to Simulink.
- Set the options listed below and click OK:
Format: XML (.sdl)
S-Function or Simscape: S-Function version 2
- Launch Matlab with Simulink and Stateflow extensions.
- In Matlab’s Current Directory navigation bar, search for the file directory where the Simulink files (as well as the SysML files) are saved, and set it as the current directory. The Current Folder panel should display generated Simulink (.slx) files.
- In the Current Folder panel, double-click the file named HumidifierSystem.slx. The model will open up in a Simulink window.
- Open the Library Browser either by using the 4-block icon or by going to Tools > Library Browser. Find and click on Sinks among the list in the Libraries panel, which will be categorized under Simulink.
- Pull-and-drag the Scope block from the Sinks library list into the HumidifierSystem Simulink model. Attach a signal line segment from the Scope port onto the signal line that connects the humidity-out port of the room block to the humidity-in port of the humidifier block.
- Go to Simulation > Model Configuration Settings. This allows selecting the types of solver and the runtime of the simulation. Select a Start Time of 0.0, and a Stop Time of 3600. Under Solver Options, select the solver Type to Variable-step (or any other desirable solver that is suitable) and change the Max step size to 0.1. Press Apply, then press OK.
- Double-click the Scope block in the model. An empty (black) plot will show up. Press the ‘Scope’ parameters button (the gear icon above the empty plot). A ‘Scope’ parameters dialogue box will pop up. Go to the History tab and uncheck the option box Limit data points to last. Press Apply, and then OK.
- Go to Simulation > Run. Double-click on the Scope block to see the simulation results.