@@ -1,2 +1,2 | |||
|
1 | IPP(km) DutyCicle(%) 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 | |
|
1 | IPP(km) DutyCicle(%) threshold(%) Wu Wd Nd Nu Eu Ed Sd Su | |
|
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 | 65 | fecha_utc_menos_5 = fecha_utc.replace(tzinfo=timezone.utc).astimezone(zona_horaria_utc_menos_5) |
|
66 | 66 | fecha_legible=fecha_utc_menos_5.strftime('%d-%m-%Y %H:%M:%S') |
|
67 | 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 | 69 | client.publish(publish_topic, json.dumps(processed_data)) |
|
70 | 70 | print("---------------------------------------") |
|
71 | 71 | print(average_raw) |
@@ -91,14 +91,15 def on_message(client, userdata, msg): | |||
|
91 | 91 | #Leo los datos de la configuracion y halla el ancho |
|
92 | 92 | archivo_txt = 'commandPotencia.txt' |
|
93 | 93 | datos_numericos = leer_datos_desde_txt(archivo_txt) |
|
94 |
if len(datos_numericos)!=1 |
|
|
94 | if len(datos_numericos)!=11: | |
|
95 | 95 | print("Hay más(o menos) valores de los que debería") |
|
96 | 96 | else: |
|
97 | 97 | IPP_km=datos_numericos[0] |
|
98 | 98 | IPP=IPP_km*1/150#IPP en ms |
|
99 | 99 | Dutty=datos_numericos[1] |
|
100 | threshold=datos_numericos[2] | |
|
100 | 101 | ancho=IPP*Dutty*pow(10,3)/100 |
|
101 |
potenciaNominal=datos_numericos[ |
|
|
102 | potenciaNominal=datos_numericos[3:] | |
|
102 | 103 | # Configurar el cliente MQTT |
|
103 | 104 | client = mqtt.Client() |
|
104 | 105 | # Configurar los callbacks |
General Comments 0
You need to be logged in to leave comments.
Login now