Skip to content

Commit

Permalink
configureable timing CP interrupt and phase switch
Browse files Browse the repository at this point in the history
  • Loading branch information
benderl committed Mar 23, 2021
1 parent cc660d7 commit dc9d84a
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 39 deletions.
10 changes: 6 additions & 4 deletions regel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,16 @@ if (( cpunterbrechunglp1 == 1 )); then
cpulp1counter=$(<ramdisk/cpulp1counter)
if (( cpulp1counter > 5 )); then
if (( cpulp1waraktiv == 0 )); then
openwbDebugLog "MAIN" 0 "CP Unterbrechung an LP1 durchgeführt"
openwbDebugLog "MAIN" 0 "CP Unterbrechung an LP1 wird durchgeführt"
if [[ $evsecon == "simpleevsewifi" ]]; then
curl --silent --connect-timeout $evsewifitimeoutlp1 -s http://$evsewifiiplp1/interruptCp > /dev/null
elif [[ $evsecon == "ipevse" ]]; then
python runs/cpuremote.py $evseiplp1 4
elif [[ $evsecon == "extopenwb" ]]; then
mosquitto_pub -r -t openWB/set/isss/Cpulp1 -h $chargep1ip -m "1"
else
sudo python runs/cpulp1.py
openwbDebugLog "MAIN" 0 "Dauer der Unterbrechung: ${cpunterbrechungdauerlp1}s"
sudo python runs/cpulp1.py $cpunterbrechungdauerlp1
fi
echo 1 > ramdisk/cpulp1waraktiv
fi
Expand All @@ -249,15 +250,16 @@ if (( cpunterbrechunglp2 == 1 )); then
if (( ladeleistunglp2 < 200 )); then
cpulp2waraktiv=$(<ramdisk/cpulp2waraktiv)
if (( cpulp2waraktiv == 0 )); then
openwbDebugLog "MAIN" 0 "CP Unterbrechung an LP2 durchgeführt"
openwbDebugLog "MAIN" 0 "CP Unterbrechung an LP2 wird durchgeführt"
if [[ $evsecons1 == "simpleevsewifi" ]]; then
curl --silent --connect-timeout $evsewifitimeoutlp2 -s http://$evsewifiiplp2/interruptCp > /dev/null
elif [[ $evsecons1 == "ipevse" ]]; then
python runs/cpuremote.py $evseiplp2 7
elif [[ $evsecons1 == "extopenwb" ]]; then
mosquitto_pub -r -t openWB/set/isss/Cpulp1 -h $chargep2ip -m "1"
else
sudo python runs/cpulp2.py
openwbDebugLog "MAIN" 0 "Dauer der Unterbrechung: ${cpunterbrechungdauerlp2}s"
sudo python runs/cpulp2.py $cpunterbrechungdauerlp2
fi
echo 1 > ramdisk/cpulp2waraktiv
fi
Expand Down
12 changes: 11 additions & 1 deletion runs/cpulp1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@

import time
import RPi.GPIO as GPIO
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--duration", type=int, default=4, help="duration in seconds, defaults to 4")
parser.add_argument("-v", "--verbose", action="store_true", help="verbose debug output")
args = parser.parse_args()

if(args.verbose):
print("CP-Unterbrechung LP1: %ds"%(args.duration))

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.HIGH)
time.sleep(4)
time.sleep(args.duration)
GPIO.output(22, GPIO.LOW)
12 changes: 11 additions & 1 deletion runs/cpulp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@

import time
import RPi.GPIO as GPIO
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--duration", type=int, default=4, help="duration in seconds, defaults to 4")
parser.add_argument("-v", "--verbose", action="store_true", help="verbose debug output")
args = parser.parse_args()

if(args.verbose):
print("CP-Unterbrechung LP2: %ds"%(args.duration))

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(15, GPIO.OUT)
GPIO.output(15, GPIO.HIGH)
time.sleep(4)
time.sleep(args.duration)
GPIO.output(15, GPIO.LOW)
21 changes: 15 additions & 6 deletions runs/trigclose.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@

import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--duration", type=int, default=2, help="duration in seconds, defaults to 2")
parser.add_argument("-v", "--verbose", action="store_true", help="verbose debug output")
args = parser.parse_args()

if(args.verbose):
print("Wartezeit nach 1p/3p Umschaltung: %ds"%(args.duration))

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.HIGH)
GPIO.setup(37, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)

GPIO.output(22, GPIO.HIGH)

