Main Content

setup

R2026b

Set up simulation configuration and model for optimization and evaluation

Since R2024a

    Description

    simulator_out = setup(simulator) sets up simulation configuration simulator and its associated Simulink® model for optimization and evaluation. This setting up includes the following steps:

    1. Set up the model to allow optimization of reference configuration sets.

    2. For parameter estimation using an sdo.Experiment object or sensitivity analysis using a signal-matching requirement, set up the model to produce outputs at the same times as the measured experiment data points.

    3. Activate signal logging, which the software uses to evaluate requirements and experiments.

    By default, the configuration and model are not set up for fast restart.

    simulator_out = setup(simulator,FastRestart='on') enables or disables fast restart for the simulation configuration and model. Fast restart configures the model to compile once when first simulated. Subsequent model simulations reuse the compiled data, speeding up subsequent simulation runs.

    example

    Examples

    collapse all

    Open the model.

    model = "sdoCSTR";
    open_system(model)
    

    Create a simulation configuration for the model.

    simulator = sdo.SimulationTest(model);
    

    Configure the model and simulator for optimization and simulation, enabling fast restart.

    simulator = setup(simulator,FastRestart="on");
    

    Simulate the model.

    simulator = sim(simulator);
    

    The first simulation in fast restart mode requires the model to compile. Subsequent simulations execute in fast restart mode and reuse the compiled data.

    Adjust tunable model parameters.

    A = sdo.getParameterFromModel(model,"A");
    A.Value = 0.6;
    simulator.Parameters = A;
    

    Simulate the model again.

    simulator = sim(simulator);
    

    The model simulates in fast restart mode.

    Restore the simulator to its initial configuration, which disables fast restart.

    simulator = restore(simulator);
    

    Input Arguments

    collapse all

    Simulation configuration for Simulink model, specified as an sdo.SimulationTest object. A simulation configuration specifies input signals, model parameter and initial state values, and signals to log for a model.

    Output Arguments

    collapse all

    Set up simulation configuration, returned as an sdo.SimulationTest object.

    Version History

    Introduced in R2024a