From b4a626b908749a75a9ab645e27b7ae1e8b6455b8 Mon Sep 17 00:00:00 2001 From: RobertJDavis Date: Thu, 6 Nov 2025 06:52:10 -0700 Subject: [PATCH] minor adjustments to CRAH UMAS TCP added Fan Speed Feedback register 40029, initialized unit to run for better image visualization while we wait for PICS-Arduino solution. --- platformio.ini | 4 +-- src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp | 27 +++++++++++++++++-- src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp | 3 +++ src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp | 10 +++++-- src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp | 5 ++-- src/BMS/CRAH/CRAH_UMAS_TCP/config.h | 6 ++--- .../PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h | 2 +- .../HUM/HUM_DriSteem_RTS_RX36_TCP/config.h | 2 +- src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h | 4 +-- 9 files changed, 48 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index b7351a8..efbda27 100644 --- a/platformio.ini +++ b/platformio.ini @@ -10,10 +10,10 @@ [platformio] -default_envs = CRAH_UMAS_TCP ; Select here the name of the configuration you want to download +default_envs = CH_York_YVAA_RTU ; Select here the name of the configuration you want to download [env] -upload_port = COM6 +upload_port = COM16 [common_env_options] framework = arduino diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp index 056bf7b..f980695 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp @@ -112,7 +112,6 @@ void updateAnalogs(Equipment* equipment){ else if (equipment->getModbus_Point("RA Temp High Alarm ON")->getValue()==1){ equipment->setModbus_Point("Return Air Temp", 104.0f); } - else equipment->setModbus_Point("Return Air Temp", 74.0f); if (equipment->getModbus_Point("RA Humidity Low Alarm ON")->getValue()==1){ equipment->setModbus_Point("Return Air Humidity", 15.0f); @@ -120,5 +119,29 @@ void updateAnalogs(Equipment* equipment){ else if (equipment->getModbus_Point("RA Humidity High Alarm ON")->getValue()==1){ equipment->setModbus_Point("Return Air Humidity", 65.0f); } - else equipment->setModbus_Point("Return Air Humidity", 35.0f); +} + +/** + * @brief This function is used to update the Control Mode (feedback), + * based on the selected BMS Control Source and BMS Enable Source. + * + * This is a function used in the update() of the Standby, Running, and Fail States. + * +*/ +void checkHB(Equipment* equipment){ + Modbus_Point* PLC_Heartbeat = equipment -> getModbus_Point ("PLC Heartbeat"); + int BMS_Control_Source = BMS_Control_Source_Pt ? BMS_Control_Source_Pt->getValue() : 0; + int BMS_Enable_Source = BMS_Enable_Source_Pt ? BMS_Enable_Source_Pt->getValue() : 0; + int Control_Mode_Selected = Control_Mode_Pt ? Control_Mode_Pt->getValue() : -1; + + if (BMS_Control_Source == 0 && BMS_Enable_Source == 2) { + Control_Mode_Selected = 0; + } else if (BMS_Control_Source == 1 && BMS_Enable_Source == 2) { + Control_Mode_Selected = 1; + } else if (BMS_Enable_Source == 0) { + Control_Mode_Selected = 2; + } + equipment->setModbus_Point("Control Mode Selected", Control_Mode_Selected); + + equipment->setModbus_Point("General Alarm", 0); } \ No newline at end of file diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp index c2f9171..eed9417 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp @@ -40,6 +40,9 @@ FailState::FailState(const std::vector& activeAlarms) { // Fan speed --> 0, Run Status --> 0, Amps --> 0 addStrategy("CW Valve Position", new RampStrategy(0.0f, 5.0f, 1000)); + addStrategy("Supply Air Temp", new SingleValueStrategy(74.0f, 1.0f, 1000)); + addStrategy("Return Air Temp", new SingleValueStrategy(86.0f, 1.0f, 1000)); + addStrategy("Return Air Humidity", new SingleValueStrategy(35.0f, 2.0f, 1000)); addStrategy("Speed Fan 1", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Speed Fan 2", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Speed Fan 3", new RampStrategy(0.0f, 10.0f, 1000)); diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp index ef8177c..a7b797b 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp @@ -72,10 +72,12 @@ RunningState::RunningState() { addStrategy("Operating Hours Fan 8", new TotalizerStrategy(1000)); addStrategy("Operating Hours Fan 9", new TotalizerStrategy(1000)); addStrategy("Supply Air Temp", new SawStrategy(60.0f, 100.0f, 2.2f, 1000)); // Won't initialize at lower bound; always initializes at 0 b/c FLOAT; initialize manually via Modscan - addStrategy("Return Air Temp", new SawStrategy(70.0f, 80.0f, 1.0f, 1000)); + addStrategy("Return Air Humidity", new SawStrategy(25.0f, 40.0f, 1.1f, 1000)); + addStrategy("Return Air Temp", new SawStrategy(70.0f, 80.0f, 0.8f, 1000)); addStrategy("Filter Differential Pressure", new SawStrategy(0.0f, 5.0f, 0.2f, 1000)); addStrategy("CW Valve Position", new PIDStrategy("Supply Air Temp Setpoint", 1000, "Supply Air Temp")); // SAT must be greater than SAT Setpoint for this PID to work. addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000)); + addStrategy("Fan Speed Feedback", new RampStrategy(0.0f, 1.0f, 200)); } /** @@ -141,7 +143,11 @@ State* RunningState::update(Equipment* equipment) } } - setPointValue(equipment, "Fan Speed Feedback", BMS_Speed_Setpoint); + // Fan Speed Feedback dynamically ramp to Fan Speed Setpoint sent to Arduino + Strategy_Behavior* speedFeedback = getStrategy("Fan Speed Feedback"); + if (speedFeedback){ + static_cast(speedFeedback)->setTarget(BMS_Speed_Setpoint); + } // Apply any strategies defined for the standby state _applyStrategies(equipment); diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp index a0f6b7d..5c86a7a 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp @@ -41,8 +41,9 @@ StandbyState::StandbyState() { // You can add initialization code here if needed. // These strategies are applied at the end of the update function. addStrategy("CW Valve Position", new RampStrategy(0.0f, 5.0f, 1000)); - addStrategy("Supply Air Temp", new RampStrategy(74.0f, 1.0f, 1000)); - addStrategy("Return Air Temp", new RampStrategy(86.0f, 1.0f, 1000)); + addStrategy("Supply Air Temp", new SingleValueStrategy(74.0f, 1.0f, 1000)); + addStrategy("Return Air Temp", new SingleValueStrategy(86.0f, 1.0f, 1000)); + addStrategy("Return Air Humidity", new SingleValueStrategy(35.0f, 2.0f, 1000)); addStrategy("Speed Fan 1", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Speed Fan 2", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Speed Fan 3", new RampStrategy(0.0f, 10.0f, 1000)); diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h index 196db82..409f130 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h @@ -23,7 +23,7 @@ #include const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(172, 17, 32, 49); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 32, 62); /**< @brief The static IP address for the device. */ IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ @@ -136,7 +136,7 @@ modbusMap mb_map[] = {IR_FLOAT, 75, 0, "Amps Fan 7"}, {IR_FLOAT, 77, 0, "Amps Fan 8"}, {IR_FLOAT, 79, 0, "Amps Fan 9"}, - {IR_FLOAT, 99, 0, "CRAH Heartbeat"}, // Placeholder - we don't have this from UMAS yet. Not used in logic yet. + {IR_FLOAT, 99, 0, "CRAH Heartbeat"}, {HR_FLOAT, 13, 0, "Fan Speed Setpoint"}, // Receive signal from PLC {HR_FLOAT, 17, 0, "Supply Air Temp Setpoint"}, // Receive signal from PLC @@ -145,7 +145,7 @@ modbusMap mb_map[] = {HR, 25, 0, "BMS Control Source"}, // Receive signal from PLC 0:Speed, 1:Room Temp {HR, 26, 2, "BMS Enable Source"}, // Receive signal from PLC 0:Keypad, 1:DI, 2:BMS {HR_FLOAT, 28, 0, "Fan Speed Feedback"}, - + {HR_FLOAT, 99, 0, "PLC Heartbeat"}, // This will be seconds from PLC - if doesn't change for 15 seconds set BMS Enable Source to Local (0) }; //Size of modbus map used in FOR cycles, automatically calculated. diff --git a/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h b/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h index c027708..2aec506 100644 --- a/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h +++ b/src/BMS/CRAH/PHX3_CRAH_LIEBERT_80_SLAB_TCP/config.h @@ -22,7 +22,7 @@ */ const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(172, 17, 32, 63); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 32, 66); /**< @brief The static IP address for the device. */ IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ diff --git a/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h b/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h index a40b037..b78c910 100644 --- a/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h +++ b/src/BMS/HUM/HUM_DriSteem_RTS_RX36_TCP/config.h @@ -23,7 +23,7 @@ #include const char *ssid = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */ const char *password = "123abc456"; /**< @brief The password for the WiFi network. */ - IPAddress local_IP(172, 17, 32, 67); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 32, 68); /**< @brief The static IP address for the device. */ IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */ IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */ diff --git a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h index d3c2a9e..79b6515 100644 --- a/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h +++ b/src/BMS/VFD/PHX3_VFD_ABB_ACH580_RTU/config.h @@ -56,8 +56,8 @@ */ modbusMap mb_map[] = { - {HR, 149, 1800, "Speed Cmd"}, // arbitrary register number - receive signal from PLC (hardwire IO in field); expecting rpm (1800 rpm max) - {HR, 151, 0, "Start/Stop"}, // arbitrary register number - receive signal from PLC (hardwire IO in practice) + {HR, 149, 1650, "Speed Cmd"}, // arbitrary register number - receive signal from PLC (hardwire IO in field); expecting rpm (1800 rpm max) + {HR, 151, 1, "Start/Stop"}, // arbitrary register number - receive signal from PLC (hardwire IO in practice) {HR, 152, 0, "HOA Command"}, // arbitrary register number - not used in program {HR, 154, 0, "Run Status"}, // arbitrary register number - 0:off, 1:on (simulated hardwire IO) sending feedback to PLC during simulation. {HR, 155, 1, "Fault Status"}, // arbitrary register number - 0:faulted, 1:not faulted (simulated hardwire IO). When = 0, will turn off VFD.