Browse Source

MaxTemp Berechnung und Anzeige

pull/1541/head
geronet1 10 months ago
parent
commit
42ee440e11
  1. 17
      src/hm/hmDefines.h
  2. 29
      src/hm/hmInverter.h
  3. 12
      src/hms/hmsDefines.h
  4. 5
      src/web/RestApi.h
  5. 4
      src/web/html/visualization.html

17
src/hm/hmDefines.h

@ -24,20 +24,20 @@ enum {FLD_UDC = 0, FLD_IDC, FLD_PDC, FLD_YD, FLD_YW, FLD_YT,
FLD_IRR, FLD_Q, FLD_EVT, FLD_FW_VERSION, FLD_FW_BUILD_YEAR,
FLD_FW_BUILD_MONTH_DAY, FLD_FW_BUILD_HOUR_MINUTE, FLD_BOOTLOADER_VER,
FLD_ACT_ACTIVE_PWR_LIMIT, FLD_PART_NUM, FLD_HW_VERSION, FLD_GRID_PROFILE_CODE,
FLD_GRID_PROFILE_VERSION, /*FLD_ACT_REACTIVE_PWR_LIMIT, FLD_ACT_PF,*/ FLD_LAST_ALARM_CODE, FLD_MP};
FLD_GRID_PROFILE_VERSION, /*FLD_ACT_REACTIVE_PWR_LIMIT, FLD_ACT_PF,*/ FLD_LAST_ALARM_CODE, FLD_MP, FLD_MT};
const char* const fields[] = {"U_DC", "I_DC", "P_DC", "YieldDay", "YieldWeek", "YieldTotal",
"U_AC", "U_AC_1N", "U_AC_2N", "U_AC_3N", "UAC_12", "UAC_23", "UAC_31", "I_AC",
"IAC_1", "I_AC_2", "I_AC_3", "P_AC", "F_AC", "Temp", "PF_AC", "Efficiency", "Irradiation","Q_AC",
"ALARM_MES_ID","FWVersion","FWBuildYear","FWBuildMonthDay","FWBuildHourMinute","BootloaderVersion",
"active_PowerLimit", "HWPartNumber", "HWVersion", "GridProfileCode",
"GridProfileVersion", /*"reactivePowerLimit","Powerfactor",*/ "LastAlarmCode", "MaxPower"};
"GridProfileVersion", /*"reactivePowerLimit","Powerfactor",*/ "LastAlarmCode", "MaxPower", "MaxTemp"};
const char* const notAvail = "n/a";
const uint8_t fieldUnits[] = {UNIT_V, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_KWH,
UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_A, UNIT_A, UNIT_A, UNIT_A,
UNIT_W, UNIT_HZ, UNIT_C, UNIT_NONE, UNIT_PCT, UNIT_PCT, UNIT_VAR,
UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_PCT, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_W};
UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_PCT, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_W, UNIT_C};
// mqtt discovery device classes
enum {DEVICE_CLS_NONE = 0, DEVICE_CLS_CURRENT, DEVICE_CLS_ENERGY, DEVICE_CLS_PWR, DEVICE_CLS_VOLTAGE, DEVICE_CLS_FREQ, DEVICE_CLS_TEMP};
@ -68,7 +68,7 @@ const byteAssign_fieldDeviceClass deviceFieldAssignment[] = {
#define DEVICE_CLS_ASSIGN_LIST_LEN (sizeof(deviceFieldAssignment) / sizeof(byteAssign_fieldDeviceClass))
// indices to calculation functions, defined in hmInverter.h
enum {CALC_YT_CH0 = 0, CALC_YD_CH0, CALC_UDC_CH, CALC_PDC_CH0, CALC_EFF_CH0, CALC_IRR_CH, CALC_MPAC_CH0, CALC_MPDC_CH};
enum {CALC_YT_CH0 = 0, CALC_YD_CH0, CALC_UDC_CH, CALC_PDC_CH0, CALC_EFF_CH0, CALC_IRR_CH, CALC_MPAC_CH0, CALC_MPDC_CH, CALC_MT_CH0};
enum {CMD_CALC = 0xffff};
@ -173,7 +173,8 @@ const byteAssign_t hm1chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HM1CH_LIST_LEN (sizeof(hm1chAssignment) / sizeof(byteAssign_t))
#define HM1CH_PAYLOAD_LEN 30
@ -211,7 +212,8 @@ const byteAssign_t hm2chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HM2CH_LIST_LEN (sizeof(hm2chAssignment) / sizeof(byteAssign_t))
@ -266,7 +268,8 @@ const byteAssign_t hm4chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HM4CH_LIST_LEN (sizeof(hm4chAssignment) / sizeof(byteAssign_t))
#define HM4CH_PAYLOAD_LEN 62

29
src/hm/hmInverter.h

@ -53,6 +53,9 @@ static T calcIrradiation(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0);
@ -107,7 +110,8 @@ const calcFunc_t<T> calcFunctions[] = {
{ CALC_EFF_CH0, &calcEffiencyCh0 },
{ CALC_IRR_CH, &calcIrradiation },
{ CALC_MPAC_CH0, &calcMaxPowerAcCh0 },
{ CALC_MPDC_CH, &calcMaxPowerDc }
{ CALC_MPDC_CH, &calcMaxPowerDc },
{ CALC_MT_CH0, &calcMaxTempCh0 }
};
template <class REC_TYP>
@ -147,6 +151,7 @@ class Inverter {
HeuristicInv heuristics; // heuristic information / logic
uint8_t curCmtFreq = 0; // current used CMT frequency, used to check if freq. was changed during runtime
uint32_t tsMaxAcPower = 0; // holds the timestamp when the MaxAC power was seen
uint32_t tsMaxTemp = 0; // holds the timestamp when the max temp was seen
bool commEnabled = true; // 'pause night communication' sets this field to false
public:
@ -951,6 +956,28 @@ static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) {
return acMaxPower;
}
template<class T=float>
static T calcMaxTempCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxTempCh0"));
T maxTemp = 0.0;
if(NULL != iv) {
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
T Temp = iv->getChannelFieldValue(arg0, FLD_T, rec);
for(uint8_t i = 0; i < rec->length; i++) {
if((FLD_MT == rec->assign[i].fieldId) && (0 == rec->assign[i].ch)) {
maxTemp = iv->getValue(i, rec);
}
}
if(Temp > maxTemp) {
iv->tsMaxTemp = *iv->timestamp;
return Temp;
}
}
return maxTemp;
}
template<class T=float>
static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxPowerDc"));

