コード例 #1
0
ファイル: routing_wiggler.py プロジェクト: bhenne/MoSP
 def __init__(self, *args):
     """Init the RoutingShowcaseWiggler person."""
     Person.__init__(self, *args)
     self.dest_node = self.next_node
     self.p_color_rgba = COLOR[self.p_id]
     self.routed = True
     self.next_target = self.next_target_routed
コード例 #2
0
ファイル: external_person.py プロジェクト: bhenne/MoSP
    def handle_interrupts(self):
        """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.
        @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.
        """
        Person.handle_interrupts(self)
コード例 #3
0
ファイル: external_person.py プロジェクト: bhenne/MoSP
 def pause_movement(self, duration, location_offset_xy=0, deactivateActions=False):
     """Stops movement of person. Currently only works with passivating at next_node.  
     Currently cannot be used to stop on a way like after infect!
     @param duration: pause duration
     @param location_offset_xy: optional random offset to be added to current location when stopping.
     @param deactivateActions: deactive actions while pausing?
     
     """
     Person.pause_movement(self, duration, location_offset_xy=0, deactivateActions=False)
コード例 #4
0
ファイル: poi_wiggler.py プロジェクト: bhenne/MoSP
 def __init__(self, *args, **kwargs):
     """Inits the PoiWiggler person."""
     super(PoiWiggler, self).__init__(*args, **kwargs)
     Person.__init__(self, *args)
     self.dest_node = self.next_node
     if kwargs.get("cafes"):
         self.cafes = kwargs["cafes"]    #: list of all cafes in osm data
     else:
         self.cafes = None               #: list of all cafes in osm data
     self.p_state = GO_SOMEWHERE
     self.p_cafe = None
     self.p_color = self.p_id
     self.p_color_rgba = COLOR[self.p_id]
     self.next_target = self.next_target_routed
コード例 #5
0
ファイル: external_person.py プロジェクト: bhenne/MoSP
    def receive(self, message, sender):
        """Receive a message and handle it.

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

        @param message: a message from the persons message queue.
        @param sender: the sender of the message.
        @return: True if the message should be removed from the queue, False else. It will then be delivered again in the next cycle.

        """
        return Person.receive(self, message, sender)
コード例 #6
0
ファイル: statemachine_wiggler.py プロジェクト: bhenne/MoSP
    def __init__(self, *args):
        """Inits the working man."""
        Person.__init__(self, *args)

        w_id = self._random.choice(WORKPLACES)
        for node in self.sim.geo.way_nodes:
            if node.id == w_id:
                self.p_workplace_node = node
                break
        else:
            raise Exception('No workplace found')

        self.p_wakeup_time = self._random.randint(6000, 8000)
        self.p_home_time = self._random.randint(16000, 18000)
        
        self.dest_node = self.next_node
        self.home_node = self.last_node
        self.p_state = 'SLEEP'
        self.p_color = 2
        self.p_color_rgba = (0.1, 1.0, 0.1, 1.0)
コード例 #7
0
ファイル: external_person.py プロジェクト: bhenne/MoSP
 def reactivate(self, at = 'undefined', delay = 'undefined', prior = False):
     """Reactivates passivated person and optionally restarts stopped actions."""
     Person.reactivate(self)