mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-28 17:56:21 +02:00
0.7.14
* fix Contrast for Nokia Display #1041 * attempt to fix #1016 by improving inverter status * added option to adjust effiency for yield (day/total) #1028
This commit is contained in:
parent
ac57e16902
commit
c9d705baa4
10 changed files with 63 additions and 29 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<bool>(obj, F("en"), &mCfg.inst.enabled);
|
||||
|
@ -635,6 +638,12 @@ class settings {
|
|||
getVal<bool>(obj, F("rstNotAvail"), &mCfg.inst.rstValsNotAvail);
|
||||
getVal<bool>(obj, F("rstComStop"), &mCfg.inst.rstValsCommStop);
|
||||
getVal<bool>(obj, F("strtWthtTime"), &mCfg.inst.startWithoutTime);
|
||||
getVal<float>(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;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 7
|
||||
#define VERSION_PATCH 13
|
||||
#define VERSION_PATCH 14
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -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;
|
||||
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(val) {
|
||||
if((InverterStatus::OFF == status) || (InverterStatus::WAS_ON == status))
|
||||
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 <class REC_TYP>
|
||||
uint32_t *Inverter<REC_TYP>::timestamp {0};
|
||||
template <class REC_TYP>
|
||||
cfgInst_t *Inverter<REC_TYP>::generalConfig {0};
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -176,6 +176,10 @@
|
|||
<div class="col-8 col-sm-3">Start without time sync (useful in AP-Only-Mode)</div>
|
||||
<div class="col-4 col-sm-9"><input type="checkbox" name="strtWthtTm"/></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-8 col-sm-3">Yield Effiency (should be between 0.95 and 0.96)</div>
|
||||
<div class="col-4 col-sm-9"><input type="number" name="yldEff" step="any"/></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
@ -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]];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue