From 07bf9036dc455531ce5db12f7e54bab7d71e4b51 Mon Sep 17 00:00:00 2001 From: RobertJDavis Date: Tue, 21 Oct 2025 13:14:49 -0700 Subject: [PATCH 1/3] UMAS CRAH update Changed running status to 0: running, 1: stopped per UMAS submittal Made default value of BMS Enable = 2 (BMS), so do not have to change to run Fixed bug associated with Fail State update() --> Standby Mode --- platformio.ini | 2 +- src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp | 2 ++ src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp | 11 +++++---- src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp | 14 ++++++----- src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp | 7 +++--- src/BMS/CRAH/CRAH_UMAS_TCP/config.h | 25 ++++++++++---------- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/platformio.ini b/platformio.ini index dc2ae6b..3905b81 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ default_envs = CRAH_UMAS_TCP ; Select here the name of the configuration you want to download [env] -upload_port = COM5 +upload_port = COM9 [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 aaa8bf0..056bf7b 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp @@ -75,6 +75,8 @@ void updateAlarms(Equipment* equipment){ "Alarm Condensate Pump ON", "Alarm Fire ON", "Alarm Smoke ON" }; + // NOTE: Per UMAS hardwire signals, alarm opened in case of normal operation, closed in case of alarm condition + // 0: no alarm, 1: alarm int numAlarms = 0; for (int i =0; i< alarmCommands.size() && i < alarmDescriptions.size(); ++i) { Modbus_Point* commandPoint = equipment->getModbus_Point(alarmCommands[i]); diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp index 3136cea..eafcf6b 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp @@ -82,8 +82,8 @@ State* FailState::update(Equipment* equipment) { setPointValue(equipment, "ON/OFF Command By BMS", 0); // The only way to exit the Fail State is for Leak Detect Alarm to turn off, then enter Standby State. - bool leakDetected = equipment->getModbus_Point("Alarm Leak Detect"); - if (leakDetected == 0){ + bool leakDetected = getPointValue(equipment, "Alarm Leak Detect"); + if (!leakDetected){ return new StandbyState(); } @@ -93,7 +93,7 @@ State* FailState::update(Equipment* equipment) { /** * @brief Logic to execute once when entering the fail state. - * When entering failed state, turn all fans off (fan status --> 0) and set BMS Command --> 0 + * When entering failed state, turn all fans off (fan status --> 1) and set BMS Command --> 0 * @param equipment Pointer to the Equipment instance. */ template<> @@ -107,11 +107,12 @@ void FailState::enterState(Equipment* equipment) { "Run Status Fan 7", "Run Status Fan 8", "Run Status Fan 9" }; - // Loop through and set all motor statuses to 0 + // Per UMAS submittal Hardwired Run Status signals- 0: fans running, 1: fans stopped + // Loop through and set all motor statuses to 1 for (const auto& desc : motorStatusDescriptions) { Modbus_Point* point = equipment->getModbus_Point(desc); if (point) { - point->setValue(0); + point->setValue(1); } }; diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp index 07ab898..96b1a0e 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp @@ -114,7 +114,7 @@ State* RunningState::update(Equipment* equipment) // Check to see if BMS Command set to OFF --> Place unit in Standby // Removed logic of placing unit on standby if BMS_Enable_Source != 2 for ease in testing Mode Feedback. if (On_Off_Command == 0){ - setPointValue(equipment, "ON/OFF Command By BMS", 0); + // setPointValue(equipment, "ON/OFF Command By BMS", 0); return new StandbyState(); } @@ -164,18 +164,19 @@ void RunningState::enterState(Equipment* equipment) { "Run Status Fan 7", "Run Status Fan 8", "Run Status Fan 9" }; - // Loop through and set all motor statuses to 1 + // Per UMAS submittal Hardwired Run Status signals- 0: fans running, 1: fans stopped + // Loop through and set all motor statuses to 0 for (const auto& desc : motorStatusDescriptions) { Modbus_Point* point = equipment->getModbus_Point(desc); if (point) { - point->setValue(1); + point->setValue(0); } } } /** * @brief Logic to execute once when exiting the running state. - * Sets the "Run Status" for all EC fans to 0 before transitioning to the next state. + * Sets the "Run Status" for all EC fans to 1 (stopped) before transitioning to the next state. * @param equipment Pointer to the Equipment instance. */ template<> @@ -188,11 +189,12 @@ void RunningState::exitState(Equipment* equipment) { "Run Status Fan 7", "Run Status Fan 8", "Run Status Fan 9" }; - // Loop through and set all motor statuses to 0 + // Per UMAS submittal Hardwired Run Status signals- 0: fans running, 1: fans stopped + // Loop through and set all motor statuses to 1 for (const auto& desc : motorStatusDescriptions) { Modbus_Point* point = equipment->getModbus_Point(desc); if (point) { - point->setValue(0); + point->setValue(1); } } } \ No newline at end of file diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp index 5611468..70be6d4 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp @@ -105,7 +105,7 @@ State* StandbyState::update(Equipment* equipment) /** * @brief Logic to execute once when entering the standby state. - * This method performs cleanup by setting all EC fan run status points to 0. + * This method performs cleanup by setting all EC fan run status points to 1 (stopped). * The BMS Command is also set to OFF. * @param equipment Pointer to the Equipment instance. */ @@ -120,11 +120,12 @@ void StandbyState::enterState(Equipment* equipment) { "Run Status Fan 7", "Run Status Fan 8", "Run Status Fan 9" }; - // Loop through and set all motor statuses to 0 + // Per UMAS submittal Hardwired Run Status signals- 0: fans running, 1: fans stopped + // Loop through and set all motor statuses to 1 for (const auto& desc : motorStatusDescriptions) { Modbus_Point* point = equipment->getModbus_Point(desc); if (point) { - point->setValue(0); + point->setValue(1); } }; diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h index 2bd9273..9490535 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h @@ -99,15 +99,15 @@ modbusMap mb_map[] = {IR, 50, 0, "Alarm Fan 7"}, {IR, 54, 0, "Alarm Fan 8"}, {IR, 58, 0, "Alarm Fan 9"}, - {IR, 27, 0, "Run Status Fan 1"}, // Send to PLC - {IR, 31, 0, "Run Status Fan 2"}, // Send to PLC - {IR, 35, 0, "Run Status Fan 3"}, // Send to PLC - {IR, 39, 0, "Run Status Fan 4"}, // Send to PLC - {IR, 43, 0, "Run Status Fan 5"}, // Send to PLC - {IR, 47, 0, "Run Status Fan 6"}, // Send to PLC - {IR, 51, 0, "Run Status Fan 7"}, // Send to PLC - {IR, 55, 0, "Run Status Fan 8"}, // Send to PLC - {IR, 59, 0, "Run Status Fan 9"}, // Send to PLC + {IR, 27, 1, "Run Status Fan 1"}, // Send to PLC + {IR, 31, 1, "Run Status Fan 2"}, // Send to PLC + {IR, 35, 1, "Run Status Fan 3"}, // Send to PLC + {IR, 39, 1, "Run Status Fan 4"}, // Send to PLC + {IR, 43, 1, "Run Status Fan 5"}, // Send to PLC + {IR, 47, 1, "Run Status Fan 6"}, // Send to PLC + {IR, 51, 1, "Run Status Fan 7"}, // Send to PLC + {IR, 55, 1, "Run Status Fan 8"}, // Send to PLC + {IR, 59, 1, "Run Status Fan 9"}, // Send to PLC {IR, 25, 0, "Speed Fan 1"}, {IR, 29, 0, "Speed Fan 2"}, {IR, 33, 0, "Speed Fan 3"}, @@ -126,7 +126,7 @@ modbusMap mb_map[] = {IR, 52, 0, "Operating Hours Fan 7"}, {IR, 56, 0, "Operating Hours Fan 8"}, {IR, 60, 0, "Operating Hours Fan 9"}, - {IR, 61, 0, "Control Mode Selected"}, + {IR, 61, 0, "Control Mode Selected"}, // 0: BMS+Speed, 1: BMS+Room Temp, 2: Return Temp {IR_FLOAT, 63, 0, "Amps Fan 1"}, {IR_FLOAT, 65, 0, "Amps Fan 2"}, {IR_FLOAT, 67, 0, "Amps Fan 3"}, @@ -141,8 +141,9 @@ modbusMap mb_map[] = {HR_FLOAT, 17, 0, "Supply Air Temp Setpoint"}, // Receive signal from PLC {HR_FLOAT, 21, 0, "Fan Min Speed"}, // Send to PLC {HR_FLOAT, 23, 0, "Fan Max Speed"}, // Send to PLC - {HR, 25, 0, "BMS Control Source"}, // Receive signal from PLC - {HR, 26, 0, "BMS Enable Source"}, // Receive signal from PLC + {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, 99, 0, "CRAH Heartbeat"} // Placeholder - we don't have this from UMAS yet. Not used in logic yet. }; //Size of modbus map used in FOR cycles, automatically calculated. From 2b7a376bc614bc6987b3b13cfdd137e0fbcb86d3 Mon Sep 17 00:00:00 2001 From: RobertJDavis Date: Tue, 21 Oct 2025 13:16:59 -0700 Subject: [PATCH 2/3] Update Running State removed comment --- src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp index 96b1a0e..f85524b 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp @@ -114,7 +114,6 @@ State* RunningState::update(Equipment* equipment) // Check to see if BMS Command set to OFF --> Place unit in Standby // Removed logic of placing unit on standby if BMS_Enable_Source != 2 for ease in testing Mode Feedback. if (On_Off_Command == 0){ - // setPointValue(equipment, "ON/OFF Command By BMS", 0); return new StandbyState(); } From 16a1bdf240dd3c221b8e367aa9a491aa8fc3b4a3 Mon Sep 17 00:00:00 2001 From: RobertJDavis Date: Tue, 21 Oct 2025 15:13:09 -0700 Subject: [PATCH 3/3] Update platformio.ini --- platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 3905b81..78645ca 100644 --- a/platformio.ini +++ b/platformio.ini @@ -191,5 +191,5 @@ build_src_filter = -<*> + platform = espressif32 board = dfrobot_firebeetle2_esp32e extends = common_env_options -build_flags = -D USE_MODBUS_IP ;Importat configuration, this flags is used to configure the program -build_src_filter = -<*> + ;Add the specific folder path here \ No newline at end of file +build_flags = -D USE_MODBUS_IP +build_src_filter = -<*> + \ No newline at end of file