reg_vibration_metric = graphite.register(vibration_metric)
        graphite.create_relationship(reg_sensor_tag, reg_vibration_metric)
        reg_vibration_metric.start_collecting()

        rpm_metric = Metric(
            name="windmill.RPM",
            unit=None,
            interval=0,
            aggregation_size=1,
            sampling_function=lambda: get_rpm(sensor_tag_collector))
        reg_rpm_metric = graphite.register(rpm_metric)
        graphite.create_relationship(reg_sensor_tag, reg_rpm_metric)
        reg_rpm_metric.start_collecting()

        pfa_rpm_metric = Metric(name="windmill.RPM",
                                unit=None,
                                interval=0,
                                aggregation_size=1,
                                sampling_function=get_rpm_for_model)

        edge_component = PFAComponent(
            '/home/pi/Desktop/Borathon/liota/edge_intelligence_models/windmill/finalized_model.pfa',
            actuator_udm=action_actuator)

        pfa_reg_rpm_metric = edge_component.register(pfa_rpm_metric)
        pfa_reg_rpm_metric.start_collecting()

    except RegistrationFailure:
        print "Registration to graphite failed"
        sensor_tag_collector.stop()
Example #2
0

def action_actuator(value):
    print value


def read_csv_file():
    global line
    line += 1
    if not line > len(rows):
        return int(rows[line][0])


# ---------------------------------------------------------------------------
# In this example, we demonstrate how System health and some simulated data
# can be directed to data center component IoTCC using Liota.
# The program illustrates the ease of use Liota brings to IoT application developers.

if __name__ == '__main__':
    read_file("/Users/vkohli/sample.csv")
    sample = PFAComponent(
        '/home/pi/Desktop/Borathon/liota/edge_intelligence_models/windmill/finalized_model.pfa',
        action_actuator)
    sample_metric = Metric(name="File Metric",
                           unit=None,
                           interval=10,
                           aggregation_size=1,
                           sampling_function=read_csv_file)
    reg_sample_metric = sample.register(sample_metric)
    reg_sample_metric.start_collecting()