ambulance_simulation.patient_generator#

ambulance_simulation.patient_generator(env: Environment, ambulances: list[ambulance.Ambulance], charging_stations: dict[str, dict[str, list[simpy.resources.resource.Resource | float]]], location_IDs: ndarray, simulation_times: dict[str, numpy.ndarray], to_hospital_bool: ndarray, patient_queue: deque, SIMULATION_PARAMETERS: dict[str, Any], SIMULATION_DATA: dict[str, Any])#

Generates new patients and starts their aid process.

The patients are generated according to their interarrival times. If the patient can be helped immediately by an ambulance, the patient is assigned to an ambulance and the aid process starts. If this is not possible, then the patient waits in the patient queue until it can be helped.

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

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

  • 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.

  • location_IDs (np.ndarray) – Contains the initial location IDs of the patients.

  • simulation_times (dict[str, np.ndarray]) – Contains the interarrival times, the on-site aid times and the drop-off times.

  • to_hospital_bool (np.ndarray) – Specifies for each patient whether transportation to the hospital is required or not.

  • patient_queue (collections.deque) – The patient queue.

  • SIMULATION_PARAMETERS (dict[str, Any]) – The simulation parameters. The parameters NUM_CALLS and PRINT are 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. TIME_LAST_ARRIVAL (float) is at least necessary. It is the time of the last patient arrival. At the start of this method, this should be np.inf, since it is set in this method. Note that methods that are called within this method may require more data.