From 35afd2fb145d4c3f09023184c305ec3e2f9fbb9c Mon Sep 17 00:00:00 2001 From: shining-man Date: Sun, 24 Nov 2024 13:58:49 +0100 Subject: [PATCH] =?UTF-8?q?Hysterese=20bei=20Alarmregel=20f=C3=BCr=20Zells?= =?UTF-8?q?panung=20(#171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/defines.h | 4 ++- include/params.h | 4 +-- include/params_dt.h | 1 + include/params_py.h | 21 ++++++------ src/AlarmRules.cpp | 79 +++++++++++++++++++++++++++++++++++++-------- 5 files changed, 83 insertions(+), 26 deletions(-) diff --git a/include/defines.h b/include/defines.h index d4850e51..6e5ebb45 100644 --- a/include/defines.h +++ b/include/defines.h @@ -9,7 +9,7 @@ #include "params_dt.h" #include "bscTime.h" -#define BSC_SW_VERSION "V0.7.0_dm11" +#define BSC_SW_VERSION "V0.7.0_T12" static const char COMPILE_DATE_TIME[] = ""; @@ -435,6 +435,8 @@ enum serialDataRwTyp_e {BPN_NO_DATA, BPN_READ_SETTINGS, BPN_WRITE_READ_SETTINGS, #define ID_PARAM_DEVICE_MAPPING_ADRESSE 164 #define ID_PARAM_DEVICE_MAPPING_NAME 165 +#define ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE 166 + //Auswahl Bluetooth Geräte diff --git a/include/params.h b/include/params.h index c318eacf..8e359747 100644 --- a/include/params.h +++ b/include/params.h @@ -13,8 +13,8 @@ const char paramSystem[] PROGMEM = R"rawliteral( {"page":[{"name":160,"label":"BSC Benutzer","type":0,"default":"bsc","dt":8,"flash":"1"},{"name":161,"label":"BSC Passwort","type":2,"default":"admin","dt":8,"flash":"1"},{"name":45,"label":"Device Name","type":0,"default":"bsc","minlen":3,"dt":8,"help":"Wird auch als MQTT device name genutzt"},{"name":144,"label":"Display timeout","type":3,"default":5,"min":1,"max":120,"unit":"min","dt":1},{"label":"WLAN","type":13},{"name":40,"label":"WLAN SSID","type":0,"default":"","dt":8},{"name":41,"label":"WLAN Passwort","type":2,"default":"","dt":8},{"name":96,"label":"WLAN connect Timeout","type":3,"unit":"s","default":30,"min":0,"max":3600,"dt":3,"help":"Der Timeout gibt an, nach welcher Zeit ein Verbindungsversuch abgebrochen wird und ein Accesspoint erstellt wird.
0 deaktiviert den Timeout."},{"label":"Static IP","type":13},{"name":36,"label":"IP-Adresse","type":0,"default":"","dt":8,"flash":"1","help":"Wenn die IP-Adresse leer ist, dann ist DHCP aktiv"},{"name":37,"label":"Gateway","type":0,"default":"","dt":8,"flash":"1"},{"name":38,"label":"Subnet","type":0,"default":"255.255.255.0","dt":8,"flash":"1"},{"name":39,"label":"DNS","type":0,"default":"","dt":8,"help":"Optional","flash":"1"},{"label":"MQTT","type":13,"help":"Zum Übernehmen der Settings, muss der BSC neu gestartet werden!"},{"name":44,"label":"MQTT enable","type":10,"default":0,"dt":9},{"name":42,"label":"MQTT Server IP","type":0,"default":"","dt":8},{"name":43,"label":"MQTT Server Port","type":3,"default":1883,"min":1,"max":49151,"dt":3},{"name":86,"label":"Username","type":0,"default":"","dt":8},{"name":87,"label":"Passwort","type":2,"default":"","dt":8},{"name":46,"label":"MQTT Topic Name","type":0,"default":"bsc","dt":8},{"name":133,"label":"MQTT Sendeintervall","unit":"s","type":3,"default":60,"min":30,"max":120,"dt":1},{"label":"NTP","type":13,"help":"Zum Übernehmen der Settings, muss der BSC neu gestartet werden!"},{"name":122,"label":"Server Name/IP","type":0,"default":"pool.ntp.org","flash":"1","dt":8},{"label":"Aufzeichnung","type":13},{"name":143,"label":"Aufzeichnung Periode","type":9,"options":[{"v":0,"l":"Aus"},{"v":1,"l":"24h"}],"default":0,"dt":1},{"label":"Triggername","type":13},{"label":"Trigger description","label_entry":"Trigger","label_offset":1,"groupsize":10,"type":12,"group":[{"name":117,"label":"Trigger","type":0,"default":"","flash":"1","dt":8}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; const char paramBluetooth[] PROGMEM = R"rawliteral( {"page":[{"label":"Bluetooth","label_entry":"BT Device","groupsize":5,"type":12,"help":"Die MAC-Adresse muss klein geschrieben werden!","group":[{"name":4,"label":"Bluetooth","type":9,"options":[{"v":"0","l":"nicht belegt"},{"v":"1","l":"NEEY GW-24S4EB"},{"v":"4","l":"NEEY EK-24S4EB, EK-24S10EB"},{"v":"2","l":"JK-BMS [Test]"},{"v":"3","l":"JK-BMS (32S) [Test]"}],"default":"0","dt":1},{"name":5,"label":"MAC-Adresse","type":0,"default":"","dt":8},{"name":126,"label":"Deactivate","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1}]}],"btn":[{"name":"save-btn","label":"Save"}],"timer":[{"type":"text","interval":5000}]} )rawliteral"; const char paramSerial[] PROGMEM = R"rawliteral( {"page":[{"label":"Serielle Schnittstellen","label_entry":"Serial","help":"To use serial 3-11, the serial extension is required!","groupsize":11,"type":12,"group":[{"name":1,"label":"Serial","type":9,"options":[{"v":"0","l":"nicht belegt"},{"v":"9","l":"BPN (not use)"},{"v":"1","l":"JBD BMS"},{"v":"2","l":"JK BMS"},{"v":"6","l":"JK BMS V1.3 (only monitoring)"},{"v":"14","l":"JK Inverter BMS"},{"v":"3","l":"Seplos BMS"},{"v":"12","l":"Seplos V3 BMS (Test)"},{"v":"4","l":"DALY BMS"},{"v":"5","l":"Sylcin BMS"},{"v":"7","l":"Gobel RN150 BMS (Test)"},{"v":"11","l":"Gobel PC200 BMS (Test)"},{"v":"15","l":"Pylontech"},{"v":"10","l":"Victron SmartShunt"}],"default":"0","dt":1}]},{"label":"Allgemein","type":13},{"name":141,"label":"Anzahl Zellen","type":3,"default":16,"min":4,"max":24,"dt":1},{"label":"Filter","type":13},{"name":121,"label":"Anzahl RX Fehler","help":"Gibt an, nach wievielen fehlerhaften Paketen es als Fehler bewertet wird.","type":3,"default":2,"min":1,"max":125,"flash":"1","dt":1},{"name":120,"label":"Abweichung Zellspannung","help":"0=Filter deaktiviert","unit":"%","type":3,"default":0,"min":0,"max":100,"flash":"1","dt":1},{"label":"Plausibility check","type":13},{"name":132,"label":"Cellvoltage plausibility check","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"label":"Value adjustments","type":13},{"label":"Data devices","label_entry":"Device","groupsize":18,"type":12,"group":[{"name":127,"label":"Cellvoltage for SoC 100%","help":"0=deaktiviert","unit":"mV","type":3,"default":0,"min":0,"max":5000,"dt":3},{"name":130,"label":"Cellvoltage for SoC 0%","help":"0=deaktiviert","unit":"mV","type":3,"default":0,"min":0,"max":5000,"dt":3}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; -const char paramAlarmBms[] PROGMEM = R"rawliteral( {"page":[{"label":"BMS Alarmregeln","label_entry":"Alarmregel","groupsize":20,"type":12,"group":[{"name":9,"label":"Zu überwachendes BMS","type":9,"options":[{"v":"255","l":"Aus"},{"v":"0","l":"Data device 0","d":10560},{"v":"1","l":"Data device 1","d":10561},{"v":"2","l":"Data device 2","d":10562},{"v":"3","l":"Data device 3","d":10563},{"v":"4","l":"Data device 4","d":10564},{"v":"5","l":"Data device 5","d":10565},{"v":"6","l":"Data device 6","d":10566},{"v":"7","l":"Data device 7","d":10567},{"v":"8","l":"Data device 8","d":10568},{"v":"9","l":"Data device 9","d":10569},{"v":"10","l":"Data device 10","d":10570},{"v":"11","l":"Data device 11","d":10571},{"v":"12","l":"Data device 12","d":10572},{"v":"13","l":"Data device 13","d":10573},{"v":"14","l":"Data device 14","d":10574},{"v":"15","l":"Data device 15","d":10575},{"v":"16","l":"Data device 16","d":10576},{"v":"17","l":"Data device 17","d":10576}],"default":255,"dt":1},{"label":"Keine Daten vom BMS","type":13},{"name":17,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":12,"label":"Trigger keine Daten","unit":"s","type":3,"default":15,"min":1,"max":255,"dt":1},{"label":"Spannungsüberwachung Zelle Min/Max","type":13},{"name":18,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":14,"label":"Anzahl Zellen Monitoring","type":3,"default":16,"min":1,"max":24,"dt":1},{"name":15,"label":"Zellspannung Min","unit":"mV","type":3,"default":2500,"min":0,"max":5000,"dt":3},{"name":16,"label":"Zellspannung Max","unit":"mV","type":3,"default":3650,"min":0,"max":5000,"dt":3},{"label":"Spannungsüberwachung Gesamt Min/Max","type":13},{"name":19,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":72,"label":"Spannung Min","unit":"V","type":4,"default":48.0,"min":0,"max":66,"dt":7},{"name":73,"label":"Spannung Max","unit":"V","type":4,"default":54.0,"min":0,"max":66,"dt":7},{"name":131,"label":"Hysterese Min/Max","unit":"V","type":4,"default":0.5,"min":0,"max":10,"dt":7}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; -const char paramAlarmTemp[] PROGMEM = R"rawliteral( {"page":[{"label":"Alarm bei Sensorfehler","type":13},{"name":109,"label":"Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":110,"label":"Timeout","unit":"s","type":3,"default":"5","min":5,"max":240,"dt":1},{"label":"Temperatur Überwachung","type":13},{"name":20,"label":"Temperatur Überwachung","label_entry":"Überwachung","groupsize":10,"type":12,"group":[{"name":128,"label":"Quelle","type":9,"options":[{"v":"1","l":"BMS"},{"v":"2","l":"Onewire"}],"default":"1","dt":1},{"name":129,"label":"Zu überwachendes BMS (nur wenn Quelle BMS)","type":9,"options":[{"v":"0","l":"Data device 0","d":10560},{"v":"1","l":"Data device 1","d":10561},{"v":"2","l":"Data device 2","d":10562},{"v":"3","l":"Data device 3","d":10563},{"v":"4","l":"Data device 4","d":10564},{"v":"5","l":"Data device 5","d":10565},{"v":"6","l":"Data device 6","d":10566},{"v":"7","l":"Data device 7","d":10567},{"v":"8","l":"Data device 8","d":10568},{"v":"9","l":"Data device 9","d":10569},{"v":"10","l":"Data device 10","d":10570},{"v":"11","l":"Data device 11","d":10571},{"v":"12","l":"Data device 12","d":10572},{"v":"13","l":"Data device 13","d":10573},{"v":"14","l":"Data device 14","d":10574},{"v":"15","l":"Data device 15","d":10575},{"v":"16","l":"Data device 16","d":10576},{"v":"17","l":"Data device 17","d":10576}],"default":7,"dt":1},{"name":21,"label":"Sensornummer von","type":3,"default":"","min":0,"max":255,"dt":1,"help":"Mögliche Werte:
BMS:0-5
Onewire:0-63"},{"name":22,"label":"Sensornummer bis","type":3,"default":"","min":0,"max":255,"dt":1,"help":"Mögliche Werte:
BMS:0-2
Onewire:0-63"},{"name":27,"label":"Überwachung","type":9,"options":[{"v":"0","l":"nicht belegt"},{"v":"1","l":"Maximalwert-Überschreitung"},{"v":"4","l":"Minimalwert-Unterschreitung"},{"v":"2","l":"Maximalwert-Überschreitung (Referenz)"},{"v":"3","l":"Differenzwert-Überwachung"}],"default":"0","dt":1,"help":"Maximalwert-Überschreitung: Wert1=Maximale Temperatur
Maximalwert-Überschreitung (Referenz): Wert1=Temperatur Offset
Differenzwert-Überwachung: Wert1=Maximal erlaubte Differenz"},{"name":23,"label":"Referenzsensor","type":3,"default":"","min":0,"max":255,"dt":1},{"name":24,"label":"Wert 1","type":4,"default":"","min":0,"max":70,"dt":7},{"name":25,"label":"Hysterese","type":4,"default":"","min":0,"max":70,"dt":7},{"name":26,"label":"Auslösung","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; +const char paramAlarmBms[] PROGMEM = R"rawliteral( {"page":[{"label":"BMS Alarmregeln","label_entry":"Alarmregel","groupsize":20,"type":12,"group":[{"name":9,"label":"Zu überwachendes BMS","type":9,"options":[{"v":"255","l":"Aus"},{"v":"0","l":"Data device 0","d":10560},{"v":"1","l":"Data device 1","d":10561},{"v":"2","l":"Data device 2","d":10562},{"v":"3","l":"Data device 3","d":10563},{"v":"4","l":"Data device 4","d":10564},{"v":"5","l":"Data device 5","d":10565},{"v":"6","l":"Data device 6","d":10566},{"v":"7","l":"Data device 7","d":10567},{"v":"8","l":"Data device 8","d":10568},{"v":"9","l":"Data device 9","d":10569},{"v":"10","l":"Data device 10","d":10570},{"v":"11","l":"Data device 11","d":10571},{"v":"12","l":"Data device 12","d":10572},{"v":"13","l":"Data device 13","d":10573},{"v":"14","l":"Data device 14","d":10574},{"v":"15","l":"Data device 15","d":10575},{"v":"16","l":"Data device 16","d":10576},{"v":"17","l":"Data device 17","d":10576}],"default":255,"dt":1},{"label":"Keine Daten vom BMS","type":13},{"name":17,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":12,"label":"Trigger keine Daten","unit":"s","type":3,"default":15,"min":1,"max":255,"dt":1},{"label":"Spannungsüberwachung Zelle Min/Max","type":13},{"name":18,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":14,"label":"Anzahl Zellen Monitoring","type":3,"default":16,"min":1,"max":24,"dt":1},{"name":15,"label":"Zellspannung Min","unit":"mV","type":3,"default":2500,"min":0,"max":5000,"dt":3},{"name":16,"label":"Zellspannung Max","unit":"mV","type":3,"default":3650,"min":0,"max":5000,"dt":3},{"name":166,"label":"Hysterese Min/Max","unit":"mV","type":3,"default":50,"min":0,"max":3000,"dt":3},{"label":"Spannungsüberwachung Gesamt Min/Max","type":13},{"name":19,"label":"Aktion bei Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":72,"label":"Spannung Min","unit":"V","type":4,"default":48.0,"min":0,"max":66,"dt":7},{"name":73,"label":"Spannung Max","unit":"V","type":4,"default":54.0,"min":0,"max":66,"dt":7},{"name":131,"label":"Hysterese Min/Max","unit":"V","type":4,"default":0.5,"min":0,"max":10,"dt":7}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; +const char paramAlarmTemp[] PROGMEM = R"rawliteral( {"page":[{"label":"Alarm bei Sensorfehler","type":13},{"name":109,"label":"Trigger","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1},{"name":110,"label":"Timeout","unit":"s","type":3,"default":"5","min":5,"max":240,"dt":1},{"label":"Temperatur Überwachung","type":13},{"name":20,"label":"Temperatur Überwachung","label_entry":"Überwachung","groupsize":10,"type":12,"group":[{"name":128,"label":"Quelle","type":9,"options":[{"v":"1","l":"BMS"},{"v":"2","l":"Onewire"}],"default":"1","dt":1},{"name":129,"label":"Zu überwachendes BMS (nur wenn Quelle BMS)","type":9,"options":[{"v":"0","l":"Data device 0","d":10560},{"v":"1","l":"Data device 1","d":10561},{"v":"2","l":"Data device 2","d":10562},{"v":"3","l":"Data device 3","d":10563},{"v":"4","l":"Data device 4","d":10564},{"v":"5","l":"Data device 5","d":10565},{"v":"6","l":"Data device 6","d":10566},{"v":"7","l":"Data device 7","d":10567},{"v":"8","l":"Data device 8","d":10568},{"v":"9","l":"Data device 9","d":10569},{"v":"10","l":"Data device 10","d":10570},{"v":"11","l":"Data device 11","d":10571},{"v":"12","l":"Data device 12","d":10572},{"v":"13","l":"Data device 13","d":10573},{"v":"14","l":"Data device 14","d":10574},{"v":"15","l":"Data device 15","d":10575},{"v":"16","l":"Data device 16","d":10576},{"v":"17","l":"Data device 17","d":10576}],"default":7,"dt":1},{"name":21,"label":"Sensornummer von","type":3,"default":"","min":0,"max":63,"dt":1,"help":"Mögliche Werte:
BMS:0-5
Onewire:0-63"},{"name":22,"label":"Sensornummer bis","type":3,"default":"","min":0,"max":63,"dt":1,"help":"Mögliche Werte:
BMS:0-5
Onewire:0-63"},{"name":27,"label":"Überwachung","type":9,"options":[{"v":"0","l":"nicht belegt"},{"v":"1","l":"Maximalwert-Überschreitung"},{"v":"4","l":"Minimalwert-Unterschreitung"},{"v":"2","l":"Maximalwert-Überschreitung (Referenz)"},{"v":"3","l":"Differenzwert-Überwachung"}],"default":"0","dt":1,"help":"Maximalwert-Überschreitung: Wert1=Maximale Temperatur
Maximalwert-Überschreitung (Referenz): Wert1=Temperatur Offset
Differenzwert-Überwachung: Wert1=Maximal erlaubte Differenz"},{"name":23,"label":"Referenzsensor","type":3,"default":"","min":0,"max":255,"dt":1},{"name":24,"label":"Wert 1","type":4,"default":"","min":0,"max":70,"dt":7},{"name":25,"label":"Hysterese","type":4,"default":"","min":0,"max":70,"dt":7},{"name":26,"label":"Auslösung","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; const char paramDigitalOut[] PROGMEM = R"rawliteral( {"page":[{"label":"Relaisausgänge","label_entry":"Relaisausgang","groupsize":6,"type":12,"group":[{"name":30,"label":"Auslöseverhalten","type":9,"options":[{"v":"0","l":"Permanent"},{"v":"1","l":"Impuls"}],"default":"0","dt":1},{"name":31,"label":"Impulsdauer","unit":"ms","type":3,"default":500,"min":100,"max":10000,"dt":3},{"name":33,"label":"Verzögerung","unit":"s","type":3,"default":0,"min":0,"max":254,"dt":1},{"name":164,"label":"Invertieren","type":10,"default":"0","dt":9},{"name":32,"label":"Auswahl Trigger","type":14,"options":[{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"","dt":3}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; const char paramDigitalIn[] PROGMEM = R"rawliteral( {"page":[{"label":"Digitaleingänge","label_entry":"Digitaleingang","groupsize":4,"type":12,"group":[{"name":34,"label":"Eingang invertieren","type":10,"default":"0","dt":9},{"name":35,"label":"Weiterleiten an","type":9,"options":[{"v":"0","l":"Aus"},{"v":"1","l":"Trigger 1","d":7488},{"v":"2","l":"Trigger 2","d":7489},{"v":"3","l":"Trigger 3","d":7490},{"v":"4","l":"Trigger 4","d":7491},{"v":"5","l":"Trigger 5","d":7492},{"v":"6","l":"Trigger 6","d":7493},{"v":"7","l":"Trigger 7","d":7494},{"v":"8","l":"Trigger 8","d":7495},{"v":"9","l":"Trigger 9","d":7496},{"v":"10","l":"Trigger 10","d":7497}],"default":"0","dt":1}]}],"btn":[{"name":"save-btn","label":"Save"}]} )rawliteral"; const char paramOnewireAdr[] PROGMEM = R"rawliteral( {"page":[{"name":50,"label":"Onewire enable","type":10,"default":"0","dt":9},{"label":"OW Adressen","label_entry":"OW Adr.","groupsize":64,"type":12,"group":[{"name":51,"label":"OW Adr.","type":0,"default":"","flash":"1","dt":8}]}],"btn":[{"name":"save-btn","label":"Save"}],"timer":[{"type":"text","interval":2000}]} )rawliteral"; diff --git a/include/params_dt.h b/include/params_dt.h index 7ff0ff6c..2cde9979 100644 --- a/include/params_dt.h +++ b/include/params_dt.h @@ -40,6 +40,7 @@ #define DT_ID_PARAM_ALARM_BT_CNT_CELL_CTRL PARAM_DT_U8 #define DT_ID_PARAM_ALARM_BT_CELL_SPG_MIN PARAM_DT_U16 #define DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX PARAM_DT_U16 +#define DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE PARAM_DT_U16 #define DT_ID_PARAM_ALARM_BT_GESAMT_SPG_ALARM_AKTION PARAM_DT_U8 #define DT_ID_PARAM_ALARM_BT_GESAMT_SPG_MIN PARAM_DT_FL #define DT_ID_PARAM_ALARM_BT_GESAMT_SPG_MAX PARAM_DT_FL diff --git a/include/params_py.h b/include/params_py.h index be03b58a..498facf3 100644 --- a/include/params_py.h +++ b/include/params_py.h @@ -602,16 +602,17 @@ const String paramAlarmBms PROGMEM = "{'page':[" "'max':5000," "'dt':"+String(PARAM_DT_U16)+"" "}," - //"{" - // "'name':"+String(ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE)+"," - // "'label':'Hysterese'," - // "'unit':'mV'," - // "'type':"+String(HTML_INPUTNUMBER)+"," - // "'default':20," - // "'min':0," - // "'max':255," - // "'dt':"+String(PARAM_DT_U8)+"" - //"}," + "{" + "'name':"+String(ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE)+"," + "'label':'Hysterese Min/Max'," + "'unit':'mV'," + "'type':"+String(HTML_INPUTNUMBER)+"," + "'default':50," + "'min':0," + "'max':3000," + "'dt':"+String(PARAM_DT_U16)+"" + "}," + "{" "'label':'Spannungsüberwachung Gesamt Min/Max'," "'type':"+String(HTML_SEPARATION)+"" diff --git a/src/AlarmRules.cpp b/src/AlarmRules.cpp index fdaeba48..6fe42c04 100644 --- a/src/AlarmRules.cpp +++ b/src/AlarmRules.cpp @@ -46,9 +46,10 @@ uint8_t u8_mTachoChannel; uint16_t vTrigger; //Hysterese -uint32_t u32_hystereseTotalVoltageMin=0; -uint32_t u32_hystereseTotalVoltageMax=0; -uint8_t u8_merkerHysterese_TriggerAtSoc=0; +uint32_t u32_hystereseTotalVoltageMin = 0; +uint32_t u32_hystereseTotalVoltageMax = 0; +uint8_t u8_merkerHysterese_TriggerAtSoc = 0; +uint32_t mHystereseCellVoltage = 0; #ifndef LILYGO_TCAN485 void runDigitalAusgaenge(); @@ -658,22 +659,74 @@ void rules_Bms() //Überwachung Zellspannung if(WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION)>0) { - for(uint8_t cc=0; cc WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MAX,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX)) + if(getBmsCellVoltage(lAlarmruleDataDevice, cc) > highestCellVoltage) { - //Alarm - tmp=WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION); - setAlarm(tmp, true, ALARM_CAUSE_BMS_CELL_VOLTAGE, String(F("C")) + String(cc) + String(F(", ")) + String(getBmsCellVoltage(lAlarmruleDataDevice,cc)) + F(" mV")); - break; //Sobald eine Zelle Alarm meldet kann abgebrochen werden + highestCellVoltage = getBmsCellVoltage(lAlarmruleDataDevice,cc); + highestCellVoltageNr = cc; } - else + + if(getBmsCellVoltage(lAlarmruleDataDevice, cc) < lowestCellVoltage) { - tmp=WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION); - setAlarm(tmp, false, ALARM_CAUSE_BMS_CELL_VOLTAGE, String(F("C")) + String(cc) + String(F(", ")) + String(getBmsCellVoltage(lAlarmruleDataDevice,cc)) + F(" mV")); + lowestCellVoltage = getBmsCellVoltage(lAlarmruleDataDevice,cc); + lowestCellVoltageNr = cc; } } + + // Hysterese + uint16_t hystVoltage = (uint16_t)WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX_HYSTERESE); + + // Min. Cellvoltage + if(lowestCellVoltage < WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MIN,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MIN)) + { + bitSet(mHystereseCellVoltage, i); + cellVoltAlarm = true; + } + else if(isBitSet(mHystereseCellVoltage, i) && + lowestCellVoltage < WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MIN,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MIN) + hystVoltage) + { + CellVoltHyst = true; + } + + // Max. Cellvoltage + if(highestCellVoltage > WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MAX,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX)) + { + bitSet(mHystereseCellVoltage, i); + cellVoltAlarm = true; + } + else if(isBitSet(mHystereseCellVoltage, i) && + highestCellVoltage > WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_MAX,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_MAX) - hystVoltage) + { + CellVoltHyst = true; + } + + // Alarm auswerten + if(cellVoltAlarm || CellVoltHyst) + { + tmp = WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION); + setAlarm(tmp, true, ALARM_CAUSE_BMS_CELL_VOLTAGE, String(F("C")) + + String(lowestCellVoltageNr) + String(F("/")) + String(highestCellVoltageNr) + String(F(", ")) + + String(lowestCellVoltage) + String(F("/")) + String(highestCellVoltage) + F(" mV")); + } + else + { + bitClear(mHystereseCellVoltage, i); + + tmp = WebSettings::getInt(ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION,i,DT_ID_PARAM_ALARM_BT_CELL_SPG_ALARM_AKTION); + setAlarm(tmp, false, ALARM_CAUSE_BMS_CELL_VOLTAGE, String(F("C")) + + String(lowestCellVoltageNr) + String(F("/")) + String(highestCellVoltageNr) + String(F(", ")) + + String(lowestCellVoltage) + String(F("/")) + String(highestCellVoltage) + F(" mV")); + } } //Überwachung Gesamtspannung