diff --git a/platformio.ini b/platformio.ini index 144a2c8..cb47d6d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -199,4 +199,4 @@ build_src_filter = -<*> + platform = espressif32 board = dfrobot_firebeetle2_esp32e extends = common_env_options -build_src_filter = -<*> + \ No newline at end of file +build_src_filter = -<*> + 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..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(); } @@ -164,18 +163,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 +188,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.