Package mosp_examples :: Module statemachine_wiggler :: Class WorkWiggler
[hide private]
[frames] | no frames]

Class WorkWiggler

source code


The WorkWiggler wakes up between 6 and 8 o'clock and goes to work. He comes home for sleeping after 16 o'clock.

Home place is randomly chosen from all way_nodes. Workplace is randomly chosen from hard coded node ids selected using node_finder.py. Waking up time and going home time is random between a start and an end time. 1000 ticks = 1 hour.


Authors:
P. Tute, F. Ludwig
Instance Methods [hide private]
 
__init__(self, *args)
Inits the working man.
source code
 
time_until(self, t)
Time until.
source code
 
think(self)
Decide what to do (sleep, work, walk) based on daytime and state.
source code
 
next_target(self)
Sets next next_node an route to destination for next_target().
source code

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

Inherited from mosp.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 mosp.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 mosp.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 mosp.core.Person: p_agenttype, p_speed, x, y

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 

Inits the working man.

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__

time_until(self, t)

source code 

Time until. Used to calculate day events. Here: 1 day = 24000 ticks.

think(self)

source code 

Decide what to do (sleep, work, walk) based on daytime and state.

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

next_target(self)

source code 

Sets next next_node an route to destination for next_target().

Overrides: mosp.core.Person.next_target