Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
snaptec committed Mar 8, 2018
1 parent ab75862 commit 6bd28bf
Show file tree
Hide file tree
Showing 20 changed files with 99 additions and 28 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ Für den Produktiv betrieb, derzeit in testphase manuell ausführen:
crontab -e
hier einfügen:

* * * * /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * * sleep 10 && /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * * sleep 20 && /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * * sleep 30 && /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * * sleep 40 && /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * * sleep 50 && /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log
* * * * /var/www/html/openWB/regel.sh >> /var/www/html/openWB/web/lade.log 2>&1
* * * * * sleep 10 && /var/www/html/openWB/regel.sh >> /var/log/openWB.log 2>&1
* * * * * sleep 20 && /var/www/html/openWB/regel.sh >> /var/log/openWB.log 2>&1
* * * * * sleep 30 && /var/www/html/openWB/regel.sh >> /var/log/openWB.log 2>&1
* * * * * sleep 40 && /var/www/html/openWB/regel.sh >> /var/log/openWB.log 2>&1
* * * * * sleep 50 && /var/www/html/openWB/regel.sh >> /var/log/openWB.log 2>&1

4 changes: 2 additions & 2 deletions modules/sdm630modbusll/main.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#llPhase1 x Ampere
#llPhase2 x Ampere
#llPhase3 x Ampere
lla1=9
lla1=0
lla2=0
lla3=0
#calc :
#ladeleistung= (lla1+lla2+lla3)*llVolt
ladeleistung=2070
ladeleistung=0

echo $ladeleistung > /var/www/html/openWB/ramdisk/llaktuell
echo $lla1 > /var/www/html/openWB/ramdisk/lla1
Expand Down
1 change: 1 addition & 0 deletions modules/vzlogger/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ip=10.20.0.51:8080

watttmp=$(curl --connect-timeout 15 -s $ip)
watt=$(echo $watttmp | jq . | sed '13!d' | tr -d ' ' )
watt=$(echo "${watt}" | cut -f1 -d".")
echo $watt
#zur weiteren verwendung im webinterface
echo $watt > /var/www/html/openWB/ramdisk/wattbezug
10 changes: 9 additions & 1 deletion openwb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ else
crontab -l -u root | cat - /tmp/tocrontab | crontab -u root -
rm /tmp/tocrontab
echo "...added"
fi
fi

echo "check for MCP4725"
if [ ! -d /home/pi/Adafruit_Python_MCP4725 ]; then
Expand All @@ -128,6 +128,14 @@ else
echo "...ok"
fi

echo "disable cronjob logging"
if grep -Fxq "EXTRA_OPTS="-L 0"" /etc/default/cron
then
echo "...ok"
else
echo "EXTRA_OPTS="-L 0"" >> /etc/default/cron
fi

