diff --git a/platformio.ini b/platformio.ini index 6806fba..56b04b8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,8 @@ [platformio] -default_envs = RPP_Cortex_TCP ; Select here the name of the configuration you want to download + +default_envs = CRAH_UMAS_TCP ; Select here the name of the configuration you want to download [env] upload_port = COM11 @@ -213,71 +214,9 @@ board = dfrobot_firebeetle2_esp32e extends = common_env_options build_src_filter = -<*> + -[env:PHX3_VFD_ABB_ACH580_RTU] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_src_filter = -<*> + - -[env:PHX3_CRAH_LIEBERT_80_SLAB_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + - -[env:HUM_DriSteem_RTS_RX36_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + - [env:CRAH_UMAS_TCP] platform = espressif32 board = dfrobot_firebeetle2_esp32e extends = common_env_options build_flags = -D USE_MODBUS_IP build_src_filter = -<*> + - -[env:GEN_HSE] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + - -[env:SEL_2440_MVG] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + - -[env:MVG_SC_EC_M505_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP, -build_src_filter = -<*> + - -[env:GEN_CAT_GCCP_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP, -build_src_filter = -<*> + - -[env:CDU_CoolIT_Oracle_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + - -[env:RPP_Cortex_TCP] -platform = espressif32 -board = dfrobot_firebeetle2_esp32e -extends = common_env_options -build_flags = -D USE_MODBUS_IP -build_src_filter = -<*> + \ No newline at end of file diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp index 8fdfcc1..f479c57 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.cpp @@ -53,6 +53,120 @@ void updateControlMode(Equipment* equipment){ equipment->setModbus_Point("Control Mode Selected", Control_Mode_Selected); } +/** This function will set RA Temp, SA Temp, RA Humidity analog values to a LOW or HIGH range for testing alarms in Ignition. + * There is an associated COIL for performing each of those functions. + * There is also a NORMAL bit, which sends a one-shot to reset the associated analog value back into a normal range. + */ + +void updateAnalogs(Equipment* equipment){ + if (equipment->getModbus_Point("RA Temp NORMAL")->getValue()==1){ + equipment->setModbus_Point("Return Air Temp", 84.0f); + equipment->setModbus_Point("RA Temp Low Alarm ON", 0); + equipment->setModbus_Point("RA Temp High Alarm ON", 0); + equipment->setModbus_Point("RA Temp NORMAL", 0); + } + else if (equipment->getModbus_Point("RA Temp Low Alarm ON")->getValue() ==1){ + equipment->setModbus_Point("Return Air Temp", 60.0f); + equipment->setModbus_Point("RA Temp High Alarm ON", 0); + } + else if (equipment->getModbus_Point("RA Temp High Alarm ON")->getValue()==1){ + equipment->setModbus_Point("Return Air Temp", 110.0f); + equipment->setModbus_Point("RA Temp Low Alarm ON", 0); + } + + if (equipment->getModbus_Point("RA Humidity NORMAL")->getValue()==1){ + equipment->setModbus_Point("Return Humidity", 25.0f); + equipment->setModbus_Point("RA Humidity Low Alarm ON", 0); + equipment->setModbus_Point("RA Humidity High Alarm ON", 0); + equipment->setModbus_Point("RA Humidity NORMAL", 0); + } + else if (equipment->getModbus_Point("RA Humidity Low Alarm ON")->getValue()==1){ + equipment->setModbus_Point("Return Humidity", 5.0f); + equipment->setModbus_Point("RA Humidity High Alarm ON", 0); + } + else if (equipment->getModbus_Point("RA Humidity High Alarm ON")->getValue()==1){ + equipment->setModbus_Point("Return Humidity", 80.0f); + equipment->setModbus_Point("RA Humidity Low Alarm ON", 0); + } + + if (equipment->getModbus_Point("SA Temp NORMAL")->getValue()==1){ + equipment->setModbus_Point("Supply Air Temp", 76.0f); + equipment->setModbus_Point("SA Temp Low Alarm ON", 0); + equipment->setModbus_Point("SA Temp High Alarm ON", 0); + equipment->setModbus_Point("SA Temp NORMAL", 0); + } + else if (equipment->getModbus_Point("SA Temp Low Alarm ON")->getValue() ==1){ + equipment->setModbus_Point("Supply Air Temp", 60.0f); + equipment->setModbus_Point("SA Temp High Alarm ON", 0); + } + else if (equipment->getModbus_Point("SA Temp High Alarm ON")->getValue()==1){ + equipment->setModbus_Point("Supply Air Temp", 90.0f); + equipment->setModbus_Point("SA Temp Low Alarm ON", 0); + } + +} + +// Updates the RA Temp Alarms +void updateReturnAirTempAlarms(Equipment* equipment){ + Modbus_Point* returnAirTemp = equipment -> getModbus_Point("Return Air Temp"); + Modbus_Point* returnTempHighAlarmSP = equipment->getModbus_Point("Return Air Temp Alarm High SP"); + Modbus_Point* returnTempLowAlarmSP = equipment->getModbus_Point("Return Air Temp Alarm Low SP"); + + if (returnAirTemp->getValue() < returnTempLowAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm Low Return Air Temp", 1); + equipment->setModbus_Point("Alarm High Return Air Temp", 0); + } + else if (returnAirTemp->getValue() > returnTempHighAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm High Return Air Temp", 1); + equipment->setModbus_Point("Alarm Low Return Air Temp", 0); + } + else{ + equipment->setModbus_Point("Alarm High Return Air Temp", 0); + equipment->setModbus_Point("Alarm Low Return Air Temp", 0); + } + +} + +// Updates the SA Temp Alarms +void updateSupplyAirTempAlarms(Equipment* equipment){ + Modbus_Point* supplyAirTemp = equipment -> getModbus_Point("Supply Air Temp"); + Modbus_Point* supplyTempHighAlarmSP = equipment->getModbus_Point("Supply Air Temp Alarm High SP"); + Modbus_Point* supplyTempLowAlarmSP = equipment->getModbus_Point("Supply Air Temp Alarm Low SP"); + + if (supplyAirTemp->getValue() > supplyTempHighAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm High Supply Temp", 1); + equipment->setModbus_Point("Alarm Low Supply Temp", 0); + } + else if (supplyAirTemp->getValue() < supplyTempLowAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm Low Supply Temp", 1); + equipment->setModbus_Point("Alarm High Supply Temp", 0); + } + else{ + equipment->setModbus_Point("Alarm High Supply Temp", 0); + equipment->setModbus_Point("Alarm Low Supply Temp", 0); + } +} + +// Updates the RA Humidity Alarms +void updateReturnHumidityAlarms(Equipment* equipment){ + Modbus_Point* returnHumidity = equipment -> getModbus_Point("Return Humidity"); + Modbus_Point* returnHumHighAlarmSP = equipment->getModbus_Point("Return Humidity Alarm High SP"); + Modbus_Point* returnHumLowAlarmSP = equipment->getModbus_Point("Return Humidity Alarm Low SP"); + + if (returnHumidity->getValue() > returnHumHighAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm High Return Humidity", 1); + equipment->setModbus_Point("Alarm Low Return Humidity", 0); + } + else if (returnHumidity->getValue() < returnHumLowAlarmSP->getValue()) { + equipment->setModbus_Point("Alarm Low Return Humidity", 1); + equipment->setModbus_Point("Alarm High Return Humidity", 0); + } + else{ + equipment->setModbus_Point("Alarm High Return Humidity", 0); + equipment->setModbus_Point("Alarm Low Return Humidity", 0); + } +} + /** * @brief This function will update the Alarm status DI bits according to the Alarm Commands from Coils (Modscan) * It will also update the Common Alarm: if any alarm is active, the Common alarm will also be active. @@ -75,6 +189,12 @@ void updateAlarms(Equipment* equipment){ "Alarm Condensate Pump ON", "Alarm Fire ON", "Alarm Smoke ON" }; + const std::vector alarmAnalogs = { + "Alarm High Return Air Temp", "Alarm Low Return Air Temp", "Alarm High Return Humidity", "Alarm Low Return Humidity", + "Alarm High Supply Temp", "Alarm Low Supply Temp" + }; + + // 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; @@ -86,37 +206,15 @@ void updateAlarms(Equipment* equipment){ if (alarmPoint->getValue() == 1) numAlarms++; } } + // If any of the analog alarms = 1, increment counter for number of active alarms + for (int j = 0; j* alarmAnalogPoint = equipment->getModbus_Point(alarmAnalogs[j]); + if (alarmAnalogPoint) { + if (alarmAnalogPoint->getValue() == 1) numAlarms++; + } + } + // If any alarms are active, set the Common Alarm = 1, else Common Alarm = 0. + if (numAlarms >= 1) equipment->setModbus_Point("Common Alarm", 1); else equipment->setModbus_Point("Common Alarm", 0); -} - -/** - * @brief The purpose of this function is for testing the RA Temp and RA Humidity alarms (Ignition HMI display) - * User will manually set Alarms through Modscan coils, which will change RA Temp or RA Humidity accordingly. - * The RA Temp alarm limits (reference Ignition UDT) are 72, 100. - * The SA Temp alarm limits (reference Ignition UDT) are 72, 78. - * The RA Humidity alarm limits (reference Ignition UDT) are 20, 60. - * If an associated alarm coil is not active, the analog values are set to a safe, un-alarmed value. - * - * NOTE: These analog alarms will not activate the Common Alarm in the Arduino test. - * Since these alarms will be set in Ignition, will not be sent over Modbus from CRAH to Ignition. - * - * This is a function used in the update() of the Running State. - * -*/ -// Note: The Common Alarm is not configured to annunciate with these analog low/high alarms. -void updateAnalogs(Equipment* equipment){ - if (equipment->getModbus_Point("RA Temp Low Alarm ON")->getValue() ==1){ - equipment->setModbus_Point("Return Air Temp", 68.0f); - } - else if (equipment->getModbus_Point("RA Temp High Alarm ON")->getValue()==1){ - equipment->setModbus_Point("Return Air Temp", 104.0f); - } - - if (equipment->getModbus_Point("RA Humidity Low Alarm ON")->getValue()==1){ - equipment->setModbus_Point("Return Air Humidity", 15.0f); - } - else if (equipment->getModbus_Point("RA Humidity High Alarm ON")->getValue()==1){ - equipment->setModbus_Point("Return Air Humidity", 65.0f); - } } \ No newline at end of file diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.h b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.h index 23b56cb..7c49f8f 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.h +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/StateUtils.h @@ -34,17 +34,14 @@ class State; * @return The selected control mode (int). */ void updateControlMode(Equipment* equipment); +void updateAnalogs(Equipment* equipment); +void updateReturnAirTempAlarms(Equipment* equipment); +void updateSupplyAirTempAlarms(Equipment* equipment); +void updateReturnHumidityAlarms(Equipment* equipment); /** * @brief Checks common alarms (non-fail alarms) and updates the Common Alarm Modbus point. * @param equipment Pointer to the Equipment instance. * @return true if any common alarm is active, false otherwise. */ -void updateAlarms(Equipment* equipment); - -/** - * @brief Checks common alarms (non-fail alarms) and updates the Common Alarm Modbus point. - * @param equipment Pointer to the Equipment instance. - * @return true if any common alarm is active, false otherwise. - */ -void updateAnalogs(Equipment* equipment); \ No newline at end of file +void updateAlarms(Equipment* equipment); \ 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 ceeb819..5e9c124 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Fail.cpp @@ -42,16 +42,17 @@ FailState::FailState(const std::vector& activeAlarms) { 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)); - addStrategy("Speed Fan 4", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 5", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 6", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 7", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 8", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 9", new RampStrategy(0.0f, 10.0f, 1000)); + addStrategy("Return Humidity", new SingleValueStrategy(30.0f, 1.0f, 3000)); + addStrategy("Speed Fan 1", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 2", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 3", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 4", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 5", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 6", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 7", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 8", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 9", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Fan Speed Feedback", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Amps Fan 1", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 2", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 3", new RampStrategy(0.0f, 4.5f, 1000)); @@ -81,8 +82,11 @@ State* FailState::update(Equipment* equipment) { // Still want Control Mode and Alarms to be updated while in Fail State // Ensure BMS Command is set to Off: want operator to re-start from BMS once Leak Detect Alarm is cleared. updateControlMode(equipment); - updateAlarms(equipment); updateAnalogs(equipment); + updateReturnAirTempAlarms(equipment); + updateSupplyAirTempAlarms(equipment); + updateReturnHumidityAlarms(equipment); + updateAlarms(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. diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp index a1c8f16..9290275 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Running.cpp @@ -44,15 +44,15 @@ template<> RunningState::RunningState() { addStrategy("Fan Min Speed", new SingleValueStrategy(30.0f, 0.0f, 1000)); addStrategy("Fan Max Speed", new SingleValueStrategy(100.0f, 0.0f, 1000)); - addStrategy("Speed Fan 1", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 2", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 3", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 4", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 5", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 6", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 7", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 8", new RampStrategy(0.0f, 1.0f, 200)); - addStrategy("Speed Fan 9", new RampStrategy(0.0f, 1.0f, 200)); + addStrategy("Speed Fan 1", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 2", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 3", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 4", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 5", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 6", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 7", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 8", new RampStrategy(0.0f, 100.0f, 1000)); + addStrategy("Speed Fan 9", new RampStrategy(0.0f, 100.0f, 1000)); addStrategy("Amps Fan 1", new RampStrategy(15.0f, 2.5f, 1000)); addStrategy("Amps Fan 2", new RampStrategy(15.0f, 2.5f, 1000)); addStrategy("Amps Fan 3", new RampStrategy(15.0f, 2.5f, 1000)); @@ -71,13 +71,13 @@ RunningState::RunningState() { addStrategy("Operating Hours Fan 7", new TotalizerStrategy(1000)); 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 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("Supply Air Temp", new SawStrategy(73.0f, 77.0f, 0.2f, 1000)); // Won't initialize at lower bound; always initializes at 0 b/c FLOAT; initialize manually via Modscan + addStrategy("Return Humidity", new SawStrategy(25.0f, 35.0f, 0.2f, 1000)); + addStrategy("Return Air Temp", new SawStrategy(80.0f, 90.0f, 0.2f, 1000)); + addStrategy("Filter Differential Pressure", new SawStrategy(0.1f, 5.1f, 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)); + addStrategy("Fan Speed Feedback", new RampStrategy(0.0f, 2.0f, 200)); } /** @@ -104,8 +104,11 @@ State* RunningState::update(Equipment* equipment) int BMS_Enable_Source = getPointValue(equipment, "BMS Enable Source"); // Modscan HR 2 updateControlMode(equipment); - updateAlarms(equipment); updateAnalogs(equipment); + updateReturnAirTempAlarms(equipment); + updateSupplyAirTempAlarms(equipment); + updateReturnHumidityAlarms(equipment); + updateAlarms(equipment); // Check to see if Leak Detect alarm is active (only alarm which will make unit FAIL and turn off) --> Send to FailState bool leakDetect = getPointValue(equipment, "Alarm Leak Detect"); @@ -121,11 +124,14 @@ State* RunningState::update(Equipment* equipment) // This will update the Fan Speed Setpoint dynamically while in run mode. Fan Speed Setpoint changed through Modscan. // This functioanlity matches the UMAS SOO specifically for how it calculates Speed Setpoint. - float BMS_Speed_Setpoint = getPointValue(equipment, "Fan Speed Setpoint"); - float BMS_Speed_Setpoint_Pct = BMS_Speed_Setpoint / 100.0f; float Fan_Min_Speed = getPointValue(equipment, "Fan Min Speed"); float Fan_Max_Speed = getPointValue(equipment, "Fan Max Speed"); + float Fan_Nominal_Speed = 1900.0f; + + float BMS_Speed_Setpoint = getPointValue(equipment, "Fan Speed Setpoint"); + float BMS_Speed_Setpoint_Pct = BMS_Speed_Setpoint / 100.0f; float Fan_Speed_Setpoint = BMS_Speed_Setpoint_Pct * (Fan_Max_Speed - Fan_Min_Speed) + Fan_Min_Speed; + float Fan_Speed_Setpoint_RPM = Fan_Speed_Setpoint / 100.0f * Fan_Nominal_Speed; for (int i = 0; i < 10; i++){ std::string pointName = "Speed Fan " + std::to_string(i); Strategy_Behavior* strat = getStrategy(pointName); @@ -134,11 +140,13 @@ State* RunningState::update(Equipment* equipment) if (ramp){ if (BMS_Speed_Setpoint > 100){ Fan_Speed_Setpoint = Fan_Max_Speed; + Fan_Speed_Setpoint_RPM = Fan_Max_Speed / 100.0f * Fan_Nominal_Speed; } else if (BMS_Speed_Setpoint < 0){ - Fan_Speed_Setpoint = Fan_Min_Speed; + Fan_Speed_Setpoint = Fan_Min_Speed; + Fan_Speed_Setpoint_RPM = Fan_Min_Speed / 100.0f * Fan_Nominal_Speed; } - ramp->setTarget(Fan_Speed_Setpoint); + ramp->setTarget(Fan_Speed_Setpoint_RPM); } } } @@ -146,7 +154,7 @@ State* RunningState::update(Equipment* equipment) // 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); + static_cast(speedFeedback)->setTarget(Fan_Speed_Setpoint); } // Apply any strategies defined for the standby state diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp index 2b78791..c863fcd 100644 --- a/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp +++ b/src/BMS/CRAH/CRAH_UMAS_TCP/State_Standby.cpp @@ -41,18 +41,19 @@ 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 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)); - addStrategy("Speed Fan 4", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 5", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 6", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 7", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 8", new RampStrategy(0.0f, 10.0f, 1000)); - addStrategy("Speed Fan 9", new RampStrategy(0.0f, 10.0f, 1000)); + addStrategy("Supply Air Temp", new SingleValueStrategy(76.0f, 1.0f, 2000)); + addStrategy("Return Air Temp", new SingleValueStrategy(86.0f, 1.0f, 3000)); + addStrategy("Return Humidity", new SingleValueStrategy(25.0f, 1.0f, 4000)); + addStrategy("Speed Fan 1", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 2", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 3", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 4", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 5", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 6", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 7", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 8", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Speed Fan 9", new RampStrategy(0.0f, 300.0f, 1000)); + addStrategy("Fan Speed Feedback", new RampStrategy(0.0f, 10.0f, 1000)); addStrategy("Amps Fan 1", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 2", new RampStrategy(0.0f, 4.5f, 1000)); addStrategy("Amps Fan 3", new RampStrategy(0.0f, 4.5f, 1000)); @@ -86,8 +87,11 @@ State* StandbyState::update(Equipment* equipment) int BMS_Enable_Source = getPointValue(equipment, "BMS Enable Source"); // Modscan HR 2 updateControlMode(equipment); - updateAlarms(equipment); updateAnalogs(equipment); + updateReturnAirTempAlarms(equipment); + updateSupplyAirTempAlarms(equipment); + updateReturnHumidityAlarms(equipment); + updateAlarms(equipment); // Check to see if Leak Detect alarm is active (only alarm which will make unit FAIL and turn off) --> Send to FailState bool leakDetect = getPointValue(equipment, "Alarm Leak Detect"); diff --git a/src/BMS/CRAH/CRAH_UMAS_TCP/config.h b/src/BMS/CRAH/CRAH_UMAS_TCP/config.h index 186fa3b..0fac917 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, 62); /**< @brief The static IP address for the device. */ + IPAddress local_IP(172, 17, 32, 232); /**< @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. */ @@ -56,37 +56,55 @@ * This array defines all the Modbus points available on the emulated device. * The `description` field is crucial as it's used to look up points within the application logic. */ + + // "One-Based" Addressing for IR, HR registers + modbusMap mb_map[] = { {COIL, 0, 0, "ON/OFF Command By BMS"}, // Receive signal from PLC - {COIL, 1, 0, "Alarm Fan 1 ON"}, // Just for Arduino testing. Sets Alarm Fan 1 to 1. - {COIL, 2, 0, "Alarm Fan 2 ON"}, // Just for Arduino testing. Sets Alarm Fan 2 to 1. - {COIL, 3, 0, "Alarm Dirty Filter ON"}, // Just for Arduino testing. Sets Alarm Dirty Filter to 1. - {COIL, 4, 0, "Alarm Leak Detect ON"}, // Just for Arduino testing. Sets Alarm Fan 1 to 1. - {COIL, 5, 0, "RA Temp Low Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) - {COIL, 6, 0, "RA Temp High Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 104F (high alarm) - {COIL, 7, 0, "RA Humidity Low Alarm ON"}, // Just for Arduino testing. Sets RA Humidity to 15% (low alarm) - {COIL, 8, 0, "RA Humidity High Alarm ON"}, // Just for Arduino testing. Sets RA Humidity to 65% (high alarm) - {COIL, 9, 0, "Alarm Fan 3 ON"}, // Just for Arduino testing. Sets Alarm Fan 3 to 1. - {COIL, 10, 0, "Alarm Fan 4 ON"}, // Just for Arduino testing. Sets Alarm Fan 4 to 1. - {COIL, 11, 0, "Alarm Fan 5 ON"}, // Just for Arduino testing. Sets Alarm Fan 5 to 1. - {COIL, 12, 0, "Alarm Fan 6 ON"}, // Just for Arduino testing. Sets Alarm Fan 6 to 1. - {COIL, 13, 0, "Alarm Fan 7 ON"}, // Just for Arduino testing. Sets Alarm Fan 7 to 1. - {COIL, 14, 0, "Alarm Fan 8 ON"}, // Just for Arduino testing. Sets Alarm Fan 8 to 1. - {COIL, 15, 0, "Alarm Fan 9 ON"}, // Just for Arduino testing. Sets Alarm Fan 9 to 1. - {COIL, 16, 0, "Alarm Condensate Pump ON"}, // Just for Arduino testing. Sets Alarm Condensate Pump to 1. - {COIL, 17, 0, "Alarm Fire ON"}, // Just for Arduino testing. Sets Alarm Fire to 1. - {COIL, 18, 0, "Alarm Smoke ON"}, // Just for Arduino testing. Sets Alarm Smoke to 1. + {COIL, 1, 0, "Alarm Dirty Filter ON"}, // Just for Arduino testing. Sets Alarm Dirty Filter to 1. + {COIL, 2, 0, "Alarm Leak Detect ON"}, // Just for Arduino testing. Sets Alarm Fan 1 to 1. + + {COIL, 3, 0, "Alarm Fan 1 ON"}, // Just for Arduino testing. Sets Alarm Fan 1 to 1. + {COIL, 4, 0, "Alarm Fan 2 ON"}, // Just for Arduino testing. Sets Alarm Fan 2 to 1. + {COIL, 5, 0, "Alarm Fan 3 ON"}, // Just for Arduino testing. Sets Alarm Fan 3 to 1. + {COIL, 6, 0, "Alarm Fan 4 ON"}, // Just for Arduino testing. Sets Alarm Fan 4 to 1. + {COIL, 7, 0, "Alarm Fan 5 ON"}, // Just for Arduino testing. Sets Alarm Fan 5 to 1. + {COIL, 8, 0, "Alarm Fan 6 ON"}, // Just for Arduino testing. Sets Alarm Fan 6 to 1. + {COIL, 9, 0, "Alarm Fan 7 ON"}, // Just for Arduino testing. Sets Alarm Fan 7 to 1. + {COIL, 10, 0, "Alarm Fan 8 ON"}, // Just for Arduino testing. Sets Alarm Fan 8 to 1. + {COIL, 11, 0, "Alarm Fan 9 ON"}, // Just for Arduino testing. Sets Alarm Fan 9 to 1. + {COIL, 12, 0, "Alarm Condensate Pump ON"}, // Just for Arduino testing. Sets Alarm Condensate Pump to 1. + {COIL, 13, 0, "Alarm Fire ON"}, // Just for Arduino testing. Sets Alarm Fire to 1. + {COIL, 14, 0, "Alarm Smoke ON"}, // Just for Arduino testing. Sets Alarm Smoke to 1. + + {COIL, 15, 0, "RA Temp Low Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) + {COIL, 16, 0, "RA Temp NORMAL"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) + {COIL, 17, 0, "RA Temp High Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 104F (high alarm) + + {COIL, 18, 0, "SA Temp Low Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) + {COIL, 19, 0, "SA Temp NORMAL"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) + {COIL, 20, 0, "SA Temp High Alarm ON"}, // Just for Arduino testing. Sets RA Temp to 104F (high alarm) + + {COIL, 21, 0, "RA Humidity Low Alarm ON"}, // Just for Arduino testing. Sets RA Humidity to 15% (low alarm) + {COIL, 22, 0, "RA Humidity NORMAL"}, // Just for Arduino testing. Sets RA Temp to 68F (low alarm) + {COIL, 23, 0, "RA Humidity High Alarm ON"}, // Just for Arduino testing. Sets RA Humidity to 65% (high alarm) {DI, 4, 0, "Alarm Leak Detect"}, {DI, 5, 0, "Alarm Dirty Filter"}, + {DI, 6, 0, "Alarm High Return Air Temp"}, // suggested default 100, operator inputs High RA Temp SP for alarm limit + {DI, 7, 0, "Alarm Low Return Air Temp"}, // suggested default 72, operator inputs Low RA Temp SP for alarm limit + {DI, 8, 0, "Alarm High Supply Temp"}, // suggested default 78, operator inputs High SA Temp SP for alarm limit + {DI, 9, 0, "Alarm Low Supply Temp"}, // suggested default 72, operator inputs Low SA Temp SP for alarm limit + {DI, 10, 0, "Alarm High Return Humidity"}, // suggested default 60, operator inputs High Return Humidity SP for alarm limit + {DI, 11, 0, "Alarm Low Return Humidity"}, // suggested default 20, operator inputs Low Return Humidity SP for alarm limit {DI, 12, 0, "Common Alarm"}, // Send to PLC {DI, 14, 0, "Alarm Condensate Pump"}, {DI, 15, 0, "Alarm Smoke"}, {DI, 16, 0, "Alarm Fire"}, {IR_FLOAT, 1, 0, "Supply Air Temp"}, - {IR_FLOAT, 3, 0, "Return Air Humidity"}, // Ignition visual only + {IR_FLOAT, 3, 0, "Return Humidity"}, // Ignition visual only {IR_FLOAT, 5, 0, "Return Air Temp"}, // Send to PLC {IR_FLOAT, 7, 0, "Filter Differential Pressure"}, // sawStrategy between 0 and 5 {IR_FLOAT, 9, 0, "CW Valve Position"}, @@ -135,17 +153,24 @@ modbusMap mb_map[] = {IR_FLOAT, 73, 0, "Amps Fan 6"}, {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"}, + {IR_FLOAT, 79, 0, "Amps Fan 9"}, + {HR_FLOAT, 1, 0, "Return Air Temp Alarm High SP"}, // default: 100, set locally on unit + {HR_FLOAT, 3, 0, "Return Air Temp Alarm Low SP"}, // default: 72, set locally on unit + {HR_FLOAT, 5, 0, "Supply Air Temp Alarm High SP"}, // default: 78, set locally on unit + {HR_FLOAT, 7, 0, "Supply Air Temp Alarm Low SP"}, // default: 72, set locally on unit + {HR_FLOAT, 9, 0, "Return Humidity Alarm High SP"}, // default: 60, set locally on unit + {HR_FLOAT, 11, 0, "Return Humidity Alarm Low SP"}, // default: 20, set locally on unit {HR_FLOAT, 13, 0, "Fan Speed Setpoint"}, // Receive signal from PLC {HR_FLOAT, 17, 0, "Supply Air Temp Setpoint"}, // Receive signal from PLC + {HR_FLOAT, 19, 0, "Return Air Temp Setpoint"}, // set locally on unit {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 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) + {HR, 95, 0, "CRAH Heartbeat"}, + {HR, 96, 0, "BMS 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.