Main Content

Initialize Model Using Operating Point from Logged Simulation Data

This example shows how you can create an OperatingPoint object from logged simulation data and then use this operating point to initialize the model for a subsequent simulation run.

  1. Open the Permanent Magnet DC Motor example model. At the MATLAB® command prompt, enter:


    This example model has data logging enabled for the whole model, with the Workspace variable name parameter set to simlog_PermanentMagnetDCMotor.

  2. Simulate the model to log the simulation data.

  3. Examine the simulation results in the Motor RPM scope window.

    For the first 0.1 seconds, the motor has no external load, and the speed builds up to the no-load value. Then at 0.1 seconds, the stall torque is applied as a load to the motor shaft.

  4. Create an operating point from logged simulation data at 0.1 seconds after the start of simulation:

    op = simscape.op.create(simlog_PermanentMagnetDCMotor, 0.1)
    op = 
      OperatingPoint with children:
       ChildId         Size
       ______________  ____
       'DC Motor'       1x1
       'DC Voltage'     1x1
       'ERef'           1x1
       'Load Torque'    1x1
       'MRRef Motor'    1x1
       'MRRef Torque'   1x1
       'Sensing'        1x1
       'Step Input'     1x1
  5. Enable model initialization from operating point:


    This command is equivalent to selecting the Enable operating point initialization check box in the Simscape pane of the Configuration Parameters dialog box.

  6. Specify the name of operating point:


    This command is equivalent to entering op in the Model operating point textbox.

  7. Simulate the model. The simulation now starts with the full no-load speed.

Related Topics