diff --git a/modules/goelp1/main.sh b/modules/goelp1/main.sh index e81cb7a39..21b838776 100755 --- a/modules/goelp1/main.sh +++ b/modules/goelp1/main.sh @@ -4,24 +4,31 @@ rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status) if [[ $? == "0" ]] ; then + goecorrectionfactor=$(echo "scale=0;$goecorrectionfactorlp1 * 100000 /1" |bc) watt=$(echo $output | jq -r '.nrg[11]') watt=$(echo "scale=0;$watt * 10 /1" |bc) if [[ $watt =~ $re ]] ; then - echo $watt > /var/www/html/openWB/ramdisk/llaktuell + if [[ $goesimulationlp1 == "0" ]] ; then + echo $watt > /var/www/html/openWB/ramdisk/llaktuell + else + wattc=$((watt*$goecorrectionfactor/100000)) + wattc=$(echo "scale=0;$wattc" |bc) + echo $wattc > /var/www/html/openWB/ramdisk/llaktuell + fi fi lla1=$(echo $output | jq -r '.nrg[4]') - lla1=$(echo "scale=0;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + lla1=$(echo "scale=1;$lla1 / 10" |bc) + if [[ $lla1 =~ $rekwh ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/lla1 fi lla2=$(echo $output | jq -r '.nrg[5]') - lla2=$(echo "scale=0;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + lla2=$(echo "scale=1;$lla2 / 10" |bc) + if [[ $lla2 =~ $rekwh ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/lla2 fi lla3=$(echo $output | jq -r '.nrg[6]') - lla3=$(echo "scale=0;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + lla3=$(echo "scale=1;$lla3 / 10" |bc) + if [[ $lla3 =~ $rekwh ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/lla3 fi llv1=$(echo $output | jq -r '.nrg[0]') @@ -38,15 +45,41 @@ if [[ $? == "0" ]] ; then fi llkwh=$(echo $output | jq -r '.eto') llkwh=$(echo "scale=3;$llkwh / 10" |bc) - if [[ $llkwh =~ $rekwh ]] ; then - echo $llkwh > /var/www/html/openWB/ramdisk/llkwh - fi rfid=$(echo $output | jq -r '.uby') oldrfid=$( /var/www/html/openWB/ramdisk/readtag echo $rfid > /var/www/html/openWB/ramdisk/tmpgoelp1rfid fi + if [[ $goesimulationlp1 == "0" ]] ; then + if [[ $llkwh =~ $rekwh ]] ; then + echo $llkwh > /var/www/html/openWB/ramdisk/llkwh + fi + else + temp_kWhCounter_lp1=$( /var/www/html/openWB/ramdisk/goewatt0pos + fi + else + echo 0 > /var/www/html/openWB/ramdisk/goewatt0neg + fi + #der ausgelesene Zählerstand wird ignoriert und stattdessen die Leistung aufintegriert + #Grund: der ausgelesene Zählerstand hat eine Auflösung von 1kWh -> zu ungenau in der Darstellung + if [ -f "/var/www/html/openWB/ramdisk/goeposkwh" ]; then + simenergy=$(echo "scale=3; $( /var/www/html/openWB/ramdisk/llkwh + else + #Wenn die Simulation noch nicht gelaufen ist, nehme den Wert temp_kWhCounter_lp1 + echo $temp_kWhCounter_lp1 > /var/www/html/openWB/ramdisk/llkwh + fi + fi #car status 1 Ladestation bereit, kein Auto #car status 2 Auto lädt #car status 3 Warte auf Fahrzeug diff --git a/modules/goelp2/main.sh b/modules/goelp2/main.sh index d61ddf587..4cc4d1e62 100755 --- a/modules/goelp2/main.sh +++ b/modules/goelp2/main.sh @@ -4,24 +4,31 @@ rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp2 -s http://$goeiplp2/status) if [[ $? == "0" ]] ; then + goecorrectionfactor=$(echo "scale=0;$goecorrectionfactorlp2 * 100000 /1" |bc) watt=$(echo $output | jq -r '.nrg[11]') watt=$(echo "scale=0;$watt * 10 /1" |bc) if [[ $watt =~ $re ]] ; then - echo $watt > /var/www/html/openWB/ramdisk/llaktuells1 + if [[ $goesimulationlp1 == "0" ]] ; then + echo $watt > /var/www/html/openWB/ramdisk/llaktuells1 + else + wattc=$((watt*$goecorrectionfactor/100000)) + wattc=$(echo "scale=0;$wattc" |bc) + echo $wattc > /var/www/html/openWB/ramdisk/llaktuells1 + fi fi lla1=$(echo $output | jq -r '.nrg[4]') - lla1=$(echo "scale=0;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + lla1=$(echo "scale=1;$lla1 / 10" |bc) + if [[ $lla1 =~ $rekwh ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/llas11 fi lla2=$(echo $output | jq -r '.nrg[5]') - lla2=$(echo "scale=0;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + lla2=$(echo "scale=1;$lla2 / 10" |bc) + if [[ $lla2 =~ $rekwh ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/llas12 fi lla3=$(echo $output | jq -r '.nrg[6]') - lla3=$(echo "scale=0;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + lla3=$(echo "scale=1;$lla3 / 10" |bc) + if [[ $lla3 =~ $rekwh ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/llas13 fi llv1=$(echo $output | jq -r '.nrg[0]') @@ -37,10 +44,39 @@ if [[ $? == "0" ]] ; then echo $llv3 > /var/www/html/openWB/ramdisk/llvs13 fi llkwh=$(echo $output | jq -r '.eto') - llkwh=$(echo "scale=3;$llkwh / 10" |bc) - if [[ $llkwh =~ $rekwh ]] ; then - echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs1 + llkwh=$(echo "scale=3;$llkwh / 10" |bc) + if [[ $goesimulationlp2 == "0" ]] ; then + if [[ $llkwh =~ $rekwh ]] ; then + echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs1 + fi + else + temp_kWhCounter_lp2=$( /var/www/html/openWB/ramdisk/goe2watt0pos + fi + else + echo 0 > /var/www/html/openWB/ramdisk/goe2watt0neg + fi + #der ausgelesene Zählerstand wird ignoriert und stattdessen die Leistung aufintegriert + #Grund: der ausgelesene Zählerstand hat eine Auflösung von 1kWh -> zu ungenau in der Darstellung + if [ -f "/var/www/html/openWB/ramdisk/goe2poskwh" ]; then + simenergy=$(echo "scale=3; $( /var/www/html/openWB/ramdisk/llkwhs1 + else + #Wenn die Simulation noch nicht gelaufen ist, nehme den Wert temp_kWhCounter_lp2 + echo $temp_kWhCounter_lp2 > /var/www/html/openWB/ramdisk/llkwhs1 + fi fi + + + #car status 1 Ladestation bereit, kein Auto #car status 2 Auto lädt #car status 3 Warte auf Fahrzeug diff --git a/modules/goelp3/main.sh b/modules/goelp3/main.sh index 75a87c1cc..03e121fab 100755 --- a/modules/goelp3/main.sh +++ b/modules/goelp3/main.sh @@ -4,24 +4,31 @@ rekwh='^[-+]?[0-9]+\.?[0-9]*$' output=$(curl --connect-timeout $goetimeoutlp3 -s http://$goeiplp3/status) if [[ $? == "0" ]] ; then + goecorrectionfactor=$(echo "scale=0;$goecorrectionfactorlp3 * 100000 /1" |bc) watt=$(echo $output | jq -r '.nrg[11]') watt=$(echo "scale=0;$watt * 10 /1" |bc) if [[ $watt =~ $re ]] ; then - echo $watt > /var/www/html/openWB/ramdisk/llaktuells2 + if [[ $goesimulationlp1 == "0" ]] ; then + echo $watt > /var/www/html/openWB/ramdisk/llaktuells2 + else + wattc=$((watt*$goecorrectionfactor/100000)) + wattc=$(echo "scale=0;$wattc" |bc) + echo $wattc > /var/www/html/openWB/ramdisk/llaktuells2 + fi fi lla1=$(echo $output | jq -r '.nrg[4]') - lla1=$(echo "scale=0;$lla1 / 10" |bc) - if [[ $lla1 =~ $re ]] ; then + lla1=$(echo "scale=1;$lla1 / 10" |bc) + if [[ $lla1 =~ $rekwh ]] ; then echo $lla1 > /var/www/html/openWB/ramdisk/llas21 fi lla2=$(echo $output | jq -r '.nrg[5]') - lla2=$(echo "scale=0;$lla2 / 10" |bc) - if [[ $lla2 =~ $re ]] ; then + lla2=$(echo "scale=1;$lla2 / 10" |bc) + if [[ $lla2 =~ $rekwh ]] ; then echo $lla2 > /var/www/html/openWB/ramdisk/llas22 fi lla3=$(echo $output | jq -r '.nrg[6]') - lla3=$(echo "scale=0;$lla3 / 10" |bc) - if [[ $lla3 =~ $re ]] ; then + lla3=$(echo "scale=1;$lla3 / 10" |bc) + if [[ $lla3 =~ $rekwh ]] ; then echo $lla3 > /var/www/html/openWB/ramdisk/llas23 fi llv1=$(echo $output | jq -r '.nrg[0]') @@ -38,9 +45,38 @@ if [[ $? == "0" ]] ; then fi llkwh=$(echo $output | jq -r '.eto') llkwh=$(echo "scale=3;$llkwh / 10" |bc) - if [[ $llkwh =~ $rekwh ]] ; then - echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs2 + if [[ $goesimulationlp3 == "0" ]] ; then + if [[ $llkwh =~ $rekwh ]] ; then + echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs2 + fi + else + temp_kWhCounter_lp3=$( /var/www/html/openWB/ramdisk/goe3watt0pos + fi + else + echo 0 > /var/www/html/openWB/ramdisk/goe3watt0neg + fi + #der ausgelesene Zählerstand wird ignoriert und stattdessen die Leistung aufintegriert + #Grund: der ausgelesene Zählerstand hat eine Auflösung von 1kWh -> zu ungenau in der Darstellung + if [ -f "/var/www/html/openWB/ramdisk/goe2poskwh" ]; then + simenergy=$(echo "scale=3; $( /var/www/html/openWB/ramdisk/llkwhs2 + else + #Wenn die Simulation noch nicht gelaufen ist, nehme den Wert temp_kWhCounter_lp3 + echo $temp_kWhCounter_lp3 > /var/www/html/openWB/ramdisk/llkwhs2 + fi fi + + + #car status 1 Ladestation bereit, kein Auto #car status 2 Auto lädt #car status 3 Warte auf Fahrzeug diff --git a/runs/initRamdisk.sh b/runs/initRamdisk.sh index aae943fc2..8768ba6ea 100644 --- a/runs/initRamdisk.sh +++ b/runs/initRamdisk.sh @@ -447,6 +447,7 @@ initRamdisk(){ for f in \ "pluggedladunglp${i}startkwh:openWB/lp/${i}/plugStartkWh:0" \ "manual_soc_lp${i}:openWB/lp/${i}/manualSoc:0" \ + "temp_kWhCounter_lp${i}:openWB/lp/${i}/kWhCounter:0" \ "pluggedladungaktlp${i}:openWB/lp/${i}/pluggedladungakt:0" \ "lp${i}phasen::0" \ "lp${i}enabled::1" \ diff --git a/runs/updateConfig.sh b/runs/updateConfig.sh index adf164e4c..2b487af97 100755 --- a/runs/updateConfig.sh +++ b/runs/updateConfig.sh @@ -571,18 +571,36 @@ updateConfig(){ if ! grep -Fq "goetimeoutlp1=" $ConfigFile; then echo "goetimeoutlp1=5" >> $ConfigFile fi + if ! grep -Fq "goesimulationlp1=" $ConfigFile; then + echo "goesimulationlp1=0" >> $ConfigFile + fi + if ! grep -Fq "goecorrectionfactorlp1=" $ConfigFile; then + echo "goecorrectionfactorlp1=1" >> $ConfigFile + fi if ! grep -Fq "goeiplp2=" $ConfigFile; then echo "goeiplp2=192.168.0.15" >> $ConfigFile fi if ! grep -Fq "goetimeoutlp2=" $ConfigFile; then echo "goetimeoutlp2=5" >> $ConfigFile fi + if ! grep -Fq "goesimulationlp2=" $ConfigFile; then + echo "goesimulationlp2=0" >> $ConfigFile + fi + if ! grep -Fq "goecorrectionfactorlp2=" $ConfigFile; then + echo "goecorrectionfactorlp2=1" >> $ConfigFile + fi if ! grep -Fq "goeiplp3=" $ConfigFile; then echo "goeiplp3=192.168.0.15" >> $ConfigFile fi if ! grep -Fq "goetimeoutlp3=" $ConfigFile; then echo "goetimeoutlp3=5" >> $ConfigFile fi + if ! grep -Fq "goesimulationlp3=" $ConfigFile; then + echo "goesimulationlp3=0" >> $ConfigFile + fi + if ! grep -Fq "goecorrectionfactorlp3=" $ConfigFile; then + echo "goecorrectionfactorlp3=1" >> $ConfigFile + fi if ! grep -Fq "pushbenachrichtigung=" $ConfigFile; then echo "pushbenachrichtigung=0" >> $ConfigFile fi diff --git a/web/settings/modulconfiglp.php b/web/settings/modulconfiglp.php index 2cdb0ec9f..79fe87031 100644 --- a/web/settings/modulconfiglp.php +++ b/web/settings/modulconfiglp.php @@ -386,7 +386,7 @@ function visibility_twcmanagerlp1_connection() {