UtilisationCalculator

Compute time-weighted ambulance utilisation from an event log.

Usage

Source

UtilisationCalculator(
    log,
    warm_up_period,
    data_collection_period,
    capacity,
)

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: int
Total number of ambulances.

Methods

Name Description
__init__() Initialise UtilisationCalculator.
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.
state_changes_df() Return the time-weighted ambulance utilisation intervals.

__init__()

Initialise UtilisationCalculator.

Usage

Source

__init__(log, warm_up_period, data_collection_period, capacity)
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
Total number of ambulances.

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()
Returns
float
Mean time-weighted ambulance utilisation.

state_changes_df()

Return the time-weighted ambulance utilisation intervals.

Usage

Source

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