des_hems.DES_HEMS

des_hems.DES_HEMS(
    run_number,
    sim_duration,
    warm_up_duration,
    sim_start_date,
    amb_data,
    random_seed,
    demand_increase_percent,
    activity_duration_multiplier,
    print_debug_messages,
)

The DES_HEMS class

This class contains everything require to undertake a single DES run for multiple patients over the specified duration.

NOTE: The unit of sim is minutes

Methods

Name Description
add_patient_result_row Convenience function to create a row of data for the results table
calls_per_hour Function to return a dictionary of keys representing the hour of day
generate_calls Call generator
patient_journey Send patient on their journey!
predetermine_call_arrival Function to determine the number of calls in
run Function to start the simulation.
store_patient_results Adds a row of data to the Class’ result_df dataframe
write_all_results Writes the content of result_df to a csv file
write_run_results Writes the content of result_dfs to csv files that contains only the results from the

add_patient_result_row

des_hems.DES_HEMS.add_patient_result_row(
    patient,
    time_type,
    event_type,
    **kwargs,
)

Convenience function to create a row of data for the results table

calls_per_hour

des_hems.DES_HEMS.calls_per_hour(quarter)

Function to return a dictionary of keys representing the hour of day and value representing the number of calls in that hour

generate_calls

des_hems.DES_HEMS.generate_calls()

Call generator

Generate calls (and patients) until current time equals sim_duration + warm_up_duration. This method calculates number of calls per day and then distributes them according to distributions determined from historic data

patient_journey

des_hems.DES_HEMS.patient_journey(hems_res, patient, secondary_hems_res)

Send patient on their journey!

predetermine_call_arrival

des_hems.DES_HEMS.predetermine_call_arrival(current_hour, quarter)

Function to determine the number of calls in 24 hours and the inter-arrival rate for calls in that period Returns a list of times that should be used in the yield timeout statement in a patient generator

run

des_hems.DES_HEMS.run()

Function to start the simulation.

store_patient_results

des_hems.DES_HEMS.store_patient_results(results)

Adds a row of data to the Class’ result_df dataframe

write_all_results

des_hems.DES_HEMS.write_all_results()

Writes the content of result_df to a csv file

write_run_results

des_hems.DES_HEMS.write_run_results()

Writes the content of result_dfs to csv files that contains only the results from the single run

Note that this cannot be done in a similar manner to write_all_results due to the impacts of the parallisation approach that is taken with joblib - depending on process timings it can lead to not all