Skip to content

Protocol

Matej Troják edited this page Oct 25, 2019 · 6 revisions

The protocol (represented either as a Python dict) is structured as follows:

{
    int: { # identified by a unique ID
        'experiment_details': {
            'sleep_time': int # how often periodical measurements are executed (seconds)
        },
        'devices': [
            # a list of devices defined below
        ]
    }
    ...
}

Multiple nodes are allowed, but they have to be identified by a unique ID. For each device there has to be defined several arbitrary attributes:

{
    'device_type' : str, # one of ['PBR', 'GAS', 'GSM']
    'device_class' : str, # the class of devices which should be used
    'device_id': str, # unique identifier of the device (optional)
    'encryption_key': str, # communication key (optional)
    'host_port': int, # communication key (optional)
    'setup' : {
        'initial_commands' : [ # commands which should be executed with initialisation
               { 'time': str, 'cmd_id': int, 'args': list } # id of command and list of its arguments
               # the time is obtained like this - datetime.datetime.utcnow().strftime("%Y-%m-%d, %H:%M:%S")
               ...
        ],
        'lower_outlier_tol' : int, # the lower percentual tolerance for outliers
        'upper_outlier_tol' : int, # the upper percentual tolerance for outliers
        'max_outliers' : int, # the number of outliers in row considered as correct data
        'min_OD' : float, # the lowest allowed OD value 
        'max_OD' : float, # the highest allowed OD value
        'pump_id' : int # ID of the pump
    }
}

Clone this wiki locally