ambulance_simulation.ambulance_drive_process#
- ambulance_simulation.ambulance_drive_process(env: Environment, ambulance: Ambulance, charging_stations: dict[str, dict[str, list[simpy.resources.resource.Resource | float]]], SIMULATION_PARAMETERS: dict[str, Any], SIMULATION_DATA: dict[str, Any])#
 The ambulance drive process to its base.
If the ambulance is a diesel vehicle, the ambulance immediately drives to its base. If the ambulance is an electric vehicle, it is first checked whether the ambulance can reach its base without charging. If not, the ambulance first charges at the hospital. Otherwise, it droves to its base. Once arrived, it starts charging. Note that charging and driving to the base are interruptible.
- Parameters:
 env (sp.core.Environment) – The SimPy environment.
ambulance (Ambulance) – The ambulance object.
charging_stations (dict[str, dict[str, list[sp.resources.resource.Resource | float]]]) – The charging stations resources at all bases and all hospitals together with their charging speeds.
SIMULATION_PARAMETERS (dict[str, Any]) – The simulation parameters. The parameters
ENGINE_TYPEandPRINTare at least necessary. Note that methods that are called within this method may require more parameters. Seemain.pyfor parameter explanations.SIMULATION_DATA (dict[str, Any]) – The simulation data.
NODES_HOSPITALis at least necessary. It is based onHOSPITAL_FILE. Seemain.pyand the input data section on the ELASPY website for explanations. Note that methods that are called within this method may require more data.
- Raises:
 Exception –
If the base is not reachable, but the ambulance is not at the hospital. 2. If the base is not reachable, but there are no chargers at the hospital. 3. If charging at the hospital is interrupted, since this cannot happen with the implemented check_patient_reachable() method.