in lab/03-Package-Deploy/iot-jobs/app/windfarm.py [0:0]
def __init__(self, simulator, mqtt_host, mqtt_port):
if simulator is None:
raise Exception("You need to pass the simulator as argument")
self.simulator = simulator
self.n_turbines = simulator.get_num_turbines()
self.mqtt_host = mqtt_host
self.mqtt_port = mqtt_port
## launch edge agent clients
self.edge_agents = [EdgeAgentClient('/tmp/agent%d' % i) for i in range(self.n_turbines)]
self.model_meta = [{'model_name':None} for i in range(self.n_turbines)]
self.ota_devices = []
# we need to load the statistics computed in the data prep notebook
# these statistics will be used to compute normalize the input
self.raw_std = np.load('../../../statistics/raw_std.npy')
self.mean = np.load('../../../statistics/mean.npy')
self.std = np.load('../../../statistics/std.npy')
# then we load the thresholds computed in the training notebook
# for more info, take a look on the Notebook #2
self.thresholds = np.load('../../../statistics/thresholds.npy')
# configurations to format the time based data for the anomaly detection model
# If you change these parameters you need to retrain your model with the new parameters
self.INTERVAL = 5 # seconds
self.TIME_STEPS = 20 * self.INTERVAL # 50ms -> seg: 50ms * 20
self.STEP = 10
# these are the features used in this application
self.feature_ids = [8,9,10,7, 22, 5, 6] # qX,qy,qz,qw ,wind_seed_rps, rps, voltage
self.n_features = 6 # roll, pitch, yaw, wind_speed, rotor_speed, voltage
self.running = False # running status
# minimal buffer length for denoising. We need to accumulate some sample before denoising
self.min_num_samples = 500