Simulation module

Python library to model the spread of infectious diseases within a microenvironment

class Simulation.Simulation(simulation_name=None, simulation_run=None, microenvironment=None, periods=None)

Bases: object

Class to implement a simulation using simpy discreate event simulation

The simulation class is the main controlling class for the simulation and is responsible for:

  • Creating the simpy environment

  • Creating the data collection environment

  • Creating individual microenvironments

  • Generating people

  • Defining the routing for each person

  • Starting and stopping the model

create_activities(microenvironment_name)

Create a dictionary of activities.

create_microenvironments()

Create the microenvironments used within the simulation.

create_network_routing()

Create a simple network routing.

From ‘start’ to ‘end’ via ‘visit environment

create_people(arrivals_per_hour, max_arrivals=None, quanta_emission_rate=None, inhalation_rate=None)

Create a method of generating people

get_counter(data_set_name)

Return stored value of a counter

Parameters

{string} -- Name of the counter to get (data_set_name) –

Returns

number – value of the counter

get_list_of_reports()

Get the list of reports.

Returns

list of strings – List of reports.

get_results(data_set_name)

Return stored report as a pandas dataFrame.

Parameters

{string} -- Name of the dataset to get (data_set_name) –

Returns

pandas dataFrame – dataFrame containing the results

run(arrivals_per_hour=None, quanta_emission_rate=None, inhalation_rate=None, max_arrivals=None, report_time=None)

Run the simulation

Keyword arguments: periods Number of periods to run the simulation report_time When True the simulation prints the time taken to execute the simulation to console.