To generate a Simulink model directly from the modeling tool 

  1. Right-click the Block HumidifierSystem and select Tools > Export to Simulink
  2. Set the options listed below and click OK:
    • Format: XML (.sdl)

    • S-Function or Simscape: S-Function version 2

  3. Launch Matlab with Simulink and Stateflow extensions.
  4. 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.

  5. In the Current Folder panel, double-click the file named HumidifierSystem.slx. The model will open up in a Simulink window.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. Go to Simulation > Run. Double-click on the Scope block to see the simulation results.