UtilisationCalculator

Compute time-weighted ambulance utilisation from an event log.

Usage

Source

UtilisationCalculator(
    log,
    warm_up_period,
    data_collection_period,
    capacity=None,
    capacity_log=None
)

Attributes

log: pd.DataFrame

Event log from a vidigi EventLogger.

warm_up_period: float

Length of the warm-up period - observations before this time are excluded.

data_collection_period: float

Length of the data collection period.

run_length: float

Total run length (including warm-up and data collection period).

capacity_log: pd.DataFrame
Record of ambulance capacity over time.

Methods

Name Description
__init__() Initialise UtilisationCalculator.
create_util_df() Return the time-weighted ambulance utilisation intervals.
from_model() Construct a UtilisationCalculator from a completed Model instance.
from_model_at_time() Construct a UtilisationCalculator from a running Model, up to now.
mean_utilisation() Return mean time-weighted ambulance utilisation.

__init__()

Initialise UtilisationCalculator.

Usage

Source

__init__(
    log,
    warm_up_period,
    data_collection_period,
    capacity=None,
    capacity_log=None
)
Parameters
log: pd.DataFrame

Event log from a vidigi EventLogger.

warm_up_period: float

Length of the warm-up period - observations before this time are excluded.

data_collection_period: float

Length of the data collection period.

capacity: int = None

Fixed number of ambulances available throughout the simulation. Provide this argument when capacity does not change over time. Exactly one of capacity or capacity_log must be provided.

capacity_log: list[dict] = None
Record of changes in ambulance capacity over time. Provide this argument when capacity varies during the simulation. Exactly one of capacity or capacity_log must be provided.

create_util_df()

Return the time-weighted ambulance utilisation intervals.

Usage

Source

create_util_df()
Returns
util_df: pd.DataFrame
Columns: time, busy, capacity, interval_duration, and utilisation. One row per state-change interval during the data collection period. busy is the number of ambulances in use during that interval.

from_model()

Construct a UtilisationCalculator from a completed Model instance.

Usage

Source

from_model(model)

This “classmethod” makes it easier to set up the UtilisationCalculator as you can just write UtilisationCalculator.from_model(model) instead of manually passing all the arguments.

Parameters
model: Model
A model instance that has already been executed (model.run()).
Returns
UtilisationCalculator

from_model_at_time()

Construct a UtilisationCalculator from a running Model, up to now.

Usage

Source

from_model_at_time(model, current_time)

Intended for use during warm-up audits, where the model has not yet finished. warm_up_period is forced to 0 and run_length is set to current_time so the full elapsed period is included.

This “classmethod” makes it easier to set up the UtilisationCalculator as you can just write UtilisationCalculator.from_model_at_time(model) instead of manually passing all the arguments.

Parameters
model: Model

A model instance that has been run up to current_time.

current_time: float
The simulation time to treat as the end of the observation window.
Returns
UtilisationCalculator

mean_utilisation()

Return mean time-weighted ambulance utilisation.

Usage

Source

mean_utilisation()

Calculated as total busy ambulance-minutes divided by total available ambulance-minutes. Accounts for interval duration and changes in available capacity.

Returns
float
Mean time-weighted ambulance utilisation.