diff --git a/platformio.ini b/platformio.ini index 06422a6..6282084 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,7 +10,7 @@ [platformio] -default_envs = BKR_ABB_XT_TCP ; Select here the name of the configuration you want to download +default_envs = BKR_Susol_ACB_TCP ; Select here the name of the configuration you want to download [env] upload_port = COM50 diff --git a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Running.cpp b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Running.cpp index 3fb5e0b..a7c0ad2 100644 --- a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Running.cpp +++ b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Running.cpp @@ -61,7 +61,10 @@ State* RunningState::update(Equipment* equipment) // STATE control, add conditions if change to a different state is needed Serial.println("Running update function"); float State_Ctrl = getPointValue(equipment, "State Control"); - if (State_Ctrl == 1){ + if (State_Ctrl == 0.0f){ + return new StandbyState(); + } + if (State_Ctrl == 2.0f){ return new StandbyState(); } @@ -92,7 +95,9 @@ void RunningState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Running State..."); // You could also update a Modbus register to show the "standby" state - setPointValue(equipment, "Status", 4); + + setBitValue(equipment, "Status", 2, true); + setBitValue(equipment, "Tripped", 0, false); } diff --git a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Standby.cpp b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Standby.cpp index c7a1db4..b98eb98 100644 --- a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Standby.cpp +++ b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/State_Standby.cpp @@ -57,9 +57,16 @@ State* StandbyState::update(Equipment* equipment) // STATE control, add conditions if change to a different state is needed Serial.println("Standby update function"); float State_Ctrl = getPointValue(equipment, "State Control"); - if (State_Ctrl == 2){ + if (State_Ctrl == 1.0f){ return new RunningState(); } + + if (State_Ctrl == 0.0f){ + setBitValue(equipment, "Tripped", 0, false); + } + if (State_Ctrl == 2.0f){ + setBitValue(equipment, "Tripped", 0, true); + } // Apply any strategies defined for the standby state _applyStrategies(equipment); return nullptr; @@ -75,11 +82,13 @@ template<> void StandbyState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Standby State..."); - setPointValue(equipment, "Status", 0); setPointValue(equipment, "Amps A", 0.0f); setPointValue(equipment, "Amps B", 0.0f); setPointValue(equipment, "Amps C", 0.0f); + setPointValue(equipment, "Amps N", 0.0f); + + setBitValue(equipment, "Status", 2, false); } /** diff --git a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/config.h b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/config.h index 89915d8..66287f0 100644 --- a/src/EPMS/Breaker/BKR_Susol_ACB_TCP/config.h +++ b/src/EPMS/Breaker/BKR_Susol_ACB_TCP/config.h @@ -21,10 +21,10 @@ * @{ */ #include - const char *ssid = "wifi_name"; /**< @brief The SSID of the WiFi network. */ - const char *password = "wifi_password"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(192, 168, 1, 238); /**< @brief The static IP address for the device. */ - IPAddress gateway(192, 138, 1, 1); /**< @brief The gateway IP address. */ + const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */ + const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ + IPAddress local_IP(172, 17, 33, 149); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; diff --git a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Running.cpp b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Running.cpp index 387ac71..c334bdd 100644 --- a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Running.cpp +++ b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Running.cpp @@ -68,7 +68,10 @@ State* RunningState::update(Equipment* equipment) // STATE control, add conditions if change to a different state is needed Serial.println("Running update function"); float State_Ctrl = getPointValue(equipment, "State Control"); - if (State_Ctrl == 1){ + if (State_Ctrl == 0.0f){ + return new StandbyState(); + } + if (State_Ctrl == 2.0f){ return new StandbyState(); } // Apply any strategies defined for the standby state @@ -116,7 +119,9 @@ void RunningState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state Serial.println("Enter Running State..."); // You could also update a Modbus register to show the "standby" state - setPointValue(equipment, "CB Position", 4096); + + setBitValue(equipment, "CB Position", 12, true); + setBitValue(equipment, "CB Position", 9, false); } diff --git a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Standby.cpp b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Standby.cpp index 13f630c..d839d21 100644 --- a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Standby.cpp +++ b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/State_Standby.cpp @@ -57,9 +57,17 @@ State* StandbyState::update(Equipment* equipment) // STATE control, add conditions if change to a different state is needed Serial.println("Standby update function"); float State_Ctrl = getPointValue(equipment, "State Control"); - if (State_Ctrl == 2){ + if (State_Ctrl == 1.0f){ return new RunningState(); } + + if (State_Ctrl == 0.0f){ + setBitValue(equipment, "CB Position", 9, false); + } + + if (State_Ctrl == 2.0f){ + setBitValue(equipment, "CB Position", 9, true); + } // Apply any strategies defined for the standby state _applyStrategies(equipment); return nullptr; @@ -86,6 +94,7 @@ void StandbyState::enterState(Equipment* equipment) { setPointValue(equipment, "Amps A", 0.0f); setPointValue(equipment, "Amps B", 0.0f); setPointValue(equipment, "Amps C", 0.0f); + setBitValue(equipment, "CB Position", 12, false); } /** diff --git a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/config.h b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/config.h index 5d19823..cee6758 100644 --- a/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/config.h +++ b/src/EPMS/Breaker/Susol_Smart_MCCB_TCP/config.h @@ -23,7 +23,7 @@ #include const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */ const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(172, 17, 33, 132); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 33, 141); /**< @brief The static IP address for the device. */ IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ @@ -64,7 +64,7 @@ modbusMap mb_map[] = {HR, 10, 0, "Load"}, {HR, 11, 0, "Rating"}, - {IR, 207, 0, "CB Position"}, //bit 9 tripp bit 12 open closed + {IR, 207, 0, "CB Position"}, //bit 9 trip bit 12 open closed {IR_FLOAT, 215, 0, "Amps A"}, {IR_FLOAT, 217, 0, "Amps B"}, {IR_FLOAT, 219, 0, "Amps C"},