ambulance.Ambulance#
- class ambulance.Ambulance(env: Environment, base_location_ID: int, ENGINE_TYPE: str, ID: int, BATTERY_CAPACITY: float)#
A class to represent an ambulance.
- Variables:
env (sp.core.Environment) – The SimPy environment.
resource (sp.resources.resource.PreemptiveResource) – A preemptive resource used for events that occupy the ambulance.
assigned_to_patient (bool) – Whether the ambulance is currently assigned to a patient or not.
helps_patient (bool) – Whether the ambulance is currently helping a patient or not.
drives_to_base (bool) – Whether the ambulance is currently driving to its base or not.
charges (bool) – Whether the ambulance is currently charging or not.
current_location_ID (int) – The current location ID of the ambulance.
base_location_ID (int) – The base location ID of the ambulance.
battery (float) – The current battery level of the ambulance (kWh).
MAX_BATTERY_LEVEL (float) – The maximum battery level of the ambulance.
ENGINE_TYPE (str) – The engine type of the ambulance. “diesel” or “electric”.
ambulance_ID (int) – The ambulance ID.
charging_since (float) – The start time of the current charging session. Equal to
np.nan
if the ambulance is not charging.speed_charger (float) – The speed of the charger of the current charging session. Equal to
np.nan
if the ambulance is not charging.
- __init__(env: Environment, base_location_ID: int, ENGINE_TYPE: str, ID: int, BATTERY_CAPACITY: float) None #
Initializes an ambulance.
- Parameters:
env (sp.core.Environment) – The SimPy environment.
base_location_ID (int) – The base location of the ambulance.
ENGINE_TYPE (str) – The engine type of the ambulance. “diesel” or “electric”.
ID (int) – The ambulance ID.
BATTERY_CAPACITY (float) – The battery capacity of the ambulance.
Methods
__init__
(env, base_location_ID, ENGINE_TYPE, ...)Initializes an ambulance.
Adds battery decrease data to output_ambulance for an electric vehicle.
Adds battery increase data to output_ambulance for an electric vehicle.
add_ambulance_data_diesel
(idle, idle_time, ...)Adds data for a diesel vehicle to output_ambulance.
Calculates the battery increase due to charging until this moment.
Calculates the battery reduction and distance during driving.
Calculates the battery reduction during idling.
Calculates the charging time to reach a certain battery increase.
charge_at_base
(charging_stations_bases, ...)Charge at its base station.
charge_at_drop_off
(hospital_location_ID, ...)Charges the battery during patient handover.
charge_at_hospital
(hospital_location_ID, ...)Charge at a hospital.
charge_battery
(selected_charger, ...)Charges the ambulance battery and interrupts charging if necessary.
check_base_reachable
(SIMULATION_PARAMETERS, ...)Checks whether the base is reachable with the current battery level.
Checks whether the patient is reachable for the ambulance.
decrease_battery
(decrease_quantity)Decreases the battery with a certain amount.
drop_off_time
(patient_ID, ...)Drop the patient off at the hospital.
go_to_base_station
(SIMULATION_PARAMETERS, ...)Drive to its base station.
go_to_hospital
(patient_ID, ...)Drive to the hospital.
go_to_patient
(patient_ID, ...)Drive to the patient.
increase_battery
(increase_quantity)Increases the battery with a certain amount.
on_site_aid_patient
(patient_ID, ...)Help the patient on site.
process_patient
(patient_ID, ...)Processes a patient.
Selects a charging station based on current availability.
Sets the
assigned_to_patient
variable toTrue
.