Main Content

Simulate Virtual Vehicle During Braking Maneuver on Highway

To build your virtual vehicle, use the Virtual Vehicle Composer. After you build your virtual vehicle model, you can change the model configuration to simulate standard vehicle testing maneuvers and the visualization environment. This example shows you how to simulate a virtual vehicle model, ConfiguredVirtualVehicleModel, in a 3D visualization environment during a braking maneuver on a highway.

Configured virtual vehicle Simulink model.

Tip

Before you start, make sure your virtual vehicle is configured with Vehicle dynamics set to Combined Longitudinal and Lateral Dynamics.

To configure your virtual vehicle for a braking maneuver, follow these steps.

Workflow StepDescription

Step 1: Configure Virtual Vehicle Model

After you build your virtual vehicle model, change the model configuration to simulate standard testing maneuvers like the braking test.

Step 2: Configure 3D Visualization

Specify the 3D visualization environment.

Step 3: Set Scene and Vehicle Starting Location

Specify the maneuver scene and vehicle starting location. In this example, specify a highway scene with vehicle at the recommended starting location.

Step 4: Run Simulation

On the ConfiguredVirtualVehicleModel toolstrip, click Run.

Step 1: Configure Virtual Vehicle Model

After you build your virtual vehicle model, change the model configuration to simulate standard testing maneuvers. In this example, update the Scenarios and Driver Commands subsystems to specify a braking maneuver.

Scenarios

In the configured vehicle model, in Scenarios, select the Braking variant.

  1. In ConfiguredVirtualVehicleModel, right-click Scenarios and select Mask > Look Under Mask.

  2. Right-click Reference Generator and select Variant > Label Model Active Choice. Select the maneuver. For this example, select Braking. The model implements the Acceleration and Braking block.

    Reference generator variant set to braking

    Note

    Your configured virtual vehicle model uses the block that corresponds to the maneuver that you select. For example, if you select Double Lane Change, the model implements the Lane Change block.

  3. In Scenarios, navigate to Reference Generator > Drive Cycle and open the Acceleration and Braking block. Click Help to learn more about the parameters. For this example, accept the parameter default values.

    Braking maneuver block mask.

  4. Save ConfiguredVirtualVehicleModel.

Driver Commands

In the configured vehicle model, in Driver Commands, select the Longitudinal Driver variant.

  1. In ConfiguredVirtualVehicleModel, on the Driver Commands block, right-click and select Mask > Look Under Mask.

  2. On Driver Commands, right-click and select Variant > Label Model Active Choice. Select the driver. For this example, select Longitudinal Driver. The model implements the Longitudinal Driver block.

    Driver command variant set to longitudinal driver

  3. Save ConfiguredVirtualVehicleModel.

Step 2: Configure 3D Visualization

Update and configure the Visualization and Environment subsystems for the 3D visualization environment.

Visualization

In the configured vehicle model, in Visualization, select the Engine3D variant.

  1. In ConfiguredVirtualVehicleModel, right-click Visualizations and select Mask > Look Under Mask.

  2. On 3D Engine, right-click and select Variant > Label Model Active Choice. Select the 3D environment. For this example, select Engine3D to enable 3D visualization.

    3D environment variant set to on

  3. Save ConfiguredVirtualVehicleModel.

Environment

In the configured vehicle model, in Environment, select the Engine3D variant.

  1. In ConfiguredVirtualVehicleModel, right-click Environment and select Mask > Look Under Mask.

  2. Right-click Ground Feedback and select Variant > Label Model Active Choice. For this example, select 3D Engine for 3D visualization.

    3D environment variant set to on

Step 3: Set Scene and Vehicle Starting Location

Specify the maneuver scene and vehicle starting location. In this example, specify a highway scene with vehicle at the recommended starting location. Also specify the scene view.

  1. In the Visualization > 3D Engine subsystem, open the Simulation 3D Scene Configuration block.

    Simulation 3D Scene Configuration block on model canvas.

    For this example, set these Simulation 3D Scene Configuration block parameters:

    • Scene name to US Highway

    • Scene view to SimulinkVehicle1

    Click Apply and save the model.

  2. Open the Model Explorer.

  3. In the Model Hierarchy pane, navigate to ConfiguredVirtualVehicleModel > External Data > VirtualVehicleTemplate.

  4. In the list of Referenced Dictionaries, select PassVeh. Click Open.

    Virtual vehicle template passveh data dictionary

  5. In the Model Hierarchy pane, select ConfiguredVirtualVehicleModel > PassVeh > Design Data.

  6. Set the data dictionary variable value to the initial vehicle position values recommended for the scene. For this example, use these recommended values for the US Highway scene.

    Data Dictionary VariableDescriptionRecommended Value
    PlntVehInitLongPos

    Recommended starting location - X

    3592.00

    PlntVehInitLatPos

    Recommended starting location - Y

    2617.00

    PlntVehInitVertPos

    Recommended starting location - Z

    1.00

    PlntVehInitRollAng

    Recommended starting location - Roll

    0

    PlntVehInitPitchAng

    Recommended starting location - Pitch

    0

    PlntVehInitYawAng

    Recommended starting location - Yaw

    0

  7. In the PassVeh data dictionary, confirm the variable values match the recommended starting values for the scene.

    Virtual vehicle template passveh data dictionary

  8. In the Model Explorer, save the PassVeh changes.

Step 4: Run Simulation

On the ConfiguredVirtualVehicleModel model toolstrip, click Run. As the simulation runs, view the results in the Simulation 3D Viewer. For this example, view a braking maneuver on a highway.

See Also

| | |

Related Examples

More About