Main Content

set

Set value of scenario simulation parameter

    Description

    example

    set(ScenarioSim,Name=Value) sets the value of the specified parameter in the Simulink.ScenarioSimulation object ScenarioSim.

    Examples

    collapse all

    Create ss, a Simulink.ScenarioSimulation object

    rrApp = roadrunner('C:\Project\TestHighwayRoute'); 
    openScenario(rrApp,'myScenario1'); 
    ss = createSimulation(rrApp); 

    Set the simulation step size.

    set(ss,StepSize=0.02)

    Set the maximum simulation time.

    set(ss,MaxSimulationTime=1200) 

    Set the simulation pacer status.

    set(ss,PacerStatus='on')  

    Set the simulation pace.

    set(ss,SimulationPace=1)   

    Set command to pause the simulation.

    set(ss,SimulationCommand='Pause')

    Turn on logging for the simulation.

    set(ss,Logging='On')

    Input Arguments

    collapse all

    RoadRunner Scenario simulation, specified as a Simulink.ScenarioSimulation object.

    Example: set(ss,MaxSimulationTime=1000)

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: set(ss,SimulationCommand='Start') starts playing the specified simulation.

    Step size of the simulation in seconds, specified as a double. The default value is 0.02 seconds.

    Maximum simulation time in seconds, specified as a double. The default value is 1000 seconds.

    Pacer status of the simulation, specified as one of these strings.

    • On — Pacing is turned on. You can slow down or speed up the simulation.

    • Off — Pacing is turned off. You cannot slow down or speed up the simulation.

    Pace of the simulation, specified as a double. Indicates speed of the simulation run.

    Logging status of the simulation, specified as one of these strings.

    • On — Logging is turned on. You can retrieve simulation and actor information at each time step.

    • Off — Logging is turned off. You cannot retrieve simulation and actor information at each time step.

    Command to control simulation, specified as one of these strings.

    • Start — Start playing an unstarted or stopped simulation.

    • Pause — Pause a running simulation.

    • Continue — Continue playing a paused simulation.

    • Stop — Stop playing a running or paused simulation.

    Version History

    Introduced in R2022a