예제 #1
0
    def __init__(self, num_sensors=16, aggregation_window=5, fail_floor=12.0, fail_ceil=20.0):
        """
        Create a new controller object
        :param num_sensors: The number of connected sensors
        :param aggregation_window: The number of values to maintain in the aggregation system
        :param fail_floor: The lower bound on reasonable values
        :param fail_ceil: The upper bound on reasonable values
        """
        self.eventManager = EventManager()
        self.num_sensors = num_sensors
        self.aggregation_buffers = [AggregationBuffer(aggregation_window) for i in range(num_sensors)]

        # Initialize all thresholds to zero by default
        for i in range(num_sensors):
            set_threshhold(i, 0)

        auto_fail_absolute(fail_floor, fail_ceil)
        aggregation_initialize(num_sensors)
        filtering_initialize()
예제 #2
0
def test_all():
    event_manager = EventManager()

    for i in range(16):
        set_threshhold(i, 0)
        aggregation_update(i, 0)
    test_range = range(-32,32) + range(32,0, -1)
    for i in range(16):
        for j in test_range:
            set_threshhold(i, j)
            time.sleep(0.01)

        for k in test_range:
            aggregation_update(i, k)
            time.sleep(0.01)

        set_threshhold(i, 15.0)
        aggregation_update(i, 16.0)
        time.sleep(0.01)
        event_manager.publish_packet(i, 16.0)

        time.sleep(0.5)
        aggregation_update(i, 11.0)
        event_manager.publish_failure(i)
        time.sleep(0.5)