Documentation

模拟Pacing

模拟起搏使您能够减慢模拟来理解和观察系统的行为。以较慢的速率可视化模拟使您更容易理解基础系统设计,识别设计问题并证明近乎实时的行为。您可以在仿真进行时查看结果并检查系统。放慢示波器中的动画,以观察系统如何以及何时更改状态。

模拟pacing is useful in scenarios where one simulation-second is completed in a few wall clock time milliseconds. You can also manually interact with the model while it is running at a slower rate, which can help you to explore how your changes affect the simulation behavior. Note that the simulation will run at an approximation of the specified pace.

To start, specify the rate of simulation. This rate is a ratio of elapsed simulation time to elapsed wall clock time.

Using Simulation Pacing

This example shows how to use simulation pacing during a simulation.

  1. Open thevdpmodel.

    vdp
  2. In the Simulation menu, click起搏选项

  3. In the Simulation Pacing Options dialog, select theEnable pacing to slow down simulation。On enabling, the specified pace gets automatically aplied to the simulation.

  4. Select the pace at which the model should run by using the slider or entering the pace in the模拟time per actual secondfield. This field also accepts values outside of the range on the slider. The value entered in the field can only be a finite positive number.

  5. 在模拟模型时,您可以在示波器中指定的速度下观看模拟进度。您还可以通过对话框更改步伐,并在模拟运行时启用/禁用起搏。

要从命令行启用起搏,请使用set_param(型号,'enable -pacing','on')command. To enter the value useset_param(model, 'PacingRate', value)该值是有限的正数。

Therun按钮更改为, when a simulation is run with Pacing enabled. The status bar indicates if a simulation is running with pacing enabled. It also indicates if the simulation can not run at the specified pace.

Using Simulation Pacing with Dashboard library blocks

This example shows how to adjust simulation pacing while interacting with the simulation using Dashboard library blocks.

The example uses thesldemo_househeatmodel, which is a system that models the thermal characteristics of a house, its outdoor environment, and a house heating system. This model calculates heating costs for a generic house.

In this example, observe the effects of different outside temperatures on the heating cost. The goal of this example is to determine the outside temperature for which the heating cost stays stable at 15 dollars. Use the Knob block from the Dashboard library to change the outside temperatures while the simulation is running. This model is set up such that it simulates the system over a period of several days.

Open the model.

sldemo_househeat

添加Knobblock, from the Dashboard library. To control the temperature, connect it to the Average Outdoor Temperature block. To connect the blocks, double-click the Knob block, then click on the Average Outdoor Temperature block and confirm your selection connect in the Knob block dialog box by selecting theConnectradio button in the Knob block dialog box.

In the Simulation menu, click起搏选项。将速度设置为每壁时钟的近似值为0.8模拟时间。

Simulate the model. Observe the simulation run in the scope.

While the simulation is running, change the Average Outdoor Temperature in the Knowb block to observe the heat cost. On observing the simulation at a slower pace, you can see that the heat cost is 15 dollars at 61 degrees Farenheit.

Limitations

  • 模拟pacing is not compatible with:

    • 模拟stepper

    • Profiler

  • 模拟pacing is not supported in rapid accelerator mode

See Also

||

Was this topic helpful?