Main Content

setup

Configure simulation scenario and model for optimization and evaluation

Since R2024a

    Description

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

    1. Configure 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, configure 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 scenario and model are not configured for fast restart.

    simulator_out = setup(simulator,FastRestart='on') enables or disables fast restart for the simulation scenario 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 = "sdoHydraulicCylinder";
    open_system(model)
    

    Create a simulation scenario 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.

    Ac = sdo.getParameterFromModel(model,"Ac");
    Ac.Value = 0.5;
    simulator.Parameters = Ac;
    

    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 scenario for Simulink model, specified as an sdo.SimulationTest object. A simulation scenario specifies input signals, model parameter and initial state values, and signals to log for a model.

    Output Arguments

    collapse all

    Configured simulation scenario, returned as an sdo.SimulationTest object.

    Version History

    Introduced in R2024a