Skip to content

An interface between Vissim and PDDL planner. Can be used to run pre-built scripts or just as a library to read properties from vissim networks using VAP signal controllers.

Notifications You must be signed in to change notification settings

Divailo/FYP_tfl

Repository files navigation

FYP_tfl

A project which creates an interface between Vissim and a traffic PDDL+ planner. The classes of the project could also be used as an external library to extract properties of VAP signal controllers.

External libraries

PyWin32 : to enable communicating with COM.

Install

Before you install you need to make sure that:

  • Running Windows, because COM works only on Windows.

  • Python is isntalled in your machine.

  • Pip is added to your PATH system variable.

  • If you want to run the scripts Vissim will be needed.

To install the project all you have to do is run this command in terminal:

pip install ivaylotfl

Usage

There are two use cases of the project. You can either:

  1. Used the built scripts , or
  2. Use the project as an external library for personal projects.

Run built-in scripts

Gather Signal Controller Data in JSON and Construct PDDL file

Run in terminal:

extract_data_vissim

First you will have to choose a network to run the script for. A JSON file will be created in the same folder as the chosen network with all the data it has gathered. Then you will be asked where to save the newly-generated PDDL problem file. The file will be populated with all the data available from the JSON file.

Apply PDDL Results to Network

Run in terminal:

extract_data_vissim

First you will have to choose PDDL results file and then you will be asked for the network you want to edit. Make sure that the network you've chosen is the same the PDDL results are made for.

Use as external libraries

Some classes with sample usage and sample output for those files

Vissimhelper


from ivaylotfl import vissimhelper
import win32com.client as com

# start the program
vissim = initialise_vissim(com)
# load network
load_vissim_network(vissim, path_to_network)
# bring to front
bring_vissim_to_front(vissim)

get_signal_controllers(vissim)
>>> Collection of signal controllers 

Puahelper


from ivaylotfl import puahelper

read_and_map_signalgroups_from_pua(pua_filepath)
>>> {'A' : 1, 'B' : 2, 'C' : 3}

get_phases_in_stages_from_pua(pua_filepath)
>>> { 1 : [1,3], 2 : [2], 3 : [3] }

get_starting_stage_from_pua(pua_filepath)
>>> 1

get_max_stage_from_pua(pua_helper)
>>> 3

Vaphelper


from ivaylotfl import vaphelper

get_cycle_length_from_vap(vap_filepath)
>>> 72

get_stage_lenghts_from_vap(vap_filepath)
>>> [9,24,56]
You can get the JSON keys from jsonhelper

Contribute

To contribute to this project you can fork the project and submit a pull request. Make sure that all unit tests pass before submitting the merge request.

Future work

  • Handle no such file I guess

  • := used when declaring VAP variables -> not supported

  • Non-VAP SCs not supported

  • If original VAP file has no PLAN[x,y] = [];, then it won't work

About

An interface between Vissim and PDDL planner. Can be used to run pre-built scripts or just as a library to read properties from vissim networks using VAP signal controllers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published