12
src/hms/hmsDefines.h

@ -33,7 +33,8 @@ const byteAssign_t hms1chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HMS1CH_LIST_LEN (sizeof(hms1chAssignment) / sizeof(byteAssign_t))
#define HMS1CH_PAYLOAD_LEN 30
@ -70,7 +71,8 @@ const byteAssign_t hms2chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HMS2CH_LIST_LEN (sizeof(hms2chAssignment) / sizeof(byteAssign_t))
#define HMS2CH_PAYLOAD_LEN 42
@ -123,7 +125,8 @@ const byteAssign_t hms4chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HMS4CH_LIST_LEN (sizeof(hms4chAssignment) / sizeof(byteAssign_t))
#define HMS4CH_PAYLOAD_LEN 66
@ -199,7 +202,8 @@ const byteAssign_t hmt6chAssignment[] = {
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC },
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC }
{ FLD_MP, UNIT_W, CH0, CALC_MPAC_CH0, 0, CMD_CALC },
{ FLD_MT, UNIT_C, CH0, CALC_MT_CH0, 0, CMD_CALC }
};
#define HMT6CH_LIST_LEN (sizeof(hmt6chAssignment) / sizeof(byteAssign_t))
#define HMT6CH_PAYLOAD_LEN 98

5
src/web/RestApi.h

@ -602,6 +602,7 @@ class RestApi {
obj[F("alarm_cnt")] = iv->alarmCnt;
obj[F("rssi")] = iv->rssi;
obj[F("ts_max_ac_pwr")] = iv->tsMaxAcPower;
obj[F("ts_max_temp")] = iv->tsMaxTemp;
JsonArray ch = obj.createNestedArray("ch");
@ -1110,9 +1111,9 @@ class RestApi {
private:
constexpr static uint8_t acList[] = {FLD_UAC, FLD_IAC, FLD_PAC, FLD_F, FLD_PF, FLD_T, FLD_YT,
FLD_YD, FLD_PDC, FLD_EFF, FLD_Q, FLD_MP};
FLD_YD, FLD_PDC, FLD_EFF, FLD_Q, FLD_MP, FLD_MT};
constexpr static uint8_t acListHmt[] = {FLD_UAC_1N, FLD_IAC_1, FLD_PAC, FLD_F, FLD_PF, FLD_T,
FLD_YT, FLD_YD, FLD_PDC, FLD_EFF, FLD_Q, FLD_MP};
FLD_YT, FLD_YD, FLD_PDC, FLD_EFF, FLD_Q, FLD_MP, FLD_MT};
constexpr static uint8_t dcList[] = {FLD_UDC, FLD_IDC, FLD_PDC, FLD_YD, FLD_YT, FLD_IRR, FLD_MP};
private:

4
src/web/html/visualization.html

@ -120,6 +120,7 @@
}
var maxAcPwr = toIsoDateStr(new Date(obj.ts_max_ac_pwr * 1000));
var maxTemp = toIsoDateStr(new Date(obj.ts_max_temp * 1000));
return ml("div", {class: "row mt-2"},
ml("div", {class: "col"}, [
ml("div", {class: "p-2 " + clh},
@ -134,7 +135,8 @@
ml("div", {class: "col a-c"}, ml("span", { class: "pointer", onclick: function() {
getAjax("/api/inverter/alarm/" + obj.id, parseIvAlarm);
}}, ("{#ALARMS}: " + obj.alarm_cnt))),
ml("div", {class: "col a-r mx-2 mx-md-1"}, String(obj.ch[0][5].toFixed(1)) + t.innerText)
ml("div", {class: "col a-r mx-2 mx-md-1 tooltip", data: maxTemp}, String(obj.ch[0][5].toFixed(1)) + t.innerText + "<br>" +
"Max:" + String(obj.ch[0][12].toFixed(1)) + t.innerText)
])
),
ml("div", {class: "p-2 " + clbg}, [

Loading…
Cancel
Save