Merge pull request #39 from emmanuelsrlok/ecruz/epms
CDR EPMS devices update, ATS, Brakers, PDU, UPS, tested
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
@@ -11,7 +10,7 @@
|
||||
[platformio]
|
||||
|
||||
|
||||
default_envs = PHX3_VFD_ABB_ACH580_RTU ; Select here the name of the configuration you want to download
|
||||
default_envs = CRAH_PETRA_PAHHC_600_C6_TCP ; Select here the name of the configuration you want to download
|
||||
|
||||
[env]
|
||||
upload_port = COM50
|
||||
@@ -37,6 +36,13 @@ extends = common_env_options
|
||||
build_flags = -D USE_MODBUS_IP ;Importat configuration, this flags is used to configure the program
|
||||
build_src_filter = -<*> +<Base_TCP> ;Add the specific folder path here
|
||||
;----------------------------------------------------------------------------------------------------
|
||||
[env:CRAH_PETRA_PAHHC_600_C6_TCP]
|
||||
platform = espressif32
|
||||
board = dfrobot_firebeetle2_esp32e
|
||||
extends = common_env_options
|
||||
build_flags = -D USE_MODBUS_IP
|
||||
build_src_filter = -<*> +<BMS/CRAH/CRAH_PETRA_PAHHC_600_C6_TCP>
|
||||
|
||||
[env:POD_MBB_Power_Meter_TCP]
|
||||
platform = espressif32
|
||||
board = dfrobot_firebeetle2_esp32e
|
||||
|
||||
@@ -38,16 +38,26 @@
|
||||
*/
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
addStrategy("CW Valve Position", new PIDStrategy("RAT Setpoint", 1000, "RAT"));
|
||||
addStrategy("Operating Hours EC Fan #1", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #2", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #3", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #4", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #5", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #6", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #7", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #8", new TotalizerStrategy(10000));
|
||||
addStrategy("Operating Hours EC Fan #9", new TotalizerStrategy(10000));
|
||||
addStrategy("CW Valve Position", new PIDStrategy("SAT Setpoint", 2000, "SAT Reading"));
|
||||
addStrategy("SAT Reading", new SingleValueStrategy(0.0f, 3.0f, 1000));
|
||||
addStrategy("Speed EC Fan #1", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #2", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #3", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #4", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #5", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #6", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #7", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #8", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Speed EC Fan #9", new RampStrategy(0.0f, 500.0f, 1000));
|
||||
addStrategy("Operating Hours EC Fan #1", new TotalizerStrategy(1100));
|
||||
addStrategy("Operating Hours EC Fan #2", new TotalizerStrategy(1200));
|
||||
addStrategy("Operating Hours EC Fan #3", new TotalizerStrategy(1300));
|
||||
addStrategy("Operating Hours EC Fan #4", new TotalizerStrategy(1250));
|
||||
addStrategy("Operating Hours EC Fan #5", new TotalizerStrategy(1350));
|
||||
addStrategy("Operating Hours EC Fan #6", new TotalizerStrategy(1450));
|
||||
addStrategy("Operating Hours EC Fan #7", new TotalizerStrategy(1150));
|
||||
addStrategy("Operating Hours EC Fan #8", new TotalizerStrategy(1180));
|
||||
addStrategy("Operating Hours EC Fan #9", new TotalizerStrategy(1340));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,63 +84,36 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
|
||||
Modbus_Point<ModbusIP>* faultCode = equipment->getModbus_Point("Fault Code");
|
||||
int faultCodeValue = faultCode ? faultCode->getValue() : 0;
|
||||
switch (faultCodeValue){
|
||||
case 1:
|
||||
return new FailState<ModbusIP>({"Alarm SAT Sensor Fault"});
|
||||
case 2:
|
||||
return new FailState<ModbusIP>({"Alarm RAH Sensor Fault"});
|
||||
case 3:
|
||||
return new FailState<ModbusIP>({"Alarm RAT Sensor Fault"});
|
||||
case 4:
|
||||
return new FailState<ModbusIP>({"Alarm Filter DP Sensor Fault"});
|
||||
case 5:
|
||||
return new FailState<ModbusIP>({"Alarm Flooding"});
|
||||
case 6:
|
||||
return new FailState<ModbusIP>({"Alarm Dirty Filter"});
|
||||
case 7:
|
||||
return new FailState<ModbusIP>({"Alarm High RAT"});
|
||||
case 8:
|
||||
return new FailState<ModbusIP>({"Alarm Low RAT"});
|
||||
case 9:
|
||||
return new FailState<ModbusIP>({"Alarm High SAT"});
|
||||
case 10:
|
||||
return new FailState<ModbusIP>({"Alarm Low SAT"});
|
||||
case 11:
|
||||
return new FailState<ModbusIP>({"Alarm High RAH"});
|
||||
case 12:
|
||||
return new FailState<ModbusIP>({"Alarm Low RAH"});
|
||||
case 13:
|
||||
return new FailState<ModbusIP>({"Alarm Phase Failure"});
|
||||
case 14:
|
||||
return new FailState<ModbusIP>({"Alarm Condensate Pump"});
|
||||
case 15:
|
||||
return new FailState<ModbusIP>({"Alarm Smoke"});
|
||||
case 16:
|
||||
return new FailState<ModbusIP>({"Alarm Fire"});
|
||||
case 17:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #1"});
|
||||
case 18:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #2"});
|
||||
case 19:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #3"});
|
||||
case 20:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #4"});
|
||||
case 21:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #5"});
|
||||
case 22:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #6"});
|
||||
case 23:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #7"});
|
||||
case 24:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #8"});
|
||||
case 25:
|
||||
return new FailState<ModbusIP>({"Alarm EC Fan #9"});
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float rat = getPointValue(equipment, "RAT");
|
||||
setPointValue(equipment, "RAT Reading", rat);
|
||||
float speed = getPointValue(equipment, "Setting EC Fan Speed");
|
||||
Strategy_Behavior* fan1_rs = getStrategy("Speed EC Fan #1");
|
||||
static_cast<RampStrategy*>(fan1_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan2_rs = getStrategy("Speed EC Fan #2");
|
||||
static_cast<RampStrategy*>(fan2_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan3_rs = getStrategy("Speed EC Fan #3");
|
||||
static_cast<RampStrategy*>(fan3_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan4_rs = getStrategy("Speed EC Fan #4");
|
||||
static_cast<RampStrategy*>(fan4_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan5_rs = getStrategy("Speed EC Fan #5");
|
||||
static_cast<RampStrategy*>(fan5_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan6_rs = getStrategy("Speed EC Fan #6");
|
||||
static_cast<RampStrategy*>(fan6_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan7_rs = getStrategy("Speed EC Fan #7");
|
||||
static_cast<RampStrategy*>(fan7_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan8_rs = getStrategy("Speed EC Fan #8");
|
||||
static_cast<RampStrategy*>(fan8_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
Strategy_Behavior* fan9_rs = getStrategy("Speed EC Fan #9");
|
||||
static_cast<RampStrategy*>(fan9_rs)->setTarget(4200.0f * (speed /100.0f));
|
||||
|
||||
|
||||
|
||||
float value = getPointValue(equipment, "CW Valve Position");
|
||||
Serial.printf("CW Valve Position: %0.2f\n", value);
|
||||
float sat_setpoint = getPointValue(equipment, "SAT Setpoint");
|
||||
Strategy_Behavior* sat_svs = getStrategy("SAT Reading");
|
||||
static_cast<SingleValueStrategy*>(sat_svs)->setSetpoint(sat_setpoint);
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
* @{
|
||||
*/
|
||||
#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. */
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 11); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
@@ -60,81 +60,82 @@
|
||||
*/
|
||||
modbusMap mb_map[] =
|
||||
{
|
||||
{HR, 15, 0, "State Control"}, //Internal to control from Modscan
|
||||
{HR, 16, 0, "Fault Code"},
|
||||
{HR_FLOAT, 18, 0, "RAT"}, //Internal Fault code from Modscan
|
||||
{HR_FLOAT, 1, 0, "SAT Setpoint"},
|
||||
{HR_FLOAT, 681, 0, "RAT Setpoint"},
|
||||
{HR_FLOAT, 111, 0, "High RAT Limit"},
|
||||
{HR_FLOAT, 114, 0, "Low RAT Limit"},
|
||||
{HR_FLOAT, 118, 0, "High SAT Limit"},
|
||||
{HR_FLOAT, 122, 0, "Low SAT Limit"},
|
||||
{HR_FLOAT, 685, 0, "High RAH Limit"},
|
||||
{HR_FLOAT, 689, 0, "Low RAH Limit"},
|
||||
{HR, 5, 0, "Setting the EC Fan Max Speed"},
|
||||
{HR, 695, 0, "Setting the EC Fan Min Speed"},
|
||||
{HR_FLOAT, 693, 0, "Setting Room Temp"},
|
||||
{HR, 691, 0, "Setting EC Fan Speed "},
|
||||
{DI, 146, 0, "Alarm SAT Sensor Fault"},
|
||||
{DI, 1246, 0, "Alarm RAH Sensor Fault"},
|
||||
{DI, 1245, 0, "Alarm RAT Sensor Fault"},
|
||||
{DI, 1250, 0, "Alarm Filter DP Sensor Fault"},
|
||||
{DI, 51, 0, "Alarm Flooding"},
|
||||
{DI, 1096, 0, "Alarm Dirty Filter"},
|
||||
{DI, 1367, 0, "Alarm High RAT"},
|
||||
{DI, 1099, 0, "Alarm Low RAT"},
|
||||
{DI, 118, 0, "Alarm High SAT"},
|
||||
{DI, 122, 0, "Alarm Low SAT"},
|
||||
{DI, 1307, 0, "Alarm High RAH"},
|
||||
{DI, 1308, 0, "Alarm Low RAH"},
|
||||
{DI, 1342, 0, "Alarm Common"},
|
||||
{DI, 148, 0, "Alarm Phase Failure"},
|
||||
{DI, 1370, 0, "Alarm Condensate Pump"},
|
||||
{DI, 1368, 0, "Alarm Smoke"},
|
||||
{DI, 1369, 0, "Alarm Fire"},
|
||||
{DI, 131, 0, "Alarm EC Fan #1"},
|
||||
{DI, 132, 0, "Alarm EC Fan #2"},
|
||||
{DI, 133, 0, "Alarm EC Fan #3"},
|
||||
{DI, 134, 0, "Alarm EC Fan #4"},
|
||||
{DI, 135, 0, "Alarm EC Fan #5"},
|
||||
{DI, 136, 0, "Alarm EC Fan #6"},
|
||||
{DI, 1360, 0, "Alarm EC Fan #7"},
|
||||
{DI, 1361, 0, "Alarm EC Fan #8"},
|
||||
{DI, 1362, 0, "Alarm EC Fan #9"},
|
||||
{DI, 138, 0, "Run Status EC Fan #1"},
|
||||
{DI, 139, 0, "Run Status EC Fan #2"},
|
||||
{DI, 140, 0, "Run Status EC Fan #3"},
|
||||
{DI, 141, 0, "Run Status EC Fan #4"},
|
||||
{DI, 142, 0, "Run Status EC Fan #5"},
|
||||
{DI, 143, 0, "Run Status EC Fan #6"},
|
||||
{DI, 1363, 0, "Run Status EC Fan #7"},
|
||||
{DI, 1364, 0, "Run Status EC Fan #8"},
|
||||
{DI, 1365, 0, "Run Status EC Fan #9"},
|
||||
{IR_FLOAT, 99, 0, "SAT Reading"},
|
||||
{IR_FLOAT, 70, 0, "RAH Reading"},
|
||||
{IR_FLOAT, 101, 0, "RAT Reading"},
|
||||
{IR_FLOAT, 106, 0, "Filter DP Reading"},
|
||||
{IR_FLOAT, 496, 0, "CW Valve Position"},
|
||||
{IR, 53, 0, "Speed EC Fan #1"},
|
||||
{IR, 228, 0, "Speed EC Fan #2"},
|
||||
{IR, 229, 0, "Speed EC Fan #3"},
|
||||
{IR, 230, 0, "Speed EC Fan #4"},
|
||||
{IR, 231, 0, "Speed EC Fan #5"},
|
||||
{IR, 232, 0, "Speed EC Fan #6"},
|
||||
{IR, 678, 0, "Speed EC Fan #7"},
|
||||
{IR, 679, 0, "Speed EC Fan #8"},
|
||||
{IR, 680, 0, "Speed EC Fan #9"},
|
||||
{IR, 274, 0, "Operating Hours EC Fan #1"},
|
||||
{IR, 233, 0, "Operating Hours EC Fan #2"},
|
||||
{IR, 244, 0, "Operating Hours EC Fan #3"},
|
||||
{IR, 235, 0, "Operating Hours EC Fan #4"},
|
||||
{IR, 236, 0, "Operating Hours EC Fan #5"},
|
||||
{IR, 245, 0, "Operating Hours EC Fan #6"},
|
||||
{IR, 486, 0, "Operating Hours EC Fan #7"},
|
||||
{IR, 487, 0, "Operating Hours EC Fan #8"},
|
||||
{IR, 488, 0, "Operating Hours EC Fan #9"},
|
||||
{COIL, 301, 0, "ON/OFF Command By BMS"},
|
||||
{COIL, 302, 0, "Enable Off By Supervisory"},
|
||||
{HR, 13, 0, "Delta"},
|
||||
{HR, 14, 0, "State Control"}, //Internal to control from Modscan
|
||||
{HR, 15, 0, "Fault Code"},
|
||||
{HR_FLOAT, 17, 0, "RAT"}, //Internal Fault code from Modscan
|
||||
{HR_FLOAT, 0, 0, "SAT Setpoint"},
|
||||
{HR_FLOAT, 680, 0, "RAT Setpoint"},
|
||||
{HR_FLOAT, 110, 0, "High RAT Limit"},
|
||||
{HR_FLOAT, 113, 0, "Low RAT Limit"},
|
||||
{HR_FLOAT, 117, 0, "High SAT Limit"},
|
||||
{HR_FLOAT, 121, 0, "Low SAT Limit"},
|
||||
{HR_FLOAT, 684, 0, "High RAH Limit"},
|
||||
{HR_FLOAT, 688, 0, "Low RAH Limit"},
|
||||
{HR, 4, 0, "Setting the EC Fan Max Speed"},
|
||||
{HR, 694, 0, "Setting the EC Fan Min Speed"},
|
||||
{HR_FLOAT, 692, 0, "Setting Room Temp"},
|
||||
{HR_FLOAT, 690, 0, "Setting EC Fan Speed"},
|
||||
{DI, 145, 0, "Alarm SAT Sensor Fault"},
|
||||
{DI, 1245, 0, "Alarm RAH Sensor Fault"},
|
||||
{DI, 1244, 0, "Alarm RAT Sensor Fault"},
|
||||
{DI, 1249, 0, "Alarm Filter DP Sensor Fault"},
|
||||
{DI, 50, 0, "Alarm Flooding"},
|
||||
{DI, 1095, 0, "Alarm Dirty Filter"},
|
||||
{DI, 1366, 0, "Alarm High RAT"},
|
||||
{DI, 1098, 0, "Alarm Low RAT"},
|
||||
{DI, 117, 0, "Alarm High SAT"},
|
||||
{DI, 121, 0, "Alarm Low SAT"},
|
||||
{DI, 1306, 0, "Alarm High RAH"},
|
||||
{DI, 1307, 0, "Alarm Low RAH"},
|
||||
{DI, 1341, 0, "Alarm Common"},
|
||||
{DI, 147, 0, "Alarm Phase Failure"},
|
||||
{DI, 1369, 0, "Alarm Condensate Pump"},
|
||||
{DI, 1367, 0, "Alarm Smoke"},
|
||||
{DI, 1368, 0, "Alarm Fire"},
|
||||
{DI, 130, 0, "Alarm EC Fan #1"},
|
||||
{DI, 131, 0, "Alarm EC Fan #2"},
|
||||
{DI, 132, 0, "Alarm EC Fan #3"},
|
||||
{DI, 133, 0, "Alarm EC Fan #4"},
|
||||
{DI, 134, 0, "Alarm EC Fan #5"},
|
||||
{DI, 135, 0, "Alarm EC Fan #6"},
|
||||
{DI, 1359, 0, "Alarm EC Fan #7"},
|
||||
{DI, 1360, 0, "Alarm EC Fan #8"},
|
||||
{DI, 1361, 0, "Alarm EC Fan #9"},
|
||||
{DI, 137, 0, "Run Status EC Fan #1"},
|
||||
{DI, 138, 0, "Run Status EC Fan #2"},
|
||||
{DI, 139, 0, "Run Status EC Fan #3"},
|
||||
{DI, 140, 0, "Run Status EC Fan #4"},
|
||||
{DI, 141, 0, "Run Status EC Fan #5"},
|
||||
{DI, 142, 0, "Run Status EC Fan #6"},
|
||||
{DI, 1362, 0, "Run Status EC Fan #7"},
|
||||
{DI, 1363, 0, "Run Status EC Fan #8"},
|
||||
{DI, 1364, 0, "Run Status EC Fan #9"},
|
||||
{IR_FLOAT, 98, 0, "SAT Reading"},
|
||||
{IR_FLOAT, 69, 0, "RAH Reading"},
|
||||
{IR_FLOAT, 100, 0, "RAT Reading"},
|
||||
{IR_FLOAT, 105, 0, "Filter DP Reading"},
|
||||
{IR_FLOAT, 495, 0, "CW Valve Position"},
|
||||
{IR, 52, 0, "Speed EC Fan #1"},
|
||||
{IR, 227, 0, "Speed EC Fan #2"},
|
||||
{IR, 228, 0, "Speed EC Fan #3"},
|
||||
{IR, 229, 0, "Speed EC Fan #4"},
|
||||
{IR, 230, 0, "Speed EC Fan #5"},
|
||||
{IR, 231, 0, "Speed EC Fan #6"},
|
||||
{IR, 677, 0, "Speed EC Fan #7"},
|
||||
{IR, 678, 0, "Speed EC Fan #8"},
|
||||
{IR, 679, 0, "Speed EC Fan #9"},
|
||||
{IR, 273, 0, "Operating Hours EC Fan #1"},
|
||||
{IR, 232, 0, "Operating Hours EC Fan #2"},
|
||||
{IR, 243, 0, "Operating Hours EC Fan #3"},
|
||||
{IR, 234, 0, "Operating Hours EC Fan #4"},
|
||||
{IR, 235, 0, "Operating Hours EC Fan #5"},
|
||||
{IR, 244, 0, "Operating Hours EC Fan #6"},
|
||||
{IR, 485, 0, "Operating Hours EC Fan #7"},
|
||||
{IR, 486, 0, "Operating Hours EC Fan #8"},
|
||||
{IR, 487, 0, "Operating Hours EC Fan #9"},
|
||||
{COIL, 300, 0, "ON/OFF Command By BMS"},
|
||||
{COIL, 301, 0, "Enable Off By Supervisory"},
|
||||
{COIL, 264, 0, "Alarm Reset"}
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
@@ -39,20 +39,19 @@
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
|
||||
addStrategy("Source 1 Volts AB", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 1 Volts BC", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 2 Volts CA", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 2 Volts AB", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 2 Volts BC", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 2 Volts CA", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Frequency", new SingleValueStrategy(0.0f, 0.0f, 1000));
|
||||
addStrategy("Source 2 Frequency", new SingleValueStrategy(60.0f, 1.0f, 1000));
|
||||
|
||||
addStrategy("Power Factor", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("Amps C", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("Volts AB", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Votls BC", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Volts CA", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Amps C", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Total Active Power", new SingleValueStrategy(6.0f, 5.0f, 1000));
|
||||
addStrategy("Total Apparent Power", new SingleValueStrategy(6.0f, 5.0f, 1000));
|
||||
|
||||
}
|
||||
|
||||
@@ -78,20 +77,40 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
|
||||
int I_load = getPointValue(equipment, "ATS_Load");
|
||||
int I_rating = getPointValue(equipment, "ATS_Rating");
|
||||
float load = static_cast<float>(I_load);
|
||||
float rating = static_cast<float>(I_rating);
|
||||
float real_load = rating * (load/100.0f);
|
||||
float load = getPointValue(equipment, "ATS_Load");
|
||||
float rating = getPointValue(equipment, "ATS_Rating");
|
||||
float sim_load = rating * (load/100.0f);
|
||||
|
||||
Strategy_Behavior* ampsA_svs = getStrategy("Amps A");
|
||||
Strategy_Behavior* ampsB_svs = getStrategy("Amps B");
|
||||
Strategy_Behavior* ampsC_svs = getStrategy("Amps C");
|
||||
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(real_load);
|
||||
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(sim_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(sim_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(sim_load);
|
||||
// Apply any strategies defined for the standby state
|
||||
float v_ab = getPointValue(equipment, "Source 2 Volts AB");
|
||||
float v_bc = getPointValue(equipment, "Source 2 Volts BC");
|
||||
float v_ca = getPointValue(equipment, "Source 2 Volts CA");
|
||||
float i_a = getPointValue(equipment, "Amps A");
|
||||
float i_b = getPointValue(equipment, "Amps B");
|
||||
float i_c = getPointValue(equipment, "Ampc C");
|
||||
float pwr = ((v_ab * i_a) + (v_bc * i_b) + (v_ca * i_c));
|
||||
setPointValue(equipment, "Total Active Power", pwr*1000.0f);
|
||||
float pf = getPointValue(equipment, "Power Factor");
|
||||
float a_pwr = pwr * (pf/100.0f);
|
||||
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
||||
|
||||
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||
if (preferred == 1.0f){
|
||||
setPointValue(equipment, "Source 1 Preferred", 1.0f);
|
||||
setPointValue(equipment, "Source 2 Preferred", 0.0f);
|
||||
}
|
||||
if (preferred == 2.0f){
|
||||
setPointValue(equipment, "Source 1 Preferred", 0.0f);
|
||||
setPointValue(equipment, "Source 2 Preferred", 1.0f);
|
||||
}
|
||||
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -113,6 +132,11 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "Source 1 Preferred", 1);
|
||||
setPointValue(equipment, "Source 2 Preferred", 0);
|
||||
|
||||
setPointValue(equipment, "Source 1 Volts AB", 0.0f);
|
||||
setPointValue(equipment, "Source 1 Volts BC", 0.0f);
|
||||
setPointValue(equipment, "Source 1 Volts CA", 0.0f);
|
||||
setPointValue(equipment, "Source 1 Frequency", 0.0f);
|
||||
|
||||
int transferQty = getPointValue(equipment, "Number of Transfers");
|
||||
setPointValue(equipment, "Number of Transfers", transferQty + 1);
|
||||
}
|
||||
|
||||
@@ -37,21 +37,21 @@
|
||||
*/
|
||||
template<>
|
||||
StandbyState<ModbusIP>::StandbyState() {
|
||||
// You can add initialization code here if needed
|
||||
addStrategy("Source 1 Volts AB", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Volts BC", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Volts CA", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 2 Volts AB", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 2 Volts BC", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 2 Volts CA", new SingleValueStrategy(0.0F, 0.0f, 1000));
|
||||
addStrategy("Source 1 Frequency", new SingleValueStrategy(60.0f, 1.0f, 1000));
|
||||
addStrategy("Source 2 Frequency", new SingleValueStrategy(0.0f, 0.0f, 1000));
|
||||
// You can add initialization code here if needed
|
||||
addStrategy("Source 1 Volts AB", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Volts BC", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Volts CA", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("Source 1 Frequency", new SingleValueStrategy(60.0f, 1.0f, 1000));
|
||||
addStrategy("Power Factor", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
addStrategy("Volts AB", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Votls BC", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Volts CA", new SingleValueStrategy(480.0f, 2.0f, 1000));
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Amps C", new SingleValueStrategy(1.0f, 3.0f, 1000));
|
||||
addStrategy("Total Active Power", new SingleValueStrategy(6.0f, 5.0f, 1000));
|
||||
addStrategy("Total Apparent Power", new SingleValueStrategy(6.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("Power Factor", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("Amps C", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,19 +73,42 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
int I_load = getPointValue(equipment, "ATS_Load");
|
||||
int I_rating = getPointValue(equipment, "ATS_Rating");
|
||||
float load = static_cast<float>(I_load);
|
||||
float rating = static_cast<float>(I_rating);
|
||||
float real_load = rating * (load/100.0f);
|
||||
float load = getPointValue(equipment, "ATS_Load");
|
||||
float rating = getPointValue(equipment, "ATS_Rating");
|
||||
float sim_load = rating * (load/100.0f);
|
||||
|
||||
Strategy_Behavior* ampsA_svs = getStrategy("Amps A");
|
||||
Strategy_Behavior* ampsB_svs = getStrategy("Amps B");
|
||||
Strategy_Behavior* ampsC_svs = getStrategy("Amps C");
|
||||
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(sim_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(sim_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(sim_load);
|
||||
// Apply any strategies defined for the standby state
|
||||
float v_ab = getPointValue(equipment, "Source 1 Volts AB");
|
||||
float v_bc = getPointValue(equipment, "Source 1 Volts BC");
|
||||
float v_ca = getPointValue(equipment, "Source 1 Volts CA");
|
||||
float i_a = getPointValue(equipment, "Amps A");
|
||||
float i_b = getPointValue(equipment, "Amps B");
|
||||
float i_c = getPointValue(equipment, "Ampc C");
|
||||
float pwr = ((v_ab * i_a) + (v_bc * i_b) + (v_ca * i_c));
|
||||
setPointValue(equipment, "Total Active Power", pwr*1000.0f);
|
||||
float pf = getPointValue(equipment, "Power Factor");
|
||||
float a_pwr = pwr * (pf/100.0f);
|
||||
setPointValue(equipment, "Total Apparent Power", a_pwr*1000.0f);
|
||||
|
||||
/*setPointValue(equipment, "S2 kW", kw);
|
||||
setPointValue(equipment, "S2 MWh", mwh);*/
|
||||
|
||||
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||
if (preferred == 1.0f){
|
||||
setPointValue(equipment, "Source 1 Preferred", 1.0f);
|
||||
setPointValue(equipment, "Source 2 Preferred", 0.0f);
|
||||
}
|
||||
if (preferred == 2.0f){
|
||||
setPointValue(equipment, "Source 1 Preferred", 0.0f);
|
||||
setPointValue(equipment, "Source 2 Preferred", 1.0f);
|
||||
}
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -107,6 +130,11 @@ void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "Source 1 Preferred", 0);
|
||||
setPointValue(equipment, "Source 2 Preferred", 1);
|
||||
|
||||
setPointValue(equipment, "Source 2 Volts AB", 0.0f);
|
||||
setPointValue(equipment, "Source 2 Volts BC", 0.0f);
|
||||
setPointValue(equipment, "Source 2 Volts CA", 0.0f);
|
||||
setPointValue(equipment, "Source 2 Frequency", 0.0f);
|
||||
|
||||
int transferQty = getPointValue(equipment, "Number of Transfers");
|
||||
setPointValue(equipment, "Number of Transfers", transferQty + 1);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
* @{
|
||||
*/
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "wifi_ssid"; /**< @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, 15); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 172); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
@@ -60,6 +60,7 @@
|
||||
*/
|
||||
modbusMap mb_map[] =
|
||||
{
|
||||
{HR, 8, 0, "ATS_Preferred"}, //Internal to control from Modscan
|
||||
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
||||
{HR, 10, 0, "ATS_Load"}, //Internal Fault code from Modscan
|
||||
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
||||
@@ -86,9 +87,9 @@ modbusMap mb_map[] =
|
||||
{IR, 6158, 0, "Amps A"},
|
||||
{IR, 6159, 0, "Amps B"},
|
||||
{IR, 6160, 0, "Amps C"},
|
||||
{IR_LONG, 6165, 0, "Total Active Power"},
|
||||
{IR_LONG, 6169, 0, "Total Apparent Power"},
|
||||
{IR, 6171, 0, "Power Factor"},
|
||||
{IR_LONG, 6165, 0, "Total Active Power"}, //0.001
|
||||
{IR_LONG, 6169, 0, "Total Apparent Power"}, //0.001
|
||||
{IR, 6171, 0, "Power Factor"}, //0.001
|
||||
{IR, 6263, 0, "Number of Transfers"},
|
||||
{IR, 6297, 0, "Alarm Status Bits"},
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
|
||||
addStrategy("S2 Volts AB", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S2 Volts BC", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S2 Volts CA", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S2 Volts AB", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
addStrategy("S2 Volts BC", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
addStrategy("S2 Volts CA", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
|
||||
addStrategy("PF", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
addStrategy("PF", new SingleValueStrategy(910.0f, 20.0f, 1000));
|
||||
|
||||
addStrategy("S2 Amps A", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S2 Amps B", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S2 Amps C", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S2 Amps A", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
addStrategy("S2 Amps B", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
addStrategy("S2 Amps C", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
|
||||
}
|
||||
|
||||
@@ -74,34 +74,47 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
}
|
||||
float volts_AB = getPointValue(equipment, "S2 Volts AB");
|
||||
float volts_BC = getPointValue(equipment, "S2 Volts BC");
|
||||
float volts_AC = getPointValue(equipment, "S2 Volts CA");
|
||||
float volts_CA = getPointValue(equipment, "S2 Volts CA");
|
||||
|
||||
setPointValue(equipment, "S2 Volts AN", volts_AB/1.732);
|
||||
setPointValue(equipment, "S2 Volts BN", volts_BC/1.732);
|
||||
setPointValue(equipment, "S2 Volts CN", volts_AC/1.732);
|
||||
setPointValue(equipment, "S2 Volts CN", volts_CA/1.732);
|
||||
|
||||
int I_load = getPointValue(equipment, "ATS_Load");
|
||||
int I_rating = getPointValue(equipment, "ATS_Rating");
|
||||
float load = static_cast<float>(I_load);
|
||||
float rating = static_cast<float>(I_rating);
|
||||
float real_load = rating * (load/100.0f);
|
||||
float sim_load = rating * (load/100.0f);
|
||||
Strategy_Behavior* ampsA_svs = getStrategy("S2 Amps A");
|
||||
Strategy_Behavior* ampsB_svs = getStrategy("S2 Amps B");
|
||||
Strategy_Behavior* ampsC_svs = getStrategy("S2 Amps C");
|
||||
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(sim_load*1000.0f);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(sim_load*1000.0f);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(sim_load*1000.0f);
|
||||
|
||||
float pf = getPointValue(equipment, "PF");
|
||||
float get_pf = getPointValue(equipment, "PF");
|
||||
float pf = get_pf/1000.0f;
|
||||
|
||||
|
||||
float kw = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load * pf)/1000;
|
||||
float kva = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load)/1000;
|
||||
float real_v_AB = volts_AB/1000.0f;
|
||||
float real_v_BC = volts_BC/1000.0f;
|
||||
float real_v_CA = volts_CA/1000.0f;
|
||||
float kw = (1.732f * ((real_v_AB + real_v_BC + real_v_CA)/3.0f) * sim_load * pf)*10;
|
||||
float mwh = kw *600.0f;
|
||||
|
||||
setPointValue(equipment, "S2 kW", kw);
|
||||
setPointValue(equipment, "S2 kVA", kva);
|
||||
setPointValue(equipment, "S2 MWh", mwh);
|
||||
|
||||
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||
if (preferred == 1.0f){
|
||||
setBitValue(equipment, "Source Preferred", 9, true);
|
||||
setBitValue(equipment, "Source Preferred", 8, false);
|
||||
}
|
||||
if (preferred == 2.0f){
|
||||
setBitValue(equipment, "Source Preferred", 9, false);
|
||||
setBitValue(equipment, "Source Preferred", 8, true);
|
||||
}
|
||||
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
@@ -117,9 +130,6 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Running State...");
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
setPointValue(equipment, "Source Active", 32);
|
||||
setPointValue(equipment, "Source Preferred", 512);
|
||||
|
||||
setPointValue(equipment, "S1 Volts AB", 0.0f);
|
||||
setPointValue(equipment, "S1 Volts BC", 0.0f);
|
||||
setPointValue(equipment, "S1 Volts CA", 0.0f);
|
||||
@@ -129,6 +139,14 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "S1 Amps A", 0.0f);
|
||||
setPointValue(equipment, "S1 Amps B", 0.0f);
|
||||
setPointValue(equipment, "S1 Amps C", 0.0f);
|
||||
setPointValue(equipment, "S1 kW", 0.0f);
|
||||
setPointValue(equipment, "S1 MWh", 0.0f);
|
||||
|
||||
setBitValue(equipment, "Source Active", 4, false);
|
||||
setBitValue(equipment, "Source Active", 3, true);
|
||||
|
||||
setBitValue(equipment, "Source Preferred", 8, false);
|
||||
setBitValue(equipment, "Source Preferred", 9, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,15 +38,15 @@
|
||||
template<>
|
||||
StandbyState<ModbusIP>::StandbyState() {
|
||||
// You can add initialization code here if needed
|
||||
addStrategy("S1 Volts AB", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S1 Volts BC", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S1 Volts CA", new SingleValueStrategy(480.0F, 2.0f, 1000));
|
||||
addStrategy("S1 Volts AB", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
addStrategy("S1 Volts BC", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
addStrategy("S1 Volts CA", new SingleValueStrategy(4800.0F, 10.0f, 1000));
|
||||
|
||||
addStrategy("PF", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
addStrategy("PF", new SingleValueStrategy(910.0f, 20.0f, 1000));
|
||||
|
||||
addStrategy("S1 Amps A", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S1 Amps B", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S1 Amps C", new SingleValueStrategy(1.0f, 5.0f, 1000));
|
||||
addStrategy("S1 Amps A", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
addStrategy("S1 Amps B", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
addStrategy("S1 Amps C", new SingleValueStrategy(200.0f, 100.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,33 +68,46 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
}
|
||||
float volts_AB = getPointValue(equipment, "S1 Volts AB");
|
||||
float volts_BC = getPointValue(equipment, "S1 Volts BC");
|
||||
float volts_AC = getPointValue(equipment, "S1 Volts CA");
|
||||
float volts_CA = getPointValue(equipment, "S1 Volts CA");
|
||||
|
||||
setPointValue(equipment, "S1 Volts AN", volts_AB/1.732);
|
||||
setPointValue(equipment, "S1 Volts BN", volts_BC/1.732);
|
||||
setPointValue(equipment, "S1 Volts CN", volts_AC/1.732);
|
||||
setPointValue(equipment, "S1 Volts CN", volts_CA/1.732);
|
||||
|
||||
int I_load = getPointValue(equipment, "ATS_Load");
|
||||
int I_rating = getPointValue(equipment, "ATS_Rating");
|
||||
float load = static_cast<float>(I_load);
|
||||
float rating = static_cast<float>(I_rating);
|
||||
float real_load = rating * (load/100.0f);
|
||||
float sim_load = rating * (load/100.0f);
|
||||
Strategy_Behavior* ampsA_svs = getStrategy("S1 Amps A");
|
||||
Strategy_Behavior* ampsB_svs = getStrategy("S1 Amps B");
|
||||
Strategy_Behavior* ampsC_svs = getStrategy("S1 Amps C");
|
||||
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(real_load);
|
||||
static_cast<SingleValueStrategy*>(ampsA_svs)->setSetpoint(sim_load*1000.0f);
|
||||
static_cast<SingleValueStrategy*>(ampsB_svs)->setSetpoint(sim_load*1000.0f);
|
||||
static_cast<SingleValueStrategy*>(ampsC_svs)->setSetpoint(sim_load*1000.0f);
|
||||
|
||||
float pf = getPointValue(equipment, "PF");
|
||||
float get_pf = getPointValue(equipment, "PF");
|
||||
float pf = get_pf/1000.0f;
|
||||
|
||||
float real_v_AB = volts_AB/1000.0f;
|
||||
float real_v_BC = volts_BC/1000.0f;
|
||||
float real_v_CA = volts_CA/1000.0f;
|
||||
float kw = (1.732f * ((real_v_AB + real_v_BC + real_v_CA)/3.0f) * sim_load * pf)*10;
|
||||
float mwh = kw *600.0f;
|
||||
|
||||
float kw = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load * pf)/1000;
|
||||
float kva = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load)/1000;
|
||||
float preferred = getPointValue(equipment, "ATS_Preferred");
|
||||
if (preferred == 1.0f){
|
||||
setBitValue(equipment, "Source Preferred", 9, true);
|
||||
setBitValue(equipment, "Source Preferred", 8, false);
|
||||
}
|
||||
if (preferred == 2.0f){
|
||||
setBitValue(equipment, "Source Preferred", 9, false);
|
||||
setBitValue(equipment, "Source Preferred", 8, true);
|
||||
}
|
||||
|
||||
setPointValue(equipment, "S1 kW", kw);
|
||||
setPointValue(equipment, "S1 kVA", kva);
|
||||
setPointValue(equipment, "S1 MWh", mwh);
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -109,8 +122,6 @@ template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "Source Active", 64);
|
||||
setPointValue(equipment, "Source Preferred", 1024);
|
||||
|
||||
setPointValue(equipment, "S2 Volts AB", 0.0f);
|
||||
setPointValue(equipment, "S2 Volts BC", 0.0f);
|
||||
@@ -121,6 +132,14 @@ void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "S2 Amps A", 0.0f);
|
||||
setPointValue(equipment, "S2 Amps B", 0.0f);
|
||||
setPointValue(equipment, "S2 Amps C", 0.0f);
|
||||
setPointValue(equipment, "S2 kW", 0.0f);
|
||||
setPointValue(equipment, "S2 MWh", 0.0f);
|
||||
|
||||
setBitValue(equipment, "Source Active", 3, false);
|
||||
setBitValue(equipment, "Source Active", 4, true);
|
||||
|
||||
setBitValue(equipment, "Source Preferred", 8, false);
|
||||
setBitValue(equipment, "Source Preferred", 9, true);
|
||||
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 241); /**< @brief The static IP address for the device. */
|
||||
IPAddress local_IP(172, 17, 33, 173); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
@@ -60,35 +60,37 @@
|
||||
*/
|
||||
modbusMap mb_map[] =
|
||||
{
|
||||
{HR, 8, 0, "ATS_Preferred"}, //Internal to control from Modscan
|
||||
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
|
||||
{HR, 10, 0, "ATS_Load"},
|
||||
{HR, 11, 0, "ATS_Rating"}, //Internal Fault code from Modscan
|
||||
|
||||
{HR, 50009, 0, "PF"},
|
||||
{HR_LONG, 50001, 0, "S2 Volts AB"},
|
||||
{HR_LONG, 50004, 0, "S2 Volts AN"},
|
||||
{HR_LONG, 50007, 0, "S2 Volts BC"},
|
||||
{HR_LONG, 50010, 0, "S2 Volts BN"},
|
||||
{HR_LONG, 50013, 0, "S2 Volts CA"},
|
||||
{HR_LONG, 50016, 0, "S2 Volts CN"},
|
||||
{HR_LONG, 50019, 0, "S1 Volts AB"},
|
||||
{HR_LONG, 50022, 0, "S1 Volts AN"},
|
||||
{HR_LONG, 50025, 0, "S1 Volts BC"},
|
||||
{HR_LONG, 50028, 0, "S1 Volts BN"},
|
||||
{HR_LONG, 50031, 0, "S1 Volts CA"},
|
||||
{HR_LONG, 50034, 0, "S1 Volts CN"},
|
||||
{HR_LONG, 50037, 0, "S2 Amps A"},
|
||||
{HR_LONG, 50040, 0, "S2 Amps B"},
|
||||
{HR_LONG, 50043, 0, "S2 Amps C"},
|
||||
{HR_LONG, 50060, 0, "S2 kW"},
|
||||
{HR_LONG, 50064, 0, "S2 MWh"},
|
||||
{HR, 50078, 0, "Source Preferred"}, // bit 8 and bit 9
|
||||
{HR, 50082, 0, "Source Active"}, //bit2 and bit 3
|
||||
{HR_LONG, 50091, 0, "S1 Amps A"},
|
||||
{HR, 50093, 0, "S1 kW"},
|
||||
{HR_LONG, 50094, 0, "S1 Amps B"},
|
||||
{HR_LONG, 50097, 0, "S1 Amps C"},
|
||||
{HR_LONG, 50100, 0, "S1 MWh"},
|
||||
{HR, 50009, 0, "PF"}, //0.001x
|
||||
{HR_LONG, 50001, 0, "S2 Volts AB"}, //0.1x
|
||||
{HR_LONG, 50004, 0, "S2 Volts AN"}, //0.1x
|
||||
{HR_LONG, 50007, 0, "S2 Volts BC"}, //0.1x
|
||||
{HR_LONG, 50010, 0, "S2 Volts BN"}, //0.1x
|
||||
{HR_LONG, 50013, 0, "S2 Volts CA"}, //0.1x
|
||||
{HR_LONG, 50016, 0, "S2 Volts CN"}, //0.1x
|
||||
{HR_LONG, 50019, 0, "S1 Volts AB"}, //0.1x
|
||||
{HR_LONG, 50022, 0, "S1 Volts AN"}, //0.1x
|
||||
{HR_LONG, 50025, 0, "S1 Volts BC"}, //0.1x
|
||||
{HR_LONG, 50028, 0, "S1 Volts BN"}, //0.1x
|
||||
{HR_LONG, 50031, 0, "S1 Volts CA"}, //0.1x
|
||||
{HR_LONG, 50034, 0, "S1 Volts CN"}, //0.1x
|
||||
{HR_LONG, 50037, 0, "S2 Amps A"}, //0.001x
|
||||
{HR_LONG, 50040, 0, "S2 Amps B"}, //0.001x
|
||||
{HR_LONG, 50043, 0, "S2 Amps C"}, //0.001x
|
||||
{HR_LONG, 50060, 0, "S2 kW"},
|
||||
{HR_LONG, 50064, 0, "S2 MWh"}, //0.01x
|
||||
{HR, 50078, 0, "Source Preferred"}, //bit9 source1 bit8 source 2
|
||||
{HR, 50082, 0, "Source Active"}, //bit4 source1 bit3 source 2
|
||||
{HR_LONG, 50091, 0, "S1 Amps A"}, //.001x
|
||||
{HR, 50093, 0, "S1 kW"}, //.1x
|
||||
{HR_LONG, 50094, 0, "S1 Amps B"}, //.001x
|
||||
{HR_LONG, 50097, 0, "S1 Amps C"}, //.001x
|
||||
{HR_LONG, 50100, 0, "S1 MWh"}, //.01x
|
||||
|
||||
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
*/
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
addStrategy("Volts AB", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Volts BC", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Volts CA", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Volts AB", new SingleValueStrategy(4800.0F, 5.0f, 1000));
|
||||
addStrategy("Volts BC", new SingleValueStrategy(4800.0F, 5.0f, 1000));
|
||||
addStrategy("Volts CA", new SingleValueStrategy(4800.0F, 5.0f, 1000));
|
||||
|
||||
addStrategy("PF", new SingleValueStrategy(90.0f, 1.0f, 1000));
|
||||
addStrategy("PF", new SingleValueStrategy(900.0f, 1.0f, 1000));
|
||||
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 10.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 10.0f, 1000));
|
||||
@@ -66,9 +66,11 @@ template<>
|
||||
State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment) {
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Running update function");
|
||||
Serial.println("Running update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 1){
|
||||
if (State_Ctrl == 0.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
if (State_Ctrl == 2.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
@@ -76,9 +78,9 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float volts_BC = getPointValue(equipment, "Volts BC");
|
||||
float volts_AC = getPointValue(equipment, "Volts CA");
|
||||
|
||||
setPointValue(equipment, "Volts AN", volts_AB/1.732);
|
||||
setPointValue(equipment, "Volts BN", volts_BC/1.732);
|
||||
setPointValue(equipment, "Volts CN", volts_AC/1.732);
|
||||
setPointValue(equipment, "Volts AN", volts_AB/1.732f);
|
||||
setPointValue(equipment, "Volts BN", volts_BC/1.732f);
|
||||
setPointValue(equipment, "Volts CN", volts_AC/1.732f);
|
||||
|
||||
|
||||
int I_load = getPointValue(equipment, "Load");
|
||||
@@ -86,18 +88,21 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float load = static_cast<float>(I_load);
|
||||
float rating = static_cast<float>(I_rating);
|
||||
float real_load = rating * (load/100.0f);
|
||||
setPointValue(equipment, "Amps A", real_load);
|
||||
setPointValue(equipment, "Amps B", real_load);
|
||||
setPointValue(equipment, "Amps C", real_load);
|
||||
setPointValue(equipment, "Amps A", real_load * 10.0f);
|
||||
setPointValue(equipment, "Amps B", real_load * 10.0f);
|
||||
setPointValue(equipment, "Amps C", real_load * 10.0f);
|
||||
setPointValue(equipment, "Amps G", volts_AB * 0.037f);
|
||||
setPointValue(equipment, "Amps N", volts_BC * 0.034f);
|
||||
|
||||
float pf = getPointValue(equipment, "PF");
|
||||
|
||||
|
||||
float kw = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load * (pf/100))/100;
|
||||
float kva = (1.732f * ((volts_AB + volts_BC + volts_AC)/3.0f) * real_load)/100;
|
||||
float kva = (1.732f * ((volts_AB + volts_BC + volts_AC)/4.0f) * real_load * (pf/100.0f))/100000.0f;
|
||||
float kw = (1.732f * ((volts_AB + volts_BC + volts_AC)/4.0f) * real_load )/10000.0f;
|
||||
|
||||
setPointValue(equipment, "kW", kw);
|
||||
setPointValue(equipment, "kVA", kva);
|
||||
setPointValue(equipment, "kWh", 1724.0f);
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
@@ -113,7 +118,8 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Running State...");
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
setPointValue(equipment, "CB Position", 1);
|
||||
setBitValue(equipment, "CB Position", 0, true);
|
||||
setBitValue(equipment, "CB Position", 12, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,9 +57,16 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Standby update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 2){
|
||||
if (State_Ctrl == 1.0f){
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
if (State_Ctrl == 0.0f){
|
||||
setBitValue(equipment, "CB Position", 12, false);
|
||||
}
|
||||
if (State_Ctrl == 2.0f){
|
||||
setBitValue(equipment, "CB Position", 12, true);
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
@@ -75,7 +82,7 @@ template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "CB Position", 0);
|
||||
setBitValue(equipment, "CB Position", 0, false);
|
||||
setPointValue(equipment, "Volts AB", 0.0f);
|
||||
setPointValue(equipment, "Volts BC", 0.0f);
|
||||
setPointValue(equipment, "Volts CA", 0.0f);
|
||||
@@ -86,8 +93,11 @@ void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "Amps A", 0.0f);
|
||||
setPointValue(equipment, "Amps B", 0.0f);
|
||||
setPointValue(equipment, "Amps C", 0.0f);
|
||||
setPointValue(equipment, "Amps G", 0.0f);
|
||||
setPointValue(equipment, "Amps N", 0.0f);
|
||||
setPointValue(equipment, "kW", 0.0f);
|
||||
setPointValue(equipment, "kVA", 0.0f);
|
||||
setPointValue(equipment, "kWh", 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 30, 241); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 30, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress local_IP(172, 17, 33, 154); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
@@ -63,7 +63,7 @@ modbusMap mb_map[] =
|
||||
{HR, 9, 0, "State Control"}, //Open-Close Cmd
|
||||
{HR, 10, 0, "Load"}, //Adjustble Load
|
||||
{HR, 11, 0, "Rating"}, //Max amp to calculate kw, kVA, etc
|
||||
{IR_LONG, 41, 0, "CB Position"},
|
||||
{IR, 41, 0, "CB Position"}, //b0 close open b12 tripped
|
||||
{IR_LONG, 101, 0, "Amps A"},
|
||||
{IR_LONG, 103, 0, "Amps B"},
|
||||
{IR_LONG, 105, 0, "Amps C"},
|
||||
|
||||
@@ -68,7 +68,10 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Running update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 1){
|
||||
if (State_Ctrl == 0){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
if (State_Ctrl == 2){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
@@ -118,6 +121,7 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
Serial.println("Enter Running State...");
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
setPointValue(equipment, "CB Position", 2048);
|
||||
setPointValue(equipment, "CB Trip", 0.0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,16 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Standby update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 2){
|
||||
if (State_Ctrl == 1){
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
if (State_Ctrl == 0){
|
||||
setPointValue(equipment, "CB Trip", 0.0f);
|
||||
}
|
||||
if (State_Ctrl == 2){
|
||||
setPointValue(equipment, "CB Trip", 1.0f);
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
* @{
|
||||
*/
|
||||
#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. */
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 167); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
|
||||
@@ -61,7 +61,10 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Running update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 1){
|
||||
if (State_Ctrl == 0.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
if (State_Ctrl == 2.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
|
||||
@@ -92,7 +95,9 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Running State...");
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
setPointValue(equipment, "Status", 4);
|
||||
|
||||
setBitValue(equipment, "Status", 2, true);
|
||||
setBitValue(equipment, "Tripped", 0, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,16 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Standby update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 2){
|
||||
if (State_Ctrl == 1.0f){
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
if (State_Ctrl == 0.0f){
|
||||
setBitValue(equipment, "Tripped", 0, false);
|
||||
}
|
||||
if (State_Ctrl == 2.0f){
|
||||
setBitValue(equipment, "Tripped", 0, true);
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
@@ -75,11 +82,13 @@ template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "Status", 0);
|
||||
|
||||
setPointValue(equipment, "Amps A", 0.0f);
|
||||
setPointValue(equipment, "Amps B", 0.0f);
|
||||
setPointValue(equipment, "Amps C", 0.0f);
|
||||
setPointValue(equipment, "Amps N", 0.0f);
|
||||
|
||||
setBitValue(equipment, "Status", 2, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
* @{
|
||||
*/
|
||||
#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, 238); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(192, 138, 1, 1); /**< @brief The gateway IP address. */
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 149); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
@@ -64,11 +64,12 @@ modbusMap mb_map[] =
|
||||
{HR, 10, 0, "Load"},
|
||||
{HR, 11, 0, "Rating"},
|
||||
|
||||
{IR, 2, 0, "Status"},
|
||||
{IR, 2, 0, "Status"}, //bit 2 open-close,
|
||||
{IR, 3, 0, "Amps A"},
|
||||
{IR, 5, 0, "Amps B"},
|
||||
{IR, 7, 0, "Amps C"},
|
||||
{IR, 9, 0, "Amps N"},
|
||||
{IR, 13, 0, "Tripped"}, //bit 0 tripped
|
||||
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
@@ -68,7 +68,10 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Running update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 1){
|
||||
if (State_Ctrl == 0.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
if (State_Ctrl == 2.0f){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
@@ -116,7 +119,9 @@ void RunningState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Running State...");
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
setPointValue(equipment, "CB Position", 4096);
|
||||
|
||||
setBitValue(equipment, "CB Position", 12, true);
|
||||
setBitValue(equipment, "CB Position", 9, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,17 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
// STATE control, add conditions if change to a different state is needed
|
||||
Serial.println("Standby update function");
|
||||
float State_Ctrl = getPointValue(equipment, "State Control");
|
||||
if (State_Ctrl == 2){
|
||||
if (State_Ctrl == 1.0f){
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
if (State_Ctrl == 0.0f){
|
||||
setBitValue(equipment, "CB Position", 9, false);
|
||||
}
|
||||
|
||||
if (State_Ctrl == 2.0f){
|
||||
setBitValue(equipment, "CB Position", 9, true);
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
@@ -86,6 +94,7 @@ void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "Amps A", 0.0f);
|
||||
setPointValue(equipment, "Amps B", 0.0f);
|
||||
setPointValue(equipment, "Amps C", 0.0f);
|
||||
setBitValue(equipment, "CB Position", 12, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 132); /**< @brief The static IP address for the device. */
|
||||
IPAddress local_IP(172, 17, 33, 141); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
@@ -64,7 +64,7 @@ modbusMap mb_map[] =
|
||||
{HR, 10, 0, "Load"},
|
||||
{HR, 11, 0, "Rating"},
|
||||
|
||||
{IR, 207, 0, "CB Position"},
|
||||
{IR, 207, 0, "CB Position"}, //bit 9 trip bit 12 open closed
|
||||
{IR_FLOAT, 215, 0, "Amps A"},
|
||||
{IR_FLOAT, 217, 0, "Amps B"},
|
||||
{IR_FLOAT, 219, 0, "Amps C"},
|
||||
|
||||
@@ -36,80 +36,90 @@
|
||||
* state, such as a PID controller for the 'CW Valve Position' and totalizers
|
||||
* for the run-hours of each EC fan.
|
||||
*/
|
||||
std::string cbs[] = {"CB0", "CB1", "CB2", "CB3", "CB4", "CB5", "CB6", "CB7", "CB8", "CB9"};
|
||||
std::string cbs[] = {"CB1", "CB2", "CB3", "CB4", "CB5", "CB6", "CB7", "CB8"};
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
|
||||
addStrategy("Input_I1", new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
addStrategy("Input_I2", new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
addStrategy("Input_I3", new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
addStrategy("Input_kVA", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Input_kVAR", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Input_kW", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Input_kWh", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_PF", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Input_V_AB", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_V_AN", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_V_BC", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_V_BN", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_V_CA", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_V_CN", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_LL_Avg", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Input_LN_Avg", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
|
||||
for (const std::string& cb : cbs) {
|
||||
std::string tag = "";
|
||||
tag = cb + "_V1N";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V2N";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = cb + "_I1";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V3N";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = cb + "_I2";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_L1PF";
|
||||
addStrategy(tag, new SingleValueStrategy(93.0f, 9.0f, 1000));
|
||||
tag = cb + "_I3";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_L2PF";
|
||||
addStrategy(tag, new SingleValueStrategy(93.0f, 9.0f, 1000));
|
||||
tag = cb + "_kVA";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_L3PF";
|
||||
addStrategy(tag, new SingleValueStrategy(93.0f, 9.0f, 1000));
|
||||
tag = cb + "_kVA1";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V1THD";
|
||||
addStrategy(tag, new SingleValueStrategy(20.0f, 7.0f, 1000));
|
||||
tag = cb + "_kVA2";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V2THD";
|
||||
addStrategy(tag, new SingleValueStrategy(20.0f, 7.0f, 1000));
|
||||
tag = cb + "_kVA3";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V3THD";
|
||||
addStrategy(tag, new SingleValueStrategy(20.0f, 7.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I1THD";
|
||||
addStrategy(tag, new SingleValueStrategy(100.0f, 12.0f, 1000));
|
||||
tag = cb + "_kVAR";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2THD";
|
||||
addStrategy(tag, new SingleValueStrategy(100.0f, 12.0f, 1000));
|
||||
tag = cb + "_kW";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I3THD";
|
||||
addStrategy(tag, new SingleValueStrategy(100.0f, 12.0f, 1000));
|
||||
tag = cb + "_kW1";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I1Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kW2";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kW3";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I3Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kWh";
|
||||
addStrategy(tag, new SingleValueStrategy(0.1f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I1TDD";
|
||||
addStrategy(tag, new SingleValueStrategy(50.0f, 9.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2TDD";
|
||||
addStrategy(tag, new SingleValueStrategy(50.0f, 9.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I3TDD";
|
||||
addStrategy(tag, new SingleValueStrategy(50.0f, 9.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V12";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V23";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V31";
|
||||
addStrategy(tag, new SingleValueStrategy(0.0f, 30.0f, 1000));
|
||||
tag = cb + "_PF";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
}
|
||||
|
||||
addStrategy("Amps G", new SingleValueStrategy(0.0f, 2.0f, 1000));
|
||||
addStrategy("Amps N", new SingleValueStrategy(0.0f, 3.0f, 1000));
|
||||
addStrategy("kWh", new RampStrategy(5000000.0f, 1.0f, 1000));
|
||||
addStrategy("PF", new SingleValueStrategy(0.0f, 1.0f, 1000));
|
||||
|
||||
addStrategy("Output_I1", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_I2", new SingleValueStrategy(30.0f, 30.0f, 1000));
|
||||
addStrategy("Output_I3", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_IG", new SingleValueStrategy(30.0f, 30.0f, 1000));
|
||||
addStrategy("Output_IN", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_kVA1", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Output_kVA2", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Output_kVA3", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Output_kWh", new SingleValueStrategy(3.0f, 2.0f, 1000));
|
||||
addStrategy("Output_PF", new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
addStrategy("Output_V_AB", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_V_AN", new SingleValueStrategy(30.0f, 30.0f, 1000));
|
||||
addStrategy("Output_V_BC", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_V_BN", new SingleValueStrategy(30.0f, 30.0f, 1000));
|
||||
addStrategy("Output_V_CA", new SingleValueStrategy(30.0f, 20.0f, 1000));
|
||||
addStrategy("Output_V_CN", new SingleValueStrategy(30.0f, 30.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,14 +150,14 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float cb_count = 0.0f;
|
||||
for (const std::string& cb :cbs){
|
||||
std::string tag = "";
|
||||
tag = "Px " + cb;
|
||||
if (cb == "CB0") continue;
|
||||
tag = "Px_" + cb;
|
||||
float cb_status = getPointValue(equipment, tag);
|
||||
if (cb_status == 1.0f){
|
||||
cb_count += 1.0f;
|
||||
}
|
||||
}
|
||||
int cb_num = 0;
|
||||
Serial.printf("CB_ CLosed = %f \n", cb_count);
|
||||
int cb_num = 1;
|
||||
for (const std::string& cb : cbs) {
|
||||
std::string tag = "";
|
||||
Strategy_Behavior* strategy = nullptr;
|
||||
@@ -156,140 +166,224 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float cb_status = getPointValue(equipment, tag);
|
||||
float percent_load = getPointValue(equipment, "Px Load");
|
||||
float Rating = getPointValue(equipment, "Px Rating");
|
||||
float total_load = Rating * (percent_load /100.0f);
|
||||
float cb_load = total_load / cb_count;
|
||||
|
||||
float cb_load = 400.0f * (percent_load /1000.0f);
|
||||
|
||||
if (cb_status == 1.0f){
|
||||
setBitValue(equipment, "CB_Status", cb_num, true);
|
||||
strategy = getStrategy("Amps G");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(65.0f);
|
||||
strategy = getStrategy("Amps N");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(50.0f);
|
||||
strategy = getStrategy("PF");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(90.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V1N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(2700.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V2N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(2700.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V3N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(2700.0f);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_V12";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(4800.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V23";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(4800.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V31";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(4800.0f);
|
||||
setBitValue(equipment, "CB_Tripped", cb_num, false);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_I1";
|
||||
setPointValue(equipment, tag, total_load * 100.0f);
|
||||
setPointValue(equipment, tag, cb_load * 1000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_I2";
|
||||
setPointValue(equipment, tag, total_load * 100.0f);
|
||||
setPointValue(equipment, tag, cb_load * 1000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_I3";
|
||||
setPointValue(equipment, tag, total_load * 100.0f);
|
||||
setPointValue(equipment, tag, cb_load * 1000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_PF";
|
||||
setPointValue(equipment, tag, 910.0f);
|
||||
tag = "";
|
||||
tag = cb + "_PF";
|
||||
float pf = getPointValue(equipment, tag);
|
||||
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_L1KW";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = cb + "_kW1";
|
||||
setPointValue(equipment, tag, cb_load * 48000.0f * pf);
|
||||
float kW1 = getPointValue(equipment, tag);
|
||||
tag = "";
|
||||
tag = cb + "_L2KW";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = cb + "_kW2";
|
||||
setPointValue(equipment, tag, cb_load * 48000.0f * pf);
|
||||
float kW2 = getPointValue(equipment, tag);
|
||||
tag = "";
|
||||
tag = cb + "_L3KW";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = cb + "_kW3";
|
||||
setPointValue(equipment, tag, cb_load * 48000.0f * pf);
|
||||
float kW3 = getPointValue(equipment, tag);
|
||||
tag = "";
|
||||
tag = cb + "_kW";
|
||||
setPointValue(equipment, tag, ((kW1 + kW2 + kW3) / 3.0f)*1000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kWh";
|
||||
setPointValue(equipment, tag, 1325.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, cb_load * 480.0f * 10000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, cb_load * 480.0f * 10000.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, cb_load * 480.0f * 10000.0f);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_L1KVar";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f * 0.9f);
|
||||
tag = cb + "_kVA1";
|
||||
float kVA1 = getPointValue(equipment, tag);
|
||||
tag = "";
|
||||
tag = cb + "_L2KVar";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f * 0.9f);
|
||||
tag = cb + "_kVA2";
|
||||
float kVA2 = getPointValue(equipment, tag);
|
||||
tag = "";
|
||||
tag = cb + "_L3KVar";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f * 0.9f);
|
||||
tag = cb + "_kVA3";
|
||||
float kVA3 = getPointValue(equipment, tag);
|
||||
float kVA = (kVA1 + kVA2 + kVA3) * 1732.0f;
|
||||
tag = "";
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, kVA);
|
||||
tag = "";
|
||||
tag = cb + "_kVAR";
|
||||
setPointValue(equipment, tag, kVA / pf);
|
||||
|
||||
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
if (cb_status == 2.0f){
|
||||
setBitValue(equipment, "CB_Tripped", cb_num, true);
|
||||
} else {
|
||||
setBitValue(equipment, "CB_Tripped", cb_num, false);
|
||||
}
|
||||
setBitValue(equipment, "CB_Status", cb_num, false);
|
||||
strategy = getStrategy("Amps G");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
strategy = getStrategy("Amps N");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
strategy = getStrategy("PF");
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V1N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V2N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V3N";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_V12";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V23";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_V31";
|
||||
strategy = getStrategy(tag);
|
||||
static_cast<SingleValueStrategy*>(strategy)->setSetpoint(0.0f);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_I1";
|
||||
setPointValue(equipment, tag, total_load);
|
||||
tag = "";
|
||||
tag = cb + "_I2";
|
||||
setPointValue(equipment, tag, total_load);
|
||||
tag = "";
|
||||
tag = cb + "_I3";
|
||||
setPointValue(equipment, tag, total_load);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_L1KW";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L2KW";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L3KW";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_L1KVar";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L2KVar";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L3KVar";
|
||||
setPointValue(equipment, tag, total_load*0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_I1";
|
||||
setPointValue(equipment, tag, 40.0f);
|
||||
tag = "";
|
||||
tag = cb + "_I2";
|
||||
setPointValue(equipment, tag, 0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_I3";
|
||||
setPointValue(equipment, tag, 40.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA1";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA2";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVA3";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kVAR";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kW";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kW1";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kW2";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kW3";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
tag = "";
|
||||
tag = cb + "_kWh";
|
||||
setPointValue(equipment, tag, 0.5f);
|
||||
tag = "";
|
||||
tag = cb + "_PF";
|
||||
setPointValue(equipment, tag, 150.0f);
|
||||
}
|
||||
cb_num++;
|
||||
|
||||
|
||||
}
|
||||
Serial.printf("CB_ CLosed = %f \n", cb_count);
|
||||
if (cb_count > 0.0f){
|
||||
Serial.println("At least one breaker closed...");
|
||||
float percent_load = getPointValue(equipment, "Px Load");
|
||||
float cb_load = 400.0f * (percent_load /1000.0f);
|
||||
setPointValue(equipment, "Input_I1", cb_count * cb_load *100.0f);
|
||||
setPointValue(equipment, "Input_I2", cb_count * cb_load *100.0f);
|
||||
setPointValue(equipment, "Input_I3", cb_count * cb_load *100.0f);
|
||||
setPointValue(equipment, "Output_I1", cb_count * cb_load *100.0f);
|
||||
setPointValue(equipment, "Output_I2", cb_count * cb_load*100.0f);
|
||||
setPointValue(equipment, "Output_I3", cb_count * cb_load*100.0f);
|
||||
setPointValue(equipment, "Output_IG", cb_count * 750.0f);
|
||||
setPointValue(equipment, "Output_IN", cb_count * 482.0f);
|
||||
|
||||
float pf = 0.92f;
|
||||
setPointValue(equipment, "Input_PF", pf * 930.0f);
|
||||
setPointValue(equipment, "Output_PF", pf);
|
||||
float i1 = getPointValue(equipment, "Input_I1");
|
||||
float i2 = getPointValue(equipment, "Input_I2");
|
||||
float i3 = getPointValue(equipment, "Input_I3");
|
||||
|
||||
setPointValue(equipment, "Input_kW", 480.0f * ((i1 + i2 + i3) / 3.0f));
|
||||
float kW = getPointValue(equipment, "Input_kW");
|
||||
setPointValue(equipment, "Input_kVA", kW * 1.732f);
|
||||
setPointValue(equipment, "Output_kVA1", (kW * 1.732f)/3.0f);
|
||||
setPointValue(equipment, "Output_kVA2", (kW * 1.732f)/3.0f);
|
||||
setPointValue(equipment, "Output_kVA3", (kW * 1.732f)/3.0f);
|
||||
setPointValue(equipment, "Input_kVAR", kW * 1.732f* pf);
|
||||
setPointValue(equipment, "Output_kVAR", kW * 1.732f* pf);
|
||||
|
||||
setPointValue(equipment, "Output_kW1", kW /3.0f);
|
||||
setPointValue(equipment, "Output_kW2", kW /3.0f);
|
||||
setPointValue(equipment, "Output_kW3", kW /3.0f);
|
||||
|
||||
setPointValue(equipment, "Output_kWh", 1423.0f);
|
||||
|
||||
|
||||
setPointValue(equipment, "Input_V_AB", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_AN", 2700.0f);
|
||||
setPointValue(equipment, "Input_V_BC", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_BN", 2700.0f);
|
||||
setPointValue(equipment, "Input_V_CA", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_CN", 2700.0f);
|
||||
setPointValue(equipment, "Input_LL_Avg", 4800.0f);
|
||||
setPointValue(equipment, "Input_LN_Avg", 2700.0f);
|
||||
setPointValue(equipment, "Output_V_AB", 4800.0f);
|
||||
setPointValue(equipment, "Output_V_AN", 2700.0f);
|
||||
setPointValue(equipment, "Output_V_BC", 4800.0f);
|
||||
setPointValue(equipment, "Output_V_BN", 2700.0f);
|
||||
setPointValue(equipment, "Output_V_CA", 4800.0f);
|
||||
setPointValue(equipment, "Output_V_CN", 2700.0f);
|
||||
} else {
|
||||
Serial.println("No breaker closed...");
|
||||
setPointValue(equipment, "Input_I1", 50.0f);
|
||||
setPointValue(equipment, "Input_I2", 50.0f);
|
||||
setPointValue(equipment, "Input_I3", 50.0f);
|
||||
setPointValue(equipment, "Output_I1", 50.0f);
|
||||
setPointValue(equipment, "Output_I2", 50.0f);
|
||||
setPointValue(equipment, "Output_I3", 50.0f);
|
||||
setPointValue(equipment, "Output_IG", 50.0f);
|
||||
setPointValue(equipment, "Output_IN", 50.0f);
|
||||
setPointValue(equipment, "Input_PF", 0.0f);
|
||||
setPointValue(equipment, "Output_PF", 0.0f);
|
||||
setPointValue(equipment, "Input_kW", 0.0f);
|
||||
setPointValue(equipment, "Input_kVA", 0.0f);
|
||||
setPointValue(equipment, "Output_kVA1", 0.0f);
|
||||
setPointValue(equipment, "Output_kVA2", 0.0f);
|
||||
setPointValue(equipment, "Output_kVA3", 0.0f);
|
||||
setPointValue(equipment, "Input_kVAR", 0.0f);
|
||||
setPointValue(equipment, "Output_kVAR", 0.0f);
|
||||
setPointValue(equipment, "Output_kW1", 0.0f);
|
||||
setPointValue(equipment, "Output_kW2", 0.0f);
|
||||
setPointValue(equipment, "Output_kW3", 0.0f);
|
||||
setPointValue(equipment, "Output_kWh", 1.0f);
|
||||
setPointValue(equipment, "Input_V_AB", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_AN", 2700.0f);
|
||||
setPointValue(equipment, "Input_V_BC", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_BN", 2700.0f);
|
||||
setPointValue(equipment, "Input_V_CA", 4800.0f);
|
||||
setPointValue(equipment, "Input_V_CN", 2700.0f);
|
||||
setPointValue(equipment, "Input_LL_Avg", 4800.0f);
|
||||
setPointValue(equipment, "Input_LN_Avg", 2700.0f);
|
||||
setPointValue(equipment, "Output_V_AB", 10.0f);
|
||||
setPointValue(equipment, "Output_V_AN", 10.0f);
|
||||
setPointValue(equipment, "Output_V_BC", 10.0f);
|
||||
setPointValue(equipment, "Output_V_BN", 10.0f);
|
||||
setPointValue(equipment, "Output_V_CA", 10.0f);
|
||||
setPointValue(equipment, "Output_V_CN", 10.0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
|
||||
@@ -79,6 +79,16 @@ template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "Input_V_AB", 0.0f);
|
||||
setPointValue(equipment, "Input_V_AN", 0.0f);
|
||||
setPointValue(equipment, "Input_V_BC", 0.0f);
|
||||
setPointValue(equipment, "Input_V_BN", 0.0f);
|
||||
setPointValue(equipment, "Input_V_CA", 0.0f);
|
||||
setPointValue(equipment, "Input_V_CN", 0.0f);
|
||||
setPointValue(equipment, "Input_LL_Avg", 0.0f);
|
||||
setPointValue(equipment, "Input_LN_Avg", 0.0f);
|
||||
setPointValue(equipment, "Output_PF", 0.0f);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 178); /**< @brief The static IP address for the device. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 33, 181); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
ModbusRTU mb;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup ModbusMapConfig Modbus Map Configuration
|
||||
* @brief Defines the Modbus register map and related parameters for the emulator.
|
||||
@@ -64,9 +62,9 @@ modbusMap mb_map[] = {
|
||||
// Write Registers (as Input Registers - 3X)
|
||||
//***************************************
|
||||
{HR, 9, 0, "Px Ctrl"},
|
||||
{HR, 10, 0, "Px Rating"}, //Watts
|
||||
{HR, 10, 0, "Px Rating"}, //Amps
|
||||
{HR, 11, 0, "Px Load"}, //%load
|
||||
{HR, 19, 0, "Px_CB0"},
|
||||
{HR, 19, 0, "Px_Input"},
|
||||
{HR, 20, 0, "Px_CB1"},
|
||||
{HR, 21, 0, "Px_CB2"},
|
||||
{HR, 22, 0, "Px_CB3"},
|
||||
@@ -75,497 +73,178 @@ modbusMap mb_map[] = {
|
||||
{HR, 25, 0, "Px_CB6"},
|
||||
{HR, 26, 0, "Px_CB7"},
|
||||
{HR, 27, 0, "Px_CB8"},
|
||||
{HR, 28, 0, "Px_CB9"},
|
||||
{HR, 28, 0, "Px_Output"},
|
||||
|
||||
// System Status
|
||||
{IR_LONG, 0, 0, "CB0_V1N" },
|
||||
{IR_LONG, 2, 0, "CB0_V2N" },
|
||||
{IR_LONG, 4, 0, "CB0_V3N" },
|
||||
{IR_LONG, 6, 0, "CB0_I1" },
|
||||
{IR_LONG, 8, 0, "CB0_I2" },
|
||||
{IR_LONG, 10, 0, "CB0_I3" },
|
||||
{IR_LONG, 12, 0, "CB0_L1KW" },
|
||||
{IR_LONG, 14, 0, "CB0_L2KW" },
|
||||
{IR_LONG, 16, 0, "CB0_L3KW" },
|
||||
{IR_LONG, 18, 0, "CB0_L1KVar" },
|
||||
{IR_LONG, 20, 0, "CB0_L2KVar" },
|
||||
{IR_LONG, 22, 0, "CB0_L3KVar" },
|
||||
{IR_LONG, 24, 0, "CB0_L1KVA" },
|
||||
{IR_LONG, 26, 0, "CB0_L2KVA" },
|
||||
{IR_LONG, 28, 0, "CB0_L3KVA" },
|
||||
{IR_LONG, 30, 0, "CB0_L1PF" },
|
||||
{IR_LONG, 32, 0, "CB0_L2PF" },
|
||||
{IR_LONG, 34, 0, "CB0_L3PF" },
|
||||
{IR_LONG, 36, 0, "CB0_V1THD" },
|
||||
{IR_LONG, 38, 0, "CB0_V2THD" },
|
||||
{IR_LONG, 40, 0, "CB0_V3THD" },
|
||||
{IR_LONG, 42, 0, "CB0_I1THD" },
|
||||
{IR_LONG, 44, 0, "CB0_I2THD" },
|
||||
{IR_LONG, 46, 0, "CB0_I3THD" },
|
||||
{IR_LONG, 48, 0, "CB0_I1Kfactor" },
|
||||
{IR_LONG, 50, 0, "CB0_I2Kfactor" },
|
||||
{IR_LONG, 52, 0, "CB0_I3Kfactor" },
|
||||
{IR_LONG, 54, 0, "CB0_I1TDD" },
|
||||
{IR_LONG, 56, 0, "CB0_I2TDD" },
|
||||
{IR_LONG, 58, 0, "CB0_I3TDD" },
|
||||
{IR_LONG, 60, 0, "CB0_V12" },
|
||||
{IR_LONG, 62, 0, "CB0_V23" },
|
||||
{IR_LONG, 64, 0, "CB0_V31" },
|
||||
{IR_LONG, 66, 0, "CB0_TotalKW" },
|
||||
{IR_LONG, 68, 0, "CB0_TotalKVar" },
|
||||
{IR_LONG, 70, 0, "CB0_TotalKVA" },
|
||||
{IR_LONG, 72, 0, "CB0_TotalPF" },
|
||||
{IR_LONG, 74, 0, "CB0_TotalPFLag" },
|
||||
{IR_LONG, 76, 0, "CB0_TotalPFLead" },
|
||||
{IR_LONG, 78, 0, "CB0_TotalKWImport" },
|
||||
{IR_LONG, 80, 0, "CB0_TotalKWExport" },
|
||||
{IR_LONG, 82, 0, "CB0_TotalKVarImport" },
|
||||
{IR_LONG, 84, 0, "CB0_TotalKVarExport" },
|
||||
{IR_LONG, 86, 0, "CB0_LN_Avg" },
|
||||
{IR_LONG, 88, 0, "CB0_LL_Avg" },
|
||||
{IR_LONG, 92, 0, "CB0_TotalKWh" },
|
||||
{IR_LONG, 99, 0, "CB0_Status" },
|
||||
|
||||
// Circuit Breaker 1 (OB01)
|
||||
{IR_LONG, 100, 0, "CB1_V1N" },
|
||||
{IR_LONG, 102, 0, "CB1_V2N" },
|
||||
{IR_LONG, 104, 0, "CB1_V3N" },
|
||||
{IR_LONG, 106, 0, "CB1_I1" },
|
||||
{IR_LONG, 108, 0, "CB1_I2" },
|
||||
{IR_LONG, 110, 0, "CB1_I3" },
|
||||
{IR_LONG, 112, 0, "CB1_L1KW" },
|
||||
{IR_LONG, 114, 0, "CB1_L2KW" },
|
||||
{IR_LONG, 116, 0, "CB1_L3KW" },
|
||||
{IR_LONG, 118, 0, "CB1_L1KVar" },
|
||||
{IR_LONG, 120, 0, "CB1_L2KVar" },
|
||||
{IR_LONG, 122, 0, "CB1_L3KVar" },
|
||||
{IR_LONG, 124, 0, "CB1_L1KVA" },
|
||||
{IR_LONG, 126, 0, "CB1_L2KVA" },
|
||||
{IR_LONG, 128, 0, "CB1_L3KVA" },
|
||||
{IR_LONG, 130, 0, "CB1_L1PF" },
|
||||
{IR_LONG, 132, 0, "CB1_L2PF" },
|
||||
{IR_LONG, 134, 0, "CB1_L3PF" },
|
||||
{IR_LONG, 136, 0, "CB1_V1THD" },
|
||||
{IR_LONG, 138, 0, "CB1_V2THD" },
|
||||
{IR_LONG, 140, 0, "CB1_V3THD" },
|
||||
{IR_LONG, 142, 0, "CB1_I1THD" },
|
||||
{IR_LONG, 144, 0, "CB1_I2THD" },
|
||||
{IR_LONG, 146, 0, "CB1_I3THD" },
|
||||
{IR_LONG, 148, 0, "CB1_I1Kfactor" },
|
||||
{IR_LONG, 150, 0, "CB1_I2Kfactor" },
|
||||
{IR_LONG, 152, 0, "CB1_I3Kfactor" },
|
||||
{IR_LONG, 154, 0, "CB1_I1TDD" },
|
||||
{IR_LONG, 156, 0, "CB1_I2TDD" },
|
||||
{IR_LONG, 158, 0, "CB1_I3TDD" },
|
||||
{IR_LONG, 160, 0, "CB1_V12" },
|
||||
{IR_LONG, 162, 0, "CB1_V23" },
|
||||
{IR_LONG, 164, 0, "CB1_V31" },
|
||||
{IR_LONG, 166, 0, "CB1_TotalKW" },
|
||||
{IR_LONG, 168, 0, "CB1_TotalKVar" },
|
||||
{IR_LONG, 170, 0, "CB1_TotalKVA" },
|
||||
{IR_LONG, 172, 0, "CB1_TotalPF" },
|
||||
{IR_LONG, 174, 0, "CB1_TotalPFLag" },
|
||||
{IR_LONG, 176, 0, "CB1_TotalPFLead" },
|
||||
{IR_LONG, 178, 0, "CB1_TotalKWImport" },
|
||||
{IR_LONG, 180, 0, "CB1_TotalKWExport" },
|
||||
{IR_LONG, 182, 0, "CB1_TotalKVarImport" },
|
||||
{IR_LONG, 184, 0, "CB1_TotalKVarExport" },
|
||||
{IR_LONG, 186, 0, "CB1_LN_Avg" },
|
||||
{IR_LONG, 188, 0, "CB1_LL_Avg" },
|
||||
{IR_LONG, 199, 0, "CB1_Status" },
|
||||
|
||||
// Circuit Breaker 2 (OB02)
|
||||
{IR_LONG, 200, 0, "CB2_V1N" },
|
||||
{IR_LONG, 202, 0, "CB2_V2N" },
|
||||
{IR_LONG, 204, 0, "CB2_V3N" },
|
||||
{IR_LONG, 206, 0, "CB2_I1" },
|
||||
{IR_LONG, 208, 0, "CB2_I2" },
|
||||
{IR_LONG, 210, 0, "CB2_I3" },
|
||||
{IR_LONG, 212, 0, "CB2_L1KW" },
|
||||
{IR_LONG, 214, 0, "CB2_L2KW" },
|
||||
{IR_LONG, 216, 0, "CB2_L3KW" },
|
||||
{IR_LONG, 218, 0, "CB2_L1KVar" },
|
||||
{IR_LONG, 220, 0, "CB2_L2KVar" },
|
||||
{IR_LONG, 222, 0, "CB2_L3KVar" },
|
||||
{IR_LONG, 224, 0, "CB2_L1KVA" },
|
||||
{IR_LONG, 226, 0, "CB2_L2KVA" },
|
||||
{IR_LONG, 228, 0, "CB2_L3KVA" },
|
||||
{IR_LONG, 230, 0, "CB2_L1PF" },
|
||||
{IR_LONG, 232, 0, "CB2_L2PF" },
|
||||
{IR_LONG, 234, 0, "CB2_L3PF" },
|
||||
{IR_LONG, 236, 0, "CB2_V1THD" },
|
||||
{IR_LONG, 238, 0, "CB2_V2THD" },
|
||||
{IR_LONG, 240, 0, "CB2_V3THD" },
|
||||
{IR_LONG, 242, 0, "CB2_I1THD" },
|
||||
{IR_LONG, 244, 0, "CB2_I2THD" },
|
||||
{IR_LONG, 246, 0, "CB2_I3THD" },
|
||||
{IR_LONG, 248, 0, "CB2_I1Kfactor" },
|
||||
{IR_LONG, 250, 0, "CB2_I2Kfactor" },
|
||||
{IR_LONG, 252, 0, "CB2_I3Kfactor" },
|
||||
{IR_LONG, 254, 0, "CB2_I1TDD" },
|
||||
{IR_LONG, 256, 0, "CB2_I2TDD" },
|
||||
{IR_LONG, 258, 0, "CB2_I3TDD" },
|
||||
{IR_LONG, 260, 0, "CB2_V12" },
|
||||
{IR_LONG, 262, 0, "CB2_V23" },
|
||||
{IR_LONG, 264, 0, "CB2_V31" },
|
||||
{IR_LONG, 266, 0, "CB2_TotalKW" },
|
||||
{IR_LONG, 268, 0, "CB2_TotalKVar" },
|
||||
{IR_LONG, 270, 0, "CB2_TotalKVA" },
|
||||
{IR_LONG, 272, 0, "CB2_TotalPF" },
|
||||
{IR_LONG, 274, 0, "CB2_TotalPFLag" },
|
||||
{IR_LONG, 276, 0, "CB2_TotalPFLead" },
|
||||
{IR_LONG, 278, 0, "CB2_TotalKWImport" },
|
||||
{IR_LONG, 280, 0, "CB2_TotalKWExport" },
|
||||
{IR_LONG, 282, 0, "CB2_TotalKVarImport" },
|
||||
{IR_LONG, 284, 0, "CB2_TotalKVarExport" },
|
||||
{IR_LONG, 286, 0, "CB2_LN_Avg" },
|
||||
{IR_LONG, 288, 0, "CB2_LL_Avg" },
|
||||
{IR_LONG, 299, 0, "CB2_Status" },
|
||||
|
||||
// Circuit Breaker 3 (OB03)
|
||||
{IR_LONG, 300, 0, "CB3_V1N" },
|
||||
{IR_LONG, 302, 0, "CB3_V2N" },
|
||||
{IR_LONG, 304, 0, "CB3_V3N" },
|
||||
{IR_LONG, 306, 0, "CB3_I1" },
|
||||
{IR_LONG, 308, 0, "CB3_I2" },
|
||||
{IR_LONG, 310, 0, "CB3_I3" },
|
||||
{IR_LONG, 312, 0, "CB3_L1KW" },
|
||||
{IR_LONG, 314, 0, "CB3_L2KW" },
|
||||
{IR_LONG, 316, 0, "CB3_L3KW" },
|
||||
{IR_LONG, 318, 0, "CB3_L1KVar" },
|
||||
{IR_LONG, 320, 0, "CB3_L2KVar" },
|
||||
{IR_LONG, 322, 0, "CB3_L3KVar" },
|
||||
{IR_LONG, 324, 0, "CB3_L1KVA" },
|
||||
{IR_LONG, 326, 0, "CB3_L2KVA" },
|
||||
{IR_LONG, 328, 0, "CB3_L3KVA" },
|
||||
{IR_LONG, 330, 0, "CB3_L1PF" },
|
||||
{IR_LONG, 332, 0, "CB3_L2PF" },
|
||||
{IR_LONG, 334, 0, "CB3_L3PF" },
|
||||
{IR_LONG, 336, 0, "CB3_V1THD" },
|
||||
{IR_LONG, 338, 0, "CB3_V2THD" },
|
||||
{IR_LONG, 340, 0, "CB3_V3THD" },
|
||||
{IR_LONG, 342, 0, "CB3_I1THD" },
|
||||
{IR_LONG, 344, 0, "CB3_I2THD" },
|
||||
{IR_LONG, 346, 0, "CB3_I3THD" },
|
||||
{IR_LONG, 348, 0, "CB3_I1Kfactor" },
|
||||
{IR_LONG, 350, 0, "CB3_I2Kfactor" },
|
||||
{IR_LONG, 352, 0, "CB3_I3Kfactor" },
|
||||
{IR_LONG, 354, 0, "CB3_I1TDD" },
|
||||
{IR_LONG, 356, 0, "CB3_I2TDD" },
|
||||
{IR_LONG, 358, 0, "CB3_I3TDD" },
|
||||
{IR_LONG, 360, 0, "CB3_V12" },
|
||||
{IR_LONG, 362, 0, "CB3_V23" },
|
||||
{IR_LONG, 364, 0, "CB3_V31" },
|
||||
{IR_LONG, 366, 0, "CB3_TotalKW" },
|
||||
{IR_LONG, 368, 0, "CB3_TotalKVar" },
|
||||
{IR_LONG, 370, 0, "CB3_TotalKVA" },
|
||||
{IR_LONG, 372, 0, "CB3_TotalPF" },
|
||||
{IR_LONG, 374, 0, "CB3_TotalPFLag" },
|
||||
{IR_LONG, 376, 0, "CB3_TotalPFLead" },
|
||||
{IR_LONG, 378, 0, "CB3_TotalKWImport" },
|
||||
{IR_LONG, 380, 0, "CB3_TotalKWExport" },
|
||||
{IR_LONG, 382, 0, "CB3_TotalKVarImport" },
|
||||
{IR_LONG, 384, 0, "CB3_TotalKVarExport" },
|
||||
{IR_LONG, 386, 0, "CB3_LN_Avg" },
|
||||
{IR_LONG, 388, 0, "CB3_LL_Avg" },
|
||||
{IR_LONG, 399, 0, "CB3_Status" },
|
||||
|
||||
// Circuit Breaker 4 (OB04)
|
||||
{IR_LONG, 400, 0, "CB4_V1N" },
|
||||
{IR_LONG, 402, 0, "CB4_V2N" },
|
||||
{IR_LONG, 404, 0, "CB4_V3N" },
|
||||
{IR_LONG, 406, 0, "CB4_I1" },
|
||||
{IR_LONG, 408, 0, "CB4_I2" },
|
||||
{IR_LONG, 410, 0, "CB4_I3" },
|
||||
{IR_LONG, 412, 0, "CB4_L1KW" },
|
||||
{IR_LONG, 414, 0, "CB4_L2KW" },
|
||||
{IR_LONG, 416, 0, "CB4_L3KW" },
|
||||
{IR_LONG, 418, 0, "CB4_L1KVar" },
|
||||
{IR_LONG, 420, 0, "CB4_L2KVar" },
|
||||
{IR_LONG, 422, 0, "CB4_L3KVar" },
|
||||
{IR_LONG, 424, 0, "CB4_L1KVA" },
|
||||
{IR_LONG, 426, 0, "CB4_L2KVA" },
|
||||
{IR_LONG, 428, 0, "CB4_L3KVA" },
|
||||
{IR_LONG, 430, 0, "CB4_L1PF" },
|
||||
{IR_LONG, 432, 0, "CB4_L2PF" },
|
||||
{IR_LONG, 434, 0, "CB4_L3PF" },
|
||||
{IR_LONG, 436, 0, "CB4_V1THD" },
|
||||
{IR_LONG, 438, 0, "CB4_V2THD" },
|
||||
{IR_LONG, 440, 0, "CB4_V3THD" },
|
||||
{IR_LONG, 442, 0, "CB4_I1THD" },
|
||||
{IR_LONG, 444, 0, "CB4_I2THD" },
|
||||
{IR_LONG, 446, 0, "CB4_I3THD" },
|
||||
{IR_LONG, 448, 0, "CB4_I1Kfactor" },
|
||||
{IR_LONG, 450, 0, "CB4_I2Kfactor" },
|
||||
{IR_LONG, 452, 0, "CB4_I3Kfactor" },
|
||||
{IR_LONG, 454, 0, "CB4_I1TDD" },
|
||||
{IR_LONG, 456, 0, "CB4_I2TDD" },
|
||||
{IR_LONG, 458, 0, "CB4_I3TDD" },
|
||||
{IR_LONG, 460, 0, "CB4_V12" },
|
||||
{IR_LONG, 462, 0, "CB4_V23" },
|
||||
{IR_LONG, 464, 0, "CB4_V31" },
|
||||
{IR_LONG, 466, 0, "CB4_TotalKW" },
|
||||
{IR_LONG, 468, 0, "CB4_TotalKVar" },
|
||||
{IR_LONG, 470, 0, "CB4_TotalKVA" },
|
||||
{IR_LONG, 472, 0, "CB4_TotalPF" },
|
||||
{IR_LONG, 474, 0, "CB4_TotalPFLag" },
|
||||
{IR_LONG, 476, 0, "CB4_TotalPFLead" },
|
||||
{IR_LONG, 478, 0, "CB4_TotalKWImport" },
|
||||
{IR_LONG, 480, 0, "CB4_TotalKWExport" },
|
||||
{IR_LONG, 482, 0, "CB4_TotalKVarImport" },
|
||||
{IR_LONG, 484, 0, "CB4_TotalKVarExport" },
|
||||
{IR_LONG, 486, 0, "CB4_LN_Avg" },
|
||||
{IR_LONG, 488, 0, "CB4_LL_Avg" },
|
||||
{IR_LONG, 499, 0, "CB4_Status" },
|
||||
|
||||
// Circuit Breaker 5 (OB05)
|
||||
{IR_LONG, 500, 0, "CB5_V1N" },
|
||||
{IR_LONG, 502, 0, "CB5_V2N" },
|
||||
{IR_LONG, 504, 0, "CB5_V3N" },
|
||||
{IR_LONG, 506, 0, "CB5_I1" },
|
||||
{IR_LONG, 508, 0, "CB5_I2" },
|
||||
{IR_LONG, 510, 0, "CB5_I3" },
|
||||
{IR_LONG, 512, 0, "CB5_L1KW" },
|
||||
{IR_LONG, 514, 0, "CB5_L2KW" },
|
||||
{IR_LONG, 516, 0, "CB5_L3KW" },
|
||||
{IR_LONG, 518, 0, "CB5_L1KVar" },
|
||||
{IR_LONG, 520, 0, "CB5_L2KVar" },
|
||||
{IR_LONG, 522, 0, "CB5_L3KVar" },
|
||||
{IR_LONG, 524, 0, "CB5_L1KVA" },
|
||||
{IR_LONG, 526, 0, "CB5_L2KVA" },
|
||||
{IR_LONG, 528, 0, "CB5_L3KVA" },
|
||||
{IR_LONG, 530, 0, "CB5_L1PF" },
|
||||
{IR_LONG, 532, 0, "CB5_L2PF" },
|
||||
{IR_LONG, 534, 0, "CB5_L3PF" },
|
||||
{IR_LONG, 536, 0, "CB5_V1THD" },
|
||||
{IR_LONG, 538, 0, "CB5_V2THD" },
|
||||
{IR_LONG, 540, 0, "CB5_V3THD" },
|
||||
{IR_LONG, 542, 0, "CB5_I1THD" },
|
||||
{IR_LONG, 544, 0, "CB5_I2THD" },
|
||||
{IR_LONG, 546, 0, "CB5_I3THD" },
|
||||
{IR_LONG, 548, 0, "CB5_I1Kfactor" },
|
||||
{IR_LONG, 550, 0, "CB5_I2Kfactor" },
|
||||
{IR_LONG, 552, 0, "CB5_I3Kfactor" },
|
||||
{IR_LONG, 554, 0, "CB5_I1TDD" },
|
||||
{IR_LONG, 556, 0, "CB5_I2TDD" },
|
||||
{IR_LONG, 558, 0, "CB5_I3TDD" },
|
||||
{IR_LONG, 560, 0, "CB5_V12" },
|
||||
{IR_LONG, 562, 0, "CB5_V23" },
|
||||
{IR_LONG, 564, 0, "CB5_V31" },
|
||||
{IR_LONG, 566, 0, "CB5_TotalKW" },
|
||||
{IR_LONG, 568, 0, "CB5_TotalKVar" },
|
||||
{IR_LONG, 570, 0, "CB5_TotalKVA" },
|
||||
{IR_LONG, 572, 0, "CB5_TotalPF" },
|
||||
{IR_LONG, 574, 0, "CB5_TotalPFLag" },
|
||||
{IR_LONG, 576, 0, "CB5_TotalPFLead" },
|
||||
{IR_LONG, 578, 0, "CB5_TotalKWImport" },
|
||||
{IR_LONG, 580, 0, "CB5_TotalKWExport" },
|
||||
{IR_LONG, 582, 0, "CB5_TotalKVarImport" },
|
||||
{IR_LONG, 584, 0, "CB5_TotalKVarExport" },
|
||||
{IR_LONG, 586, 0, "CB5_LN_Avg" },
|
||||
{IR_LONG, 588, 0, "CB5_LL_Avg" },
|
||||
{IR_LONG, 599, 0, "CB5_Status" },
|
||||
|
||||
// Circuit Breaker 6 (OB06)
|
||||
{IR_LONG, 600, 0, "CB6_V1N" },
|
||||
{IR_LONG, 602, 0, "CB6_V2N" },
|
||||
{IR_LONG, 604, 0, "CB6_V3N" },
|
||||
{IR_LONG, 606, 0, "CB6_I1" },
|
||||
{IR_LONG, 608, 0, "CB6_I2" },
|
||||
{IR_LONG, 610, 0, "CB6_I3" },
|
||||
{IR_LONG, 612, 0, "CB6_L1KW" },
|
||||
{IR_LONG, 614, 0, "CB6_L2KW" },
|
||||
{IR_LONG, 616, 0, "CB6_L3KW" },
|
||||
{IR_LONG, 618, 0, "CB6_L1KVar" },
|
||||
{IR_LONG, 620, 0, "CB6_L2KVar" },
|
||||
{IR_LONG, 622, 0, "CB6_L3KVar" },
|
||||
{IR_LONG, 624, 0, "CB6_L1KVA" },
|
||||
{IR_LONG, 626, 0, "CB6_L2KVA" },
|
||||
{IR_LONG, 628, 0, "CB6_L3KVA" },
|
||||
{IR_LONG, 630, 0, "CB6_L1PF" },
|
||||
{IR_LONG, 632, 0, "CB6_L2PF" },
|
||||
{IR_LONG, 634, 0, "CB6_L3PF" },
|
||||
{IR_LONG, 636, 0, "CB6_V1THD" },
|
||||
{IR_LONG, 638, 0, "CB6_V2THD" },
|
||||
{IR_LONG, 640, 0, "CB6_V3THD" },
|
||||
{IR_LONG, 642, 0, "CB6_I1THD" },
|
||||
{IR_LONG, 644, 0, "CB6_I2THD" },
|
||||
{IR_LONG, 646, 0, "CB6_I3THD" },
|
||||
{IR_LONG, 648, 0, "CB6_I1Kfactor" },
|
||||
{IR_LONG, 650, 0, "CB6_I2Kfactor" },
|
||||
{IR_LONG, 652, 0, "CB6_I3Kfactor" },
|
||||
{IR_LONG, 654, 0, "CB6_I1TDD" },
|
||||
{IR_LONG, 656, 0, "CB6_I2TDD" },
|
||||
{IR_LONG, 658, 0, "CB6_I3TDD" },
|
||||
{IR_LONG, 660, 0, "CB6_V12" },
|
||||
{IR_LONG, 662, 0, "CB6_V23" },
|
||||
{IR_LONG, 664, 0, "CB6_V31" },
|
||||
{IR_LONG, 666, 0, "CB6_TotalKW" },
|
||||
{IR_LONG, 668, 0, "CB6_TotalKVar" },
|
||||
{IR_LONG, 670, 0, "CB6_TotalKVA" },
|
||||
{IR_LONG, 672, 0, "CB6_TotalPF" },
|
||||
{IR_LONG, 674, 0, "CB6_TotalPFLag" },
|
||||
{IR_LONG, 676, 0, "CB6_TotalPFLead" },
|
||||
{IR_LONG, 678, 0, "CB6_TotalKWImport" },
|
||||
{IR_LONG, 680, 0, "CB6_TotalKWExport" },
|
||||
{IR_LONG, 682, 0, "CB6_TotalKVarImport" },
|
||||
{IR_LONG, 684, 0, "CB6_TotalKVarExport" },
|
||||
{IR_LONG, 686, 0, "CB6_LN_Avg" },
|
||||
{IR_LONG, 688, 0, "CB6_LL_Avg" },
|
||||
{IR_LONG, 699, 0, "CB6_Status" },
|
||||
|
||||
// Circuit Breaker 7 (OB07)
|
||||
{IR_LONG, 700, 0, "CB7_V1N" },
|
||||
{IR_LONG, 702, 0, "CB7_V2N" },
|
||||
{IR_LONG, 704, 0, "CB7_V3N" },
|
||||
{IR_LONG, 706, 0, "CB7_I1" },
|
||||
{IR_LONG, 708, 0, "CB7_I2" },
|
||||
{IR_LONG, 710, 0, "CB7_I3" },
|
||||
{IR_LONG, 712, 0, "CB7_L1KW" },
|
||||
{IR_LONG, 714, 0, "CB7_L2KW" },
|
||||
{IR_LONG, 716, 0, "CB7_L3KW" },
|
||||
{IR_LONG, 718, 0, "CB7_L1KVar" },
|
||||
{IR_LONG, 720, 0, "CB7_L2KVar" },
|
||||
{IR_LONG, 722, 0, "CB7_L3KVar" },
|
||||
{IR_LONG, 724, 0, "CB7_L1KVA" },
|
||||
{IR_LONG, 726, 0, "CB7_L2KVA" },
|
||||
{IR_LONG, 728, 0, "CB7_L3KVA" },
|
||||
{IR_LONG, 730, 0, "CB7_L1PF" },
|
||||
{IR_LONG, 732, 0, "CB7_L2PF" },
|
||||
{IR_LONG, 734, 0, "CB7_L3PF" },
|
||||
{IR_LONG, 736, 0, "CB7_V1THD" },
|
||||
{IR_LONG, 738, 0, "CB7_V2THD" },
|
||||
{IR_LONG, 740, 0, "CB7_V3THD" },
|
||||
{IR_LONG, 742, 0, "CB7_I1THD" },
|
||||
{IR_LONG, 744, 0, "CB7_I2THD" },
|
||||
{IR_LONG, 746, 0, "CB7_I3THD" },
|
||||
{IR_LONG, 748, 0, "CB7_I1Kfactor" },
|
||||
{IR_LONG, 750, 0, "CB7_I2Kfactor" },
|
||||
{IR_LONG, 752, 0, "CB7_I3Kfactor" },
|
||||
{IR_LONG, 754, 0, "CB7_I1TDD" },
|
||||
{IR_LONG, 756, 0, "CB7_I2TDD" },
|
||||
{IR_LONG, 758, 0, "CB7_I3TDD" },
|
||||
{IR_LONG, 760, 0, "CB7_V12" },
|
||||
{IR_LONG, 762, 0, "CB7_V23" },
|
||||
{IR_LONG, 764, 0, "CB7_V31" },
|
||||
{IR_LONG, 766, 0, "CB7_TotalKW" },
|
||||
{IR_LONG, 768, 0, "CB7_TotalKVar" },
|
||||
{IR_LONG, 770, 0, "CB7_TotalKVA" },
|
||||
{IR_LONG, 772, 0, "CB7_TotalPF" },
|
||||
{IR_LONG, 774, 0, "CB7_TotalPFLag" },
|
||||
{IR_LONG, 776, 0, "CB7_TotalPFLead" },
|
||||
{IR_LONG, 778, 0, "CB7_TotalKWImport" },
|
||||
{IR_LONG, 780, 0, "CB7_TotalKWExport" },
|
||||
{IR_LONG, 782, 0, "CB7_TotalKVarImport" },
|
||||
{IR_LONG, 784, 0, "CB7_TotalKVarExport" },
|
||||
{IR_LONG, 786, 0, "CB7_LN_Avg" },
|
||||
{IR_LONG, 788, 0, "CB7_LL_Avg" },
|
||||
{IR_LONG, 799, 0, "CB7_Status" },
|
||||
|
||||
// Circuit Breaker 8 (OB08)
|
||||
{IR_LONG, 800, 0, "CB8_V1N" },
|
||||
{IR_LONG, 802, 0, "CB8_V2N" },
|
||||
{IR_LONG, 804, 0, "CB8_V3N" },
|
||||
{IR_LONG, 806, 0, "CB8_I1" },
|
||||
{IR_LONG, 808, 0, "CB8_I2" },
|
||||
{IR_LONG, 810, 0, "CB8_I3" },
|
||||
{IR_LONG, 812, 0, "CB8_L1KW" },
|
||||
{IR_LONG, 814, 0, "CB8_L2KW" },
|
||||
{IR_LONG, 816, 0, "CB8_L3KW" },
|
||||
{IR_LONG, 818, 0, "CB8_L1KVar" },
|
||||
{IR_LONG, 820, 0, "CB8_L2KVar" },
|
||||
{IR_LONG, 822, 0, "CB8_L3KVar" },
|
||||
{IR_LONG, 824, 0, "CB8_L1KVA" },
|
||||
{IR_LONG, 826, 0, "CB8_L2KVA" },
|
||||
{IR_LONG, 828, 0, "CB8_L3KVA" },
|
||||
{IR_LONG, 830, 0, "CB8_L1PF" },
|
||||
{IR_LONG, 832, 0, "CB8_L2PF" },
|
||||
{IR_LONG, 834, 0, "CB8_L3PF" },
|
||||
{IR_LONG, 836, 0, "CB8_V1THD" },
|
||||
{IR_LONG, 838, 0, "CB8_V2THD" },
|
||||
{IR_LONG, 840, 0, "CB8_V3THD" },
|
||||
{IR_LONG, 842, 0, "CB8_I1THD" },
|
||||
{IR_LONG, 844, 0, "CB8_I2THD" },
|
||||
{IR_LONG, 846, 0, "CB8_I3THD" },
|
||||
{IR_LONG, 848, 0, "CB8_I1Kfactor" },
|
||||
{IR_LONG, 850, 0, "CB8_I2Kfactor" },
|
||||
{IR_LONG, 852, 0, "CB8_I3Kfactor" },
|
||||
{IR_LONG, 854, 0, "CB8_I1TDD" },
|
||||
{IR_LONG, 856, 0, "CB8_I2TDD" },
|
||||
{IR_LONG, 858, 0, "CB8_I3TDD" },
|
||||
{IR_LONG, 860, 0, "CB8_V12" },
|
||||
{IR_LONG, 862, 0, "CB8_V23" },
|
||||
{IR_LONG, 864, 0, "CB8_V31" },
|
||||
{IR_LONG, 866, 0, "CB8_TotalKW" },
|
||||
{IR_LONG, 868, 0, "CB8_TotalKVar" },
|
||||
{IR_LONG, 870, 0, "CB8_TotalKVA" },
|
||||
{IR_LONG, 872, 0, "CB8_TotalPF" },
|
||||
{IR_LONG, 874, 0, "CB8_TotalPFLag" },
|
||||
{IR_LONG, 876, 0, "CB8_TotalPFLead" },
|
||||
{IR_LONG, 878, 0, "CB8_TotalKWImport" },
|
||||
{IR_LONG, 880, 0, "CB8_TotalKWExport" },
|
||||
{IR_LONG, 882, 0, "CB8_TotalKVarImport" },
|
||||
{IR_LONG, 884, 0, "CB8_TotalKVarExport" },
|
||||
{IR_LONG, 886, 0, "CB8_LN_Avg" },
|
||||
{IR_LONG, 888, 0, "CB8_LL_Avg" },
|
||||
{IR_LONG, 899, 0, "CB8_Status" },
|
||||
|
||||
// Circuit Breaker 8 (OB08)
|
||||
{IR_LONG, 900, 0, "CB9_V1N" },
|
||||
{IR_LONG, 902, 0, "CB9_V2N" },
|
||||
{IR_LONG, 904, 0, "CB9_V3N" },
|
||||
{IR_LONG, 906, 0, "CB9_I1" },
|
||||
{IR_LONG, 908, 0, "CB9_I2" },
|
||||
{IR_LONG, 910, 0, "CB9_I3" },
|
||||
{IR_LONG, 912, 0, "CB9_L1KW" },
|
||||
{IR_LONG, 914, 0, "CB9_L2KW" },
|
||||
{IR_LONG, 916, 0, "CB9_L3KW" },
|
||||
{IR_LONG, 918, 0, "CB9_L1KVar" },
|
||||
{IR_LONG, 920, 0, "CB9_L2KVar" },
|
||||
{IR_LONG, 922, 0, "CB9_L3KVar" },
|
||||
{IR_LONG, 924, 0, "CB9_L1KVA" },
|
||||
{IR_LONG, 926, 0, "CB9_L2KVA" },
|
||||
{IR_LONG, 928, 0, "CB9_L3KVA" },
|
||||
{IR_LONG, 930, 0, "CB9_L1PF" },
|
||||
{IR_LONG, 932, 0, "CB9_L2PF" },
|
||||
{IR_LONG, 934, 0, "CB9_L3PF" },
|
||||
{IR_LONG, 936, 0, "CB9_V1THD" },
|
||||
{IR_LONG, 938, 0, "CB9_V2THD" },
|
||||
{IR_LONG, 940, 0, "CB9_V3THD" },
|
||||
{IR_LONG, 942, 0, "CB9_I1THD" },
|
||||
{IR_LONG, 944, 0, "CB9_I2THD" },
|
||||
{IR_LONG, 946, 0, "CB9_I3THD" },
|
||||
{IR_LONG, 948, 0, "CB9_I1Kfactor" },
|
||||
{IR_LONG, 950, 0, "CB9_I2Kfactor" },
|
||||
{IR_LONG, 952, 0, "CB9_I3Kfactor" },
|
||||
{IR_LONG, 954, 0, "CB9_I1TDD" },
|
||||
{IR_LONG, 956, 0, "CB9_I2TDD" },
|
||||
{IR_LONG, 958, 0, "CB9_I3TDD" },
|
||||
{IR_LONG, 960, 0, "CB9_V12" },
|
||||
{IR_LONG, 962, 0, "CB9_V23" },
|
||||
{IR_LONG, 964, 0, "CB9_V31" },
|
||||
{IR_LONG, 966, 0, "CB9_TotalKW" },
|
||||
{IR_LONG, 968, 0, "CB9_TotalKVar" },
|
||||
{IR_LONG, 970, 0, "CB9_TotalKVA" },
|
||||
{IR_LONG, 972, 0, "CB9_TotalPF" },
|
||||
{IR_LONG, 974, 0, "CB9_TotalPFLag" },
|
||||
{IR_LONG, 976, 0, "CB9_TotalPFLead" },
|
||||
{IR_LONG, 978, 0, "CB9_TotalKWImport" },
|
||||
{IR_LONG, 980, 0, "CB9_TotalKWExport" },
|
||||
{IR_LONG, 982, 0, "CB9_TotalKVarImport" },
|
||||
{IR_LONG, 984, 0, "CB9_TotalKVarExport" },
|
||||
{IR_LONG, 986, 0, "CB9_LN_Avg" },
|
||||
{IR_LONG, 988, 0, "CB9_LL_Avg" },
|
||||
{IR_LONG, 999, 0, "CB9_Status" },
|
||||
|
||||
{IR_FLOAT, 1068, 0, "Amps G" },
|
||||
{IR_FLOAT, 1066, 0, "Amps N" },
|
||||
{IR_FLOAT, 1087, 0, "kWh" },
|
||||
{IR_FLOAT, 1091, 0, "PF" },
|
||||
|
||||
{IR, 1150, 0, "CB_Status" },
|
||||
{IR, 1151, 0, "CB_Tripped" },
|
||||
// PDU Input
|
||||
{IR_LONG, 6, 0, "Input_I1" }, //0.01
|
||||
{IR_LONG, 8, 0, "Input_I2" }, //0.01
|
||||
{IR_LONG, 10, 0, "Input_I3" }, //0.01
|
||||
{IR_LONG, 70, 0, "Input_kVA" }, //0.001
|
||||
{IR_LONG, 68, 0, "Input_KVAR" }, //0.001
|
||||
{IR_LONG, 66, 0, "Input_kW" }, //0.001
|
||||
{IR_LONG, 66, 0, "Input_kWh" }, //0.1
|
||||
{IR_LONG, 72, 0, "Input_PF" }, //0.001
|
||||
{IR_LONG, 60, 0, "Input_V_AB" }, //0.1
|
||||
{IR_LONG, 0, 0, "Input_V_AN" }, //0.1
|
||||
{IR_LONG, 62, 0, "Input_V_BC" }, //0.1
|
||||
{IR_LONG, 2, 0, "Input_V_BN" }, //0.1
|
||||
{IR_LONG, 64, 0, "Input_V_CA" }, //0.1
|
||||
{IR_LONG, 4, 0, "Input_V_CN" }, //0.1
|
||||
{IR_LONG, 88, 0, "Input_LL_Avg" },//0.1
|
||||
{IR_LONG, 86, 0, "Input_LN_Avg" },//0.1
|
||||
|
||||
// Circuit Breaker 1 (CB1)
|
||||
{IR_LONG, 106, 0, "CB1_I1" }, //0.01x
|
||||
{IR_LONG, 108, 0, "CB1_I2" }, //0.01x
|
||||
{IR_LONG, 110, 0, "CB1_I3" }, //0.01x
|
||||
{IR_LONG, 170, 0, "CB1_kVA" }, //0.001x
|
||||
{IR_LONG, 124, 0, "CB1_kVA1" }, //0.001x
|
||||
{IR_LONG, 126, 0, "CB1_kVA2" }, //0.001x
|
||||
{IR_LONG, 128, 0, "CB1_kVA3" }, //0.001x
|
||||
{IR_LONG, 168, 0, "CB1_kVAR" }, //0.001x
|
||||
{IR_LONG, 166, 0, "CB1_kW" }, //0.001x
|
||||
{IR_LONG, 112, 0, "CB1_kW1" }, //0.001x
|
||||
{IR_LONG, 114, 0, "CB1_kW2" }, //0.001x
|
||||
{IR_LONG, 116, 0, "CB1_kW3" }, //0.001x
|
||||
{IR_LONG, 1113, 0, "CB1_kWh" },
|
||||
{IR_LONG, 172, 0, "CB1_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 2 (CB1)
|
||||
{IR_LONG, 206, 0, "CB2_I1" }, //0.01x
|
||||
{IR_LONG, 208, 0, "CB2_I2" }, //0.01x
|
||||
{IR_LONG, 210, 0, "CB2_I3" }, //0.01x
|
||||
{IR_LONG, 270, 0, "CB2_kVA" }, //0.001x
|
||||
{IR_LONG, 224, 0, "CB2_kVA1" }, //0.001x
|
||||
{IR_LONG, 226, 0, "CB2_kVA2" }, //0.001x
|
||||
{IR_LONG, 228, 0, "CB2_kVA3" }, //0.001x
|
||||
{IR_LONG, 268, 0, "CB2_kVAR" }, //0.001x
|
||||
{IR_LONG, 266, 0, "CB2_kW" }, //0.001x
|
||||
{IR_LONG, 212, 0, "CB2_kW1" }, //0.001x
|
||||
{IR_LONG, 214, 0, "CB2_kW2" }, //0.001x
|
||||
{IR_LONG, 216, 0, "CB2_kW3" }, //0.001x
|
||||
{IR_LONG, 1168, 0, "CB2_kWh" },
|
||||
{IR_LONG, 272, 0, "CB2_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 3 (CB1)
|
||||
{IR_LONG, 306, 0, "CB3_I1" }, //0.01x
|
||||
{IR_LONG, 308, 0, "CB3_I2" }, //0.01x
|
||||
{IR_LONG, 310, 0, "CB3_I3" }, //0.01x
|
||||
{IR_LONG, 370, 0, "CB3_kVA" }, //0.001x
|
||||
{IR_LONG, 324, 0, "CB3_kVA1" }, //0.001x
|
||||
{IR_LONG, 326, 0, "CB3_kVA2" }, //0.001x
|
||||
{IR_LONG, 328, 0, "CB3_kVA3" }, //0.001x
|
||||
{IR_LONG, 368, 0, "CB3_kVAR" }, //0.001x
|
||||
{IR_LONG, 366, 0, "CB3_kW" }, //0.001x
|
||||
{IR_LONG, 312, 0, "CB3_kW1" }, //0.001x
|
||||
{IR_LONG, 314, 0, "CB3_kW2" }, //0.001x
|
||||
{IR_LONG, 316, 0, "CB3_kW3" }, //0.001x
|
||||
{IR_LONG, 1223, 0, "CB3_kWh" },
|
||||
{IR_LONG, 372, 0, "CB3_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 4 (CB1)
|
||||
{IR_LONG, 406, 0, "CB4_I1" }, //0.01x
|
||||
{IR_LONG, 408, 0, "CB4_I2" }, //0.01x
|
||||
{IR_LONG, 410, 0, "CB4_I3" }, //0.01x
|
||||
{IR_LONG, 470, 0, "CB4_kVA" }, //0.001x
|
||||
{IR_LONG, 424, 0, "CB4_kVA1" }, //0.001x
|
||||
{IR_LONG, 426, 0, "CB4_kVA2" }, //0.001x
|
||||
{IR_LONG, 428, 0, "CB4_kVA3" }, //0.001x
|
||||
{IR_LONG, 468, 0, "CB4_kVAR" }, //0.001x
|
||||
{IR_LONG, 466, 0, "CB4_kW" }, //0.001x
|
||||
{IR_LONG, 412, 0, "CB4_kW1" }, //0.001x
|
||||
{IR_LONG, 414, 0, "CB4_kW2" }, //0.001x
|
||||
{IR_LONG, 416, 0, "CB4_kW3" }, //0.001x
|
||||
{IR_LONG, 1278, 0, "CB4_kWh" },
|
||||
{IR_LONG, 472, 0, "CB4_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 5 (CB1)
|
||||
{IR_LONG, 506, 0, "CB5_I1" }, //0.01x
|
||||
{IR_LONG, 508, 0, "CB5_I2" }, //0.01x
|
||||
{IR_LONG, 510, 0, "CB5_I3" }, //0.01x
|
||||
{IR_LONG, 570, 0, "CB5_kVA" }, //0.001x
|
||||
{IR_LONG, 524, 0, "CB5_kVA1" }, //0.001x
|
||||
{IR_LONG, 526, 0, "CB5_kVA2" }, //0.001x
|
||||
{IR_LONG, 528, 0, "CB5_kVA3" }, //0.001x
|
||||
{IR_LONG, 568, 0, "CB5_kVAR" }, //0.001x
|
||||
{IR_LONG, 566, 0, "CB5_kW" }, //0.001x
|
||||
{IR_LONG, 512, 0, "CB5_kW1" }, //0.001x
|
||||
{IR_LONG, 514, 0, "CB5_kW2" }, //0.001x
|
||||
{IR_LONG, 516, 0, "CB5_kW3" }, //0.001x
|
||||
{IR_LONG, 1333, 0, "CB5_kWh" },
|
||||
{IR_LONG, 572, 0, "CB5_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 6 (CB1)
|
||||
{IR_LONG, 606, 0, "CB6_I1" }, //0.01x
|
||||
{IR_LONG, 608, 0, "CB6_I2" }, //0.01x
|
||||
{IR_LONG, 610, 0, "CB6_I3" }, //0.01x
|
||||
{IR_LONG, 670, 0, "CB6_kVA" }, //0.001x
|
||||
{IR_LONG, 624, 0, "CB6_kVA1" }, //0.001x
|
||||
{IR_LONG, 626, 0, "CB6_kVA2" }, //0.001x
|
||||
{IR_LONG, 628, 0, "CB6_kVA3" }, //0.001x
|
||||
{IR_LONG, 668, 0, "CB6_kVAR" }, //0.001x
|
||||
{IR_LONG, 666, 0, "CB6_kW" }, //0.001x
|
||||
{IR_LONG, 612, 0, "CB6_kW1" }, //0.001x
|
||||
{IR_LONG, 614, 0, "CB6_kW2" }, //0.001x
|
||||
{IR_LONG, 616, 0, "CB6_kW3" }, //0.001x
|
||||
{IR_LONG, 1388, 0, "CB6_kWh" },
|
||||
{IR_LONG, 672, 0, "CB6_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 7 (CB1)
|
||||
{IR_LONG, 706, 0, "CB7_I1" }, //0.01x
|
||||
{IR_LONG, 708, 0, "CB7_I2" }, //0.01x
|
||||
{IR_LONG, 710, 0, "CB7_I3" }, //0.01x
|
||||
{IR_LONG, 770, 0, "CB7_kVA" }, //0.001x
|
||||
{IR_LONG, 724, 0, "CB7_kVA1" }, //0.001x
|
||||
{IR_LONG, 726, 0, "CB7_kVA2" }, //0.001x
|
||||
{IR_LONG, 728, 0, "CB7_kVA3" }, //0.001x
|
||||
{IR_LONG, 768, 0, "CB7_kVAR" }, //0.001x
|
||||
{IR_LONG, 766, 0, "CB7_kW" }, //0.001x
|
||||
{IR_LONG, 712, 0, "CB7_kW1" }, //0.001x
|
||||
{IR_LONG, 714, 0, "CB7_kW2" }, //0.001x
|
||||
{IR_LONG, 716, 0, "CB7_kW3" }, //0.001x
|
||||
{IR_LONG, 1443, 0, "CB7_kWh" },
|
||||
{IR_LONG, 772, 0, "CB7_PF" }, //0.001x
|
||||
|
||||
// Circuit Breaker 8 (CB1)
|
||||
{IR_LONG, 806, 0, "CB8_I1" }, //0.01x
|
||||
{IR_LONG, 808, 0, "CB8_I2" }, //0.01x
|
||||
{IR_LONG, 810, 0, "CB8_I3" }, //0.01x
|
||||
{IR_LONG, 870, 0, "CB8_kVA" }, //0.001x
|
||||
{IR_LONG, 824, 0, "CB8_kVA1" }, //0.001x
|
||||
{IR_LONG, 826, 0, "CB8_kVA2" }, //0.001x
|
||||
{IR_LONG, 828, 0, "CB8_kVA3" }, //0.001x
|
||||
{IR_LONG, 868, 0, "CB8_kVAR" }, //0.001x
|
||||
{IR_LONG, 866, 0, "CB8_kW" }, //0.001x
|
||||
{IR_LONG, 812, 0, "CB8_kW1" }, //0.001x
|
||||
{IR_LONG, 814, 0, "CB8_kW2" }, //0.001x
|
||||
{IR_LONG, 816, 0, "CB8_kW3" }, //0.001x
|
||||
{IR_LONG, 1498, 0, "CB8_kWh" },
|
||||
{IR_LONG, 872, 0, "CB8_PF" }, //0.001x
|
||||
|
||||
// PDU Output
|
||||
{IR_LONG, 906, 0, "Output_I1" }, //0.01x
|
||||
{IR_LONG, 908, 0, "Output_I2" },
|
||||
{IR_LONG, 910, 0, "Output_I3" },
|
||||
{IR_LONG, 1068, 0, "Output_IG" },
|
||||
{IR_LONG, 1066, 0, "Output_IN" },
|
||||
{IR_LONG, 924, 0, "Output_kVA1" }, //0.001
|
||||
{IR_LONG, 926, 0, "Output_kVA2" },
|
||||
{IR_LONG, 928, 0, "Output_kVA3" },
|
||||
{IR_LONG, 968, 0, "Output_kVAR" }, //0.001
|
||||
{IR_LONG, 912, 0, "Output_kW1" }, //0.001x
|
||||
{IR_LONG, 914, 0, "Output_kW2" },
|
||||
{IR_LONG, 916, 0, "Output_kW3" },
|
||||
{IR_LONG, 1086, 0, "Output_kWh" },
|
||||
{IR_LONG, 1091, 0, "Output_PF" }, //0.001
|
||||
{IR_LONG, 960, 0, "Output_V_AB" },
|
||||
{IR_LONG, 900, 0, "Output_V_AN" }, //0.01x
|
||||
{IR_LONG, 962, 0, "Output_V_BC" },
|
||||
{IR_LONG, 902, 0, "Output_V_BN" },
|
||||
{IR_LONG, 964, 0, "Output_V_CA" },
|
||||
{IR_LONG, 904, 0, "Output_V_CN" },
|
||||
|
||||
{IR, 1550, 0, "CB_Status" },
|
||||
{IR, 1551, 0, "CB_Tripped" },
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ RunningState<ModbusIP>::RunningState() {
|
||||
addStrategy("Volts CA", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
|
||||
addStrategy("PF", new SingleValueStrategy(0.9f, 0.05f, 1000));
|
||||
|
||||
addStrategy("Frequency", new SingleValueStrategy(60.0f, 0.7f, 1000));
|
||||
addStrategy("Amps A", new SingleValueStrategy(1.0f, 10.0f, 1000));
|
||||
addStrategy("Amps B", new SingleValueStrategy(1.0f, 10.0f, 1000));
|
||||
addStrategy("Amps C", new SingleValueStrategy(1.0f, 10.0f, 1000));
|
||||
|
||||
@@ -87,6 +87,7 @@ void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "Amps C", 0.0f);
|
||||
setPointValue(equipment, "kW", 0.0f);
|
||||
setPointValue(equipment, "kVA", 0.0f);
|
||||
setPointValue(equipment, "Frequency", 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <ModbusIP_ESP8266.h>
|
||||
const char *ssid = "QTS_CDR_Arduino"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 30, 241); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 30, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress local_IP(172, 17, 33, 174); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 33, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
|
||||
@@ -40,31 +40,32 @@
|
||||
*/
|
||||
template<>
|
||||
BatteryState<ModbusIP>::BatteryState() {
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
|
||||
addStrategy("System Output Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs A", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs C", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(0.0F, 0.3f, 1000));
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(0.0f, 3.0f, 1000));
|
||||
addStrategy("Percentage Load", new RampStrategy(0.0f, 5.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,95 +96,123 @@ State<ModbusIP>* BatteryState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
case 4:
|
||||
return new BypassState<ModbusIP>();
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
float rating = getPointValue(equipment, "Px Rating");
|
||||
float load = getPointValue(equipment, "Px Load");
|
||||
float real_load = rating * (load/100.f);
|
||||
|
||||
Strategy_Behavior* ramp_strat = nullptr;
|
||||
}
|
||||
|
||||
float Battery_time = getPointValue(equipment, "Battery Time Remaining");
|
||||
float Bat_Percent = Battery_time /4.80f;
|
||||
float select = 1.0f;
|
||||
if (Bat_Percent > 98.0f){
|
||||
setPointValue(equipment, "UPS Battery Status2", 0.0f);
|
||||
select = 1.0f;
|
||||
}
|
||||
if (Bat_Percent > 20.0f) {
|
||||
setPointValue(equipment, "UPS Battery Status1", 2.0f);
|
||||
setPointValue(equipment, "Battery Low", 0.0f);
|
||||
select = 1.0f;
|
||||
}
|
||||
if (Bat_Percent <= 20.0f && Bat_Percent >= 5.0f){
|
||||
setPointValue(equipment, "UPS Battery Status1", 3.0f);
|
||||
setPointValue(equipment, "Battery Low", 1.0f);
|
||||
select = 0.8f;
|
||||
}
|
||||
if (Bat_Percent < 5.0f){
|
||||
setPointValue(equipment, "UPS Battery Status1", 4.0f);
|
||||
select = 0.05f;
|
||||
}
|
||||
float rating = getPointValue(equipment, "Px Rating");
|
||||
float load = getPointValue(equipment, "Px Load");
|
||||
float real_load = (rating) * (load/100.0f);
|
||||
|
||||
Strategy_Behavior* ramp_strat = nullptr;
|
||||
//Output strategies
|
||||
float Out_Vab = getPointValue(equipment, "System Output RMS A-B");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vab);
|
||||
float Out_Vbc = getPointValue(equipment, "System Output RMS B-C");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vbc);
|
||||
float Out_Vca = getPointValue(equipment, "System Output RMS C-A");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vca);
|
||||
float Out_Vab = getPointValue(equipment, "System Output RMS A-B");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load*select);
|
||||
float Out_Vbc = getPointValue(equipment, "System Output RMS B-C");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load*select);
|
||||
float Out_Vca = getPointValue(equipment, "System Output RMS C-A");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load*select);
|
||||
|
||||
float Out_Van = getPointValue(equipment, "System Output RMS A-N");
|
||||
float Out_Ia = getPointValue(equipment, "System Output RMS Current Phase A");
|
||||
float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Output Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * Out_PFa);
|
||||
|
||||
float Out_Vbn = getPointValue(equipment, "System Output RMS B-N");
|
||||
float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B");
|
||||
float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Output Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * Out_PFb);
|
||||
|
||||
float Out_Vcn = getPointValue(equipment, "System Output RMS C-N");
|
||||
float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C");
|
||||
float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Output Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * Out_PFc);
|
||||
|
||||
float Out_Van = getPointValue(equipment, "System Output RMS A-N");
|
||||
float Out_Ia = getPointValue(equipment, "System Output RMS Current Phase A");
|
||||
float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Output Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * Out_PFa);
|
||||
|
||||
float Out_Vbn = getPointValue(equipment, "System Output RMS B-N");
|
||||
float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B");
|
||||
float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Output Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * Out_PFb);
|
||||
|
||||
float Out_Vcn = getPointValue(equipment, "System Output RMS C-N");
|
||||
float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C");
|
||||
float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Output Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * Out_PFc);
|
||||
|
||||
float Battery_time = getPointValue(equipment, "Battery Time Remaining");
|
||||
float Bat_Percent = Battery_time /4.80f;
|
||||
if (Bat_Percent > 98.0f){
|
||||
setPointValue(equipment, "UPS Battery Status2", 0.0f);
|
||||
}
|
||||
if (Bat_Percent > 20.0f) {
|
||||
setPointValue(equipment, "UPS Battery Status1", 2.0f);
|
||||
setPointValue(equipment, "Battery Low", 0.0f);
|
||||
}
|
||||
if (Bat_Percent <= 20.0f && Bat_Percent >= 5.0f){
|
||||
setPointValue(equipment, "UPS Battery Status1", 3.0f);
|
||||
setPointValue(equipment, "Battery Low", 1.0f);
|
||||
}
|
||||
if (Bat_Percent < 5.0f){
|
||||
setPointValue(equipment, "UPS Battery Status1", 4.0f);
|
||||
}
|
||||
setPointValue(equipment, "System Output Power", (real_load * Out_Vab)/1000.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power", (real_load* Out_Vab * 0.9f)/1000.0f);
|
||||
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logic to execute once when entering the Battery state.
|
||||
* Sets the "Run Status" for all EC fans to 1 to indicate they are active.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
template<>
|
||||
void BatteryState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logic to execute once when entering the Battery state.
|
||||
* Sets the "Run Status" for all EC fans to 1 to indicate they are active.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
template<>
|
||||
void BatteryState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Battery State...");
|
||||
setPointValue(equipment, "System Input RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Input Frequency", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs C", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs C", 0.0f);
|
||||
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Frequency", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase C", 0.0f);
|
||||
|
||||
setPointValue(equipment, "UPS Loading Status", 6.0f);
|
||||
setPointValue(equipment, "UPS Battery Status2", 2.0f);
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Frequency", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase C", 0.0f);
|
||||
setPointValue(equipment, "UPS Loading Status", 6.0f);
|
||||
setPointValue(equipment, "UPS Battery Status2", 2.0f);
|
||||
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -42,72 +42,72 @@ template<>
|
||||
BypassState<ModbusIP>::BypassState() {
|
||||
|
||||
//Input System
|
||||
addStrategy("System Input RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Input RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase A", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
|
||||
addStrategy("System Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
addStrategy("System Input Frequency", new SingleValueStrategy(60.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Input Power Factor Phs A", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Factor Phs A", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
|
||||
//Bypass System
|
||||
|
||||
addStrategy("Bypass Input Voltage RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Voltage RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("Bypass Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
addStrategy("Bypass Input Frequency", new SingleValueStrategy(60.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("Bypass Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase A", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase B", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase C", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
|
||||
//Output System
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
|
||||
addStrategy("System Output Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
addStrategy("System Output Frequency", new SingleValueStrategy(60.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(480.0F, 0.3f, 1000));
|
||||
addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0F, 5.0f, 1000));
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(480.0f, 0.3f, 1000));
|
||||
addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0f, 5.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,85 +143,85 @@ State<ModbusIP>* BypassState<ModbusIP>::update(Equipment<ModbusIP>* equipment) {
|
||||
}
|
||||
float rating = getPointValue(equipment, "Px Rating");
|
||||
float load = getPointValue(equipment, "Px Load");
|
||||
float real_load = rating * (load/100.f);
|
||||
float real_load = (rating) * (load/100.0f);
|
||||
|
||||
Strategy_Behavior* ramp_strat = nullptr;
|
||||
|
||||
//Input strategies
|
||||
float In_Vab = getPointValue(equipment, "System Input RMS A-B");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vab);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float In_Vbc = getPointValue(equipment, "System Input RMS B-C");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vbc);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float In_Vca = getPointValue(equipment, "System Input RMS C-A");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vca);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
|
||||
float In_Van = getPointValue(equipment, "System Input RMS A-N");
|
||||
float In_Ia = getPointValue(equipment, "System Input RMS Current Phase A");
|
||||
float In_PFa = getPointValue(equipment, "System Input Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Input Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia);
|
||||
ramp_strat = getStrategy("Bypass Power Phase A");
|
||||
ramp_strat = getStrategy("Bypass Input Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia * In_PFa);
|
||||
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia * 0.9f);
|
||||
|
||||
float In_Vbn = getPointValue(equipment, "System Input RMS B-N");
|
||||
float In_Ib = getPointValue(equipment, "System Input RMS Current Phase B");
|
||||
float In_PFb = getPointValue(equipment, "System Input Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Input Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib);
|
||||
ramp_strat = getStrategy("Bypass Power Phase B");
|
||||
ramp_strat = getStrategy("Bypass Input Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib * In_PFb);
|
||||
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib * 0.9f);
|
||||
|
||||
float In_Vcn = getPointValue(equipment, "System Input RMS C-N");
|
||||
float In_Ic = getPointValue(equipment, "System Input RMS Current Phase C");
|
||||
float In_PFc = getPointValue(equipment, "System Input Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Input Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic);
|
||||
ramp_strat = getStrategy("Bypass Power Phase C");
|
||||
ramp_strat = getStrategy("Bypass Input Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic * In_PFc);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic * 0.9f);
|
||||
|
||||
//Output strategies
|
||||
float Out_Vab = getPointValue(equipment, "System Output RMS A-B");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vab);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float Out_Vbc = getPointValue(equipment, "System Output RMS B-C");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vbc);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float Out_Vca = getPointValue(equipment, "System Output RMS C-A");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vca);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
|
||||
float Out_Van = getPointValue(equipment, "System Output RMS A-N");
|
||||
float Out_Ia = getPointValue(equipment, "System Output RMS Current Phase A");
|
||||
float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Output Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * Out_PFa);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * 0.9f);
|
||||
|
||||
float Out_Vbn = getPointValue(equipment, "System Output RMS B-N");
|
||||
float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B");
|
||||
float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Output Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * Out_PFb);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * 0.9f);
|
||||
|
||||
float Out_Vcn = getPointValue(equipment, "System Output RMS C-N");
|
||||
float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C");
|
||||
float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Output Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * Out_PFc);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * 0.9f);
|
||||
|
||||
float Battery_time = getPointValue(equipment, "Battery Time Remaining");
|
||||
float Bat_Percent = Battery_time /4.80f;
|
||||
@@ -239,11 +239,12 @@ State<ModbusIP>* BypassState<ModbusIP>::update(Equipment<ModbusIP>* equipment) {
|
||||
if (Bat_Percent < 5.0f){
|
||||
setPointValue(equipment, "UPS Battery Status1", 4.0f);
|
||||
}
|
||||
setPointValue(equipment, "System Output Power", (real_load * In_Vab)/1000.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power", (real_load* In_Vab * 0.9f)/1000.0f);
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Logic to execute once when entering the Bypass state.
|
||||
* Sets the "Run Status" for all EC fans to 1 to indicate they are active.
|
||||
@@ -252,9 +253,10 @@ State<ModbusIP>* BypassState<ModbusIP>::update(Equipment<ModbusIP>* equipment) {
|
||||
template<>
|
||||
void BypassState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Battery State...");
|
||||
Serial.println("Enter Bypass State...");
|
||||
setPointValue(equipment, "UPS Loading Status", 4.0f);
|
||||
setPointValue(equipment, "UPS Battery Status2", 3.0f);
|
||||
setPointValue(equipment, "Percentage Load", 0.0f);
|
||||
// You could also update a Modbus register to show the "standby" state
|
||||
|
||||
}
|
||||
|
||||
@@ -40,60 +40,60 @@
|
||||
*/
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
addStrategy("System Input RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Input RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Input RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase A", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
|
||||
addStrategy("System Input Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
addStrategy("System Input Frequency", new SingleValueStrategy(60.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Input Power Factor Phs A", new SingleValueStrategy(93.0F, 0.5f, 1000));
|
||||
addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0F, 0.5f, 1000));
|
||||
addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0F, 0.5f, 1000));
|
||||
addStrategy("System Input Power Factor Phs A", new SingleValueStrategy(93.0f, 0.5f, 1000));
|
||||
addStrategy("System Input Power Factor Phs B", new SingleValueStrategy(93.0f, 0.5f, 1000));
|
||||
addStrategy("System Input Power Factor Phs C", new SingleValueStrategy(93.0f, 0.5f, 1000));
|
||||
|
||||
addStrategy("System Input Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.0f, 50.0f, 1000));
|
||||
|
||||
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0F, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-B", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-C", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-A", new SingleValueStrategy(480.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS A-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS B-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
addStrategy("System Output RMS C-N", new SingleValueStrategy(270.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Frequency", new SingleValueStrategy(60.0F, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0F, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phase C", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(480.0F, 1.0f, 1000));
|
||||
|
||||
|
||||
addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0F, 5.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase A", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0f, 25.0f, 1000));
|
||||
|
||||
addStrategy("System Output Frequency", new SingleValueStrategy(60.0f, 2.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Factor Phs A", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs B", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Power Factor Phs C", new SingleValueStrategy(93.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power Phase A", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs A", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs C", new RampStrategy(10.0f, 50.0f, 1000));
|
||||
|
||||
addStrategy("DC Bus Voltage", new SingleValueStrategy(518.0f, 5.0f, 1000));
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(480.0f, 1.0f, 1000));
|
||||
addStrategy("Percentage Load", new RampStrategy(100.0f, 5.0f, 1000));
|
||||
|
||||
addStrategy("System Output Power", new SingleValueStrategy(0.0f, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power", new SingleValueStrategy(0.0f, 5.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,78 +130,81 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
|
||||
float rating = getPointValue(equipment, "Px Rating");
|
||||
float load = getPointValue(equipment, "Px Load");
|
||||
float real_load = (rating*1000.0f) * (load/100.f);
|
||||
float real_load = (rating) * (load/100.0f);
|
||||
|
||||
Strategy_Behavior* ramp_strat = nullptr;
|
||||
//Input strategies
|
||||
float In_Vab = getPointValue(equipment, "System Input RMS A-B");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vab);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float In_Vbc = getPointValue(equipment, "System Input RMS B-C");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vbc);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float In_Vca = getPointValue(equipment, "System Input RMS C-A");
|
||||
ramp_strat = getStrategy("System Input RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/In_Vca);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
|
||||
setPointValue(equipment, "System Output Power", (real_load * In_Vab)/1000.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power", (real_load* In_Vab * 0.9f)/1000.0f);
|
||||
|
||||
float In_Van = getPointValue(equipment, "System Input RMS A-N");
|
||||
float In_Ia = getPointValue(equipment, "System Input RMS Current Phase A");
|
||||
float In_PFa = getPointValue(equipment, "System Input Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Input Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia * (In_PFa/100.0f));
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Van * In_Ia * 0.9f);
|
||||
|
||||
float In_Vbn = getPointValue(equipment, "System Input RMS B-N");
|
||||
float In_Ib = getPointValue(equipment, "System Input RMS Current Phase B");
|
||||
float In_PFb = getPointValue(equipment, "System Input Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Input Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib * (In_PFb/100.0f));
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vbn * In_Ib * 0.9f);
|
||||
|
||||
float In_Vcn = getPointValue(equipment, "System Input RMS C-N");
|
||||
float In_Ic = getPointValue(equipment, "System Input RMS Current Phase C");
|
||||
float In_PFc = getPointValue(equipment, "System Input Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Input Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic);
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic * (In_PFc/100.0f));
|
||||
ramp_strat = getStrategy("System Input Apparent Power Phs C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(In_Vcn * In_Ic * 0.9f);
|
||||
|
||||
//Output strategies
|
||||
float Out_Vab = getPointValue(equipment, "System Output RMS A-B");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vab);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float Out_Vbc = getPointValue(equipment, "System Output RMS B-C");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vbc);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
float Out_Vca = getPointValue(equipment, "System Output RMS C-A");
|
||||
ramp_strat = getStrategy("System Output RMS Current Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load/Out_Vca);
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(real_load);
|
||||
|
||||
float Out_Van = getPointValue(equipment, "System Output RMS A-N");
|
||||
float Out_Ia = getPointValue(equipment, "System Output RMS Current Phase A");
|
||||
float Out_PFa = getPointValue(equipment, "System Output Power Factor Phs A");
|
||||
ramp_strat = getStrategy("System Output Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * (Out_PFa/100.0f));
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs A");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Van * Out_Ia * 0.9f);
|
||||
|
||||
float Out_Vbn = getPointValue(equipment, "System Output RMS B-N");
|
||||
float Out_Ib = getPointValue(equipment, "System Output RMS Current Phase B");
|
||||
float Out_PFb = getPointValue(equipment, "System Output Power Factor Phs B");
|
||||
ramp_strat = getStrategy("System Output Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * (Out_PFb/100.0f));
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs B");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vbn * Out_Ib * 0.9f);
|
||||
|
||||
float Out_Vcn = getPointValue(equipment, "System Output RMS C-N");
|
||||
float Out_Ic = getPointValue(equipment, "System Output RMS Current Phase C");
|
||||
float Out_PFc = getPointValue(equipment, "System Output Power Factor Phs C");
|
||||
ramp_strat = getStrategy("System Output Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic);
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phase C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * (Out_PFc/100.0f));
|
||||
ramp_strat = getStrategy("System Output Apparent Power Phs C");
|
||||
static_cast<RampStrategy*>(ramp_strat)->setTarget(Out_Vcn * Out_Ic * 0.9f);
|
||||
|
||||
float Battery_time = getPointValue(equipment, "Battery Time Remaining");
|
||||
float Bat_Percent = Battery_time /4.80f;
|
||||
|
||||
@@ -86,9 +86,60 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
*/
|
||||
template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "UPS Loading Status", 2.0f);
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
setPointValue(equipment, "UPS Loading Status", 2.0f);
|
||||
|
||||
setPointValue(equipment, "System Input RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Input RMS Current Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Input Frequency", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Factor Phs C", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Input Power Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Input Apparent Power Phs C", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Voltage RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "Bypass Input Frequency", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "Bypass Power Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS A-B", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS B-C", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS C-A", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS A-N", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS B-N", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS C-N", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS Current Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS Current Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Output RMS Current Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Output Frequency", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Factor Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Factor Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Factor Phs C", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Phase A", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Phase B", 0.0f);
|
||||
setPointValue(equipment, "System Output Power Phase C", 0.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power Phs A", 0.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power Phs B", 0.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power Phs C", 0.0f);
|
||||
setPointValue(equipment, "System Output Power", 0.0f);
|
||||
setPointValue(equipment, "System Output Apparent Power", 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,7 +84,7 @@ modbusMap mb_map[] =
|
||||
{IR, 8, 0, "System Input RMS Current Phase B"},
|
||||
{IR, 9, 0, "System Input RMS Current Phase C"},
|
||||
{IR_10x, 10, 0, "System Input Frequency"},
|
||||
{IR, 11, 0, "System Input Power Factor Phs A"},
|
||||
{IR, 11, 0, "System Input Power Factor Phs A"}, //0.01
|
||||
{IR, 12, 0, "System Input Power Factor Phs B"},
|
||||
{IR, 13, 0, "System Input Power Factor Phs C"},
|
||||
{IR_10x, 14, 0, "System Input Power Phase A"},
|
||||
@@ -125,7 +125,8 @@ modbusMap mb_map[] =
|
||||
{IR, 60, 0, "System Output Power"},
|
||||
{IR, 61, 0, "System Output Apparent Power"},
|
||||
{IR, 164, 0, "UPS Loading Status"},
|
||||
{IR, 175, 0, "DC Bus Voltage"},
|
||||
{IR, 175, 0, "DC Bus Voltage"},
|
||||
{IR, 179, 0, "Percentage Load"},
|
||||
{IR, 180, 0, "Battery Time Remaining"},
|
||||
{IR, 183, 0, "UPS Battery Status1"},
|
||||
{IR, 184, 0, "UPS Battery Status2"},
|
||||
|
||||
Reference in New Issue
Block a user