GPIO.setup(37, GPIO.OUT)
GPIO.output(37, GPIO.HIGH)
GPIO.setup(13, GPIO.OUT)
GPIO.output(13, GPIO.HIGH)
time.sleep(2)
GPIO.output(37, GPIO.LOW)
GPIO.output(13, GPIO.LOW)
time.sleep(2)

time.sleep(args.duration)
GPIO.output(22, GPIO.LOW)
20 changes: 15 additions & 5 deletions runs/trigopen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@

import time
import RPi.GPIO as GPIO
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-d", "--duration", type=int, default=2, help="duration in seconds, defaults to 2")
parser.add_argument("-v", "--verbose", action="store_true", help="verbose debug output")
args = parser.parse_args()

if(args.verbose):
print("Wartezeit nach 1p/3p Umschaltung: %ds"%(args.duration))

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.HIGH)
GPIO.setup(29, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)

GPIO.output(22, GPIO.HIGH)

GPIO.setup(29, GPIO.OUT)
GPIO.output(29, GPIO.HIGH)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, GPIO.HIGH)
time.sleep(2)
GPIO.output(29, GPIO.LOW)
GPIO.output(11, GPIO.LOW)
time.sleep(2)

time.sleep(args.duration)
GPIO.output(22, GPIO.LOW)
6 changes: 4 additions & 2 deletions runs/u1p3pcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
if [[ "$1" == "1" ]]; then
# chargepoint 1
if [[ $evsecon == "modbusevse" ]]; then
sudo python runs/trigopen.py
openwbDebugLog "MAIN" 0 "Pause nach Umschaltung: ${u1p3ppause}s"
sudo python runs/trigopen.py $u1p3ppause
fi
if [[ $evsecon == "ipevse" ]]; then
sudo python runs/u1p3premote.py $evseiplp1 $u1p3plp2id 1
Expand Down Expand Up @@ -67,7 +68,8 @@ fi
# change to 3 phases
if [[ "$1" == "3" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
sudo python runs/trigclose.py
openwbDebugLog "MAIN" 0 "Pause nach Umschaltung: ${u1p3ppause}s"
sudo python runs/trigclose.py $u1p3ppause
fi
if [[ $evsecon == "extopenwb" ]]; then
mosquitto_pub -r -t openWB/set/isss/U1p3p -h $chargep1ip -m "3"
Expand Down
9 changes: 9 additions & 0 deletions runs/updateConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,9 @@ updateConfig(){
if ! grep -Fq "u1p3paktiv=" $ConfigFile; then
echo "u1p3paktiv=0" >> $ConfigFile
fi
if ! grep -Fq "u1p3ppause=" $ConfigFile; then
echo "u1p3ppause=2" >> $ConfigFile
fi
if ! grep -Fq "u1p3psofort=" $ConfigFile; then
echo "u1p3psofort=3" >> $ConfigFile
fi
Expand Down Expand Up @@ -1307,9 +1310,15 @@ updateConfig(){
if ! grep -Fq "cpunterbrechunglp1=" $ConfigFile; then
echo "cpunterbrechunglp1=0" >> $ConfigFile
fi
if ! grep -Fq "cpunterbrechungdauerlp1=" $ConfigFile; then
echo "cpunterbrechungdauerlp1=4" >> $ConfigFile
fi
if ! grep -Fq "cpunterbrechunglp2=" $ConfigFile; then
echo "cpunterbrechunglp2=0" >> $ConfigFile
fi
if ! grep -Fq "cpunterbrechungdauerlp2=" $ConfigFile; then
echo "cpunterbrechungdauerlp2=4" >> $ConfigFile
fi
if ! grep -Fq "soc_zerong_username=" $ConfigFile; then
echo "[email protected]" >> $ConfigFile
fi
Expand Down
81 changes: 70 additions & 11 deletions web/settings/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function getCookie(cname) {
Sobald die Frequenz wieder in einem normalen Bereich ist wird automatisch der zuletzt gewählte Lademodus wieder aktiviert.
Ebenso wird die Ladung bei Überschreiten von 51,8 Hz unterbrochen. Dies ist dann der Fall, wenn der Energieversorger Wartungsarbeiten am (Teil-)Netz durchführt und auf einen vorübergehenden Generatorbetrieb umschaltet.
Die Erhöhung der Frequenz wird durchgeführt, um die PV Anlagen abzuschalten.<br>
<span class="text-danger">Die Option ist nur aktiv, wenn der Ladepunkt die Frequenz übermittelt. Jede openWB series1/2 tut dies.</span>
<span class="text-danger">Die Option ist nur aktiv, wenn der Ladepunkt die Frequenz übermittelt. Jede openWB Series1/2 unterstützt dies.</span>
</span>
</div>
</div>
Expand Down Expand Up @@ -199,30 +199,89 @@ function getCookie(cname) {
</label>
</div>
</div>
<div class="form-row mt-2 hide" id="lp2cpdiv">
<div class="col-md-4">
<label class="col-form-label">Ladepunkt 2</label>
<div class="form-row mb-1 lp1cpon hide">
<label for="cpunterbrechungdauerlp1" class="col-md-4 col-form-label">Dauer der Unterbrechung</label>
<div class="col-md-8">
<div class="form-row vaRow mb-1">
<label for="cpunterbrechungdauerlp1" class="col-2 col-form-label valueLabel" suffix="Sek"><?php echo $cpunterbrechungdauerlp1old; ?> Sek</label>
<div class="col-10">
<input type="range" class="form-control-range rangeInput" name="cpunterbrechungdauerlp1" id="cpunterbrechungdauerlp1" min="4" max="15" step="1" value="<?php echo $cpunterbrechungdauerlp1old; ?>">
</div>
</div>
<span class="form-text small">
Die Standardeinstellung ist 4 Sekunden. Falls ein Fahrzeug den Ladevorgang nicht zuverlässig startet, kann dieser Wert erhöht werden.
<span class="text-danger">Achtung: experimentelle Einstellung!</span>
</span>
</div>
<div class="btn-group btn-group-toggle col" data-toggle="buttons">
<label class="btn btn-outline-info<?php if($cpunterbrechunglp2old == 0) echo " active" ?>">
<input type="radio" name="cpunterbrechunglp2" id="cpunterbrechunglp2Off" value="0"<?php if($cpunterbrechunglp2old == 0) echo " checked=\"checked\"" ?>>Aus
</label>
<label class="btn btn-outline-info<?php if($cpunterbrechunglp2old == 1) echo " active" ?>">
<input type="radio" name="cpunterbrechunglp2" id="cpunterbrechunglp2On" value="1"<?php if($cpunterbrechunglp2old == 1) echo " checked=\"checked\"" ?>>An
</label>
</div>
<div id="lp2cpdiv" class="hide">
<div class="form-row mt-2">
<div class="col-md-4">
<label class="col-form-label">Ladepunkt 2</label>
</div>
<div class="btn-group btn-group-toggle col" data-toggle="buttons">
<label class="btn btn-outline-info<?php if($cpunterbrechunglp2old == 0) echo " active" ?>">
<input type="radio" name="cpunterbrechunglp2" id="cpunterbrechunglp2Off" value="0"<?php if($cpunterbrechunglp2old == 0) echo " checked=\"checked\"" ?>>Aus
</label>
<label class="btn btn-outline-info<?php if($cpunterbrechunglp2old == 1) echo " active" ?>">
<input type="radio" name="cpunterbrechunglp2" id="cpunterbrechunglp2On" value="1"<?php if($cpunterbrechunglp2old == 1) echo " checked=\"checked\"" ?>>An
</label>
</div>
</div>
<div class="form-row mb-1 lp2cpon hide">
<label for="cpunterbrechungdauerlp2" class="col-md-4 col-form-label">Dauer der Unterbrechung</label>
<div class="col-md-8">
<div class="form-row vaRow mb-1">
<label for="cpunterbrechungdauerlp2" class="col-2 col-form-label valueLabel" suffix="Sek"><?php echo $cpunterbrechungdauerlp2old; ?> Sek</label>
<div class="col-10">
<input type="range" class="form-control-range rangeInput" name="cpunterbrechungdauerlp2" id="cpunterbrechungdauerlp2" min="4" max="15" step="1" value="<?php echo $cpunterbrechungdauerlp2old; ?>">
</div>
</div>
<span class="form-text small">
Die Standardeinstellung ist 4 Sekunden. Falls ein Fahrzeug den Ladevorgang nicht zuverlässig startet, kann dieser Wert erhöht werden.
<span class="text-danger">Achtung: experimentelle Einstellung!</span>
</span>
</div>
</div>
</div>
</div>
</div>
<script>
var lp2akt = <?php echo $lastmanagementold ?>;

function visibility_lp1cp() {
if($('#cpunterbrechunglp1Off').prop("checked")) {
hideSection('.lp1cpon');
} else {
showSection('.lp1cpon', false);
}
}

function visibility_lp2cp() {
if($('#cpunterbrechunglp2Off').prop("checked")) {
hideSection('.lp2cpon');
} else {
showSection('.lp2cpon', false);
}
}

$(document).ready(function(){
if(lp2akt == '0') {
hideSection('#lp2cpdiv');
} else {
showSection('#lp2cpdiv');
}

$('input[type=radio][name=cpunterbrechunglp1]').change(function(){
visibility_lp1cp();
});

$('input[type=radio][name=cpunterbrechunglp2]').change(function(){
visibility_lp2cp();
});

visibility_lp1cp();
visibility_lp2cp();
});
</script>
</div>
Expand Down
33 changes: 24 additions & 9 deletions web/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,17 @@ function visibility_zielladenaktivlp1() {
</label>
</div>
</div>
<div class="form-row mb-1">
<label class="col-md-4 col-form-label">Nachtladen</label>
<div class="btn-group btn-group-toggle col" data-toggle="buttons">
<label class="btn btn-outline-info<?php if($u1p3pnlold == 1) echo " active" ?>">
<input type="radio" name="u1p3pnl" id="u1p3pnl1" value="1"<?php if($u1p3pnlold == 1) echo " checked=\"checked\"" ?>>einphasig
</label>
<label class="btn btn-outline-info<?php if($u1p3pnlold == 3) echo " active" ?>">
<input type="radio" name="u1p3pnl" id="u1p3pnl3" value="3"<?php if($u1p3pnlold == 3) echo " checked=\"checked\"" ?>>dreiphasig
</label>
</div>
</div>
<div class="form-row mb-1">
<label class="col-md-4 col-form-label">Min + PV Laden</label>
<div class="btn-group btn-group-toggle col" data-toggle="buttons">
Expand Down Expand Up @@ -898,7 +909,7 @@ function visibility_zielladenaktivlp1() {
<label class="col-md-4 col-form-label">Schaltzeiten Automatikmodus</label>
<div class="col">
<div class="form-row vaRow mb-1">
<label for="u1p3schaltparam" class="col-2 col-form-label valueLabel" suffix="min"><?php echo $u1p3schaltparamold; ?> min</label>
<label for="u1p3schaltparam" class="col-2 col-form-label valueLabel" suffix="Min"><?php echo $u1p3schaltparamold; ?> Min</label>
<div class="col-10">
<input type="range" class="form-control-range rangeInput" name="u1p3schaltparam" id="u1p3schaltparam" min="1" max="15" step="1" value="<?php echo $u1p3schaltparamold; ?>">
</div>
Expand All @@ -907,14 +918,18 @@ function visibility_zielladenaktivlp1() {
</div>
</div>
<div class="form-row mb-1">
<label class="col-md-4 col-form-label">Nachtladen</label>
<div class="btn-group btn-group-toggle col" data-toggle="buttons">
<label class="btn btn-outline-info<?php if($u1p3pnlold == 1) echo " active" ?>">
<input type="radio" name="u1p3pnl" id="u1p3pnl1" value="1"<?php if($u1p3pnlold == 1) echo " checked=\"checked\"" ?>>einphasig
</label>
<label class="btn btn-outline-info<?php if($u1p3pnlold == 3) echo " active" ?>">
<input type="radio" name="u1p3pnl" id="u1p3pnl3" value="3"<?php if($u1p3pnlold == 3) echo " checked=\"checked\"" ?>>dreiphasig
</label>
<label for="u1p3ppause" class="col-md-4 col-form-label">Pause nach der Umschaltung</label>
<div class="col-md-8">
<div class="form-row vaRow mb-1">
<label for="u1p3ppause" class="col-2 col-form-label valueLabel" suffix="Sek"><?php echo $u1p3ppauseold; ?> Sek</label>
<div class="col-10">
<input type="range" class="form-control-range rangeInput" name="u1p3ppause" id="u1p3ppause" min="2" max="15" step="1" value="<?php echo $u1p3ppauseold; ?>">
</div>
</div>
<span class="form-text small">
Die Standardeinstellung ist 2 Sekunden. Falls ein Fahrzeug den Ladevorgang nach einer Umschaltung nicht zuverlässig startet, kann dieser Wert erhöht werden.
<span class="text-danger">Achtung: experimentelle Einstellung!</span>
</span>
</div>
</div>
</div>
Expand Down

0 comments on commit dc9d84a

Please sign in to comment.