starling_sim.basemodel.agent.persons.person

Module Contents

Classes

Person

This class describes the basic features of a human agent

class starling_sim.basemodel.agent.persons.person.Person(simulation_model, agent_id, origin, destination, origin_time, number=1, **kwargs)

Bases: starling_sim.basemodel.agent.moving_agent.MovingAgent

This class describes the basic features of a human agent

It should be extended to implement more specific features and behaviours

SCHEMA
__str__()

Give a string display to the simulation element

trace_event(event)

Add the event to the person’s trace and to other relevant agents.

In the case of a movement using a vehicle, the vehicle itself traces the movements of the agent.

Parameters:

event – Event object to be added to the person’s trace

move_shortest_with_vehicle_(destination=None, duration=None, parameters=None)

Call self.vehicle’s move method.

Parameters:
  • destination – agent destination, default is self.tempDestination

  • duration – total duration of the move

  • parameters – agent specific parameters used for path evaluation

Returns:

yield the moving process of the agent’s vehicle

walk_to_destination_()

Walk from current position to the destination position.

Returns:

get_vehicle(vehicle)

Get the given vehicle.

Set the agent’s vehicle attribute, and add the agent to the vehicle occupants. This method should only be called after making sure the vehicle is available

Parameters:

vehicle – Vehicle object

leave_vehicle()

Leave the currently owned vehicle.

Set the agent’s vehicle attribute, and add the agent to the vehicle occupants. This method should only be called after making sure the owner is allowed to leave the vehicle.

closest_walkable_node_of(mode, position=None, n=1, parameters=None, return_path=False)

Compute the closest node of the given mode that can be reached by walking.

The node is computed by looking at the common nodes of the two modes. The default behaviour is then to look at the euclidean closest one (with n=1), but the shortest path can also be used. It can be returned with the result node.

Parameters:
  • mode – mode that should be reached by walking

  • position – departure position. Default is self.position.

  • n – simplify the computation to the n euclidean closest nodes. Default is 1, we look at the euclidean closest node .

  • parameters – agent parameters for computing weight

  • return_path – boolean indicating if the path should be returned. Default is False.

Returns:

closest_node, or (closest_node, path) if return_path

try_new_request_()

Realise a new request according to the agent state.

This method must be implemented according to the user’s request mode

Returns:

Request object, completed according to request result

request_loop_(max_tentatives=None)

Loop over the requests and return the last one.

This method allows the user to loop over a series of requests. The user either stop after succeeding in a request, or after reaching the maximum number of tentatives (which defaults to infinite). The creation and execution of new requests are realised by calling the try_new_request method, which must be implemented for the needs of the model.

Parameters:

max_tentatives – number of failed requests until giving up

Returns:

last Request object, completed according to request result

wait_for_request_(request, patience=None)

Wait for the given request, respecting a patience threshold.

Parameters:
  • request – Request object

  • patience – patience threshold, None corresponds to infinite patience

Returns:

yield the request event, with a timeout event if patience is provided, and returns the request result

wait_trip_request_(request)
station_get_request(local_station)

Request (GET) the station at current position.

Parameters:

local_station – Station object at current position

Returns:

StationRequest object

station_put_request(local_station)

Request (PUT) the station at current position.

Parameters:

local_station – Station object at current position

Returns:

StationRequest object