zmiana w modb_orno3.c i dodanie skryptu usuniecie_pola_highfluct.sh

This commit is contained in:
ms
2026-02-15 22:22:01 +01:00
parent bc399e0044
commit 7220d3e750
2 changed files with 14 additions and 17 deletions

View File

@@ -348,25 +348,21 @@ int influx_send_orno_batch(s_voltage *v, int v_ok, s_current *i, int i_ok,
char batch[1024]; char batch[1024];
int offset = 0; int offset = 0;
if (v_ok) { /* Line protocol format: measurement,tag=value field=value ... */
offset += snprintf(batch + offset, sizeof(batch) - offset, /* New format groups data by phase with U, I, P, W fields */
"orno,device=orno,pomiar=voltage L1=%.2f,L2=%.2f,L3=%.2f\n", v->U1, v->U2, v->U3); offset += snprintf(batch + offset, sizeof(batch) - offset,
} "energydb,device=orno,phase=L1 U=%.2f,I=%.2f,P=%.2f,W=%.2f\n"
if (i_ok) { "energydb,device=orno,phase=L2 U=%.2f,I=%.2f,P=%.2f,W=%.2f\n"
offset += snprintf(batch + offset, sizeof(batch) - offset, "energydb,device=orno,phase=L3 U=%.2f,I=%.2f,P=%.2f,W=%.2f\n"
"orno,device=orno,pomiar=current L1=%.2f,L2=%.2f,L3=%.2f\n", i->I1, i->I2, i->I3); "energydb,device=orno,phase=total P=%.2f,W=%.2f\n",
} v->U1, i->I1, p->P1, w->W1,
if (p_ok) { v->U2, i->I2, p->P2, w->W2,
offset += snprintf(batch + offset, sizeof(batch) - offset, v->U3, i->I3, p->P3, w->W3,
"orno,device=orno,pomiar=power total=%.3f,L1=%.3f,L2=%.3f,L3=%.3f\n", p->P_Tot, p->P1, p->P2, p->P3); p->P_Tot, w->W_Tot);
}
if (w_ok) {
offset += snprintf(batch + offset, sizeof(batch) - offset,
"orno,device=orno,pomiar=energy total=%.3f,L1=%.3f,L2=%.3f,L3=%.3f\n", w->W_Tot, w->W1, w->W2, w->W3);
}
if (f_ok) { if (f_ok) {
offset += snprintf(batch + offset, sizeof(batch) - offset, offset += snprintf(batch + offset, sizeof(batch) - offset,
"orno,device=orno,pomiar=frequency frequency=%.4f\n", f->Freq); "energydb,device=orno,frequency=Hz value=%.4f\n", f->Freq);
} }
if (offset == 0) return 0; if (offset == 0) return 0;

View File

@@ -0,0 +1 @@
influx delete --host "http://localhost:5086" --org "sic" --bucket "energydb" --token "BCIZ6kcCAVgpcwSfU0PBS7m0Zb6an93kuOtizbEtlXub-uaoYp4dmIQBQYaJCv8_KE4QYYZ08jxtpaZ3TUWP-Q==" --start 1970-01-01T00:00:00Z --stop $(date -u +"%Y-%m-%dT%H:%M:%SZ") --predicate '_fields="highfluct"'