@@ -8231,9 +8231,94 @@ static const MetersSunSpecParser::ModelData model_714_data = {
82318231 }
82328232};
82338233
8234+ // ========================
8235+ // 802 - Battery Base Model
8236+ // ========================
8237+
8238+ #include " model_802.h"
8239+
8240+ static float get_model_802_SoC (const void *register_data, uint32_t quirks, bool detection)
8241+ {
8242+ const struct SunSpecBatteryBaseModelModel802_s *model = static_cast <const struct SunSpecBatteryBaseModelModel802_s *>(register_data);
8243+ uint16_t val = model->SoC ;
8244+ if (val == UINT16_MAX) return NAN;
8245+ float fval = static_cast <float >(val);
8246+ fval *= get_sun_spec_scale_factor (model->SoC_SF );
8247+ return fval;
8248+ }
8249+
8250+ static float get_model_802_V (const void *register_data, uint32_t quirks, bool detection)
8251+ {
8252+ const struct SunSpecBatteryBaseModelModel802_s *model = static_cast <const struct SunSpecBatteryBaseModelModel802_s *>(register_data);
8253+ uint16_t val = model->V ;
8254+ if (val == UINT16_MAX) return NAN;
8255+ float fval = static_cast <float >(val);
8256+ fval *= get_sun_spec_scale_factor (model->V_SF );
8257+ return fval;
8258+ }
8259+
8260+ static float get_model_802_A (const void *register_data, uint32_t quirks, bool detection)
8261+ {
8262+ const struct SunSpecBatteryBaseModelModel802_s *model = static_cast <const struct SunSpecBatteryBaseModelModel802_s *>(register_data);
8263+ int16_t val = model->A ;
8264+ if (val == INT16_MIN) return NAN;
8265+ float fval = static_cast <float >(val);
8266+ fval *= get_sun_spec_scale_factor (model->A_SF );
8267+ return fval;
8268+ }
8269+
8270+ static float get_model_802_W (const void *register_data, uint32_t quirks, bool detection)
8271+ {
8272+ const struct SunSpecBatteryBaseModelModel802_s *model = static_cast <const struct SunSpecBatteryBaseModelModel802_s *>(register_data);
8273+ int16_t val = model->W ;
8274+ if (val == INT16_MIN) return NAN;
8275+ float fval = static_cast <float >(val);
8276+ fval *= get_sun_spec_scale_factor (model->W_SF );
8277+ return fval;
8278+ }
8279+
8280+ static bool model_802_validator (const uint16_t * const register_data[2 ])
8281+ {
8282+ const SunSpecBatteryBaseModelModel802_s *block0 = reinterpret_cast <const SunSpecBatteryBaseModelModel802_s *>(register_data[0 ]);
8283+ const SunSpecBatteryBaseModelModel802_s *block1 = reinterpret_cast <const SunSpecBatteryBaseModelModel802_s *>(register_data[1 ]);
8284+ if (block0->ID != 802 ) return false ;
8285+ if (block1->ID != 802 ) return false ;
8286+ if (block0->L != 62 ) return false ;
8287+ if (block1->L != 62 ) return false ;
8288+ if (block0->AHRtg_SF != block1->AHRtg_SF ) return false ;
8289+ if (block0->WHRtg_SF != block1->WHRtg_SF ) return false ;
8290+ if (block0->WChaDisChaMax_SF != block1->WChaDisChaMax_SF ) return false ;
8291+ if (block0->DisChaRte_SF != block1->DisChaRte_SF ) return false ;
8292+ if (block0->SoC_SF != block1->SoC_SF ) return false ;
8293+ if (block0->DoD_SF != block1->DoD_SF ) return false ;
8294+ if (block0->SoH_SF != block1->SoH_SF ) return false ;
8295+ if (block0->V_SF != block1->V_SF ) return false ;
8296+ if (block0->CellV_SF != block1->CellV_SF ) return false ;
8297+ if (block0->A_SF != block1->A_SF ) return false ;
8298+ if (block0->AMax_SF != block1->AMax_SF ) return false ;
8299+ if (block0->W_SF != block1->W_SF ) return false ;
8300+ return true ;
8301+ }
8302+
8303+ static const MetersSunSpecParser::ModelData model_802_data = {
8304+ 802 , // model_id
8305+ 62 , // model_length
8306+ 64 , // interesting_registers_count
8307+ false , // is_meter
8308+ true , // read_twice
8309+ &model_802_validator,
8310+ 4 , // value_count
8311+ { // value_data
8312+ { &get_model_802_SoC, MeterValueID::StateOfCharge, 56 },
8313+ { &get_model_802_V, MeterValueID::VoltageDC, 59 },
8314+ { &get_model_802_A, MeterValueID::CurrentDCChaDisDiff, 61 },
8315+ { &get_model_802_W, MeterValueID::PowerDCChaDisDiff, 63 },
8316+ }
8317+ };
8318+
82348319
82358320const MetersSunSpecParser::AllModelData meters_sun_spec_all_model_data {
8236- 18 , // model_count
8321+ 19 , // model_count
82378322 { // model_data
82388323 &model_001_data,
82398324 &model_101_data,
@@ -8253,5 +8338,6 @@ const MetersSunSpecParser::AllModelData meters_sun_spec_all_model_data {
82538338 &model_701_data,
82548339 &model_713_data,
82558340 &model_714_data,
8341+ &model_802_data,
82568342 }
82578343};
0 commit comments