queue_waits

models.queue_waits(trace)

Per-request waiting times, derived from a DESModel trace.

Pairs each request event with its grant for the same entity, intervention, iteration, and resource, and reports the wait between them. This is the pattern the design intends: queueing reports come from the event log, so analysis code never reaches into the engine.

Parameters

Name Type Description Default
trace pd.DataFrame The event log from run_psa(engine, draws, collect="events").events. required

Returns

Name Type Description
pd.DataFrame One row per served request with a wait column.

Example

import pandas as pd from heormodel.models.des import queue_waits trace = pd.DataFrame({ … “intervention”: [“s”, “s”], “iteration”: [0, 0], “entity”: [0, 0], … “t”: [1.0, 4.0], “event”: [“request”, “grant”], … “state”: [None, None], “resource”: [“clinic”, “clinic”]}) float(queue_waits(trace)[“wait”].iloc[0]) 3.0