Susol Smart MCCB TCP modbus map fixed

This commit is contained in:
Emmanuel HC
2025-10-01 11:21:57 -05:00
parent 448948e2da
commit 2b7b5d9603
3 changed files with 28 additions and 24 deletions

View File

@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[platformio] [platformio]
default_envs = PQM_PM9000_TCP ; Select here the name of the configuration you want to download default_envs = Susol_Smart_MCCB_TCP ; Select here the name of the configuration you want to download
[env] [env]
upload_port = COM15 upload_port = COM15

View File

@@ -86,9 +86,13 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
float load = static_cast<float>(I_load); float load = static_cast<float>(I_load);
float rating = static_cast<float>(I_rating); float rating = static_cast<float>(I_rating);
float real_load = rating * (load/100.0f); float real_load = rating * (load/100.0f);
setPointValue(equipment, "Amps A", real_load); Strategy_Behavior* ampsA_svs = getStrategy("Amps A");
setPointValue(equipment, "Amps B", real_load); Strategy_Behavior* ampsB_svs = getStrategy("Amps B");
setPointValue(equipment, "Amps C", real_load); Strategy_Behavior* ampsC_svs = getStrategy("Amps C");
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(real_load);
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(real_load);
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(real_load);
float pf = getPointValue(equipment, "PF"); float pf = getPointValue(equipment, "PF");
@@ -112,7 +116,7 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
// Logic to run when the equipment enters this state // Logic to run when the equipment enters this state
Serial.println("Enter Running State..."); Serial.println("Enter Running State...");
// You could also update a Modbus register to show the "standby" state // You could also update a Modbus register to show the "standby" state
setPointValue(equipment, "CB Position", 2048); setPointValue(equipment, "CB Position", 4096);
} }

View File

@@ -23,8 +23,8 @@
#include <ModbusIP_ESP8266.h> #include <ModbusIP_ESP8266.h>
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */ const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
IPAddress local_IP(172, 17, 30, 241); /**< @brief The static IP address for the device. */ IPAddress local_IP(172, 17, 33, 132); /**< @brief The static IP address for the device. */
IPAddress gateway(172, 17, 30, 1); /**< @brief The gateway IP address. */ IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
ModbusIP mb; ModbusIP mb;
@@ -64,23 +64,23 @@ modbusMap mb_map[] =
{HR, 10, 0, "Load"}, {HR, 10, 0, "Load"},
{HR, 11, 0, "Rating"}, {HR, 11, 0, "Rating"},
{IR, 206, 0, "CB Position"}, {IR, 207, 0, "CB Position"},
{IR_FLOAT, 214, 0, "Amps A"}, {IR_FLOAT, 215, 0, "Amps A"},
{IR_FLOAT, 216, 0, "Amps B"}, {IR_FLOAT, 217, 0, "Amps B"},
{IR_FLOAT, 218, 0, "Amps C"}, {IR_FLOAT, 219, 0, "Amps C"},
{IR_FLOAT, 220, 0, "Amps N"}, {IR_FLOAT, 221, 0, "Amps N"},
{IR_FLOAT, 222, 0, "Amps G"}, {IR_FLOAT, 223, 0, "Amps G"},
{IR_FLOAT, 230, 0, "Volts AN"}, {IR_FLOAT, 231, 0, "Volts AN"},
{IR_FLOAT, 231, 0, "Volts BN"}, {IR_FLOAT, 233, 0, "Volts BN"},
{IR_FLOAT, 234, 0, "Volts CN"}, {IR_FLOAT, 235, 0, "Volts CN"},
{IR_FLOAT, 236, 0, "Volts AB"}, {IR_FLOAT, 237, 0, "Volts AB"},
{IR_FLOAT, 238, 0, "Volts BC"}, {IR_FLOAT, 239, 0, "Volts BC"},
{IR_FLOAT, 240, 0, "Volts CA"}, {IR_FLOAT, 241, 0, "Volts CA"},
{IR_FLOAT, 248, 0, "PF"}, {IR_FLOAT, 249, 0, "PF"},
{IR_FLOAT, 250, 0, "kW"}, {IR_FLOAT, 251, 0, "kW"},
{IR_FLOAT, 254, 0, "kVA"}, {IR_FLOAT, 255, 0, "kVA"},
{IR_FLOAT, 264, 0, "kWh reg1"}, {IR_FLOAT, 265, 0, "kWh reg1"},
{IR_FLOAT, 266, 0, "kWh reg2"}, {IR_FLOAT, 267, 0, "kWh reg2"},
}; };
//Size of modbus map used in FOR cycles, automatically calculated. //Size of modbus map used in FOR cycles, automatically calculated.