WIP common alarm

This commit is contained in:
RobertJDavis
2025-12-08 18:23:06 -06:00
parent 7145b04717
commit 6dae38f8a5
2 changed files with 29 additions and 14 deletions

View File

@@ -44,6 +44,7 @@ void updateReturnAirTempAlarms(Equipment<ModbusIP>* equipment){
equipment->setModbus_Point("RATempLowAlm Value", RATempLowAlm);
if (returnAirTemp->getValue() < returnTempLowAlarmSP->getValue()) {
equipment->setModbus_Point("Alarm High Return Air Temp", 1);
equipment->setModbus_Point("Alarm High Return Air Temp", 1);
//returnTempHighAlarm->setValue(1);
}
@@ -95,15 +96,15 @@ void updateReturnHumidityAlarms(Equipment<ModbusIP>* equipment){
int RAHumHighAlm = returnHumHighAlarmSP->getValue();
int RAHumLowAlm = returnHumLowAlarmSP->getValue();
equipment->setModbus_Point("RATemp Value", RAHum);
equipment->setModbus_Point("RATempHighAlm Value", RAHumHighAlm);
equipment->setModbus_Point("RATempLowAlm Value", RAHumLowAlm);
equipment->setModbus_Point("RAHum Value", RAHum);
equipment->setModbus_Point("RAHumHighAlm Value", RAHumHighAlm);
equipment->setModbus_Point("RAHumLowAlm Value", RAHumLowAlm);
if (returnHumidity->getValue() > returnHumHighAlarmSP->getValue()) {
equipment->setModbus_Point("Alarm High Return Humidity", 1);
}
else if (returnHumidity->getValue() < returnHumLowAlarmSP->getValue()) {
equipment->setModbus_Point("AAlarm Low Return Humidity", 1);
equipment->setModbus_Point("Alarm Low Return Humidity", 1);
}
else{
equipment->setModbus_Point("Alarm High Return Humidity", 0);
@@ -146,8 +147,14 @@ void updateAlarms(Equipment<ModbusIP>* equipment){
"Common Alarm ON", "Alarm Pump Failure ON", "Alarm Comm Loss Condenser 1 ON", "Alarm Comm Loss Condenser 2 ON",
"Alarm Compressor 1B Overload ON", "Alarm Compressor 2B Overload ON"
};
const std::vector<std::string> 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"
};
// If any Alarm Commands = 1, set the appropriate Alarm = 1 and increment counter for number of active alarms
int numAlarms = 0;
for (int i =0; i< alarmCommands.size() && i < alarmDescriptions.size(); ++i) {
Modbus_Point<ModbusIP>* commandPoint = equipment->getModbus_Point(alarmCommands[i]);
@@ -157,6 +164,14 @@ void updateAlarms(Equipment<ModbusIP>* 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<alarmAnalogs.size(); ++j){
Modbus_Point<ModbusIP>* 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);
}

View File

@@ -21,10 +21,10 @@
* @{
*/
#include <ModbusIP_ESP8266.h>
const char *ssid = "TP-Link_D91A"; /**< @brief The SSID of the WiFi network. */
const char *password = "52761492"; /**< @brief The password for the WiFi network. */
IPAddress local_IP(192, 168, 0, 234); /**< @brief The static IP address for the device. */
IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */
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, 11); /**< @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. */
ModbusIP mb;
@@ -159,17 +159,17 @@ modbusMap mb_map[] =
{HR_10x, 738, 0, "Return Air Temp Alarm High SP"},
{HR_10x, 739, 0, "Return Air Temp Alarm Low SP"},
{HR, 740, 0, "RATemp Value"},
{HR, 741, 0, "RATempHighAlm Value"},
{HR, 742, 0, "RATempLowAlm Value"},
{HR, 741, 0, "RATemp Value"},
{HR, 742, 0, "RATempHighAlm Value"},
{HR, 743, 0, "RATempLowAlm Value"},
{HR, 753, 80, "Return Air Temp Setpoint"},
{HR_10x, 754, 78, "Supply Air Temp Alarm High SP"},
{HR_10x, 755, 72, "Supply Air Temp Alarm Low SP"},
{HR, 740, 0, "SATemp Value"},
{HR, 741, 0, "SATempHighAlm Value"},
{HR, 742, 0, "SATempLowAlm Value"},
{HR, 757, 0, "SATemp Value"},
{HR, 758, 0, "SATempHighAlm Value"},
{HR, 759, 0, "SATempLowAlm Value"},
};