From a24462e77b155dcc0a6e775e53767b8b1a07cc46 Mon Sep 17 00:00:00 2001 From: Emmanuel HC Date: Fri, 24 Oct 2025 13:24:59 -0500 Subject: [PATCH] save --- .../PDU_Maverick_Power_TCP/State_Running.cpp | 10 ++- src/EPMS/PDU/PDU_Maverick_Power_TCP/config.h | 2 +- .../UPS/UPS_Vertiv_APM2_TCP/State_Battery.cpp | 65 +++++++++------ .../UPS/UPS_Vertiv_APM2_TCP/State_Bypass.cpp | 79 ++++++++++--------- .../UPS/UPS_Vertiv_APM2_TCP/State_Running.cpp | 70 ++++++++-------- .../UPS/UPS_Vertiv_APM2_TCP/State_Standby.cpp | 57 ++++++++++++- src/EPMS/UPS/UPS_Vertiv_APM2_TCP/config.h | 7 +- 7 files changed, 185 insertions(+), 105 deletions(-) diff --git a/src/EPMS/PDU/PDU_Maverick_Power_TCP/State_Running.cpp b/src/EPMS/PDU/PDU_Maverick_Power_TCP/State_Running.cpp index 153ba0f..df33296 100644 --- a/src/EPMS/PDU/PDU_Maverick_Power_TCP/State_Running.cpp +++ b/src/EPMS/PDU/PDU_Maverick_Power_TCP/State_Running.cpp @@ -161,6 +161,8 @@ State* RunningState::update(Equipment* equipment) if (cb_status == 1.0f){ setBitValue(equipment, "CB_Status", cb_num, true); + setBitValue(equipment, "CB_Tripped", cb_num, false); + strategy = getStrategy("Amps G"); static_cast(strategy)->setSetpoint(65.0f); strategy = getStrategy("Amps N"); @@ -224,7 +226,13 @@ State* RunningState::update(Equipment* equipment) setPointValue(equipment, tag, total_load * 1715.0f * 0.9f); - }else{ + } + else{ + if (cb_status == 2.0f){ + setBitValue(equipment, "CB_Tripped", cb_num, true); + } else { + setBitValue(equipment, "CB_Tripped", cb_num, false); + } setBitValue(equipment, "CB_Status", cb_num, false); strategy = getStrategy("Amps G"); static_cast(strategy)->setSetpoint(0.0f); diff --git a/src/EPMS/PDU/PDU_Maverick_Power_TCP/config.h b/src/EPMS/PDU/PDU_Maverick_Power_TCP/config.h index db59a4b..3bb5f0c 100644 --- a/src/EPMS/PDU/PDU_Maverick_Power_TCP/config.h +++ b/src/EPMS/PDU/PDU_Maverick_Power_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, 178); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 33, 181); /**< @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. */ diff --git a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Battery.cpp b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Battery.cpp index 29c1e91..ce7c1a1 100644 --- a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Battery.cpp +++ b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Battery.cpp @@ -60,11 +60,12 @@ BatteryState::BatteryState() { addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs A", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs C", new RampStrategy(10.0F, 5.0f, 1000)); addStrategy("Battery Time Remaining", new RampStrategy(0.0F, 0.3f, 1000)); + addStrategy("Percentage Load", new RampStrategy(0.0F, 1.0f, 1000)); } /** @@ -120,7 +121,7 @@ State* BatteryState::update(Equipment* equipment) float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A"); ramp_strat = getStrategy("System Output Power Phase A"); static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia); - ramp_strat = getStrategy("System Output Apparent Power Phase A"); + ramp_strat = getStrategy("System Output Apparent Power Phs A"); static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia * Out_PFa); float Out_Vbn = getPointValue(equipment, "System Output RMS B-N"); @@ -128,7 +129,7 @@ State* BatteryState::update(Equipment* equipment) float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B"); ramp_strat = getStrategy("System Output Power Phase B"); static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib); - ramp_strat = getStrategy("System Output Apparent Power Phase B"); + ramp_strat = getStrategy("System Output Apparent Power Phs B"); static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib * Out_PFb); float Out_Vcn = getPointValue(equipment, "System Output RMS C-N"); @@ -136,7 +137,7 @@ State* BatteryState::update(Equipment* equipment) float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C"); ramp_strat = getStrategy("System Output Power Phase C"); static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic); - ramp_strat = getStrategy("System Output Apparent Power Phase C"); + ramp_strat = getStrategy("System Output Apparent Power Phs C"); static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic * Out_PFc); float Battery_time = getPointValue(equipment, "Battery Time Remaining"); @@ -167,23 +168,43 @@ State* BatteryState::update(Equipment* equipment) */ template<> void BatteryState::enterState(Equipment* equipment) { - // Logic to run when the equipment enters this state - Serial.println("Enter Battery State..."); + // Logic to run when the equipment enters this state + Serial.println("Enter Battery State..."); + setPointValue(equipment, "System Input RMS A-B", 0.0f); + setPointValue(equipment, "System Input RMS B-C", 0.0f); + setPointValue(equipment, "System Input RMS C-A", 0.0f); + setPointValue(equipment, "System Input RMS A-N", 0.0f); + setPointValue(equipment, "System Input RMS B-N", 0.0f); + setPointValue(equipment, "System Input RMS C-N", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase A", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase B", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase C", 0.0f); + setPointValue(equipment, "System Input Frequency", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs A", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs B", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs C", 0.0f); + setPointValue(equipment, "System Input Power Phase A", 0.0f); + setPointValue(equipment, "System Input Power Phase B", 0.0f); + setPointValue(equipment, "System Input Power Phase C", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs A", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs B", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs C", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f); - setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f); - setPointValue(equipment, "Bypass Input Frequency", 0.0f); - setPointValue(equipment, "Bypass Power Phase A", 0.0f); - setPointValue(equipment, "Bypass Power Phase B", 0.0f); - setPointValue(equipment, "Bypass Power Phase C", 0.0f); - - setPointValue(equipment, "UPS Loading Status", 6.0f); - setPointValue(equipment, "UPS Battery Status2", 2.0f); - // You could also update a Modbus register to show the "standby" state + + setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f); + setPointValue(equipment, "Bypass Input Frequency", 0.0f); + setPointValue(equipment, "Bypass Power Phase A", 0.0f); + setPointValue(equipment, "Bypass Power Phase B", 0.0f); + setPointValue(equipment, "Bypass Power Phase C", 0.0f); + setPointValue(equipment, "UPS Loading Status", 6.0f); + setPointValue(equipment, "UPS Battery Status2", 2.0f); + + // You could also update a Modbus register to show the "standby" state } diff --git a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Bypass.cpp b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Bypass.cpp index 9a1012d..73a2b31 100644 --- a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Bypass.cpp +++ b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Bypass.cpp @@ -49,9 +49,9 @@ BypassState::BypassState() { addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Input RMS Current Phase A", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0F, 1.0f, 1000)); addStrategy("System Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000)); @@ -59,12 +59,12 @@ BypassState::BypassState() { addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000)); addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000)); - addStrategy("System Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Input Power Phase A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Power Phase B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Power Phase C", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.0F, 5.0f, 1000)); //Bypass System @@ -77,9 +77,9 @@ BypassState::BypassState() { addStrategy("Bypass Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000)); - addStrategy("Bypass Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("Bypass Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("Bypass Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("Bypass Input Power Phase A", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("Bypass Input Power Phase B", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("Bypass Input Power Phase C", new RampStrategy(0.0F, 1.0f, 1000)); //Output System addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000)); @@ -89,9 +89,9 @@ BypassState::BypassState() { addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); - addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output RMS Current Phase A", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0F, 1.0f, 1000)); addStrategy("System Output Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000)); @@ -99,12 +99,12 @@ BypassState::BypassState() { addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000)); addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000)); - addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Power Phase A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Output Power Phase B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Output Power Phase C", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs C", new RampStrategy(0.0F, 5.0f, 1000)); addStrategy("Battery Time Remaining", new RampStrategy(480.0F, 0.3f, 1000)); addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0F, 5.0f, 1000)); @@ -163,30 +163,30 @@ State* BypassState::update(Equipment* equipment) { float In_PFa = getPointValue(equipment, "System Input Power Factor Phs A"); ramp_strat = getStrategy("System Input Power Phase A"); static_cast(ramp_strat)->setTarget(In_Van * In_Ia); - ramp_strat = getStrategy("Bypass Power Phase A"); + ramp_strat = getStrategy("Bypass Input Power Phase A"); static_cast(ramp_strat)->setTarget(In_Van * In_Ia); - ramp_strat = getStrategy("System Input Apparent Power Phase A"); - static_cast(ramp_strat)->setTarget(In_Van * In_Ia * In_PFa); - + ramp_strat = getStrategy("System Input Apparent Power Phs A"); + static_cast(ramp_strat)->setTarget(In_Van * In_Ia * 0.9f); + float In_Vbn = getPointValue(equipment, "System Input RMS B-N"); float In_Ib = getPointValue(equipment, "System Input RMS Current Phase B"); float In_PFb = getPointValue(equipment, "System Input Power Factor Phs B"); ramp_strat = getStrategy("System Input Power Phase B"); static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib); - ramp_strat = getStrategy("Bypass Power Phase B"); + ramp_strat = getStrategy("Bypass Input Power Phase B"); static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib); - ramp_strat = getStrategy("System Input Apparent Power Phase B"); - static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib * In_PFb); - + ramp_strat = getStrategy("System Input Apparent Power Phs B"); + static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib * 0.9f); + float In_Vcn = getPointValue(equipment, "System Input RMS C-N"); float In_Ic = getPointValue(equipment, "System Input RMS Current Phase C"); float In_PFc = getPointValue(equipment, "System Input Power Factor Phs C"); ramp_strat = getStrategy("System Input Power Phase C"); static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic); - ramp_strat = getStrategy("Bypass Power Phase C"); + ramp_strat = getStrategy("Bypass Input Power Phase C"); static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic); - ramp_strat = getStrategy("System Input Apparent Power Phase C"); - static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic * In_PFc); + ramp_strat = getStrategy("System Input Apparent Power Phs C"); + static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic * 0.9f); //Output strategies float Out_Vab = getPointValue(equipment, "System Output RMS A-B"); @@ -204,24 +204,24 @@ State* BypassState::update(Equipment* equipment) { float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A"); ramp_strat = getStrategy("System Output Power Phase A"); static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia); - ramp_strat = getStrategy("System Output Apparent Power Phase A"); - static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia * Out_PFa); + ramp_strat = getStrategy("System Output Apparent Power Phs A"); + static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia * 0.9f); float Out_Vbn = getPointValue(equipment, "System Output RMS B-N"); float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B"); float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B"); ramp_strat = getStrategy("System Output Power Phase B"); static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib); - ramp_strat = getStrategy("System Output Apparent Power Phase B"); - static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib * Out_PFb); + ramp_strat = getStrategy("System Output Apparent Power Phs B"); + static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib * 0.9f); float Out_Vcn = getPointValue(equipment, "System Output RMS C-N"); float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C"); float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C"); ramp_strat = getStrategy("System Output Power Phase C"); static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic); - ramp_strat = getStrategy("System Output Apparent Power Phase C"); - static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic * Out_PFc); + ramp_strat = getStrategy("System Output Apparent Power Phs C"); + static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic * 0.9f); float Battery_time = getPointValue(equipment, "Battery Time Remaining"); float Bat_Percent = Battery_time /4.80f; @@ -252,9 +252,10 @@ State* BypassState::update(Equipment* equipment) { template<> void BypassState::enterState(Equipment* equipment) { // Logic to run when the equipment enters this state - Serial.println("Enter Battery State..."); + Serial.println("Enter Bypass State..."); setPointValue(equipment, "UPS Loading Status", 4.0f); setPointValue(equipment, "UPS Battery Status2", 3.0f); + setPointValue(equipment, "Percentage Load", 0.0f); // You could also update a Modbus register to show the "standby" state } diff --git a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Running.cpp b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Running.cpp index f55d498..94036b7 100644 --- a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Running.cpp +++ b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Running.cpp @@ -47,9 +47,9 @@ RunningState::RunningState() { addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Input RMS Current Phase A", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0F, 1.0f, 1000)); addStrategy("System Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000)); @@ -57,13 +57,12 @@ RunningState::RunningState() { addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0F, 0.5f, 1000)); addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0F, 0.5f, 1000)); - addStrategy("System Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Input Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - + addStrategy("System Input Power Phase A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Power Phase B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Power Phase C", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000)); + addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.0F, 5.0f, 1000)); addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000)); addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000)); @@ -71,29 +70,28 @@ RunningState::RunningState() { addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000)); - - addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000)); + + addStrategy("System Output RMS Current Phase A", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000)); + addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0F, 1.0f, 1000)); addStrategy("System Output Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000)); - + addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0F, 5.0f, 1000)); addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000)); addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000)); - + addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000)); - addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000)); - - addStrategy("Battery Time Remaining", new RampStrategy(480.0F, 1.0f, 1000)); - - + addStrategy("System Output Apparent Power Phs A", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("System Output Apparent Power Phs C", new RampStrategy(10.0F, 5.0f, 1000)); + addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0F, 5.0f, 1000)); - + addStrategy("Battery Time Remaining", new RampStrategy(480.0F, 1.0f, 1000)); + addStrategy("Percentage Load", new RampStrategy(100.0F, 1.0f, 1000)); + } /** @@ -149,24 +147,24 @@ State* RunningState::update(Equipment* equipment) float In_PFa = getPointValue(equipment, "System Input Power Factor Phs A"); ramp_strat = getStrategy("System Input Power Phase A"); static_cast(ramp_strat)->setTarget(In_Van * In_Ia); - ramp_strat = getStrategy("System Input Apparent Power Phase A"); - static_cast(ramp_strat)->setTarget(In_Van * In_Ia * (In_PFa/100.0f)); + ramp_strat = getStrategy("System Input Apparent Power Phs A"); + static_cast(ramp_strat)->setTarget(In_Van * In_Ia * 0.9f); float In_Vbn = getPointValue(equipment, "System Input RMS B-N"); float In_Ib = getPointValue(equipment, "System Input RMS Current Phase B"); float In_PFb = getPointValue(equipment, "System Input Power Factor Phs B"); ramp_strat = getStrategy("System Input Power Phase B"); static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib); - ramp_strat = getStrategy("System Input Apparent Power Phase B"); - static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib * (In_PFb/100.0f)); + ramp_strat = getStrategy("System Input Apparent Power Phs B"); + static_cast(ramp_strat)->setTarget(In_Vbn * In_Ib * 0.9f); float In_Vcn = getPointValue(equipment, "System Input RMS C-N"); float In_Ic = getPointValue(equipment, "System Input RMS Current Phase C"); float In_PFc = getPointValue(equipment, "System Input Power Factor Phs C"); ramp_strat = getStrategy("System Input Power Phase C"); static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic); - ramp_strat = getStrategy("System Input Apparent Power Phase C"); - static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic * (In_PFc/100.0f)); + ramp_strat = getStrategy("System Input Apparent Power Phs C"); + static_cast(ramp_strat)->setTarget(In_Vcn * In_Ic * 0.9f); //Output strategies float Out_Vab = getPointValue(equipment, "System Output RMS A-B"); @@ -184,24 +182,24 @@ State* RunningState::update(Equipment* equipment) float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A"); ramp_strat = getStrategy("System Output Power Phase A"); static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia); - ramp_strat = getStrategy("System Output Apparent Power Phase A"); - static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia * (Out_PFa/100.0f)); + ramp_strat = getStrategy("System Output Apparent Power Phs A"); + static_cast(ramp_strat)->setTarget(Out_Van * Out_Ia * 0.9f); float Out_Vbn = getPointValue(equipment, "System Output RMS B-N"); float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B"); float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B"); ramp_strat = getStrategy("System Output Power Phase B"); static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib); - ramp_strat = getStrategy("System Output Apparent Power Phase B"); - static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib * (Out_PFb/100.0f)); + ramp_strat = getStrategy("System Output Apparent Power Phs B"); + static_cast(ramp_strat)->setTarget(Out_Vbn * Out_Ib * 0.9f); float Out_Vcn = getPointValue(equipment, "System Output RMS C-N"); float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C"); float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C"); ramp_strat = getStrategy("System Output Power Phase C"); static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic); - ramp_strat = getStrategy("System Output Apparent Power Phase C"); - static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic * (Out_PFc/100.0f)); + ramp_strat = getStrategy("System Output Apparent Power Phs C"); + static_cast(ramp_strat)->setTarget(Out_Vcn * Out_Ic * 0.9f); float Battery_time = getPointValue(equipment, "Battery Time Remaining"); float Bat_Percent = Battery_time /4.80f; diff --git a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Standby.cpp b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Standby.cpp index 3ce2bbd..602846b 100644 --- a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Standby.cpp +++ b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/State_Standby.cpp @@ -86,9 +86,60 @@ State* StandbyState::update(Equipment* equipment) */ template<> void StandbyState::enterState(Equipment* equipment) { - // Logic to run when the equipment enters this state - Serial.println("Enter Standby State..."); - setPointValue(equipment, "UPS Loading Status", 2.0f); + // Logic to run when the equipment enters this state + Serial.println("Enter Standby State..."); + setPointValue(equipment, "UPS Loading Status", 2.0f); + + setPointValue(equipment, "System Input RMS A-B", 0.0f); + setPointValue(equipment, "System Input RMS B-C", 0.0f); + setPointValue(equipment, "System Input RMS C-A", 0.0f); + setPointValue(equipment, "System Input RMS A-N", 0.0f); + setPointValue(equipment, "System Input RMS B-N", 0.0f); + setPointValue(equipment, "System Input RMS C-N", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase A", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase B", 0.0f); + setPointValue(equipment, "System Input RMS Current Phase C", 0.0f); + setPointValue(equipment, "System Input Frequency", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs A", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs B", 0.0f); + setPointValue(equipment, "System Input Power Factor Phs C", 0.0f); + setPointValue(equipment, "System Input Power Phase A", 0.0f); + setPointValue(equipment, "System Input Power Phase B", 0.0f); + setPointValue(equipment, "System Input Power Phase C", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs A", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs B", 0.0f); + setPointValue(equipment, "System Input Apparent Power Phs C", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f); + setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f); + setPointValue(equipment, "Bypass Input Frequency", 0.0f); + setPointValue(equipment, "Bypass Power Phase A", 0.0f); + setPointValue(equipment, "Bypass Power Phase B", 0.0f); + setPointValue(equipment, "Bypass Power Phase C", 0.0f); + setPointValue(equipment, "System Output RMS A-B", 0.0f); + setPointValue(equipment, "System Output RMS B-C", 0.0f); + setPointValue(equipment, "System Output RMS C-A", 0.0f); + setPointValue(equipment, "System Output RMS A-N", 0.0f); + setPointValue(equipment, "System Output RMS B-N", 0.0f); + setPointValue(equipment, "System Output RMS C-N", 0.0f); + setPointValue(equipment, "System Output RMS Current Phase A", 0.0f); + setPointValue(equipment, "System Output RMS Current Phase B", 0.0f); + setPointValue(equipment, "System Output RMS Current Phase C", 0.0f); + setPointValue(equipment, "System Output Frequency", 0.0f); + setPointValue(equipment, "System Output Power Factor Phs A", 0.0f); + setPointValue(equipment, "System Output Power Factor Phs B", 0.0f); + setPointValue(equipment, "System Output Power Factor Phs C", 0.0f); + setPointValue(equipment, "System Output Power Phase A", 0.0f); + setPointValue(equipment, "System Output Power Phase B", 0.0f); + setPointValue(equipment, "System Output Power Phase C", 0.0f); + setPointValue(equipment, "System Output Apparent Power Phs A", 0.0f); + setPointValue(equipment, "System Output Apparent Power Phs B", 0.0f); + setPointValue(equipment, "System Output Apparent Power Phs C", 0.0f); + setPointValue(equipment, "System Output Power", 0.0f); + setPointValue(equipment, "System Output Apparent Power", 0.0f); } /** diff --git a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/config.h b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/config.h index 766b749..9b11fce 100644 --- a/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/config.h +++ b/src/EPMS/UPS/UPS_Vertiv_APM2_TCP/config.h @@ -23,8 +23,8 @@ #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, 187); /**< @brief The static IP address for the device. */ - IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */ + IPAddress local_IP(172, 17, 3, 187); /**< @brief The static IP address for the device. */ + IPAddress gateway(172, 17, 3, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ ModbusIP mb; @@ -125,7 +125,8 @@ modbusMap mb_map[] = {IR, 60, 0, "System Output Power"}, {IR, 61, 0, "System Output Apparent Power"}, {IR, 164, 0, "UPS Loading Status"}, - {IR, 175, 0, "DC Bus Voltage"}, + {IR, 175, 0, "DC Bus Voltage"}, + {IR, 179, 0, "Percentage Load"}, {IR, 180, 0, "Battery Time Remaining"}, {IR, 183, 0, "UPS Battery Status1"}, {IR, 184, 0, "UPS Battery Status2"},