diff --git a/src/CHANGES.md b/src/CHANGES.md index ca360a36..06a80306 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,10 @@ # Development Changes +## 0.7.14 - 2023-07-23 +* fix Contrast for Nokia Display #1041 +* attempt to fix #1016 by improving inverter status +* added option to adjust effiency for yield (day/total) #1028 + ## 0.7.13 - 2023-07-19 * merged display PR #1027 * add date, time and version to export json #1024 diff --git a/src/config/config.h b/src/config/config.h index a03712bd..ad43ec2d 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -97,7 +97,10 @@ #define DEF_MAX_RETRANS_PER_PYLD 5 // number of seconds since last successful response, before inverter is marked inactive -#define INACT_THRES_SEC 300 +#define INVERTER_INACT_THRES_SEC 300 + +// number of seconds since last successful response, before inverter is marked offline +#define INVERTER_OFF_THRES_SEC 3600 // threshold of minimum power on which the inverter is marked as inactive #define INACT_PWR_THRESH 3 diff --git a/src/config/settings.h b/src/config/settings.h index 4d0ab505..255cfde3 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -145,6 +145,7 @@ typedef struct { bool rstValsNotAvail; bool rstValsCommStop; bool startWithoutTime; + float yieldEffiency; } cfgInst_t; typedef struct { @@ -409,7 +410,8 @@ class settings { mCfg.inst.rstYieldMidNight = false; mCfg.inst.rstValsNotAvail = false; mCfg.inst.rstValsCommStop = false; - mCfg.inst.startWithoutTime = false; + mCfg.inst.startWithoutTime = false; + mCfg.inst.yieldEffiency = 0.955f; mCfg.led.led0 = DEF_PIN_OFF; mCfg.led.led1 = DEF_PIN_OFF; @@ -624,10 +626,11 @@ class settings { void jsonInst(JsonObject obj, bool set = false) { if(set) { obj[F("en")] = (bool)mCfg.inst.enabled; - obj[F("rstMidNight")] = (bool)mCfg.inst.rstYieldMidNight; - obj[F("rstNotAvail")] = (bool)mCfg.inst.rstValsNotAvail; - obj[F("rstComStop")] = (bool)mCfg.inst.rstValsCommStop; - obj[F("strtWthtTime")] = (bool)mCfg.inst.startWithoutTime; + obj[F("rstMidNight")] = (bool)mCfg.inst.rstYieldMidNight; + obj[F("rstNotAvail")] = (bool)mCfg.inst.rstValsNotAvail; + obj[F("rstComStop")] = (bool)mCfg.inst.rstValsCommStop; + obj[F("strtWthtTime")] = (bool)mCfg.inst.startWithoutTime; + obj[F("yldEff")] = mCfg.inst.yieldEffiency; } else { getVal(obj, F("en"), &mCfg.inst.enabled); @@ -635,6 +638,12 @@ class settings { getVal(obj, F("rstNotAvail"), &mCfg.inst.rstValsNotAvail); getVal(obj, F("rstComStop"), &mCfg.inst.rstValsCommStop); getVal(obj, F("strtWthtTime"), &mCfg.inst.startWithoutTime); + getVal(obj, F("yldEff"), &mCfg.inst.yieldEffiency); + + if(mCfg.inst.yieldEffiency < 0.5) + mCfg.inst.yieldEffiency = 1.0f; + else if(mCfg.inst.yieldEffiency > 1.0f) + mCfg.inst.yieldEffiency = 1.0f; } JsonArray ivArr; diff --git a/src/defines.h b/src/defines.h index 4f4601cc..7c19c062 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 13 +#define VERSION_PATCH 14 //------------------------------------- typedef struct { diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index b926ca7a..cdd6428d 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -133,6 +133,7 @@ class Inverter { InverterStatus status; // indicates the current inverter status static uint32_t *timestamp; // system timestamp + static cfgInst_t *generalConfig; // general inverter configuration from setup Inverter() { ivGen = IV_HM; @@ -281,7 +282,9 @@ class Inverter { // temperature, Qvar, and power factor are a signed values rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div); } else if (FLD_YT == rec->assign[pos].fieldId) { - rec->record[pos] = ((REC_TYP)(val) / (REC_TYP)(div)) + ((REC_TYP)config->yieldCor[rec->assign[pos].ch-1]); + rec->record[pos] = ((REC_TYP)(val) / (REC_TYP)(div) * generalConfig->yieldEffiency) + ((REC_TYP)config->yieldCor[rec->assign[pos].ch-1]); + } else if (FLD_YD == rec->assign[pos].fieldId) { + rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div) * generalConfig->yieldEffiency; } else { if ((REC_TYP)(div) > 1) rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div); @@ -387,38 +390,42 @@ class Inverter { } bool isAvailable() { - bool val = false; - if((*timestamp - recordMeas.ts) < INACT_THRES_SEC) - val = true; - if((*timestamp - recordInfo.ts) < INACT_THRES_SEC) - val = true; - if((*timestamp - recordConfig.ts) < INACT_THRES_SEC) - val = true; - if((*timestamp - recordAlarm.ts) < INACT_THRES_SEC) - val = true; - - if(val) { - if((InverterStatus::OFF == status) || (InverterStatus::WAS_ON == status)) + bool avail = false; + if((*timestamp - recordMeas.ts) < INVERTER_INACT_THRES_SEC) + avail = true; + if((*timestamp - recordInfo.ts) < INVERTER_INACT_THRES_SEC) + avail = true; + if((*timestamp - recordConfig.ts) < INVERTER_INACT_THRES_SEC) + avail = true; + if((*timestamp - recordAlarm.ts) < INVERTER_INACT_THRES_SEC) + avail = true; + + if(avail) { + if(InverterStatus::OFF == status) status = InverterStatus::STARTING; - } else - status = InverterStatus::WAS_ON; + else + status = InverterStatus::WAS_ON; + } else { + if((*timestamp - recordMeas.ts) < INVERTER_OFF_THRES_SEC) + status = InverterStatus::OFF; + } - return val; + return avail; } bool isProducing() { - bool val = false; + bool producing = false; DPRINTLN(DBG_VERBOSE, F("hmInverter.h:isProducing")); if(isAvailable()) { uint8_t pos = getPosByChFld(CH0, FLD_PAC, &recordMeas); - val = (getValue(pos, &recordMeas) > INACT_PWR_THRESH); + producing = (getValue(pos, &recordMeas) > INACT_PWR_THRESH); - if(val) + if(producing) status = InverterStatus::PRODUCING; else if(InverterStatus::PRODUCING == status) - status = InverterStatus::WAS_PRODUCING; + status = InverterStatus::WAS_PRODUCING; } - return val; + return producing; } uint16_t getFwVersion() { @@ -635,6 +642,8 @@ class Inverter { template uint32_t *Inverter::timestamp {0}; +template +cfgInst_t *Inverter::generalConfig {0}; /** diff --git a/src/hm/hmSystem.h b/src/hm/hmSystem.h index 09f8a8ba..25d6dd11 100644 --- a/src/hm/hmSystem.h +++ b/src/hm/hmSystem.h @@ -19,6 +19,7 @@ class HmSystem { } void addInverters(cfgInst_t *config) { + mInverter[0].generalConfig = config; Inverter<> *iv; for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) { iv = addInverter(&config->iv[i]); diff --git a/src/plugins/Display/Display_Mono_64X48.h b/src/plugins/Display/Display_Mono_64X48.h index 8c355322..6b400a62 100644 --- a/src/plugins/Display/Display_Mono_64X48.h +++ b/src/plugins/Display/Display_Mono_64X48.h @@ -44,7 +44,7 @@ class DisplayMono64X48 : public DisplayMono { void config(bool enPowerSafe, bool enScreenSaver, uint8_t lum) { mEnPowerSafe = enPowerSafe; mEnScreenSaver = enScreenSaver; - mLuminance = lum; + mLuminance = lum * 255 / 100; } void loop(void) { diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 29a70d85..6531600d 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -333,6 +333,7 @@ class RestApi { obj[F("rstNAvail")] = (bool)mConfig->inst.rstValsNotAvail; obj[F("rstComStop")] = (bool)mConfig->inst.rstValsCommStop; obj[F("strtWthtTm")] = (bool)mConfig->inst.startWithoutTime; + obj[F("yldEff")] = mConfig->inst.yieldEffiency; } void getInverter(JsonObject obj, uint8_t id) { diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 1ee056df..6eed603c 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -176,6 +176,10 @@
Start without time sync (useful in AP-Only-Mode)
+
+
Yield Effiency (should be between 0.95 and 0.96)
+
+
@@ -626,7 +630,7 @@ } function ivGlob(obj) { - for(var i of [["invInterval", "interval"], ["invRetry", "retries"]]) + for(var i of [["invInterval", "interval"], ["invRetry", "retries"], ["yldEff", "yldEff"]]) document.getElementsByName(i[0])[0].value = obj[i[1]]; for(var i of [["Mid", "rstMid"], ["ComStop", "rstComStop"], ["NotAvail", "rstNAvail"]]) document.getElementsByName("invRst"+i[0])[0].checked = obj[i[1]]; diff --git a/src/web/web.h b/src/web/web.h index b8fe7a79..fdede860 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -525,6 +525,8 @@ class Web { mConfig->inst.rstValsCommStop = (request->arg("invRstComStop") == "on"); mConfig->inst.rstValsNotAvail = (request->arg("invRstNotAvail") == "on"); mConfig->inst.startWithoutTime = (request->arg("strtWthtTm") == "on"); + mConfig->inst.yieldEffiency = (request->arg("yldEff")).toFloat(); + // pinout uint8_t pin;