##// END OF EJS Templates
Se agrego el threshold...
JesusTapia-dev -
r20:96b1842fbedf schottkyExp
parent child
Show More
@@ -1,2 +1,2
1 IPP(km) DutyCicle(%) Wu Wd Nd Nu Eu Ed Sd Su
1 IPP(km) DutyCicle(%) threshold(%) Wu Wd Nd Nu Eu Ed Sd Su
2 1500 0.1 250 0 0 0 0 0 200 200 No newline at end of file
2 1500 0.1 10 250 0 0 0 0 0 200 200 No newline at end of file
@@ -65,7 +65,7 def procesamiento_data(analogRawMatriz):
65 fecha_utc_menos_5 = fecha_utc.replace(tzinfo=timezone.utc).astimezone(zona_horaria_utc_menos_5)
65 fecha_utc_menos_5 = fecha_utc.replace(tzinfo=timezone.utc).astimezone(zona_horaria_utc_menos_5)
66 fecha_legible=fecha_utc_menos_5.strftime('%d-%m-%Y %H:%M:%S')
66 fecha_legible=fecha_utc_menos_5.strftime('%d-%m-%Y %H:%M:%S')
67 estado=[1 if x > 0 else 0 for x in potenciaNominal]
67 estado=[1 if x > 0 else 0 for x in potenciaNominal]
68 processed_data = {"Ancho_us":IPP,"pow": potencia, "time": fecha_legible,"potenciaNominal":potenciaNominal,"status":estado}
68 processed_data = {"Ancho_us":IPP,"pow": potencia, "time": fecha_legible,"potenciaNominal":potenciaNominal,"status":estado,"threshold":threshold}
69 client.publish(publish_topic, json.dumps(processed_data))
69 client.publish(publish_topic, json.dumps(processed_data))
70 print("---------------------------------------")
70 print("---------------------------------------")
71 print(average_raw)
71 print(average_raw)
@@ -91,14 +91,15 def on_message(client, userdata, msg):
91 #Leo los datos de la configuracion y halla el ancho
91 #Leo los datos de la configuracion y halla el ancho
92 archivo_txt = 'commandPotencia.txt'
92 archivo_txt = 'commandPotencia.txt'
93 datos_numericos = leer_datos_desde_txt(archivo_txt)
93 datos_numericos = leer_datos_desde_txt(archivo_txt)
94 if len(datos_numericos)!=10:
94 if len(datos_numericos)!=11:
95 print("Hay más(o menos) valores de los que debería")
95 print("Hay más(o menos) valores de los que debería")
96 else:
96 else:
97 IPP_km=datos_numericos[0]
97 IPP_km=datos_numericos[0]
98 IPP=IPP_km*1/150#IPP en ms
98 IPP=IPP_km*1/150#IPP en ms
99 Dutty=datos_numericos[1]
99 Dutty=datos_numericos[1]
100 threshold=datos_numericos[2]
100 ancho=IPP*Dutty*pow(10,3)/100
101 ancho=IPP*Dutty*pow(10,3)/100
101 potenciaNominal=datos_numericos[2:]
102 potenciaNominal=datos_numericos[3:]
102 # Configurar el cliente MQTT
103 # Configurar el cliente MQTT
103 client = mqtt.Client()
104 client = mqtt.Client()
104 # Configurar los callbacks
105 # Configurar los callbacks
General Comments 0
You need to be logged in to leave comments. Login now