Main Content

get

Get value of scenario simulation parameter

Since R2022a

    Description

    Output = get(ScenarioSim,Param) returns the value of the specified parameter Param from a scenario simulation ScenarioSim at run-time.

    example

    Examples

    collapse all

    Create a roadrunner object to launch the RoadRunner application, and open the project at the specified project location.

    rrApp = roadrunner("C:\Project\TestHighwayRoute");

    Open the scenario file TrajectoryCutIn.rrscenario that is included with the RoadRunner Scenario application.

    openScenario(rrApp,"TrajectoryCutIn");

    Create a ScenarioSimulation object ss.

    ss = createSimulation(rrApp);
    

    Get the current simulation status.

    simstatus = get(ss,"SimulationStatus");
    

    Get the log data history associated with the simulation.

    loggeddata = get(ss,"SimulationLog");

    Get the ActorSimulation objects corresponding to all actors in the scenario.

    actors = get(ss,"ActorSimulation");

    Get an ActorSimulation object from the scenario by using the handle to the Simulink® model that specifies the behavior of this actor.

    actorsim = get(ss,"ActorSimulation","SimulinkModel",mdHdl);

    Get an ActorSimulation object by using the System object™ that represents its run-time behavior. This operation is possible only if an actor is already associated with a MATLAB® System object.

    actorsysobj = get(ss,"ActorSimulation","SystemObject",obj);

    Get a specific actor using its corresponding ActorModel object name.

    actormod = get(ss,"ActorSimulation","ActorModel",actorModel);

    Retrieve all the sensors from the simulation.

    sensors = get(ss,"SensorSimulation");

    Input Arguments

    collapse all

    RoadRunner Scenario simulation, specified as a ScenarioSimulation object.

    Example: ScenarioSim

    Scenario simulation parameter, specified as one of these values:

    ParameterDescription
    "StepSize"Step size of simulation
    "MaxSimulationTime"Maximum simulation time of scenario
    "PacerStatus"Pacer status of simulation
    "SimulationPace"Pace of simulation
    "SimulationStatus"Status of simulation
    "SimulationLog"Logged simulation data
    "Logging"Logging status of simulation
    "ActorSimulation"Actors in simulation
    "ActorSimulation", "SimulinkModel", mdHdlActor in simulation corresponding to specified Simulink model handle
    "ActorSimulation", "SystemObject", objActor in simulation corresponding to specified System object
    "ActorSimulation", "ActorModel", actorModelActor in simulation corresponding to specified Simulink.ActorModel object
    "Observers"Observers attached to a simulation
    "SimulationTime"

    Simulation time

    "SensorSimulation"Sensors in simulation
    "Map"RoadRunner HD map for the scene used in scenario simulation
    "ScenarioServices"Service that allows you to perform calculations on RoadRunner scene or scenario

    Output Arguments

    collapse all

    Value of parameter, returned as one of these data types:

    ParameterData Type of Output
    "StepSize"Step size of simulation, returned as a double.
    "MaxSimulationTime"Maximum simulation time of scenario, returned as a double.
    "PacerStatus"Pacer status of simulation, returned as a char or string. Possible values are "on" and "off".
    "SimulationPace"Simulation pace, returned as adouble.
    "SimulationStatus"

    Simulation status, returned as a char or string. These are the possible values.

    • "Running" — The simulation is currently running.

    • "Stopped" — The simulation is stopped.

    • "Paused" — The simulation is paused.

    • "Unspecified" — Undefined simulation status.

    "SimulationLog"ScenarioLog object.
    "Logging"Logging status of simulation, returned as a char or string. Possible values are "on" and "off".
    "ActorSimulation"Cell array of ActorSimulation objects.
    "ActorSimulation", "SimulinkModel", mdHdlActorSimulation object.
    "ActorSimulation", "SystemObject", objActorSimulation object.
    "ActorSimulation", "ActorModel", actorModelActorSimulation object.
    "Observers"

    Structure array containing the following fields:

    • ObserverName — Name of the observer, returned as a character vector.

    • FilePath — Path of the System object file or Simulink file modeling an observer, returned as a character vector.

    "SimulationTime"

    Simulation time, returned as a double. You can get the value of the simulation time only while a simulation is playing. The function returns -1 before the start of the simulation, or after the end of the simulation.

    "SensorSimulation"SensorSimulation object.
    "Map"roadrunnerHDMap object.
    "ScenarioServices"ScenarioServices object.

    Version History

    Introduced in R2022a

    expand all