[Discussion] Improve state and event logging
For both state and event logs, at each time step, we log the reports to a log file that we open at the start of the simulation.
Each of these reports get written to the logs as a single json line like the below for a vehicle state event.
{"vehicle_id": "v13", "memberships": "", "vehicle_state": "ChargingStation", "balance": 511.2542478929938, "distance_traveled_km": 340.20714338784205, "energy_ELECTRIC": 13.58399203772548, "link_link_id": "176107959-176080957", "link_geoid": "8f268cdacadc186", "sim_time": "1970-01-01T17:51:00", "report_type": "VEHICLE_STATE"}
Some downsides of this approach are:
- performance hit writing to file at each time step
- difficulty parsing the results afterwards since each entry into the log can have different entries for different report types
- large file sizes for big simulations
This issue is intended as a discussion for ways to improve the reporting and then we can implement more issues for the ideas that come from it.
One idea is that we could at least write each report type to a dedicated file (rather than a single log file for all states and all events). In that way, we would eliminate the report_type information, and, we could write to file in different formats, like csv, since the report keys will always be the same for each report type.