histopath_bim_des.model module

The histopathology simulation model.

Note that while Model class instances are constructed using Config instances, which are JSON serialisable, Model instances are themselves not serialisable.

class histopath_bim_des.model.Resources(env: Model)[source]

Bases: object

Dataclass for tracking the resources of a Model.

booking_in_staff: Resource
bms: Resource
cut_up_assistant: Resource
processing_room_staff: Resource
microtomy_staff: Resource
staining_staff: Resource
scanning_staff: Resource
qc_staff: Resource
histopathologist: Resource
bone_station: Resource
processing_machine: Resource
staining_machine: Resource
coverslip_machine: Resource
scanning_machine_regular: Resource
scanning_machine_megas: Resource
class histopath_bim_des.model.TaskDurations(*, receive_and_sort: Constant | Tri | PERT, pre_booking_in_investigation: Constant | Tri | PERT, booking_in_internal: Constant | Tri | PERT, booking_in_external: Constant | Tri | PERT, booking_in_investigation_internal_easy: Constant | Tri | PERT, booking_in_investigation_internal_hard: Constant | Tri | PERT, booking_in_investigation_external: Constant | Tri | PERT, cut_up_bms: Constant | Tri | PERT, cut_up_pool: Constant | Tri | PERT, cut_up_large_specimens: Constant | Tri | PERT, load_bone_station: Constant | Tri | PERT, decalc: Constant | Tri | PERT, unload_bone_station: Constant | Tri | PERT, load_into_decalc_oven: Constant | Tri | PERT, unload_from_decalc_oven: Constant | Tri | PERT, load_processing_machine: Constant | Tri | PERT, unload_processing_machine: Constant | Tri | PERT, processing_urgent: Constant | Tri | PERT, processing_small_surgicals: Constant | Tri | PERT, processing_large_surgicals: Constant | Tri | PERT, processing_megas: Constant | Tri | PERT, embedding: Constant | Tri | PERT, embedding_cooldown: Constant | Tri | PERT, block_trimming: Constant | Tri | PERT, microtomy_serials: Constant | Tri | PERT, microtomy_levels: Constant | Tri | PERT, microtomy_larges: Constant | Tri | PERT, microtomy_megas: Constant | Tri | PERT, load_staining_machine_regular: Constant | Tri | PERT, load_staining_machine_megas: Constant | Tri | PERT, staining_regular: Constant | Tri | PERT, staining_megas: Constant | Tri | PERT, unload_staining_machine_regular: Constant | Tri | PERT, unload_staining_machine_megas: Constant | Tri | PERT, load_coverslip_machine_regular: Constant | Tri | PERT, coverslip_regular: Constant | Tri | PERT, coverslip_megas: Constant | Tri | PERT, unload_coverslip_machine_regular: Constant | Tri | PERT, labelling: Constant | Tri | PERT, load_scanning_machine_regular: Constant | Tri | PERT, load_scanning_machine_megas: Constant | Tri | PERT, scanning_regular: Constant | Tri | PERT, scanning_megas: Constant | Tri | PERT, unload_scanning_machine_regular: Constant | Tri | PERT, unload_scanning_machine_megas: Constant | Tri | PERT, block_and_quality_check: Constant | Tri | PERT, assign_histopathologist: Constant | Tri | PERT, write_report: Constant | Tri | PERT)[source]

Bases: object

Dataclass for tracking task durations in a Model.

receive_and_sort: Constant | Tri | PERT
pre_booking_in_investigation: Constant | Tri | PERT
booking_in_internal: Constant | Tri | PERT
booking_in_external: Constant | Tri | PERT
booking_in_investigation_internal_easy: Constant | Tri | PERT
booking_in_investigation_internal_hard: Constant | Tri | PERT
booking_in_investigation_external: Constant | Tri | PERT
cut_up_bms: Constant | Tri | PERT
cut_up_pool: Constant | Tri | PERT
cut_up_large_specimens: Constant | Tri | PERT
load_bone_station: Constant | Tri | PERT
decalc: Constant | Tri | PERT
unload_bone_station: Constant | Tri | PERT
load_into_decalc_oven: Constant | Tri | PERT
unload_from_decalc_oven: Constant | Tri | PERT
load_processing_machine: Constant | Tri | PERT
unload_processing_machine: Constant | Tri | PERT
processing_urgent: Constant | Tri | PERT
processing_small_surgicals: Constant | Tri | PERT
processing_large_surgicals: Constant | Tri | PERT
processing_megas: Constant | Tri | PERT
embedding: Constant | Tri | PERT
embedding_cooldown: Constant | Tri | PERT
block_trimming: Constant | Tri | PERT
microtomy_serials: Constant | Tri | PERT
microtomy_levels: Constant | Tri | PERT
microtomy_larges: Constant | Tri | PERT
microtomy_megas: Constant | Tri | PERT
load_staining_machine_regular: Constant | Tri | PERT
load_staining_machine_megas: Constant | Tri | PERT
staining_regular: Constant | Tri | PERT
staining_megas: Constant | Tri | PERT
unload_staining_machine_regular: Constant | Tri | PERT
unload_staining_machine_megas: Constant | Tri | PERT
load_coverslip_machine_regular: Constant | Tri | PERT
coverslip_regular: Constant | Tri | PERT
coverslip_megas: Constant | Tri | PERT
unload_coverslip_machine_regular: Constant | Tri | PERT
labelling: Constant | Tri | PERT
load_scanning_machine_regular: Constant | Tri | PERT
load_scanning_machine_megas: Constant | Tri | PERT
scanning_regular: Constant | Tri | PERT
scanning_megas: Constant | Tri | PERT
unload_scanning_machine_regular: Constant | Tri | PERT
unload_scanning_machine_megas: Constant | Tri | PERT
block_and_quality_check: Constant | Tri | PERT
assign_histopathologist: Constant | Tri | PERT
write_report: Constant | Tri | PERT
class histopath_bim_des.model.Wips(env: Model)[source]

