Package mosp_examples :: Module BTvirus_wiggler :: Class BTVirusWiggler
[hide private]
[frames] | no frames]

Class BTVirusWiggler

source code


Models a random movement BT-virus infection

Mobile device gets infected if compatible device is in range of 10 to 20m for 15 seconds.


Author: B. Henne

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Init the BT-Infect-Wiggler.
source code
 
next_target(self)
Randomly finds a new next_node to move to.
source code
 
tryinfect(self, infecting_one)
The infection routine itself.
source code
 
infect_other(self)
The BT infect action.
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, think

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]
  p_infected
infected?
  pplInRange
stores infecting people in range
  p_infecttime
time if infection
  p_color
color for playerChamplain
  p_color_rgba
color for sim_viewer.py
  p_infectionPlace
coordinates of infection

Inherited from mosp.core.Person: current_coords, current_way, dest_node, last_coord, last_node, need_next_target, next_node, 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, **kwargs)
(Constructor)

source code 

Init the BT-Infect-Wiggler.

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__

next_target(self)

source code 

Randomly finds a new next_node to move to.

Ignores the last visited node, if possible without getting stuck. Does not set destination_node. Random movement only uses last_node and next_node of a Person.

Overrides: mosp.core.Person.next_target

Author: P. Tute

tryinfect(self, infecting_one)

source code 

The infection routine itself.

If not infected, person gets infected if bad one is in range of 10 to 20m for 15 seconds.

infect_other(self)

source code 

The BT infect action.

Every tick this action is called (using the mosp action decorator). This action looks for people in range of random(10,20) meters, and calls their tryinfect() routine (300s start delay is done by start_action(this, delay=300). Action is not active at beginning. It is activated by self.infect_other.start() and then is called every tick.

Decorators:
  • @action(1, start= False)