starling_sim.basemodel.output.kpis

Module Contents

Classes

KPI

Generic structure of a KPI class

MoveKPI

This KPI evaluates the distance and spent time for each one of the simulation modes

WaitKPI

This KPI evaluates the time spent waiting

GetVehicleKPI

This KPI evaluates the number of vehicle uses

SuccessKPI

This KPI evaluates the number of failed/successful requests

StaffOperationKPI

This KPI evaluates the number of staff operations

OccupationKPI

This KPI evaluates the empty and full time and distance

StationOccupationKPI

This KPI evaluates the time spent in the empty and full states (of a station),

VehicleOccupationKPI

This KPI evaluates the time and distance in the empty and full states (of vehicle),

ChargeKPI

This KPI evaluates the trips's boards and un-boards

ServiceKPI

This KPI describes the service time of a vehicle.

TransferKPI

This KPI lists the transfers realised by a user,

DestinationReachedKPI

This KPI evaluates the destination reach time

LeaveSimulationKPI

This KPI evaluates the cause of the simulation leave.

Functions

get_route_id_of_trip(trips, trip_id, event)

get_direction_of_trip(trips, trip_id)

get_route_short_name_of_trip(trips, routes, trip_id)

get_stop_id_of_event(event)

class starling_sim.basemodel.output.kpis.KPI

Generic structure of a KPI class

Its sub-classes compute and update specific indicator from given events

KEY_ID = 'agentId'
setup(simulation_model)

Setup method called during simulation setup.

Parameters:

simulation_model

Returns:

new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Update the kpi values according to the event content and the agent.

Parameters:
  • event – processed event

  • agent – subject of the event

Returns:

class starling_sim.basemodel.output.kpis.MoveKPI

Bases: KPI

This KPI evaluates the distance and spent time for each one of the simulation modes

SUFFIX_KEY_DISTANCE = '{mode}Distance'
SUFFIX_KEY_TIME = '{mode}Time'
setup(simulation_model)

Setup method called during simulation setup.

Parameters:

simulation_model

Returns:

new_indicator_dict()

Initialize the time and distance values at 0 for the considered modes :return:

update(event, agent)

Add travelled distances and durations :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.WaitKPI

Bases: KPI

This KPI evaluates the time spent waiting

KEY_WAIT = 'waitTime'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add total wait duration of the request :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.GetVehicleKPI

Bases: KPI

This KPI evaluates the number of vehicle uses

KEY_GET_VEHICLE = 'nbGetVehicle'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add a new use for each GetVehicleEvent :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.SuccessKPI(indicator_selection)

Bases: KPI

This KPI evaluates the number of failed/successful requests

KEY_FAILED_GET = 'nbFailedGet'
KEY_SUCCESS_GET = 'nbSuccessGet'
KEY_FAILED_PUT = 'nbFailedPut'
KEY_SUCCESS_PUT = 'nbSuccessPut'
KEY_FAILED_REQUEST = 'nbFailedRequest'
KEY_SUCCESS_REQUEST = 'nbSuccessRequest'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add request events according to their success :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.StaffOperationKPI

Bases: KPI

This KPI evaluates the number of staff operations

KEY_FAILED_GET_STAFF = 'nbFailedGetStaff'
KEY_SUCCESS_GET_STAFF = 'nbSuccessGetStaff'
KEY_FAILED_PUT_STAFF = 'nbFailedPutStaff'
KEY_SUCCESS_PUT_STAFF = 'nbSuccessPutStaff'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add operations to the total :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.OccupationKPI

Bases: KPI

This KPI evaluates the empty and full time and distance and the stock relative time/distance

new_indicator_dict()

Initialize the time and distance counts to 0.

get_capacity(element)

Get the capacity of the agent, according to its type.

Parameters:

element

Returns:

agent’s capacity

get_initial_stock(element)

Get the initial stock of the agent, according to its type.

Parameters:

element

Returns:

agent’s initial stock

add_to_stock(value, timestamp)

Update the full and empty time and distance counts, according to the previous stock value, then updates the stock and time.

Parameters:
  • value – stock change (negative for stock loss)

  • timestamp – timestamp of the stock change event

update(event, agent)

Update the stock and time counts from traced events

Parameters:
  • agent

  • event

class starling_sim.basemodel.output.kpis.StationOccupationKPI

