Skip to content

A plugin to model Vehicle-in-Loop in TransModeler traffic simulation

Notifications You must be signed in to change notification settings

Caliper-Corporation/TsmXiL

Repository files navigation

TsmXiL Plugin

This is a plugin to model Vehicle-in-Loop in TransModeler traffic simulation. It is a class library (.dll) project.

Setup instructions

Prerequisites

  • Visual Studio 2019 or later or Visual Studio Code
  • .NET Framework 4.8
  • TransModeler 7.0 or later
  • A vehicle controller that can be connected to using TCP/IP

Build the plugin DLL

  • Clone this repository to your local machine
  • Open the project file (TsmXiL.csproj) in Visual Studio or Visual Studio Code
  • Compile the project to generate the plugin dll (TsmXiL.dll)
    • dotnet build .
  • Copy the plugin dll and related files to C:\temp\TsmXiL folder if they haven't been placed there by the build process

Load the plugin DLL in TransModeler

The plugin dll is loaded in TransModeler using the TsmXiL.dbd resource. To load in TransModeler,

  • Go to Simulation > Options... menu item and in the Call Every Simulation section in the Macros tab specify -

    1. Choose the C:\temp\TsmXiL\resource\TsmXiL.dbd file as UI Database by clicking on the "Choose" button
    2. InitializeTsmXiLPlugin macro for "At Start"
    3. DisconnectTsmXiLPlugin macro for "At End"
  • Click on the "OK" button to save the changes

  • Click the "Save" menu item from the main TransModeler menu to save the simulation project

    image info

Plugin functionality

The Manager.cs class connects this plugin with the TransModeler API and handles simulation events. The Start() method in Manager.cs is the entry point into the plugin code.

The Controller.cs class has an Update() method which is called during each simulation timestep which can be set to a custom value as desired. The Update() method internally calls UpdateRealVehicle() method which sends speed and acceleration commands to the real vehicle controller and receives acceleration and speed in response. It then calls the UpdateSimulationVehicle() method which updates the speed and acceleration of the simulated vehicle.

The Controller.cs class also has an AddVehicle() method which is called to add a new vehicle to the simulation. This method creates a new instance of the Vehicle class and adds it to the list of vehicles with the attributes specified in the configuration file (config.txt).

Configuration

Vehicle attributes

The config.txt file currently allows specifying the following attributes for the vehicle to be added -

  1. Origin (VehOriginLaneId)
  2. Destination (VehDestinationLaneId)
  3. Initial speed (VehInitialSpeed)
  4. Default acceleration (DefaultAcceleration)

Controller attributes

The configuration file also provides the following configuration options -

  1. Controller TCP IP Address (TcpAddress)
  2. Controller TCP Port (TcpPort)

Simulation attributes

  1. Simulation timestep (UpdateInterval)

About

A plugin to model Vehicle-in-Loop in TransModeler traffic simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published