mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-09 15:06:37 +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
|
# 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
|
## 0.7.13 - 2023-07-19
|
||||||
* merged display PR #1027
|
* merged display PR #1027
|
||||||
* add date, time and version to export json #1024
|
* add date, time and version to export json #1024
|
||||||
|
|
|
@ -97,7 +97,10 @@
|
||||||
#define DEF_MAX_RETRANS_PER_PYLD 5
|
#define DEF_MAX_RETRANS_PER_PYLD 5
|
||||||
|
|
||||||
// number of seconds since last successful response, before inverter is marked inactive
|
// 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
|
// threshold of minimum power on which the inverter is marked as inactive
|
||||||
#define INACT_PWR_THRESH 3
|
#define INACT_PWR_THRESH 3
|
||||||
|
|
|
@ -145,6 +145,7 @@ typedef struct {
|
||||||
bool rstValsNotAvail;
|
bool rstValsNotAvail;
|
||||||
bool rstValsCommStop;
|
bool rstValsCommStop;
|
||||||
bool startWithoutTime;
|
bool startWithoutTime;
|
||||||
|
float yieldEffiency;
|
||||||
} cfgInst_t;
|
} cfgInst_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -410,6 +411,7 @@ class settings {
|
||||||
mCfg.inst.rstValsNotAvail = false;
|
mCfg.inst.rstValsNotAvail = false;
|
||||||
mCfg.inst.rstValsCommStop = 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.led0 = DEF_PIN_OFF;
|
||||||
mCfg.led.led1 = DEF_PIN_OFF;
|
mCfg.led.led1 = DEF_PIN_OFF;
|
||||||
|
@ -628,6 +630,7 @@ class settings {
|
||||||
obj[F("rstNotAvail")] = (bool)mCfg.inst.rstValsNotAvail;
|
obj[F("rstNotAvail")] = (bool)mCfg.inst.rstValsNotAvail;
|
||||||
obj[F("rstComStop")] = (bool)mCfg.inst.rstValsCommStop;
|
obj[F("rstComStop")] = (bool)mCfg.inst.rstValsCommStop;
|
||||||
obj[F("strtWthtTime")] = (bool)mCfg.inst.startWithoutTime;
|
obj[F("strtWthtTime")] = (bool)mCfg.inst.startWithoutTime;
|
||||||
|
obj[F("yldEff")] = mCfg.inst.yieldEffiency;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getVal<bool>(obj, F("en"), &mCfg.inst.enabled);
|
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("rstNotAvail"), &mCfg.inst.rstValsNotAvail);
|
||||||
getVal<bool>(obj, F("rstComStop"), &mCfg.inst.rstValsCommStop);
|
getVal<bool>(obj, F("rstComStop"), &mCfg.inst.rstValsCommStop);
|
||||||
getVal<bool>(obj, F("strtWthtTime"), &mCfg.inst.startWithoutTime);
|
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;
|
JsonArray ivArr;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 7
|
#define VERSION_MINOR 7
|
||||||
#define VERSION_PATCH 13
|
#define VERSION_PATCH 14
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -133,6 +133,7 @@ class Inverter {
|
||||||
InverterStatus status; // indicates the current inverter status
|
InverterStatus status; // indicates the current inverter status
|
||||||
|
|
||||||
static uint32_t *timestamp; // system timestamp
|
static uint32_t *timestamp; // system timestamp
|
||||||
|
static cfgInst_t *generalConfig; // general inverter configuration from setup
|
||||||
|
|
||||||
Inverter() {
|
Inverter() {
|
||||||
ivGen = IV_HM;
|
ivGen = IV_HM;
|
||||||
|
@ -281,7 +282,9 @@ class Inverter {
|
||||||
// temperature, Qvar, and power factor are a signed values
|
// temperature, Qvar, and power factor are a signed values
|
||||||
rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div);
|
rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div);
|
||||||
} else if (FLD_YT == rec->assign[pos].fieldId) {
|
} 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 {
|
} else {
|
||||||
if ((REC_TYP)(div) > 1)
|
if ((REC_TYP)(div) > 1)
|
||||||
rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div);
|
rec->record[pos] = (REC_TYP)(val) / (REC_TYP)(div);
|
||||||
|
@ -387,38 +390,42 @@ class Inverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAvailable() {
|
bool isAvailable() {
|
||||||
bool val = false;
|
bool avail = false;
|
||||||
if((*timestamp - recordMeas.ts) < INACT_THRES_SEC)
|
if((*timestamp - recordMeas.ts) < INVERTER_INACT_THRES_SEC)
|
||||||
val = true;
|
avail = true;
|
||||||
if((*timestamp - recordInfo.ts) < INACT_THRES_SEC)
|
if((*timestamp - recordInfo.ts) < INVERTER_INACT_THRES_SEC)
|
||||||
val = true;
|
avail = true;
|
||||||
if((*timestamp - recordConfig.ts) < INACT_THRES_SEC)
|
if((*timestamp - recordConfig.ts) < INVERTER_INACT_THRES_SEC)
|
||||||
val = true;
|
avail = true;
|
||||||
if((*timestamp - recordAlarm.ts) < INACT_THRES_SEC)
|
if((*timestamp - recordAlarm.ts) < INVERTER_INACT_THRES_SEC)
|
||||||
val = true;
|
avail = true;
|
||||||
|
|
||||||
if(val) {
|
if(avail) {
|
||||||
if((InverterStatus::OFF == status) || (InverterStatus::WAS_ON == status))
|
if(InverterStatus::OFF == status)
|
||||||
status = InverterStatus::STARTING;
|
status = InverterStatus::STARTING;
|
||||||
} else
|
else
|
||||||
status = InverterStatus::WAS_ON;
|
status = InverterStatus::WAS_ON;
|
||||||
|
} else {
|
||||||
|
if((*timestamp - recordMeas.ts) < INVERTER_OFF_THRES_SEC)
|
||||||
|
status = InverterStatus::OFF;
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isProducing() {
|
bool isProducing() {
|
||||||
bool val = false;
|
bool producing = false;
|
||||||
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:isProducing"));
|
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:isProducing"));
|
||||||
if(isAvailable()) {
|
if(isAvailable()) {
|
||||||
uint8_t pos = getPosByChFld(CH0, FLD_PAC, &recordMeas);
|
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;
|
status = InverterStatus::PRODUCING;
|
||||||
else if(InverterStatus::PRODUCING == status)
|
else if(InverterStatus::PRODUCING == status)
|
||||||
status = InverterStatus::WAS_PRODUCING;
|
status = InverterStatus::WAS_PRODUCING;
|
||||||
}
|
}
|
||||||
return val;
|
return producing;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getFwVersion() {
|
uint16_t getFwVersion() {
|
||||||
|
@ -635,6 +642,8 @@ class Inverter {
|
||||||
|
|
||||||
template <class REC_TYP>
|
template <class REC_TYP>
|
||||||
uint32_t *Inverter<REC_TYP>::timestamp {0};
|
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) {
|
void addInverters(cfgInst_t *config) {
|
||||||
|
mInverter[0].generalConfig = config;
|
||||||
Inverter<> *iv;
|
Inverter<> *iv;
|
||||||
for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||||
iv = addInverter(&config->iv[i]);
|
iv = addInverter(&config->iv[i]);
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DisplayMono64X48 : public DisplayMono {
|
||||||
void config(bool enPowerSafe, bool enScreenSaver, uint8_t lum) {
|
void config(bool enPowerSafe, bool enScreenSaver, uint8_t lum) {
|
||||||
mEnPowerSafe = enPowerSafe;
|
mEnPowerSafe = enPowerSafe;
|
||||||
mEnScreenSaver = enScreenSaver;
|
mEnScreenSaver = enScreenSaver;
|
||||||
mLuminance = lum;
|
mLuminance = lum * 255 / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(void) {
|
void loop(void) {
|
||||||
|
|
|
@ -333,6 +333,7 @@ class RestApi {
|
||||||
obj[F("rstNAvail")] = (bool)mConfig->inst.rstValsNotAvail;
|
obj[F("rstNAvail")] = (bool)mConfig->inst.rstValsNotAvail;
|
||||||
obj[F("rstComStop")] = (bool)mConfig->inst.rstValsCommStop;
|
obj[F("rstComStop")] = (bool)mConfig->inst.rstValsCommStop;
|
||||||
obj[F("strtWthtTm")] = (bool)mConfig->inst.startWithoutTime;
|
obj[F("strtWthtTm")] = (bool)mConfig->inst.startWithoutTime;
|
||||||
|
obj[F("yldEff")] = mConfig->inst.yieldEffiency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getInverter(JsonObject obj, uint8_t id) {
|
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-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 class="col-4 col-sm-9"><input type="checkbox" name="strtWthtTm"/></div>
|
||||||
</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>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -626,7 +630,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function ivGlob(obj) {
|
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]];
|
document.getElementsByName(i[0])[0].value = obj[i[1]];
|
||||||
for(var i of [["Mid", "rstMid"], ["ComStop", "rstComStop"], ["NotAvail", "rstNAvail"]])
|
for(var i of [["Mid", "rstMid"], ["ComStop", "rstComStop"], ["NotAvail", "rstNAvail"]])
|
||||||
document.getElementsByName("invRst"+i[0])[0].checked = obj[i[1]];
|
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.rstValsCommStop = (request->arg("invRstComStop") == "on");
|
||||||
mConfig->inst.rstValsNotAvail = (request->arg("invRstNotAvail") == "on");
|
mConfig->inst.rstValsNotAvail = (request->arg("invRstNotAvail") == "on");
|
||||||
mConfig->inst.startWithoutTime = (request->arg("strtWthtTm") == "on");
|
mConfig->inst.startWithoutTime = (request->arg("strtWthtTm") == "on");
|
||||||
|
mConfig->inst.yieldEffiency = (request->arg("yldEff")).toFloat();
|
||||||
|
|
||||||
|
|
||||||
// pinout
|
// pinout
|
||||||
uint8_t pin;
|
uint8_t pin;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue