Main Content

simulateScenario

Simulate RoadRunner scenario using MATLAB

Since R2024a

    Description

    simulateScenario(rrApp) simulates the current scenario of the specified RoadRunner Scenario application rrApp.

    simulateScenario(rrApp,Name=Value) sets options using one or more name-value arguments, such as optionally blocking additional commands from MATLAB® and other clients until the simulation is over, changing the pacing value, or enabling single-step start.

    Examples

    collapse all

    Simulate a scenario in RoadRunner Scenario using MATLAB, and set the option to enable additional command calls during simulation.

    Create a roadrunner object, specifying the path to an existing project. For example, this code shows the path to a project, on a Windows® machine, located at "C:\RR\MyProject". This code assumes that RoadRunner is installed in the default location, and returns an object, rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.

    rrApp = roadrunner(ProjectFolder="C:\RR\MyProject");

    Open an existing scenario in RoadRunner Scenario by using the openScenario function with the roadrunner object rrApp and the filename of the specific scenario that you want to open. This MATLAB code opens the desired scenario in RoadRunner Scenario.

    filename = "TrajectoryCutIn.rrscenario";
    openScenario(rrApp,filename)

    Run the simulation by using the simulateScenario function, and set IsBlocking to false to prevent RoadRunner Scenario from blocking additional calls from MATLAB or other clients during simulation.

    simulateScenario(rrApp,IsBlocking=false)

    Input Arguments

    collapse all

    RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common workflow tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

    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: simulateScenario(rrApp,IsBlocking=false) simulates the scenario without blocking additional calls from clients such as MATLAB.

    Pacing value, specified as a numeric scalar. This value controls how fast the simulation runs. A pacing value between .05 and 1 runs the simulation slower than real time, a value of 1 runs the simulation in real time, and a value between 1 and 20 runs the simulation faster than real time.

    Block calls from MATLAB and other clients during simulation, specified as a logical 1 (true) or 0 (false). If true, this function blocks additional calls from clients until the simulation ends. If false, clients execute additional calls immediately after the simulation starts.

    Single-step start, specified as a logical 1 (true) or 0 (false). If true, the function moves the simulation forward by one step if the simulation has not started yet. If false, the function starts the simulation.

    Version History

    Introduced in R2024a