Bases: object

Dataclass for tracking work-in-progress counters for the Model simulation.

total: Monitor
in_reception: Monitor
in_cut_up: Monitor
in_processing: Monitor
in_microtomy: Monitor
in_staining: Monitor
in_labelling: Monitor
in_scanning: Monitor
in_qc: Monitor
in_reporting: Monitor
class histopath_bim_des.model.Globals(prob_internal: float, prob_urgent_cancer: float, prob_urgent_non_cancer: float, prob_priority_cancer: float, prob_priority_non_cancer: float, prob_prebook: float, prob_invest_easy: float, prob_invest_hard: float, prob_invest_external: float, prob_bms_cutup: float, prob_bms_cutup_urgent: float, prob_large_cutup: float, prob_large_cutup_urgent: float, prob_pool_cutup: float, prob_pool_cutup_urgent: float, prob_mega_blocks: float, prob_decalc_bone: float, prob_decalc_oven: float, prob_microtomy_levels: float, num_blocks_large_surgical: IntConstant | IntTri | IntPERT, num_blocks_mega: IntConstant | IntTri | IntPERT, num_slides_larges: IntConstant | IntTri | IntPERT, num_slides_levels: IntConstant | IntTri | IntPERT, num_slides_megas: IntConstant | IntTri | IntPERT, num_slides_serials: IntConstant | IntTri | IntPERT)[source]

Bases: object

Dataclass for global model variables.

prob_internal: float
prob_urgent_cancer: float
prob_urgent_non_cancer: float
prob_priority_cancer: float
prob_priority_non_cancer: float
prob_prebook: float
prob_invest_easy: float
prob_invest_hard: float
prob_invest_external: float
prob_bms_cutup: float
prob_bms_cutup_urgent: float
prob_large_cutup: float
prob_large_cutup_urgent: float
prob_pool_cutup: float
prob_pool_cutup_urgent: float
prob_mega_blocks: float
prob_decalc_bone: float
prob_decalc_oven: float
prob_microtomy_levels: float
num_blocks_large_surgical: IntConstant | IntTri | IntPERT
num_blocks_mega: IntConstant | IntTri | IntPERT
num_slides_larges: IntConstant | IntTri | IntPERT
num_slides_levels: IntConstant | IntTri | IntPERT
num_slides_megas: IntConstant | IntTri | IntPERT
num_slides_serials: IntConstant | IntTri | IntPERT
class histopath_bim_des.model.RunnerTimes(reception_cutup: float, cutup_processing: float, processing_microtomy: float, microtomy_staining: float, staining_labelling: float, labelling_scanning: float, scanning_qc: float, extra_loading: float, extra_unloading: float)[source]

Bases: object

Dataclass for runner times.

reception_cutup: float
cutup_processing: float
processing_microtomy: float
microtomy_staining: float
staining_labelling: float
labelling_scanning: float
scanning_qc: float
extra_loading: float
extra_unloading: float
class histopath_bim_des.model.Model(config: Config, **kwargs)[source]

Bases: Environment

The histopathology simulation model class.

num_reps

The number of simulation replications to run the model.

Type:

int

sim_length

The duration of each simulation replication.

Type:

float

resources

The resources associated with this model, as a dataclass instance.

Type:

Resources

task_durations

Dataclass instance containing the task durations for the model.

Type:

TaskDurations

batch_sizes

Dataclass instance containing the batch sizes for various tasks in the model.

Type:

config.batching.BatchSizes

globals

Dataclass instance containing global variables for the model.

Type:

Globals

specimen_data

Dict containing specimen attributes for all specimens in the simulation model (in-progress or completed).

Type:

dict[str,Any]

wips

Dataclass instance containing work-in-progress counters for the model.

Type:

Wips

processes

Dict mapping strings to the processes of the simulation model.

Type:

list[process.core.BaseProcess]

setup(config: Config) None[source]

Set up the component, called immediately after initialisation.

run() None[source]

start execution of the simulation

Parameters:
  • duration (float or distribution) –

    schedule with a delay of duration

    if 0, now is used

    if distribution, the distribution is sampled

  • till (float or distribution) –

    schedule time

    if omitted, inf is assumed. See also note below

    if distribution, the distribution is sampled

  • priority (float) –

    priority

    default: inf

    if a component has the same time on the event list, main is sorted accoring to the priority. The default value of inf makes that all components will finish before the run is ended

  • urgent (bool) –

    urgency indicator

    if False (default), main will be scheduled behind all other components scheduled with the same time and priority

    if True, main will be scheduled in front of all components scheduled for the same time and priority

  • cap_now (bool) – indicator whether times (till, duration) in the past are allowed. If, so now() will be used. default: sys.default_cap_now(), usualy False

Note

if neither till nor duration is specified, the main component will be reactivated at the time there are no more events on the eventlist, i.e. possibly not at inf.

if you want to run till inf (particularly when animating), issue run(sim.inf)

only issue run() from the main level