agentsoz / ees

Emergency Evacuation Simulator
MIT License
9 stars 6 forks source link

Generate evacuation metrics output file #48

Closed dhixsingh closed 4 months ago

dhixsingh commented 3 years ago

Generate a custom evacuation metrics output file at the end of a simulation. This to avoid having to post-process large MATSim output event files which is resource intensive.

dhixsingh commented 3 years ago

This is now available. The evacuation metrics can now be enabled through the simulation config file as follows: https://github.com/agentsoz/ees/blob/d9d70952d9ce3607bd6083c7300d7ec778ae0ed7/ees/scenarios/mount-alexander-shire/maldon-600/ees.xml#L41-L44 The two parameters specify the location for the output file as well as the size of the time bin (in secs) to compute metrics over (so 3600 would indicate that metrics should be computed in hourly time bins).

The output is a JSON file. A snippet from the output file produced by above test is below: https://github.com/agentsoz/ees/blob/d9d70952d9ce3607bd6083c7300d7ec778ae0ed7/ees/test/input/io/github/agentsoz/ees/Maldon600Test/test/metrics.json#L2-L18

The output snippet says that at time 43200 seconds past midnight, i.e., 12pm, on link 98315-98317-98319, which stretches from the from coordinates to the to coordinates (in WSG84), for the duration of the time bin (configured as 3600 seconds in the config above), a total of 1 vehicles exited the link, and a total of 1 person completed an activity. This would indicate a situation where a person was performing an activity at a location somewhere on the link, and where the activity started prior to this time bin but finished sometime during this time bin. The person then departed, and left the link also within the same time period.

Another interesting snippet from the same output is below: https://github.com/agentsoz/ees/blob/d9d70952d9ce3607bd6083c7300d7ec778ae0ed7/ees/test/input/io/github/agentsoz/ees/Maldon600Test/test/metrics.json#L131-L146

In this case 15 vehicles entered the link, and 14 exited, in the given time bin. Since no activities started (on finished) on the link in this instance, this would represent the situation that one vehicle is currently still driving on the link.

So the simple output above can be used to calculate for a given time bin and link, the volume of traffic that crossed the link, the volume currently on the link (i.e., still driving), activities currently being performed on the link (i.e., not driving), and such. More link based metrics can be added as needed.

Since the coordinates of the links are also provided, these metrics can easily be mapped to rasters/zones as per the visualisation needs downstream.

alexandritegalle commented 3 years ago
Screen Shot 2021-02-23 at 11 28 31 am

@dhixsingh is it possible to write this inifinity value as a String ?

dhixsingh commented 3 years ago

Available since a671232 @alexandritegalle. The generated JSON is now fully compliant. The Z values are all set to zero now by default (see below) so the JSON should parse correctly now.

https://github.com/agentsoz/ees/blob/a6712323ba5b45f1d1f1d9daebe3a277c984cab0/ees/test/input/io/github/agentsoz/ees/Maldon600Test/test/metrics.json#L5-L7

alexandritegalle commented 3 years ago

@dhixsingh Great! Thanks

alexandritegalle commented 3 years ago

@dhixsingh could you also output the capacity of the link in metric.json?

dhixsingh commented 3 years ago

Available since d8ede27 @alexandritegalle:

https://github.com/agentsoz/ees/blob/d8ede27e3b3258c820c547c3ac91b1ae4db64147/ees/test/input/io/github/agentsoz/ees/Maldon600Test/test/metrics.json#L3-L20

alexandritegalle commented 3 years ago

Great !

dhixsingh commented 3 years ago

Include the following basic metrics in the output:

dhixsingh commented 3 years ago

Since 606d1d9 point-in-time metrics are generated from the BDI model; see Maldon example output metrics.

Note however that since these metrics are generated from the BDI side, there is little insight into the MATSim side. So certain outputs like average speed and link volume utilisation are not possible; for that the EvacMetricTracker class should be updated accordingly.

dhixsingh commented 3 years ago

One issue is that in cases where agents enter stuckAndAbort state in MATSim, the metricsw calculation seems incorrect.

For instance, in test SCSMidweekInJanScenario2IT, on link 49705-49706-49707 the volumes reported by Via are: 49705-49706-49707-volumes

However, in the metrics file at time stamp 68430, we see:

        "49705-49706-49707": {
          "linkId": "49705-49706-49707",
          "from": {
            "name": "49705-49706-49707:324204850",
            "x": 785178.3054492786,
            "y": 5751545.1824029535
          },
          "to": {
            "name": "49705-49706-49707:324204855",
            "x": 785163.6753783969,
            "y": 5751529.251169311
          },
          "agentsDriving": 2475,
          "agentsInActivities": 1178
        },

The reported number of agents driving well exceeds the link capacity (vehicles/hr) of 1600.

Could be related to #49.

/cc @alexandritegalle