forked from snaptec/openWB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nurpv.sh
182 lines (177 loc) · 4.81 KB
/
nurpv.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/bash
#NUR PV Uberschussregelung lademodus 2
nurpvlademodus(){
# wenn evse aus und $mindestuberschuss vorhanden, starte evse mit 6A Ladestromstaerke (1320 - 3960 Watt je nach Anzahl Phasen)
# if (( ladeleistung > 500 )); then
# if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatus"; then
# runs/set-current.sh 0 m
# exit 0
# fi
# if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatuss1"; then
# runs/set-current.sh 0 s1
# exit 0
# fi
# if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatuss2"; then
# runs/set-current.sh 0 s2
# exit 0
# fi
# fi
if [[ $lastmanagement == "0" ]]; then
if (( soc < minnurpvsoclp1 )); then
if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatus"; then
runs/set-current.sh $minnurpvsocll all
if [[ $debug == "1" ]]; then
echo "Starte PV Laden da $sofortsoclp1 % zu gering"
fi
fi
exit 0
fi
if (( soc > maxnurpvsoclp1 )); then
if grep -q 1 "/var/www/html/openWB/ramdisk/ladestatus"; then
runs/set-current.sh 0 all
if [[ $debug == "1" ]]; then
echo "Beende PV Laden da $sofortsoclp1 % erreicht"
fi
fi
exit 0
fi
fi
if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatus"; then
if (( mindestuberschussphasen <= uberschuss )); then
if [[ $debug == "1" ]]; then
echo "nur pv ladung auf $minimalapv starten"
fi
runs/set-current.sh $minimalapv all
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
exit 0
else
exit 0
fi
fi
# speicherregelpunkt=$(</var/www/html/openWB/ramdisk/speicher)
# if (( speicherregelpunkt > 10 )); then
# runs/set-current.sh 0 all
# exit 0
# fi
if (( ladeleistung < 500 )); then
if (( llalt > minimalapv )); then
llneu=$minimalapv
runs/set-current.sh $llneu all
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
exit 0
fi
if (( llalt < minimalapv )); then
llneu=$minimalapv
runs/set-current.sh $llneu all
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
exit 0
fi
if (( llalt == minimalapv )); then
if (( wattbezugint > abschaltuberschuss )); then
pvcounter=$(cat /var/www/html/openWB/ramdisk/pvcounter)
if (( pvcounter < abschaltverzoegerung )); then
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"
fi
else
runs/set-current.sh 0 all
if [[ $debug == "1" ]]; then
echo "pv ladung beendet"
fi
fi
fi
fi
else
if [[ $speichervorhanden == "1" ]]; then
if (( speicherleistung < 0 )); then
uberschuss=$((uberschuss + speicherleistung))
wattbezugint=$((wattbezugint - speicherleistung))
fi
fi
if (( uberschuss > schaltschwelle )); then
if (( llalt == maximalstromstaerke )); then
exit 0
fi
if (( uberschuss > 1380 )); then
if (( anzahlphasen < 4 )); then
llneu=$((llalt + 5 ))
else
llneu=$((llalt + 2 ))
fi
if (( uberschuss > 2760 )); then
if (( anzahlphasen < 4 )); then
llneu=$((llalt + 11 ))
else
llneu=$((llalt + 3 ))
fi
fi
if (( llneu > maximalstromstaerke )); then
llneu=$maximalstromstaerke
fi
else
llneu=$((llalt + 1 ))
fi
if (( llalt < minimalapv )); then
llneu=$minimalapv
fi
runs/set-current.sh $llneu all
if [[ $debug == "1" ]]; then
echo "pv ladung auf $llneu erhoeht"
fi
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
exit 0
fi
if (( uberschuss < pvregelungm )); then
if (( llalt > minimalapv )); then
if (( uberschuss < -1380 )); then
if (( anzahlphasen < 4 )); then
llneu=$((llalt - 6 ))
else
llneu=$((llalt - 2 ))
fi
if (( uberschuss < -2760 )); then
if (( anzahlphasen < 4 )); then
llneu=$((llalt - 12 ))
else
llneu=$((llalt - 4 ))
fi
fi
if (( llneu < minimalapv )); then
llneu=$minimalapv
fi
else
llneu=$((llalt - 1 ))
fi
runs/set-current.sh $llneu all
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
if [[ $debug == "1" ]]; then
echo "pv ladung auf $llneu reduziert"
fi
exit 0
else
if (( wattbezugint > abschaltuberschuss )); then
pvcounter=$(cat /var/www/html/openWB/ramdisk/pvcounter)
if (( pvcounter < abschaltverzoegerung )); then
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"
fi
else
runs/set-current.sh 0 all
if [[ $debug == "1" ]]; then
echo "pv ladung beendet"
fi
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
fi
exit 0
else
echo 0 > /var/www/html/openWB/ramdisk/pvcounter
exit 0
fi
fi
fi
fi
}