updates for Schertz testing

This commit is contained in:
RobertJDavis
2025-11-04 14:16:03 -07:00
parent 8b164606a9
commit 40282fca0d
12 changed files with 85 additions and 70 deletions

View File

@@ -22,11 +22,11 @@
* @{
*/
#include <ModbusIP_ESP8266.h>
const char *ssid = "wifi_name"; /**< @brief The SSID of the WiFi network. */
const char *password = "wifi_password"; /**< @brief The password for the WiFi network. */
IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */
IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
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, 35); /**< @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;
#else

View File

@@ -16,6 +16,7 @@
#include "Strategies/Strategy_Ramp.h"
#include "Strategies/Strategy_SingleValue.h"
#include "Strategies/Strategy_PID.h"
#include "Strategies/Strategy_Saw.h"
#include "States/State_Standby.h"
#include "States/State_Running.h"
#include "States/State_Fail.h"
@@ -57,7 +58,7 @@ FailState<ModbusIP>::FailState(const std::vector<std::string>& activeAlarms) {
addStrategy("Amps Fan 7", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("Amps Fan 8", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("Amps Fan 9", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000));
}
/**

View File

@@ -71,11 +71,11 @@ RunningState<ModbusIP>::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.0f, 1000)); // Won't initialize at lower bound; always initializes at 0 b/c FLOAT; initialize manually via Modscan
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("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));
}
/**

View File

@@ -61,7 +61,7 @@ StandbyState<ModbusIP>::StandbyState() {
addStrategy("Amps Fan 7", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("Amps Fan 8", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("Amps Fan 9", new RampStrategy(0.0f, 4.5f, 1000));
addStrategy("CRAH Heartbeat", new SawStrategy(0.0f, 60.0f, 1.0f, 1000));
}
/**

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, 1, 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, 30, 22, 100); /**< @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;
@@ -135,7 +135,8 @@ 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, 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.
{HR_FLOAT, 13, 0, "Fan Speed Setpoint"}, // Receive signal from PLC
{HR_FLOAT, 17, 0, "Supply Air Temp Setpoint"}, // Receive signal from PLC
@@ -143,7 +144,7 @@ modbusMap mb_map[] =
{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, 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.

View File

@@ -20,11 +20,10 @@
* @brief Parameters for Modbus TCP communication.
* @{
*/
#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, 1, 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, 63); /**< @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;

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, 1, 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, 67); /**< @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;

View File

@@ -32,9 +32,7 @@
*/
template<>
FailState<ModbusRTU>::FailState(const std::vector<std::string>& activeAlarms) {
addStrategy("Motor Speed Used", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Speed Feedback", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Motor Speed estimated", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Motor Current", new RampStrategy(0.0f, 20.0f, 1000 ));
addStrategy("Motor Torque", new RampStrategy(0.0f, 20.0f, 1000 ));
addStrategy("Inverter Temperature", new RampStrategy(0.0f, 1.0f, 1000 ));
@@ -42,7 +40,7 @@ FailState<ModbusRTU>::FailState(const std::vector<std::string>& activeAlarms) {
addStrategy("Output Frequency", new SingleValueStrategy(0.1f, 0.2f, 1000 ));
addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("Output Power", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
}
/**
@@ -77,6 +75,13 @@ template<>
void FailState<ModbusRTU>::enterState(Equipment<ModbusRTU>* equipment) {
// Logic to run when the equipment enters this state
Serial.println("Enter Fail State...");
setPointValue(equipment, "Speed Scaling", 1800);
setPointValue(equipment, "Frequency Scaling", 60);
setPointValue(equipment, "Nominal Current", 65);
setPointValue(equipment, "Nominal Voltage", 480);
setPointValue(equipment, "Nominal Frequency", 60);
setPointValue(equipment, "Nominal Speed", 1800);
setPointValue(equipment, "Nominal Power", 50);
setPointValue(equipment, "Run Status", 0);
}

View File

@@ -41,9 +41,7 @@
*/
template<>
RunningState<ModbusRTU>::RunningState() {
addStrategy("Motor Speed Used", new RampStrategy(1800.0f, 100.0f, 1000));
addStrategy("Speed Feedback", new RampStrategy(1800.0f, 100.0f, 1000));
addStrategy("Motor Speed estimated", new RampStrategy(1800.0f, 100.0f, 1000));
addStrategy("Motor Current", new RampStrategy(65.0f, 7.0f, 1000));
addStrategy("Motor Torque", new RampStrategy(90.0f, 10.0f, 1000));
addStrategy("Inverter Temperature", new SquareStrategy(40.0f, 80.0f, 1000));
@@ -51,9 +49,9 @@ RunningState<ModbusRTU>::RunningState() {
addStrategy("Output Frequency", new RampStrategy(60.0f, 3.0f, 1000 ));
addStrategy("Output Voltage", new RampStrategy(480.0f, 15.0f, 1000 ));
addStrategy("DC Voltage", new RampStrategy(678.0f, 20.0f, 1000 ));
addStrategy("Output Power", new RampStrategy(36.7f, 2.0f, 1000 ));
addStrategy("Inverter kWh cnt", new TotalizerStrategy(1000));
addStrategy("Hours Run", new TotalizerStrategy(1000));
addStrategy("Motor Shaft Power", new RampStrategy(36.7f, 2.0f, 1000 ));
addStrategy("Inverter MWh counter", new TotalizerStrategy(1000));
addStrategy("Inverter kWh counter", new TotalizerStrategy(1000));
}
/**
@@ -94,25 +92,11 @@ State<ModbusRTU>* RunningState<ModbusRTU>::update(Equipment<ModbusRTU>* equipmen
float power_update = speed_pct * speed_pct * speed_pct * 36.77f; // 50 hp ~ 36.77kW
float currentSP = getPointValue(equipment, "Speed Cmd");
Strategy_Behavior* motorSpeedUsed = getStrategy("Motor Speed Used");
// 2. Check if the strategy exists
if (motorSpeedUsed) {
// 3. Cast it to a RampStrategy pointer and call setSetpoint.
static_cast<RampStrategy*>(motorSpeedUsed)->setTarget(currentSP);
}
Strategy_Behavior* speedFeedback = getStrategy("Speed Feedback");
if (speedFeedback) {
static_cast<RampStrategy*>(speedFeedback)->setTarget(currentSP);
}
// To have Motor Speed estimated slightly different - for purposes of differentiating in Ignition
float rpm_est = currentSP * 0.98f;
Strategy_Behavior* motorSpeedEst = getStrategy("Motor Speed estimated");
if (motorSpeedEst) {
static_cast<RampStrategy*>(motorSpeedEst)->setTarget(rpm_est);
}
Strategy_Behavior* frequencystrategy = getStrategy("Output Frequency");
if (frequencystrategy) {
static_cast<RampStrategy*>(frequencystrategy)->setTarget(freq_update);
@@ -138,7 +122,7 @@ State<ModbusRTU>* RunningState<ModbusRTU>::update(Equipment<ModbusRTU>* equipmen
static_cast<RampStrategy*>(voltagestrategy)->setTarget(voltage_update);
}
Strategy_Behavior* powerstrategy = getStrategy("Output Power");
Strategy_Behavior* powerstrategy = getStrategy("Motor Shaft Power");
if (powerstrategy) {
static_cast<RampStrategy*>(powerstrategy)->setTarget(power_update);
}
@@ -157,6 +141,13 @@ template<>
void RunningState<ModbusRTU>::enterState(Equipment<ModbusRTU>* equipment) {
// Logic to run when the equipment enters this state
Serial.println("Enter Running State...");
setPointValue(equipment, "Speed Scaling", 1800);
setPointValue(equipment, "Frequency Scaling", 60);
setPointValue(equipment, "Nominal Current", 65);
setPointValue(equipment, "Nominal Voltage", 480);
setPointValue(equipment, "Nominal Frequency", 60);
setPointValue(equipment, "Nominal Speed", 1800);
setPointValue(equipment, "Nominal Power", 50);
setPointValue(equipment, "Run Status", 1);
}

View File

@@ -30,9 +30,7 @@
*/
template<>
StandbyState<ModbusRTU>::StandbyState() {
addStrategy("Motor Speed Used", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Speed Feedback", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Motor Speed estimated", new RampStrategy(0.0f, 200.0f, 1000 ));
addStrategy("Motor Current", new RampStrategy(0.0f, 20.0f, 1000 ));
addStrategy("Motor Torque", new RampStrategy(0.0f, 20.0f, 1000 ));
addStrategy("Inverter Temperature", new RampStrategy(0.0f, 1.0f, 1000 ));
@@ -40,7 +38,7 @@ StandbyState<ModbusRTU>::StandbyState() {
addStrategy("Output Frequency", new SingleValueStrategy(0.1f, 0.2f, 1000 ));
addStrategy("Output Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("DC Voltage", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("Output Power", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
addStrategy("Motor Shaft Power", new SingleValueStrategy(0.1f, 0.1f, 1000 ));
}
/**
@@ -84,6 +82,13 @@ template<>
void StandbyState<ModbusRTU>::enterState(Equipment<ModbusRTU>* equipment) {
// Logic to run when the equipment enters this state
Serial.println("Enter Standby State...");
setPointValue(equipment, "Speed Scaling", 1800);
setPointValue(equipment, "Frequency Scaling", 60);
setPointValue(equipment, "Nominal Current", 65);
setPointValue(equipment, "Nominal Voltage", 480);
setPointValue(equipment, "Nominal Frequency", 60);
setPointValue(equipment, "Nominal Speed", 1800);
setPointValue(equipment, "Nominal Power", 50);
setPointValue(equipment, "Run Status", 0);
}

View File

@@ -63,25 +63,31 @@ modbusMap mb_map[] =
{HR, 155, 1, "Fault Status"}, // arbitrary register number - 0:faulted, 1:not faulted (simulated hardwire IO). When = 0, will turn off VFD.
{HR, 156, 0, "Speed Feedback"}, // arbitrary register number - send signal to PLC (simulated hardwire IO). Will be equal to Motor Speed Used register
{HR_FLOAT, 20201, 0, "Motor Speed Used"}, // RJD: 1800 rpm max
{HR_FLOAT, 20203, 0, "Motor Speed estimated"}, // RJD: 1800 rpm max
{HR_FLOAT, 20211, 0, "Output Frequency"}, // 60 Hz @100% speed
{HR_FLOAT, 20213, 0, "Motor Current"}, // RJD: Changed from HR_10x to HR, 65 FLA
{HR_FLOAT, 20219, 0, "Motor Torque"}, // % of nominal torque
{HR_FLOAT, 20221, 0, "DC Voltage"}, // approx 678 VDC @100% speed
{HR_FLOAT, 20225, 0, "Output Voltage"}, // RJD: 480 VAC
{HR_FLOAT, 20227, 0, "Output Power"}, //max 372580 // RJD: Changed from HR_10x to HR, 50 hp ~ 36.77 kW
{HR_FLOAT, 20239, 0, "Inverter kWh cnt"},
{HR_FLOAT, 21005, 0, "Hours Run"},
{HR_FLOAT, 21021, 0, "Inverter Temperature"}, // RJD: Changed from HR_10x to HR, % of fault limit
{HR_FLOAT, 100, 0, "Motor Speed Used"}, // 1800 rpm max
{HR_FLOAT, 105, 0, "Output Frequency"}, // 60 Hz @100% speed
{HR_FLOAT, 106, 0, "Motor Current"}, // 65 FLA
{HR_FLOAT, 109, 0, "Motor Torque"}, // % of nominal torque
{HR_FLOAT, 110, 0, "DC Voltage"}, // approx 678 VDC @100% speed
{HR_FLOAT, 112, 0, "Output Voltage"}, // 480 VAC
{HR_FLOAT, 116, 0, "Motor Shaft Power"}, // 50 hp ~ 36.77 kW
{HR_FLOAT, 118, 0, "Inverter MWh counter"},
{HR_FLOAT, 119, 0, "Inverter kWh counter"},
{HR_FLOAT, 510, 0, "Inverter Temperature"}, // RJD: Changed from HR_10x to HR, % of fault limit
{HR, 519, 0, "Diagnostic Word"}, // not used in program. Bit 9:Drive Over-Temp Alarm
{HR, 21243, 0, "HOA Status Word"}, // not used in program
{HR, 20801, 0, "Trip Fault"}, // not used in program
{HR, 20821, 0, "Last Fault"}, // not used in program
{HR, 20823, 0, "2nd to last Fault"}, // not used in program
{HR, 20825, 0, "3rd to last Fault"}, // not used in program
{HR, 21221, 0, "Main Status Word"}, // not used in program
{HR, 21231, 0, "Drive Status Word 1"}, // not used in program
{HR, 1000, 0, "DI Status"}, // not used in program.
{HR, 1211, 0, "AI1 Scaled"}, // not used in program.
{HR, 1221, 0, "AI2 Scaled"}, // not used in program.
{HR, 1310, 0, "AO1 Actual"}, // not used in program.
{HR, 1910, 0, "External Control Location"}, // not used in program.
{HR_FLOAT, 4600, 0, "Speed Scaling"}, // ADD: 1800 rpm
{HR_FLOAT, 4601, 0, "Frequency Scaling"}, // ADD: 60 Hz
{HR_FLOAT, 9905, 0, "Nominal Current"}, // ADD: 65 A
{HR_FLOAT, 9906, 0, "Nominal Voltage"}, // ADD: 480 V
{HR_FLOAT, 9907, 0, "Nominal Frequency"}, // ADD: 60 Hz
{HR_FLOAT, 9908, 0, "Nominal Speed"}, // ADD: 1800 rpm
{HR_FLOAT, 9909, 0, "Nominal Power"}, // ADD: 50 hp
};
//Size of modbus map used in FOR cycles, automatically calculated.
/**