Skip to content

Commit

Permalink
snaptec#11 Status Seite hinzugefuegt
Browse files Browse the repository at this point in the history
  • Loading branch information
snaptec committed May 23, 2018
1 parent 28dd3ca commit be37a6d
Show file tree
Hide file tree
Showing 35 changed files with 994 additions and 15 deletions.
37 changes: 37 additions & 0 deletions modules/sdm630modbusbezug/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,35 @@ while read -r line; do
if (( $n == 12 )); then
ekwh3=$(echo "$line" | cut -c2- )
fi
if (( $n == 13 )); then
evupf1=$(echo "$line" | cut -c2- )
echo ${evupf1%??} > /var/www/html/openWB/ramdisk/evupf1
fi
if (( $n == 14 )); then
evupf2=$(echo "$line" | cut -c2- )
echo ${evupf2%??} > /var/www/html/openWB/ramdisk/evupf2
fi
if (( $n == 15 )); then
evupf3=$(echo "$line" | cut -c2- )
echo ${evupf3%??} > /var/www/html/openWB/ramdisk/evupf3
fi
if (( $n == 16 )); then
evuv1=$(echo "$line" | cut -c2- )
echo ${evuv1%??} > /var/www/html/openWB/ramdisk/evuv1
fi
if (( $n == 17 )); then
evuv2=$(echo "$line" | cut -c2- )
echo ${evuv2%??} > /var/www/html/openWB/ramdisk/evuv2
fi
if (( $n == 18 )); then
evuv3=$(echo "$line" | cut -c2- )
echo ${evuv3%??} > /var/www/html/openWB/ramdisk/evuv3
fi
if (( $n == 19 )); then
llhz=$(echo "$line" | cut -c2- )
echo ${llhz%??} > /var/www/html/openWB/ramdisk/llhz
fi


n=$((n + 1))
done <<< "$output"
Expand All @@ -70,11 +99,19 @@ echo $wattbezug > /var/www/html/openWB/ramdisk/wattbezug
ikwh11=${ikwh1%??}
ikwh22=${ikwh2%??}
ikwh33=${ikwh3%??}
echo $ikwh11 > /var/www/html/openWB/ramdisk/bezugkwh1
echo $ikwh22 > /var/www/html/openWB/ramdisk/bezugkwh2
echo $ikwh33 > /var/www/html/openWB/ramdisk/bezugkwh3

ikwh=$(echo "(($ikwh11+$ikwh22+$ikwh33)*1000)" |bc)
echo $ikwh > /var/www/html/openWB/ramdisk/bezugkwh
ekwh11=${ekwh1%??}
ekwh22=${ekwh2%??}
ekwh33=${ekwh3%??}
echo $ekwh11 > /var/www/html/openWB/ramdisk/einspeisungkwh1
echo $ekwh22 > /var/www/html/openWB/ramdisk/einspeisungkwh2
echo $ekwh33 > /var/www/html/openWB/ramdisk/einspeisungkwh3

ekwh=$(echo "(($ekwh11+$ekwh22+$ekwh33)*1000)" |bc)
echo $ekwh > /var/www/html/openWB/ramdisk/einspeisungkwh

Expand Down
16 changes: 16 additions & 0 deletions modules/sdm630modbusbezug/readsdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x0164,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))

resp = client.read_input_registers(0x1E,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x20,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x22,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))

