Hauptmenü

gnuplot digitaler Werte

Begonnen von wopl, 27 Juni 2013, 11:59:16

Vorheriges Thema - Nächstes Thema

wopl

Hallo,
ich habe ein Logfile mit gemischt digitalen und analogen Werten: #5 analog, #17 und #18 nehmen immer die Werte 0/1 an.
Im Moment sieht das gplot-file folgendermaßen aus:

set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics
set y2tics "Aus" 0.4, "Ein" 0.6
set grid ytics
set ylabel "Temperatur"
set y2label "Ein/Aus"

#FileLog 5:Heizung.UVR1611\x3a::
#FileLog 17:Heizung.UVR1611\x3a::
#FileLog 18:Heizung.UVR1611\x3a::

plot "<IN>" using 1:2 axes x1y1 title 'Zisterne' ls l0 lw 1.5 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Schalter1' ls l1 lw 1.5 with steps,\
     "<IN>" using 1:2 axes x1y2 title 'Schalter2' ls l2 lw 1.5 with lines


Für #17 (Schalter 1) möchte ich jetzt anstelle einer 0/1 Ausgabe die Werte 0.4/0.6 auf dem gplot ausgeben. Leider finde ich nicht raus, wie man eine entsprechende Funktion in gplot formuliert (oder doch mit awk?).

Vielen Dank, wenn mir jemand den Codeschnipsel hierzu angibt.
Gruß Wolfram
Haussteuerung mit 300 Devices, Kopplung mit Wago SPS, InfluxDB (Grafana), HomeMatic, Tinkerforge (Fensterkontakte), SmartMeter, Heizungsüberwachung/-logging... Installation in QNAP NAS Docker container vollautomatisiert mit Ansible und GITlab

fiedel

Hi Wolfram,

genau so mache ich es bei den Signalen meiner Heizungs- SPS.
Dadurch haben die Signale bei "ON" unterschiedliche Höhen im Plot.
Hier kannst du dir das abgucken:
Tipp: Damit es richtig funktioniert, benutze ich noch "AddLog".



############################
# Filename: heiz_sps.gplot
# Display the on and off values off an FS20 device
# Corresponding FileLog definition:
# define fs20log FileLog /var/log/fhem/fs20dev-%Y-%U.log fs20dev

set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title 'Zustände der SPS  "Heizung"'

set ytics ("Off" 0, "On" 1)
set y2tics ("Off" 0, "On" 1)
set yrange [-0.1:1.1]
set y2range [-0.1:1.1]
set ylabel "Status"
set y2label "Status"



#FileLog 3:SPS_I_X4:0:$fld[2]=~"on"?0.1:0
#FileLog 3:SPS_I_X5:0:$fld[2]=~"on"?0.2:0
#FileLog 3:SPS_I_X6:0:$fld[2]=~"on"?0.3:0

#FileLog 3:SPS_O_Y0:0:$fld[2]=~"on"?0.4:0
#FileLog 3:SPS_O_Y1:0:$fld[2]=~"on"?0.5:0
#FileLog 3:SPS_O_Y2:0:$fld[2]=~"on"?0.6:0
#FileLog 3:SPS_O_Y3:0:$fld[2]=~"on"?0.7:0
#FileLog 3:webServer:0:$fld[2]=~"on"?0.8:0


plot \
  "< awk '/SPS_I_X4/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_I_X4-Spare' with steps

  "< awk '/SPS_I_X5/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_I_X5-Lang_Sp' with steps

  "< awk '/SPS_I_X6/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_I_X6-Res_Sp' with steps

  "< awk '/SPS_O_Y0/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_O_Y0-Sp_Aktiv' with steps

  "< awk '/SPS_O_Y1/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_O_Y1-Fehler' with steps

  "< awk '/SPS_O_Y2/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_O_Y2-Spare' with steps

  "< awk '/SPS_O_Y3/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'SPS_O_Y3-Handshake' with steps

  "< awk '/iServer/ {print $1, $3~/on/? 1 : 0; }' <IN>"\
     using 1:2 title 'webServer' with steps


# Ende heiz_sps.gplot







Viel Erfolg

Frank
FeatureLevel: 6.1 auf Wyse N03D ; Deb. 11 ; Perl: v5.14.2 ; IO: HM-MOD-RPI-PCB + VCCU|CUL 868 V 1.66|LinkUSBi |TEK603
HM: SEC-SCO|SCI-3-FM|LC-SW4-PCB|ES-PMSW1-PL|RC-4-2|SEN-MDIR-O|SEC-WDS-2
CUL: HMS100TF|FS20 S4A-2 ; OWDevice: DS18S20|DS2401|DS2406|DS2423

Puschel74

Hallo,

bitte nicht vom titel des Beitrags irritieren lassen aber damit

ZitatLink

sollte es doch auch einfacher gehen oder nicht?

Gemeint ist der 4. Beitrag

Grüße
Zotac BI323 als Server mit DBLog
CUNO für FHT80B, 3 HM-Lan per vCCU, RasPi mit CUL433 für Somfy-Rollo (F2F), RasPi mit I2C(LM75) (F2F), RasPi für Panstamp+Vegetronix +SONOS(F2F)
Ich beantworte keine Supportanfragen per PM! Bitte im Forum suchen oder einen Beitrag erstellen.

wopl

@Puschel74: o.k., hab ich nicht verstanden

@fiedel: die Filelog Zeile hab ich jetzt mal übernommen und siehe da: es funktioniert. Nun ja, das mit dem $fld hat dann ein paar minuten gebraucht, bis ich es verstanden hab. Die awk-Zeilen hab ich dann mal weggelassen, da sie - wenn ich das richtig verstehe - nur der Auswahl der Zeilen dienen. Bei mir ist jedoch in jeder Zeile Alles vorhanden. Also vielen Dank für den code.

Gruß Wolfram
Haussteuerung mit 300 Devices, Kopplung mit Wago SPS, InfluxDB (Grafana), HomeMatic, Tinkerforge (Fensterkontakte), SmartMeter, Heizungsüberwachung/-logging... Installation in QNAP NAS Docker container vollautomatisiert mit Ansible und GITlab