main.py#
This is the main interface of the simulator.
You can set all simulator parameters with this script and then run the simulator. Below, all parameters are discussed. The input data itself is discussed in the input data section of the website.
- Parameters:
START_SEED_VALUE (int) – The initial seed value. The seed of the ith run is equal to
START_SEED_VALUE + (i-1)
.DATA_DIRECTORY (str) – The folder, relative to the
ROOT_DIRECTORY
(automatically determined), where the input data is located.SIMULATION_INPUT_DIRECTORY (str | None) – The folder, relative to the
ROOT_DIRECTORY
(automatically determined), where the simulation input data is located ifLOAD_INPUT_DATA=True
. Otherwise it should beNone
.SIMULATION_OUTPUT_DIRECTORY (str) – The folder, relative to the
ROOT_DIRECTORY
(automatically determined), where the simulation output data should be saved.TRAVEL_TIMES_FILE (str) – The name of the file that contains the data with the siren travel times between nodes.
DISTANCE_FILE (str) – The name of the file that contains the data with the distance between nodes.
NODES_FILE (str) – The name of the file that contains the data with the nodes of the region.
HOSPITAL_FILE (str) – The name of the file that contains the nodes where hospitals are located.
BASE_LOCATIONS_FILE (str) – The name of the file that contains the nodes where bases are located.
AMBULANCE_BASE_LOCATIONS_FILE (str:) – The name of the file that contains the assignment of ambulances to bases.
SCENARIO (str) – The scenario. The following are valid: RB1, RB2, FB1, RB1_FB1, RB1_RH1, RB1_FH1, FB1_RH1, FB1_FH1, RB50_RH50, Diesel.
CHARGING_SCENARIO_FILE (str) – The name of the file that contains the charging scenario data.
SIMULATION_PATIENT_OUTPUT_FILE_NAME (str) – The name of the file where the patient dataframe will be saved.
SIMULATION_AMBULANCE_OUTPUT_FILE_NAME (str) – The name of the file where the ambulance dataframe will be saved.
RUN_PARAMETERS_FILE_NAME (str) – The name of the file where the run parameters will be saved.
RUNNING_TIME_FILE_NAME (str) – The name of the file where the running times will be saved.
SIMULATION_PRINTS_FILE_NAME (str) – The name of the file where the simulation prints will be saved.
MEAN_RESPONSE_TIMES_FILE_NAME (str) – The name of the file where the mean response time of each run will be saved.
EMP_QUANTILE_RESPONSE_TIMES_FILE_NAME (str) – The name of the file where the 95% empirical quantile of the response time of each run will be saved.
BUSY_FRACTIONS_FILE_NAME (str) – The name of the file where the empirical busy fraction of each run will be saved.
INTERARRIVAL_TIMES_FILE (str) – The name of the file with the interarrival times of the patients if
LOAD_INPUT_DATA=True
. Otherwise it should beNone
.ON_SITE_AID_TIMES_FILE (str) – The name of the file with the on-site aid times of the patients if
LOAD_INPUT_DATA=True
. Otherwise it should beNone
.DROP_OFF_TIMES_FILE (str) – The name of the file with the handover times at the hospital of the patients if
LOAD_INPUT_DATA=True
. Otherwise it should beNone
.LOCATION_IDS_FILE (str) – The name of the file with the patient arrival locations if
LOAD_INPUT_DATA=True
. Otherwise it should beNone
.TO_HOSPITAL_FILE (str) – The name of the file that specifies for each patient whether transportation to the hospital is required or not if
LOAD_INPUT_DATA=True
. Otherwise it should beNone
.NUM_RUNS (int) – The number of simulation runs.
PROCESS_TYPE (str) – The type of arrival process. Use “Time” to simulate an arrival process where patients arrive within
PROCESS_TIME
time. Use “Number” to simulate an arrival process wherePROCESS_NUM_CALLS
patients arrive.PROCESS_NUM_CALLS (int | None) – The number of patients that arrive if
PROCESS_TYPE="Number"
. Should beNone
ifPROCESS_TYPE="Time"
.PROCESS_TIME (float | None) – The time in minutes during which patients can arrive if
PROCESS_TYPE="Time"
. Should beNone
ifPROCESS_TYPE="Number"
.NUM_AMBULANCES (int) – The number of ambulances.
PROB_GO_TO_HOSPITAL (float | None) – The probability that a patient has to be transported to a hospital if
LOAD_INPUT_DATA=False
. Otherwise it should beNone
.CALL_LAMBDA (float | None) – The arrival rate parameter of the arrival Poisson process if
LOAD_INPUT_DATA=False
. Otherwise it should beNone
.AID_PARAMETERS (list[float | int]) – The parameters of the lognormal distribution for providing treatment on site. The first parameter is the sigma parameter, the second the location parameter , the third the scale parameter and the last the cut-off/maximum value.
DROP_OFF_PARAMETERS (list[float | int]) – The parameters of the lognormal distribution for the handover time at the hospital. The first parameter is the sigma parameter, the second the location parameter , the third the scale parameter and the last the cut-off/maximum value.
ENGINE_TYPE (str) – The engine type. Either “electric” or “diesel”.
IDLE_USAGE (float | None) – The energy consumption when idle/stationary in kW. If
ENGINE_TYPE="diesel"
it should beNone
.DRIVING_USAGE (float | None) – The energy consumption when driving in kWh/km. If
ENGINE_TYPE="diesel"
it should beNone
.BATTERY_CAPACITY (float) – The battery capacity of an electric ambulance. If
ENGINE_TYPE="diesel"
it is equal to infinity (i.e.,numpy.inf
)).NO_SIREN_PENALTY (float) – The penalty for driving without sirens. The driving times with siren are scaled according to this value. Should be between 0 and 1.
LOAD_INPUT_DATA (bool) – Whether the input data should be read from data (
True
) or generated before the simulation starts (False
).CRN_GENERATOR (str | None) – The pseudo-random number generator that should be used if LOAD_INPUT_DATA=False`. Either “Generator” for using NumPy’s default or “RandomState” for Numpy’s legacy generator. It should be
None
ifLOAD_INPUT_DATA=True
.INTERVAL_CHECK_WP (float | None) – The interval (in minutes) at which the simulator checks for waiting patients. If
ENGINE_TYPE="diesel"
it should beNone
.TIME_AFTER_LAST_ARRIVAL (float | None) – The time after the last arriving patient the simulator needs to check for waiting patients. If
ENGINE_TYPE="diesel"
it should beNone
.AT_BOUNDARY (float) – The warm-up period (in minutes) for the busy fraction calculation.
FT_BOUNDARY (float) – The cool-down period (in minutes) for the busy fraction calculation.
PRINT (bool) – If
True
, debug prints are provided that clarify the simulation process.PRINT_STATISTICS (bool) – If
True
, useful simulation statistics such as the mean response time are provided for each run.PLOT_FIGURES (bool) – If
True
, multiple plots are provided for each simulation run.SAVE_PRINTS_TXT (bool) – If
True
, the prints are saved toSIMULATION_PRINTS_FILE_NAME
.SAVE_OUTPUT (bool) – If
True
, saves the run parameters inRUN_PARAMETERS_FILE_NAME
, the running times inRUNNING_TIME_FILE_NAME
, the mean response time per run inMEAN_RESPONSE_TIMES_FILE_NAME
, the 95% empirical quantile of the response time per run inEMP_QUANTILE_RESPONSE_TIMES_FILE_NAME
and the empirical busy fraction inBUSY_FRACTIONS_FILE_NAME
.SAVE_PLOTS (bool) – If
True
, saves the plots. Can only beTrue
ifPLOT_FIGURES=True
.SAVE_DFS (bool) – If
True
, saves the ambulance dataframe of each run inSIMULATION_AMBULANCE_OUTPUT_FILE_NAME
(adding a run_i suffix) and the patient dataframe of each run inSIMULATION_PATIENT_OUTPUT_FILE_NAME
(adding a run_i suffix).DATA_COLUMNS_PATIENT (list[str]) – The columns for the patient DataFrame.
DATA_COLUMNS_AMBULANCE (list[str]) – The columns for the ambulance DataFrame.