Package mosp :: Package external_persons :: Module external_person :: Class ExternalPerson
[hide private]
[frames] | no frames]

Class ExternalPerson

source code


Instance Methods [hide private]
 
__init__(self, id, sim, random, speed=1.4, **kwargs)
Initializes the Person.
source code
 
current_coords_free_move(self)
Return the last received location.
source code
 
calculate_duration_free_move(self) source code
 
next_target(self)
Set last and next node based on received data.
source code
 
reactivate(self, at='undefined', delay='undefined', prior=False)
Reactivates passivated person and optionally restarts stopped actions.
source code
 
pause_movement(self, duration, location_offset_xy=0, deactivateActions=False)
Stops movement of person.
source code
 
act_at_node(self, node)
Actions of the person when arriving at a node.
source code
 
think(self)
Think about what to do next.
source code
 
handle_interrupts(self)
Find out, what caused an interrupt and act accordingly.
source code
 
receive(self, message, sender)
Receive a message and handle it.
source code

Inherited from core.Person: __getstate__, calculate_duration, call_stop_actions, collide_circle, collide_rectangle, current_coords_impl, get_near, get_properties, get_random_way_node, get_speed, go, next_target_coord, readd_actions, restart_actions, send, set_speed, start_action, stop_action, stop_actions

Inherited from core.Person (private): _get_classname

Inherited from SimPy.Lib.Process: acquired, active, cancel, interrupt, interruptReset, interrupted, passive, queuing, start, stored, terminated

Inherited from SimPy.Lib.Process (private): _hold, _passivate

Inherited from SimPy.Lister.Lister: __repr__, __str__, attrnames

Inherited from collide.Point: collide_polygon, get_points

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from SimPy.Lister.Lister: indent

Instance Variables [hide private]

Inherited from core.Person: current_coords, current_way, dest_node, last_coord, last_node, need_next_target, next_node, p_color, p_color_rgba, p_id, passivate, passivate_with_stop_actions, remove_from_sim, road_orthogonal_offset, start_node, stop_all_actions, target_coord

Properties [hide private]

Inherited from core.Person: p_agenttype, p_speed, x, y

Inherited from object: __class__

Method Details [hide private]

__init__(self, id, sim, random, speed=1.4, **kwargs)
(Constructor)

source code 

Initializes the Person.

Parameters:
  • id - unique id of a person
  • sim - reference to superordinate mosp.core.Simulation
  • random - random object for Person - use superordinate mosp.core.Simulation.random
  • speed - basic walking speed of person in meter/tick
  • kwargs - additonal keyword arguments intended for inheriting classes
Overrides: object.__init__
(inherited documentation)

current_coords_free_move(self)

source code 

Return the last received location.

To Do: interpolation between received coordinates

next_target(self)

source code 

Set last and next node based on received data.

Overrides: core.Person.next_target

reactivate(self, at='undefined', delay='undefined', prior=False)

source code 

Reactivates passivated person and optionally restarts stopped actions.

Overrides: core.Person.reactivate

pause_movement(self, duration, location_offset_xy=0, deactivateActions=False)

source code 

Stops movement of person. Currently only works with passivating at next_node. Currently cannot be used to stop on a way like after infect!

Parameters:
  • duration - pause duration
  • location_offset_xy - optional random offset to be added to current location when stopping.
  • deactivateActions - deactive actions while pausing?
Overrides: core.Person.pause_movement

act_at_node(self, node)

source code 

Actions of the person when arriving at a node. To be overwritten with an implementation.

This method is executes when the Person arrives at a node.

Parameters:
  • node - is the next_node the Person arrives at
Overrides: core.Person.act_at_node

think(self)

source code 

Think about what to do next.

This method can include all logic of the person (what to do, where to go etc.). Decisions could be made by using flags for example. This is where a new self.dest_node and self.start_node should be set if necessary. self.next_node should not be set here. This should be done in self.next_target.

Returns:
time until next wakeup (int, ticks), returning a negative number or 0 will cause self.go() to find a time
Overrides: core.Person.think

Note: This method provides only the most basic functionality. Overwrite (and if necessary call) it to implement own behaviour.

handle_interrupts(self)

source code 

Find out, what caused an interrupt and act accordingly.

This method is called whenever a person is interrupted. This is the place to implement own reactions to interrupts. Calling methods that were send via a send() call is done BEFORE this method is called. Handling pause, stop, removal and change of movement speed is done automatically AFTER this method is called. Removing the corresponding flag (setting it to False) in this method allows for handling these things on your own.

Overrides: core.Person.handle_interrupts

Note: This method does nothing per default. Implement it to react to interrupts. If you do not want or need to react to interrupts, ignore this method.

receive(self, message, sender)

source code 

Receive a message and handle it.

Removal from the message queue and earliest arrival time are handled automatically.

Parameters:
  • message - a message from the persons message queue.
  • sender - the sender of the message.
Returns:
True if the message should be removed from the queue, False else. It will then be delivered again in the next cycle.
Overrides: core.Person.receive