licit-lab / symupy

SymuPy: A python API for SymuVia
https://symupy.readthedocs.io/en/stable/
MIT License
4 stars 3 forks source link

Feature/monitor #77

Closed floriangc closed 3 years ago

floriangc commented 3 years ago

This feature add monitoring fonctionalities to symupy, you might have to recreate the conda env.

To test it you can use the following code snippet:

from symupy.runtime.monitor import *

FILE = "/path/to/SingleLink_symuvia_withcapacityrestriction.xml"

manager = MonitorApp()
manager.add_monitor(SymuviaMonitorMFD(), 0, 0)
manager.add_monitor(SymuviaMonitorAccumulation(), 0, 1)
manager.add_monitor(SymuviaMonitorVEH([3,58], "speed"), 1, 0)
manager.add_monitor(SymuviaMonitorTTT(["L_0"], aggregation_period=1), 1, 1)
manager.add_monitor(SymuviaMonitorTTD(["L_0"], aggregation_period=1), 0, 2, rowspan=2)
manager.add_monitor(SymuviaMonitorFlux(["L_0"], aggregation_period=10), 2, 0, colspan=3)
manager.set_feeder(launch_simuflow(FILE))
manager.launch_app()

You will have to replace the variable FILE by the correct path to the file "SingleLink_symuvia_withcapacityrestriction.xml" (it can be found here: https://github.com/licit-lab/symupy-examples/blob/main/network/SingleLink/SingleLink_withcapacityrestriction.xml)