ambulance_simulation.check_select_ambulance#

ambulance_simulation.check_select_ambulance(env: Environment, ambulances: list[ambulance.Ambulance], patient: Patient, charging_stations_hospitals: dict[str, list[simpy.resources.resource.Resource | float]], SIMULATION_PARAMETERS: dict[str, Any], SIMULATION_DATA: dict[str, Any]) tuple[bool, int]#

Checks whether ambulances are available. If so, an ambulance is selected.

The closest ambulance that can be assigned is selected. In case of a tie, the ambulance with the lowest ID number is selected.

Parameters:
  • env (sp.core.Environment) – The SimPy environment.

  • ambulances (list[Ambulance]) – A list of ambulances.

  • patient (Patient) – The patient object.

  • charging_stations_hospitals (dict[str, list[sp.resources.resource.Resource | float]]) – The charging stations resources at all hospitals together with their charging speeds.

  • SIMULATION_PARAMETERS (dict[str, Any]) – The simulation parameters. The parameter PRINT is at least necessary. Note that methods that are called within this method may require more parameters. See main.py for parameter explanations.

  • SIMULATION_DATA (dict[str, Any]) – The simulation data. output_patient and SIREN_DRIVING_MATRIX are at least necessary. SIREN_DRIVING_MATRIX is based on TRAVEL_TIMES_FILE. See main.py and 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 ambulance drives to base but its resource is not used.

Returns:

  • PATIENT_ASSIGNED (bool) – Indicates whether the patient was assigned to an ambulance or not.

  • ambulance_ID (int) – The ambulance ID of the assigned ambulance. It is -1 if no ambulance was assigned.