resp = client.read_input_registers(0x00,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x02,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x04,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x46,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
32 changes: 32 additions & 0 deletions modules/sdm630modbusll/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,38 @@ fi
if (( $n == 6 )); then
wl3=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 7 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llv1
fi
if (( $n == 8 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llv2
fi
if (( $n == 9 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llv3
fi
if (( $n == 10 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llaltnv
fi
if (( $n == 11 )); then
llhz=$(echo "$line" | cut -c2- )
echo ${llhz%??} > /var/www/html/openWB/ramdisk/llhz
fi
if (( $n == 12 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llpf1
fi
if (( $n == 13 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llpf2
fi
if (( $n == 14 )); then
echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llpf3
fi









n=$((n + 1))
Expand Down
17 changes: 17 additions & 0 deletions modules/sdm630modbusll/readsdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,22 @@
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x10,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x00,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x02,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x04,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x2A,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x46,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x1E,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x20,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x22,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))



8 changes: 4 additions & 4 deletions openwb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ nachtladen=1
# Ladeleistung für die Nacht (Wert 6-32) wobei 6 = 6A und 32 = 32A maximale WB Leistung ist
nachtll=26
# Ab wieviel Uhr abends soll geladen werden? (17-23 Uhr möglich, angabe in Stunden)
nachtladenabuhr=21
nachtladenabuhr=17
# Bis wieviel Uhr morgens soll geladen werden? (01-10 Uhr möglich, angabe in Stunden)
nachtladenbisuhr=7
# Sofern Soc ausgelesen wird, bis wieviel % SOC laden?
nachtsoc=65
nachtsoc=75
nachtsoc1=35

#Uberschussregelung
# Mindestuberschuss in Watt im Haus damit die Ladung gestartet wird
# Die Kombination aus mindestuberschuss und abschaltuberschuss sollte sinnvoll gewählt werden.
# Ansonsten wird im 10 Sekunden Takt die Ladung gestartet und gestoppt.
# Es macht z.B. 1320 Watt mindestuberschuss und 900 Watt abschaltuberschuss Sinn
mindestuberschuss=1250
mindestuberschuss=1300

# Ab wieviel Watt Bezug soll abgeschaltet werden.
# Zunächst wird in jedem Zyklus die Ladeleistung Stufenweise bis auf 6A reduziert. Danach greift die Abschaltung.
Expand All @@ -140,7 +140,7 @@ mindestuberschuss=1250
# Der Wert ist für 1phasiges laden. Bei 3phasigem laden verdreifacht sich der Wert(automatisch). z.B. bei 900 Watt ergibt das bei 3960Watt Ladeleistung ein (erlaubter) Netzbezug bis 1260W
# Bei einem abschaltuberschuss von 0 wird erst abgeschaltet wenn Bezug über 1320w bzw 3960w (3phasig) geht
# Bei einem abschaltuberschuss von 1320 wird abgeschaltet sobald mehr als 1w aus dem Netz bezogen wird
abschaltuberschuss=800
abschaltuberschuss=1001


# Der Modi Sofort Laden lädt immer mit der vorgegebenen Ladeleistung
Expand Down
2 changes: 1 addition & 1 deletion ramdisk/bezugkwh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7891873.100000001
7972353.7
2 changes: 1 addition & 1 deletion ramdisk/einspeisungkwh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2564743.8000000003
2645074.6
1 change: 1 addition & 0 deletions ramdisk/evuhz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evupf1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evupf2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evupf3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evuv1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evuv2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/evuv3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/llaltnv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
223
1 change: 1 addition & 0 deletions ramdisk/llhz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
49.99983215332031
2 changes: 1 addition & 1 deletion ramdisk/llkwh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
359.9649963378906
410.04901123046875
1 change: 1 addition & 0 deletions ramdisk/llpf1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions ramdisk/llpf2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions ramdisk/llpf3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions ramdisk/llv1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
223
1 change: 1 addition & 0 deletions ramdisk/llv2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
223
1 change: 1 addition & 0 deletions ramdisk/llv3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
223
2 changes: 1 addition & 1 deletion ramdisk/pvkwh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5934940
6125810
2 changes: 1 addition & 1 deletion ramdisk/pvwatt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2796
3824
2 changes: 1 addition & 1 deletion ramdisk/soc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
37
63
2 changes: 1 addition & 1 deletion ramdisk/wattbezug
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-1298
-1810
2 changes: 1 addition & 1 deletion regel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ if grep -q 2 "/var/www/html/openWB/ramdisk/lademodus"; then
if (( $wattbezugint > $abschaltuberschuss )); then
pvcounter=$(cat /var/www/html/openWB/ramdisk/pvcounter)
if (( $pvcounter < $abschaltverzoegerung )); then
$pvcounter=$((pvcounter + 10))
pvcounter=$((pvcounter + 10))
echo $pvcounter > /var/www/html/openWB/ramdisk/pvcounter
if [[ $debug == "1" ]]; then
echo "Nur PV auf Minimalstromstaerke, PV Counter auf $pvcounter erhöht"
Expand Down
23 changes: 23 additions & 0 deletions runs/atreboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ touch /var/www/html/openWB/ramdisk/einspeisungkwh
touch /var/www/html/openWB/ramdisk/bezugkwh
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
echo 0 > /var/www/html/openWB/ramdisk/llas11
echo 0 > /var/www/html/openWB/ramdisk/bezuga1
echo 0 > /var/www/html/openWB/ramdisk/bezuga2
echo 0 > /var/www/html/openWB/ramdisk/bezuga3
echo 0 > /var/www/html/openWB/ramdisk/llv1
echo 0 > /var/www/html/openWB/ramdisk/llv2
echo 0 > /var/www/html/openWB/ramdisk/llv3
echo 0 > /var/www/html/openWB/ramdisk/llaltnv
echo 0 > /var/www/html/openWB/ramdisk/llhz
echo 0 > /var/www/html/openWB/ramdisk/llpf1
echo 0 > /var/www/html/openWB/ramdisk/llpf2
echo 0 > /var/www/html/openWB/ramdisk/llpf3
echo 0 > /var/www/html/openWB/ramdisk/evuv1
echo 0 > /var/www/html/openWB/ramdisk/evuv2
echo 0 > /var/www/html/openWB/ramdisk/evuv3
echo 0 > /var/www/html/openWB/ramdisk/evuhz
echo 0 > /var/www/html/openWB/ramdisk/evupf1
echo 0 > /var/www/html/openWB/ramdisk/evupf2
echo 0 > /var/www/html/openWB/ramdisk/evupf3
echo 0 > /var/www/html/openWB/ramdisk/evuhz




echo 0 > /var/www/html/openWB/ramdisk/llas12
echo 0 > /var/www/html/openWB/ramdisk/llas13
echo 0 > /var/www/html/openWB/ramdisk/wattbezug
Expand Down
2 changes: 1 addition & 1 deletion runs/read.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
from pymodbus.client.sync import ModbusSerialClient
client = ModbusSerialClient(method = "rtu", port="/dev/ttyUSB1", baudrate=9600,
client = ModbusSerialClient(method = "rtu", port="/dev/virtualcom1", baudrate=9600,
stopbits=1, bytesize=8, timeout=1)
rq = client.read_holding_registers(1000,7,unit=1)
print(rq.registers)
34 changes: 34 additions & 0 deletions runs/readmodbus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/python
import sys
import os
import time
import getopt
import socket
import struct
import binascii
seradd = str(sys.argv[1])
from pymodbus.client.sync import ModbusSerialClient
client = ModbusSerialClient(method = "rtu", port=seradd, baudrate=9600,
stopbits=1, bytesize=8, timeout=1)

#rq = client.read_holding_registers(0,8,unit=5)
#print(rq.registers)
modbusid = int(sys.argv[2])
readreg = int(sys.argv[3])
reganzahl = int(sys.argv[4])
rq = client.read_input_registers(readreg,reganzahl,unit=modbusid)
print(rq.registers)














11 changes: 9 additions & 2 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function getfile() {
</div> -->
<div class="row">
<div class="col-xs-4">
Ver0.34
Ver0.35
</div>
<div class="col-xs-4 text-center">
<a href="http://openwb.de">www.openwb.de</a>
Expand All @@ -352,9 +352,16 @@ function getfile() {
</div>
</div>
<div class="row">
<div class="col-xs-12 text-center">
<div class="col-xs-4 text-center">
</div>

<div class="col-xs-4 text-center">
<a href="/metern/index.php">Logging</a>
</div>
<div class="col-xs-4 text-right">
<a href="status.php">Status</a>
</div>

</div>
<div id="errorfeed">
<div id="errorfeedcontent"></div>
Expand Down
Loading

0 comments on commit be37a6d

Please sign in to comment.