Main Content

reportDiagnostic

Report information, warning, or error message during scenario simulation

Since R2022a

    Description

    reportDiagnostic(scenarioSim,MessageType,MessageString) reports a diagnostic message MessageString of the type MessageType (information, warning or error) from the scenarioSim object.

    example

    reportDiagnostic(actorSim,MessageType,MessageString) reports a diagnostic message MessageString of the type MessageType (information, warning or error) from the actorSim object.

    example

    Examples

    collapse all

    Create a ScenarioSimulation object by using the roadrunner and createSimulation functions.

    rrApp = roadrunner("C:\Project\TestHighwayRoute"); 
    openScenario(rrApp,"myScenario1"); 
    scenarioSim = createSimulation(rrApp); 

    Start the simulation.

    set(scenarioSim,"SimulationCommand","Start")

    Report a warning from the simulation. The diagnostic message is displayed in the output window of RoadRunner Scenario. If logging is enabled for the simulation, then the diagnostic message is also recorded by the ScenarioLog object.

    reportDiagnostic(scenarioSim,"Warning","Truck is running a red light!")

    Create a ScenarioSimulation object scenarioSim by using the roadrunner and createSimulation functions.

    rrApp = roadrunner("C:\Project\TestHighwayRoute"); 
    openScenario(rrApp,"myScenario1"); 
    scenarioSim = createSimulation(rrApp); 

    Start the simulation.

    set(scenarioSim,"SimulationCommand","Start")

    Get all the ActorSimulation objects from the simulation.

    actorSimulations = get(scenarioSim,"ActorSimulation")

    Report a warning from the second ActorSimulation object during the simulation. The diagnostic message is displayed in the output window of RoadRunner Scenario, preceded by a hyperlink of the actor name. If you click on the hyperlink, RoadRunner Scenario zooms in on the corresponding actor in the scene.

    reportDiagnostic(actorSimulations{2},"Warning",...
    "Truck is running a red light!")

    If logging is enabled for the simulation, then the diagnostic message is also recorded by the ScenarioLog object.

    Input Arguments

    collapse all

    RoadRunner Scenario simulation the diagnostic message is reported from, specified as a ScenarioSimulation object.

    Example: cityIntersection

    Actor simulation the diagnostic message is reported from, specified as an ActorSimulation object.

    Example: redSedan

    Type of diagnostic message to be displayed in the output window of RoadRunner Scenario, specified as one of these string values:

    • "Information" — Information message type. A reported information message does not affect progress of the simulation.

    • "Warning" — Warning message type. A reported warning does not affect progress of the simulation.

    • "Error" — Error message type. A reported error causes the simulation to stop.

    Data Types: string | char

    Diagnostic message to be displayed in the output window of RoadRunner Scenario, specified as a string or character vector.

    Example: "Blue sedan is approaching a dead end!"

    Version History

    Introduced in R2022a

    expand all