Giter Club home page Giter Club logo

jemss.jl's Introduction

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.

jemss.jl's People

Contributors

samridler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jemss.jl's Issues

Unknown package RasterIO

Can't install on Windows with Julia 0.6

julia> versioninfo()
Julia Version 0.6.0
Commit 903644385b* (2017-06-19 13:05 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

julia> Pkg.clone("https://github.com/samridler/AmbulanceSim.jl")
INFO: Cloning AmbulanceSim from https://github.com/samridler/AmbulanceSim.jl
INFO: Computing changes...
ERROR: unknown package RasterIO required by AmbulanceSim

Simulation Example fail

Hi all, I just fired up Julia for the first time. My goal is to use the JEMSS package for research purposes.

First of all,I could install and run JEMSS.

But,When I ran the Auckland City’s data with the file name unchanged but replaced it with data from a Japanese city, I got the following error.

julia> using JEMSS

julia> include(joinpath(JEMSS.jemssDir, “example/example.jl”))

Loading sim.

ERROR: LoadError: AssertionError: 1 <= ix && (ix <= grid.nx && (1 <= iy && iy <= grid.ny))

Stacktrace:

[1] locationToGridIndex(map::Map, grid::Grid, location::Location)

@ JEMSS C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\src\types\grid.jl:23

[2] findNearestNode(map::Map, grid::Grid, nodes::Vector{Node}, location::Location)

@ JEMSS C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\src\types\grid.jl:47

[3] initSim(configFilename::String; allowResim::Bool, createBackup::Bool, allowWriteOutput::Bool, doPrint::Bool)

@ JEMSS C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\src\run_config.jl:293

[4] initSim(configFilename::String)

@ JEMSS C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\src\run_config.jl:39

[5] top-level scope

@ C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\example\example.jl:4

[6] include(fname::String)

@ Base.MainInclude .\client.jl:451

[7] top-level scope

@ REPL[6]:1

in expression starting at C:\Users\natsuhikohara.julia\packages\JEMSS\3snbw\example\example.jl:4

Any help to fix this or to increase my understanding is highly appreciated.

the package can not precompile

Hi all, I have read your article and I am very encouraged by the role of JEMSS packages in the EMS field. However, when I started using the package, I encountered some problems that prevented JEMSS from working properly.

ERROR: LoadError: UndefVarError: _iszero not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base .\Base.jl:31
[2] top-level scope
@ C:\Users\15956.julia\packages\MutableArithmetics\mgg9J\src\dispatch.jl:287
[3] include(mod::Module, _path::String)
@ Base .\Base.jl:419
[4] include(x::String)
@ MutableArithmetics C:\Users\15956.julia\packages\MutableArithmetics\mgg9J\src\MutableArithmetics.jl:7
[5] top-level scope
@ C:\Users\15956.julia\packages\MutableArithmetics\mgg9J\src\MutableArithmetics.jl:92
[6] include
@ .\Base.jl:419 [inlined]
[7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
@ Base .\loading.jl:1554
[8] top-level scope
@ stdin:1
in expression starting at C:\Users\15956.julia\packages\MutableArithmetics\mgg9J\src\dispatch.jl:287
in expression starting at C:\Users\15956.julia\packages\MutableArithmetics\mgg9J\src\MutableArithmetics.jl:7
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile MutableArithmetics [d8a4904e-b15c-11e9-3269-09a3773c0cb0] to C:\Users\15956.julia\compiled\v1.8\MutableArithmetics\jl_5F89.tmp.
Stacktrace:
ERROR: Failed to precompile JEMSS [da3c27b9-5cdd-52db-94a3-a4eefd7acbab] to C:\Users\15956.julia\compiled\v1.8\JEMSS\jl_398C.tmp.
Stacktrace:

Any help to fix this problem is highly appreciated.

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

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

Example not running (Windows)

Hi

Upon installing and trying to run the example, this error appears in the 'loading sim' step

ERROR: LoadError: at row 0, column 0 : ArgumentError("number of rows in dims must be > 0, got 0")

Same error appears for any of the other examples. I've checked and the path to the config seems correct. Any ideas?

get_vertices in convert_osm_network not defined

Hello Sam,

Im trying to use JEMSS for the city Hamburg and downloaded a osm file and removed non-road objects via osmconvert. Next I wanted to calculate road arc travel times and write to csv via your run.jl code. I got this error:

ERROR: UndefVarError: get_vertices not defined
Stacktrace:
[1] readOsmNetworkFile(osmFilename::String; levels::Set{Int64}, boundsLLA::Nothing)
@ Main ~/.julia/packages/JEMSS/M2vZd/tools/network/convert_osm_network.jl:57

I think the function osm.getvertices in convert_osm_network.jl code is not part of the package OpenStreetMapX anymore. Do you have a solution for that issue?

Thank you in advance and best regards.
Elias

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.