histopath_bim_des.process.core module

Common definitions for salabim processes.

class histopath_bim_des.process.core.ArrivalGenerator(*args, schedule: ArrivalSchedule, env: Model, **kwargs)[source]

Bases: Component

Specimen arrival generator process.

iterator

Iterator yielding the arrival rate for each hourly period.

Type:

itertools.cycle

cls_args

Arguments passed to the Specimen constructor.

Type:

dict[str, Any]

setup(*, rates: list[float], **kwargs) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

The generator process. Creates a sub-generator for each interval (of length ARR_RATE_INTERVAL_HOURS) with the specified rate.

class histopath_bim_des.process.core.ResourceScheduler(*args, resource: Resource, schedule: ResourceSchedule, env: Model, **kwargs)[source]

Bases: Component

Resource scheduler class. The resource level is set every RESOURCE_ALLOCATION_INTERVAL_HOURS hours. The resource level is set to 0 if the day entry in the ResourceSchedule is 0.

resource

The resource to control the allocation of.

Type:

salabim.Resource

schedule

The resource schedule in dataclass form.

Type:

ResourceSchedule

env

The simulation model this arrival generator is attached to.

Type:

Model

setup(*, resource: Resource, schedule: ResourceSchedule) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

Change the resource capacity based on the schedule. Capacities are given in 30-min intervals.

class histopath_bim_des.process.core.BaseProcess(*args, env: Model, **kwargs)[source]

Bases: Component, ABC

A process with an in-queue. Typically does work on Components arriving to the in-queue and pushes completed components to another process’ in-queue.

in_queue

The in-queue of the process from which entities are taken.

Type:

salabim.Store

setup() None[source]

Set up the component, called immediately after initialisation.

abstract process() None[source]

Process launched by the simulation upon instantiation.

class histopath_bim_des.process.core.Process(*args, in_type: Type, fn: Callable[[Component], None], env: Model, **kwargs)[source]

Bases: BaseProcess

A looped processed that takes one entity from its in-queue at a time and activates it.

For example, Process(name=’do_this’, Specimen, do_this) creates Specimen.do_this = do_this and calls it for every arriving Specimen.

in_queue

The in-queue of the process from which entities are taken.

Type:

salabim.Store

in_type

The type of the entities to be processed.

Type:

Type

fn

The function to be activated by each new arrival to the process.

Type:

Callable

env

The simulation model this arrival generator is attached to.

Type:

Model

setup(in_type: Type, fn: Callable[[Component], None]) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

Process launched by the simulation upon instantiation.

histopath_bim_des.process.core.register_process(env: Model, in_type: Type, fn: Callable[[Component], None])[source]

Register a process to a simulation environment.

class histopath_bim_des.process.core.BatchingProcess(*args, batch_size: int | Callable[[], int], out_process: str, env: Model, **kwargs)[source]

Bases: BaseProcess, Generic[C]

Takes batch_size entites from in_queue and inserts a single instance of out_type to env.processes[out_process].in_queue.

batch_size

The batch size or its distribution. Can take salabim distributions or any other type with __call__ implemented.

Type:

int | Callable[[], int]

in_queue

The in-queue of the process from which entities are taken.

Type:

salabim.Store

out_process

The name of the process receiving the batch.

Type:

str

env

The simulation model this arrival generator is attached to.

Type:

Model

setup(batch_size: int | Callable[[], int], out_process: str) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

Process launched by the simulation upon instantiation.

class histopath_bim_des.process.core.CollationProcess(*args, counter_name: str, out_process: str, env: Model = None, **kwargs)[source]

Bases: BaseProcess

Takes entities from in_queue and places them into a pool. Once all entities with the same parent are found (based on comparing with a counter), the parent is inserted into env.processes[out_process].in_queue.

counter_name

The name of the counter in the parent entity defining the number of child entities.

Type:

str

in_queue

The in-queue of the process from which entities are taken.

Type:

salabim.Store

out_process

The name of the process receiving the reconstituted parent entity.

Type:

str

env

The simulation model this arrival generator is attached to.

Type:

Model

setup(counter_name: str, out_process: str) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

Process launched by the simulation upon instantiation.

class histopath_bim_des.process.core.RunnerDurations(collect: float | Distribution, out: float | Distribution, unload: float | Distribution, retur: float | Distribution)[source]

Bases: object

Durations for collecting/unloading the delivery batch and travelling to/from the destination.

collect: float | Distribution
out: float | Distribution
unload: float | Distribution
retur: float | Distribution
class histopath_bim_des.process.core.DeliveryProcess(*args, runner: Resource, durations: RunnerDurations, out_process: str, env: Model, **kwargs)[source]

Bases: BaseProcess

Takes entities/batches from the in_queue and places them in env.processes[out_process].in_queue, after some delay. A resource is required to move the entity/batch and requires time to travel between the locations associated with the two processes. Batches are unbatched upon arrival.

runner

The resource (e.g. staff) responsible for the delivery.

Type:

salabim.Resource

durations

Durations for collecting/unloading the delivery batch and travelling to/from the destination.

Type:

RunnerDurations

out_process

The name of the process receiving the delivery.

Type:

str

env

The simulation model this arrival generator is attached to.

Type:

Model

setup(runner: Resource, durations: RunnerDurations, out_process: str) None[source]

Set up the component, called immediately after initialisation.

process() None[source]

Process launched by the simulation upon instantiation.