uoa-ems-research / JEMSS.jl

Julia package for Emergency Medical Services Simulation
Apache License 2.0
13 stars 4 forks source link

To see the ambulance index dispatched in the output-file? #75

Open dsa27solver opened 4 months ago

dsa27solver commented 4 months ago

Hello Sam,

Could you help me with this question? How can I see the ambulance (index) that has been sent to every emergency call (with call-index also shown)? And also the time of every ambulance dispatched? Can I see all these data in the output-file “calls.csv”?

Thank you in advance for your attention. Best regards. Daniel

samridler commented 4 months ago

Hi Daniel, I think that the ambulance sent to an emergency call is stored on each call with call.ambIndex but it is not written to the calls.csv. As for the time of every ambulance dispatch, each call records when the final ambulance dispatched to the call occurred with call.dispatchTime, but if any ambulance is re-dispatched from one call to another then the first dispatch time will not be recorded.

dsa27solver commented 4 months ago

Thank you very much Sam for your answer. Is there any way to add the "call.ambIndex" data in the output file "calls.csv"?
Best regards.

samridler commented 4 months ago

You can set the call.attributes before calling writeStatsFiles(sim) to write additional fields to the calls.csv, though it will all be put in a single column where each cell has type Dict{String,Any}. To set the call.attributes use:

for call in sim.calls
    call.attributes["ambIndex"] = call.ambIndex
end

though if the simulation has multiple replications then use:

for rep in sim.reps, call in rep.calls
    call.attributes["ambIndex"] = call.ambIndex
end

If that doesn't work for you then I could try add the ambIndex as a column in calls.csv.