Main Content

ScenarioSimulation

Create, access, and control scenario simulation

Since R2022a

    Description

    A ScenarioSimulation object is the representation of a RoadRunner Scenario simulation in MATLAB®. Use a ScenarioSimulation object to perform these actions.

    • Control a simulation: start, pause, resume, stop, or move the simulation a single step forward.

    • Access and modify the runtime parameters of a simulation.

    • Report custom diagnostic messages during a simulation.

    Creation

    You can create a ScenarioSimulation object using the createSimulation function.

    Object Functions

    addObserverAdd observer to scenario simulation
    getGet value of scenario simulation parameter
    loadLoad saved simulation log
    removeObserverRemove observer from scenario simulation
    reportDiagnostic Report information, warning or error message during scenario simulation
    saveSave simulation log to file for later use
    setSet value of scenario simulation parameter
    Simulink.ScenarioSimulation.findReturn scenario simulations or actors in current MATLAB session

    Examples

    collapse all

    Create a RoadRunner Scenario object and open a scenario file.

    rrApp = roadrunner('C:\Project\TestRoute');
    openScenario(rrApp,'TrajectoryCutIn');

    Create the corresponding ScenarioSimulation object and start the simulation.

    scenario = createSimulation(rrApp);
    set(scenario, 'SimulationCommand', 'Start'); 
    

    Version History

    Introduced in R2022a