Main Content

set

Set value of scenario simulation parameter

Since R2022a

    Description

    example

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

    set(ScenarioSim,'SimulationCommand','Replay',FileName) replays the scenario ScenarioSim from the file FileName when the replay command is issued.

    Examples

    collapse all

    Create ss, a 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 ScenarioSimulation object.

    Example: set(ss,MaxSimulationTime=1000)

    Name of the file with .rrsimlog extension from which a scenario simulation is replayed, returned as a string or character vector. A simulation log can be replayed only if the linked .rrscenario and .rrscene files have not been modified after the simulation log was saved.

    If a scenario is open in theRoadRunner Scenario editor, and you then try to replay a different scenario from the corresponding simulation log, then the latter scenario also opens before its replay sequence begins.

    Example: set(ScenarioSim,"SimulationCommand","Replay","simulationLogFile1") replays a scenario from a simulation log file named simulationLogFile1.rrsimlog in the current folder.

    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.

    Maximum simulation time in seconds, specified as a double.

    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. The pace 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.

    • "Step" — Move the simulation forward by one time step.

    • "Replay" — Replay a scenario from the simulation log stored in FileName.

    Version History

    Introduced in R2022a

    expand all