Bases: OccupationKPI

This KPI evaluates the time spent in the empty and full states (of a station), and the stock relative time spent in the station

get_capacity(element)

Get the capacity of the agent, according to its type.

Parameters:

element

Returns:

agent’s capacity

get_initial_stock(element)

Get the initial stock of the agent, according to its type.

Parameters:

element

Returns:

agent’s initial stock

update(event, agent)

Update the stock and time counts from request events

Parameters:
  • agent

  • event

class starling_sim.basemodel.output.kpis.VehicleOccupationKPI

Bases: OccupationKPI

This KPI evaluates the time and distance in the empty and full states (of vehicle), and a passenger relative distance and time.

new_indicator_dict()

Initialize the time and distance counts to 0.

get_capacity(element)

Get the capacity of the agent, according to its type.

Parameters:

element

Returns:

agent’s capacity

get_initial_stock(element)

Get the initial stock of the agent, according to its type.

Parameters:

element

Returns:

agent’s initial stock

update(event, agent)

Update the stock and time/distance counts from get/leave vehicle and move events

Parameters:
  • agent

  • event

class starling_sim.basemodel.output.kpis.ChargeKPI(non_empty_only=True, public_transport=True)

Bases: KPI

This KPI evaluates the trips’s boards and un-boards

KEY_ROUTE_ID = 'routeId'
KEY_TRIP_ID = 'tripId'
KEY_TRIP_DIRECTION = 'tripDirection'
KEY_TIME = 'time'
KEY_STOP_ID = 'stopId'
KEY_BOARD_TYPE = 'boardType'
KEY_VALUE = 'value'
setup(simulation_model)

Setup method called during simulation setup.

Parameters:

simulation_model

Returns:

new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add stop information to the list

Parameters:
  • agent

  • event

Returns:

update_stop_information(event, agent)

Update the indicator with the information common to dropoffs and pickups.

Parameters:
  • event

  • agent

class starling_sim.basemodel.output.kpis.ServiceKPI

Bases: KPI

This KPI describes the service time of a vehicle.

KEY_SERVICE_DURATION = 'serviceDuration'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Update the kpi values according to the event content and the agent.

Parameters:
  • event – processed event

  • agent – subject of the event

Returns:

start_service(timestamp)
close_service(timestamp)
class starling_sim.basemodel.output.kpis.TransferKPI

Bases: KPI

This KPI lists the transfers realised by a user, with additional information such as walk distance and duration, wait duration, from/to trip/stop

KEY_WALK_DIST = 'walkDistance'
KEY_WALK_DURATION = 'walkDuration'
KEY_WAIT_TIME = 'waitTime'
KEY_FROM_ROUTE = 'fromRoute'
KEY_FROM_TRIP = 'fromTrip'
KEY_FROM_STOP = 'fromStop'
KEY_TO_ROUTE = 'toRoute'
KEY_TO_TRIP = 'toTrip'
KEY_TO_STOP = 'toStop'
setup(simulation_model)

Setup method called during simulation setup.

Parameters:

simulation_model

Returns:

new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Update the kpi values according to the event content and the agent.

Parameters:
  • event – processed event

  • agent – subject of the event

Returns:

reset_variables()
write_variables(agent)
class starling_sim.basemodel.output.kpis.DestinationReachedKPI

Bases: KPI

This KPI evaluates the destination reach time

KEY_DESTINATION_REACHED = 'destinationReachedTime'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add total wait duration of the request :param agent: :param event: :return:

class starling_sim.basemodel.output.kpis.LeaveSimulationKPI

Bases: KPI

This KPI evaluates the cause of the simulation leave.

KEY_LEAVE_SIMULATION = 'leaveSimulation'
new_indicator_dict()

Reset the indicator_dict, when computing the indicator for a new target :return: None, resets directly the indicator_dict attribute

update(event, agent)

Add the cause of the LeaveSimulationEvent.

Parameters:
  • event

  • agent

starling_sim.basemodel.output.kpis.get_route_id_of_trip(trips, trip_id, event)
starling_sim.basemodel.output.kpis.get_direction_of_trip(trips, trip_id)
starling_sim.basemodel.output.kpis.get_route_short_name_of_trip(trips, routes, trip_id)
starling_sim.basemodel.output.kpis.get_stop_id_of_event(event)