Skip to content

uoa-ems-research/JEMSS.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JEMSS.jl

Julia package for Emergency Medical Services Simulation

Installation

To install and build this package, run the following command in the Pkg REPL mode (entered by pressing ] from the Julia REPL; press backspace to get back):

pkg> add https://github.com/uoa-ems-research/JEMSS.jl

Simulation example

To run an example script that loads and runs a simulation and then writes statistics to files:

using JEMSS
include(joinpath(JEMSS.jemssDir, "example/example.jl"))

This example is for Auckland city, focusing on the urban area. The simulation is initialised from a configuration file (sim_config.xml) which contains a list of input files (files for ambulances, calls, stations, road network, etc.) and other parameters. The output files will be written to the folder example/output. The first time that this script is run it will take an additional minute or so to compute and serialise the all-pairs shortest-path data for the road network; subsequent runs will be faster as they read the serialised data. After this script has been run, the simulation can be animated with animate!(sim).

A list of further example scripts that may be useful can be found in example/other_examples.jl.

Cities

The package includes these city (/island/region) models: Auckland, New Zealand; Edmonton, Alberta, Canada; Manhattan Island, New York, USA; and Utrecht, Netherlands. Example scripts to simulate these cities can be found in example/other_examples.jl. The models are not exact replicas of the cities, but they are at least city-like. More information on the city models (sources, simulation results) is available in this pdf document (on Google drive).

Animation

To animate a simulation:

using JEMSS
sim = initSim("config_filename");
animate!(sim; port = 8001)

The call to animate! will open a web browser window to localhost:8001 (other port numbers may be used). The connection may take a few seconds to be established. The browser window, using Mapbox, will show a map containing the sim region, the ambulances, hospitals, stations, and roads. Controlling the animation is done with buttons and text input in a box at the bottom right of the window. To have lines drawn between each ambulance and its destination, check the 'Show destinations' box. The 'Show road arcs' check-box is provided so that the road network arcs can be hidden, which reduces the computation required to display the city while the simulation is running.

animation_frame

Notes on animation:

  • Firefox and Chrome work, Edge does not work well, other browsers have not been tested.
  • Multiple browser windows may use the same port.
  • For the timing control, 'Sim speed' is the ratio of simulation time to real time; speed of 1 gives real-time (real slow) simulation. This requires the input files to have time units in days.
  • Input files should have (latitude, longitude) coordinates, these correspond with the y and x fields in the input files.

Misc

For solving linear and integer programs, CBC and GLPK solvers are used, though Gurobi will be used (for difficult problems such as p-median and DDSM in JEMSS) if it is installed along with the Gurobi.jl package, as Gurobi generally solves faster.

Backslashes are special characters in Julia strings and so if a path includes backslashes (e.g. "path\to\file.txt"), it needs to be handled as a raw string (raw"path\to\file.txt").

Adding cities

If you have a city model that you would like to add, please submit a pull request. Cities should follow the same folder structure as those existing (in data/cities), with a data folder containing the raw data along with any sources and licenses, and a model folder containing the input files for the calls, stations, road network, etc. Note that any large files should be compressed as a .zip file.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.