主要内容

在灵敏度分析期间使用快速重新启动模式

This topic shows how to speed up sensitivity analysis using Simulink®快速重新启动。您可以使用快速重新启动功能来加快对的灵敏度分析可调参数of a model.

Fast restart enables you to perform iterative simulations without compiling a model or terminating the simulation each time. Using fast restart, you compile a model only once. You can then tune parameters and simulate the model again without spending time on compiling. Fast restart associates multiple simulation phases with a single compile phase to make iterative simulations more efficient. You see a speedup of design optimization tasks using fast restart in models that have a long compilation phase. SeeHow Fast Restart Improves Iterative Simulations.

When you enable fast restart, you can only change tunable properties of the model during simulation. For more information about the limitations, see限制.

您可以使用快速重新启动进行灵敏度分析灵敏度分析仪or at thecommand line.

快速重新启动的灵敏度分析仪工作流程

To evaluate a model using fast restart in the灵敏度分析仪:

  1. 打开Simulin金宝appk模型。

  2. Enable fast restart in the model.

    ClickFast Restart在模型窗口中。

  3. Open the灵敏度分析仪for the model.

  4. 指定参数集,生成参数样本,并指定灵敏度分析的要求。可选地指定评估设置。例如,请参阅Design Exploration Using Parameter Sampling (GUI)确定估计(代码)的关键参数.

  5. Click评估在快速重新启动模式下评估模型。评估参数集中参数值组合的每个组合。

  6. Disable fast restart.

    在模型窗口中,单击Fast Restart.

This functionality is not supported in金宝app仿真软件在线™.

快速重新启动的命令行工作流

You can use sensitivity analysis to evaluate which model parameters most influence a cost function. You can use these parameters during parameter estimation or response optimization. Suppose that you want to use sensitivity analysis to reduce the number of parameters that you need to estimate to fit a model.

To evaluate the model in fast restart mode using a cost function aimed at parameter estimation:

  1. 打开Simulin金宝appk模型。

  2. Specify the model parameter values,params, to estimate and generate parameter samples,params_samples. For an example, see确定估计(代码)的关键参数.

  3. Create an experiment object,经验.

    exp = sdo.permiment('model');

    Store the measured input-output data in经验. For an example, see确定估计(代码)的关键参数.

  4. Create a model simulator from the experiment.

    simulator = createSimulator(exp);

    Simulatoris ansdo.SimulationTest目的。

    Note

    You must create a simulation scenario with logging information before configuring the model for fast restart. You cannot modify logging information once the model has been compiled for fast restart.

  5. Configure the model and simulator for fast restart.

    模拟器= fastrestart(模拟器,,'on');
  6. Create a cost function,mycostfcn, and passSimulatorto the cost function as an input. For more information, see写一个成本功能. In the cost function, the simulator configured for fast restart is used to update the model parameters, simulate the model, and log signals.

    Use an anonymous function with one argument that callsmycostfcn.

    evalfcn = @(param) myCostfcn(param,Simulator,Exp);
  7. 评估the model.

    [param_opt,opt_info] = sdo.evaluate(evalfcn,param,param_samples);
  8. 还原模拟器快速重新启动设置。

    模拟器= fastrestart(模拟器,,'off');

The fast restart workflow is similar for sensitivity analysis that identifies design variables using a cost function aimed at response optimization. SeeUse Fast Restart Mode During Response Optimization.

Troubleshooting

Why Don’t I See the Evaluation Speedup I Expected Using Fast Restart?

You see a speedup of design optimization tasks using fast restart in models that have a long compilation phase. If the compilation phase of your model is not long, you do not see a significant change in estimation speed.

See Also

||

相关话题