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.
This commit is contained in:
RobertJDavis
2025-11-06 06:52:10 -07:00
parent e5ae233875
commit b4a626b908
9 changed files with 48 additions and 15 deletions

View File

@@ -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

View File

@@ -112,7 +112,6 @@ void updateAnalogs(Equipment<ModbusIP>* 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<ModbusIP>* 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<ModbusIP>* equipment){
Modbus_Point<ModbusIP>* 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);
}

View File

@@ -40,6 +40,9 @@ FailState<ModbusIP>::FailState(const std::vector<std::string>& 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));

View File

@@ -72,10 +72,12 @@ RunningState<ModbusIP>::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<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* 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<RampStrategy*>(speedFeedback)->setTarget(BMS_Speed_Setpoint);
}
// Apply any strategies defined for the standby state
_applyStrategies(equipment);

View File

@@ -41,8 +41,9 @@ StandbyState<ModbusIP>::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));

View File

@@ -23,7 +23,7 @@
#include <ModbusIP_ESP8266.h>
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.

View File

@@ -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. */

View File

@@ -23,7 +23,7 @@
#include <ModbusIP_ESP8266.h>
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. */

View File

@@ -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.