chmod +x /var/www/html/openWB/modules/*
chmod +x /var/www/html/openWB/runs/*

Expand Down
4 changes: 2 additions & 2 deletions openwb.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Globales Config File für die Regelanylse

#Enable debug mode, extra Ausgaben zur Fehleranalyse
debug=0
debug=2


#Minimal mögliche Ladeleistung in A(nur höher Stellen wenn das Fahrzeug Probleme bereitet)
Expand All @@ -10,7 +10,7 @@ minimalstromstaerke=6

#Maximal erlaubte Ladeleistung in A. Als Beispiel: 16A entspricht einphasig 3,6kw, 3-phasig 11kw, Abhängig von genutzter Verkabelung (Querschnitt) etc..
#Einstellbar von 10-32
maximalstromstaerke=32
maximalstromstaerke=30


# Modulauswahl für den Strombezug/Einspeisung am Übergabepunkt.
Expand Down
1 change: 1 addition & 0 deletions ramdisk/anzahlphasen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions ramdisk/lademodus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions ramdisk/ladestatus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions ramdisk/lla1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/lla2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/lla3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/llaktuell
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions ramdisk/llsoll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
1 change: 1 addition & 0 deletions ramdisk/pvwatt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2035
1 change: 1 addition & 0 deletions ramdisk/soc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ramdisk/wattbezug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-801
45 changes: 31 additions & 14 deletions regel.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
cd /var/www/html/openWB/
#config file einlesen
. openwb.conf


#######################################
# Werte für die Berechnung ermitteln

Expand Down Expand Up @@ -80,12 +80,12 @@ fi

####################
# Nachtladung bzw. Ladung bis SOC x% nachts von x bis x Uhr
if [[ $nachtladen == "1" ]]; then
if [[ $nachtladen == "0" ]]; then
if (( $nachtladenabuhr <= 10#$H && 10#$H <= 24 )) || (( 0 <= 10#$H && 10#$H <= $nachtladenbisuhr )); then
if [[ $socmodul != "none" ]]; then
if (( $soc <= $nachtsoc )); then
if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatus"; then
runs/ladungan.sh
# runs/ladungan.sh
runs/$nachtll.sh
if [[ $debug == "1" ]]; then
echo "soc $soc"
Expand All @@ -97,7 +97,7 @@ if [[ $nachtladen == "1" ]]; then
exit 0
else
if grep -q 1 "/var/www/html/openWB/ramdisk/ladestatus"; then
runs/ladungaus.sh
runs/0.sh
echo "stop Nachtladung mit $nachtll um $date bei $soc" >> log/lade.log
exit 0
fi
Expand All @@ -106,7 +106,7 @@ if [[ $nachtladen == "1" ]]; then
fi
if [[ $socmodul == "none" ]]; then
if grep -q 0 "/var/www/html/openWB/ramdisk/ladestatus"; then
runs/ladungan.sh
# runs/ladungan.sh
runs/$nachtll.sh
if [[ $debug == "1" ]]; then
echo "soc $soc"
Expand Down Expand Up @@ -158,6 +158,19 @@ abschaltungw=`echo "($abschaltuberschuss*$anzahlphasen)" | bc`
schaltschwelle=`echo "(230*$anzahlphasen)" | bc`


if [[ $debug == "2" ]]; then
echo $date
echo uberschuss $uberschuss
echo wattbezug $wattbezug
echo `cat ramdisk/ladestatus`
echo llsoll $llalt
echo pvwatt $pvwatt
echo mindestuberschussphasen $mindestuberschussphasen
echo wattkombiniert $wattkombiniert
echo abschaltungw $abschaltungw
echo schaltschwelle $schaltschwelle
fi

########################
#Min Ladung + PV Uberschussregelung lademodus 1
if grep -q 1 "/var/www/html/openWB/ramdisk/lademodus"; then
Expand All @@ -175,7 +188,7 @@ if grep -q 1 "/var/www/html/openWB/ramdisk/lademodus"; then
exit 0
fi
fi
if (( $ubserschuss > $schaltschwelle )); then
if (( $uberschuss > $schaltschwelle )); then
if (( $llalt == $maximalstromstaerke )); then
exit 0
fi
Expand All @@ -194,7 +207,6 @@ if grep -q 2 "/var/www/html/openWB/ramdisk/lademodus"; then
if (( $mindestuberschussphasen <= $uberschuss )); then
runs/ladungan.sh
runs/$minimalstromstaerke.sh
echo "ueberschussladung $uberschuss um $date mit 6A gestartet" >> log/lade.log
exit 0
fi
fi
Expand All @@ -214,24 +226,29 @@ if grep -q 2 "/var/www/html/openWB/ramdisk/lademodus"; then
exit 0
else
runs/0.sh
echo "uberschussladung bei uberschuss $uberschuss und wattkombiniert $wattkombiniert um $date beendet" >> log/lade.log
exit 0
fi
fi
else
if (( $uberschuss < 0 )); then
if (( $llalt = 0 )); then
if (( $llalt == 0 )); then
exit 0
fi
llneu=$((llalt - 1 ))
runs/$llneu.sh
exit 0
if (( $llalt > $minimalstromstaerke )); then
llneu=$((llalt - 1 ))
runs/$llneu.sh
exit 0
else
runs/0.sh
exit 0
fi

fi
if (( $ubserschuss > $schaltschwelle )); then
if (( $uberschuss > $schaltschwelle )); then
if (( $llalt == $maximalstromstaerke )); then
exit 0
fi
llneu=$(llalt + 1 )
llneu=$((llalt + 1 ))
runs/$llneu.sh
fi
exit 0
Expand Down
4 changes: 4 additions & 0 deletions runs/atreboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ touch /var/www/html/openWB/ramdisk/lademodus
touch /var/www/html/openWB/ramdisk/llaktuell
touch /var/www/html/openWB/ramdisk/pvwatt
touch /var/www/html/openWB/ramdisk/soc
touch /var/www/html/openWB/ramdisk/lla1
touch /var/www/html/openWB/ramdisk/lla2
touch /var/www/html/openWB/ramdisk/lla3
echo 0 > /var/www/html/openWB/ramdisk/wattbezug
echo 0 > /var/www/html/openWB/ramdisk/ladestatus
echo 0 > /var/www/html/openWB/ramdisk/lademodus
echo 0 > /var/www/html/openWB/ramdisk/llaktuell
echo 0 > /var/www/html/openWB/ramdisk/pvwatt
echo 0 > /var/www/html/openWB/ramdisk/soc
chmod +x modules/sdm630modbusll/main.sh
chmod 777 /var/www/html/openWB/ramdisk/*
24 changes: 21 additions & 3 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ function getfile() {
</script>
<script type='text/javascript'>
var doInterval;
function getfile() {
$.ajax({
url: "/openWB/ramdisk/llsoll",
complete: function(request){
$("#llsolldiv").html(request.responseText);
}
});
}
doInterval = setInterval(getfile, 2000);
</script>
<script type='text/javascript'>
var doInterval;
function getfile() {
$.ajax({
url: "/openWB/ramdisk/wattbezug",
Expand Down Expand Up @@ -148,16 +160,22 @@ function getfile() {
</div>
</div>
<div class="row">
<div class="col-xs-6 text-center">
<div class="col-xs-4 text-center">
<button type="button" class="btn btn-primary btn-lg btn-block btn-blue">Ladestatus
<div id="controlleranaus"></div>
</button>
</div>
<div class="col-xs-6 text-center">
<div class="col-xs-4 text-center">
<button type="button" class="btn btn-primary btn-lg btn-block btn-blue">SOC
<div id="soclevel"></div>
</button>
</div>
</div>
<div class="col-xs-4 text-center">
<button type="button" class="btn btn-primary btn-lg btn-block btn-blue">LLSoll
<div id="llsolldiv"></div>
</button>
</div>

</div>
<div class="row">
<div class="col-xs-4 text-center">
Expand Down
11 changes: 11 additions & 0 deletions web/lade.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A
setz ladung auf 6A

0 comments on commit 6bd28bf

Please sign in to comment.