simulation_statistics module#

class simulation_statistics.FinishInfo(id, start, target, start_time)#

Bases: object

All necessary statistics information of a single passenger

Parameters:
  • id (int) – The id of the passenger

  • start (int) – The starting floor of the passenger

  • target (int) – The target floor of the passenger

  • start_time (int) – The time the passenger was created

class simulation_statistics.Objective(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

ACE = 'average crowededness'#
AMP = 'amount of people'#
ATTD = 'average time to destination'#
AWT = 'average waiting time'#
AWTSD = 'standard deviation of waiting time'#
class simulation_statistics.SimulationStatistics(simulation)#

Bases: object

Tracks necessary information of the simulation for plots.

Parameters:

simulation (Simulation) – The simulation object to track

calculate_amount_people_spawned(from_time=-1, to_time=9223372036854775807)#

Get the amount of passengers spawned

Parameters:
  • from_time (int) – start time in seconds

  • to_time (int) – end time in seconds

calculate_average_crowdedness(from_time=-1, to_time=9223372036854775807)#

Get the average amount of people inside an elevator

Parameters:
  • from_time (int) – start time in seconds

  • to_time (int) – end time in seconds

calculate_average_crowdedness_per_floor()#

Get the average amount of people waiting on a floor

Returns:

A dictionary with the average amount of people waiting on a floor

Return type:

dict

calculate_average_time_to_destination(from_time=-1, to_time=9223372036854775807)#

Get the average total time the passengers have been waiting to arrive at their destination

Parameters:
  • from_time (int) – start time in seconds

  • to_time (int) – end time in seconds

calculate_average_waiting_time(from_time=-1, to_time=9223372036854775807)#

Get the average time the passengers have been waiting for an elevator to arrive

Parameters:
  • from_time (int) – start time in seconds

  • to_time (int) – end time in seconds

calculate_std_dev_waiting_time(from_time=-1, to_time=9223372036854775807)#

Get the standard deviation time the passengers have been waiting for an elevator to arrive

Parameters:
  • from_time (int) – start time in seconds

  • to_time (int) – end time in seconds

get_objective(obj: Objective, timestep=-1, timestep_amount=24)#

Get some objective over an amount of time

Parameters:
  • obj (Objective) – The objective to get

  • timestep (int) – The amount of seconds per timestep

  • timestep_amount (int) – The amount of timesteps to get

Returns:

The objective over an amount of time

Return type:

list

get_objectives(objs: [<enum 'Objective'>], timestep=-1)#

Get multiple objectives over an amount of time

Parameters:
  • objs ([Objective]) – The objectives to get

  • timestep (int) – The amount of seconds per timestep

Returns:

The objectives over an amount of time

Return type:

list

on_passenger_created(passenger, time)#

Called once one passenger created

Parameters:
  • passenger (Passenger) – The passenger object created

  • time (int) – Current time in seconds

on_passenger_entered(passenger, time)#

Called once one passenger entered the elevator

Parameters:
  • passenger (Passenger) – The passenger object created

  • time (int) – Current time in seconds

on_passenger_exited(passenger, time)#

Called once one passenger exited the elevator

Parameters:
  • passenger (Passenger) – The passenger object created

  • time (int) – Current time in seconds

on_simulation_finished(simulation)#

Called once entire simulation finished

Parameters:

simulation (Simulation) – The simulation object to track

on_simulation_started(simulation, start_time, step_amount)#

Initializes a new simulation

Parameters:
  • simulation (Simulation) – The simulation object to track

  • start_time (int) – Time in seconds of the time of day

  • step_amount (int) – Time in seconds of the duration

on_step_end(simulation, time)#

Called once one simulation step finished

Parameters:
  • simulation (Simulation) – The simulation object to track

  • time (int) – Current time in seconds

write_to_file(filename)#

Writes the statistics to a file

Parameters:

filename (str) – The filename to write to