save
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 = ATS_Eaton_ATC900_RPD_TCP ; Select here the name of the configuration you want to download
|
||||
default_envs = BKR_ABB_XT_TCP ; Select here the name of the configuration you want to download
|
||||
|
||||
[env]
|
||||
upload_port = COM50
|
||||
|
||||
@@ -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, 169); /**< @brief The static IP address for the device. */
|
||||
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. */
|
||||
|
||||
|
||||
@@ -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));
|
||||
@@ -68,7 +68,10 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
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){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
if (State_Ctrl == 2){
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
// Apply any strategies defined for the standby state
|
||||
@@ -76,9 +79,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 +89,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))/100.0f;
|
||||
float kw = (1.732f * ((volts_AB + volts_BC + volts_AC)/4.0f) * real_load )/100.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 +119,7 @@ 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", 1, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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){
|
||||
setBitValue(equipment, "CB Position", 12, false);
|
||||
}
|
||||
if (State_Ctrl == 2){
|
||||
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, 150); /**< @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_LONG, 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;
|
||||
|
||||
@@ -40,68 +40,86 @@ 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";
|
||||
tag = "";
|
||||
tag = cb + "_I1";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V2N";
|
||||
tag = cb + "_I2";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V3N";
|
||||
tag = cb + "_I3";
|
||||
addStrategy(tag, new SingleValueStrategy(40.0f, 30.0f, 1000));
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_V1THD";
|
||||
addStrategy(tag, new SingleValueStrategy(20.0f, 7.0f, 1000));
|
||||
tag = cb + "_kVA";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_V2THD";
|
||||
addStrategy(tag, new SingleValueStrategy(20.0f, 7.0f, 1000));
|
||||
tag = cb + "_kVA1";
|
||||
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 + "_kVA2";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2THD";
|
||||
addStrategy(tag, new SingleValueStrategy(100.0f, 12.0f, 1000));
|
||||
tag = cb + "_kVA3";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I3THD";
|
||||
addStrategy(tag, new SingleValueStrategy(100.0f, 12.0f, 1000));
|
||||
tag = cb + "_kVAR";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I1Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kW";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kW1";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I3Kfactor";
|
||||
addStrategy(tag, new SingleValueStrategy(30.0f, 6.0f, 1000));
|
||||
tag = cb + "_kW2";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I1TDD";
|
||||
addStrategy(tag, new SingleValueStrategy(50.0f, 9.0f, 1000));
|
||||
tag = cb + "_kW3";
|
||||
addStrategy(tag, new SingleValueStrategy(150.0f, 100.0f, 1000));
|
||||
tag = "";
|
||||
tag = cb + "_I2TDD";
|
||||
addStrategy(tag, new SingleValueStrategy(50.0f, 9.0f, 1000));
|
||||
tag = cb + "_kWh";
|
||||
addStrategy(tag, new SingleValueStrategy(0.1f, 100.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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,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;
|
||||
@@ -148,83 +166,75 @@ 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);
|
||||
setBitValue(equipment, "CB_Tripped", cb_num, false);
|
||||
|
||||
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);
|
||||
|
||||
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 + "_L1KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = cb + "_kVA";
|
||||
setPointValue(equipment, tag, kVA);
|
||||
tag = "";
|
||||
tag = cb + "_L2KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L3KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = cb + "_kVAR";
|
||||
setPointValue(equipment, tag, kVA / pf);
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
if (cb_status == 2.0f){
|
||||
@@ -233,110 +243,147 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
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 + "_L1KVA";
|
||||
setPointValue(equipment, tag, 0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L2KVA";
|
||||
setPointValue(equipment, tag, 0.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L3KVA";
|
||||
setPointValue(equipment, tag, 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++;
|
||||
|
||||
float kw1 = getPointValue(equipment, cb + "_L1KW");
|
||||
float kw2 = getPointValue(equipment, cb + "_L2KW");
|
||||
float kw3 = getPointValue(equipment, cb + "_L3KW");
|
||||
tag = "";
|
||||
tag = cb + "_TotalKW";
|
||||
setPointValue(equipment, tag, kw1 + kw2 + kw3);
|
||||
|
||||
}
|
||||
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);
|
||||
|
||||
float kvar1 = getPointValue(equipment, cb + "_L1KVar");
|
||||
float kvar2 = getPointValue(equipment, cb + "_L2KVar");
|
||||
float kvar3 = getPointValue(equipment, cb + "_L3KVar");
|
||||
tag = "";
|
||||
tag = cb + "_TotalKVar";
|
||||
setPointValue(equipment, tag, kvar1 + kvar2 + kvar3);
|
||||
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);
|
||||
|
||||
float kva1 = getPointValue(equipment, cb + "_L1KVA");
|
||||
float kva2 = getPointValue(equipment, cb + "_L2KVA");
|
||||
float kva3 = getPointValue(equipment, cb + "_L3KVA");
|
||||
tag = "";
|
||||
tag = cb + "_TotalKVA";
|
||||
setPointValue(equipment, tag, kvar1 + kva2 + kva3);
|
||||
|
||||
float pf1 = getPointValue(equipment, cb + "_L1PF");
|
||||
float pf2 = getPointValue(equipment, cb + "_L2PF");
|
||||
float pf3 = getPointValue(equipment, cb + "_L3PF");
|
||||
float total_pf = (pf1 + pf2 + pf3) / 3.0f;
|
||||
tag = "";
|
||||
tag = cb + "_TotalPF";
|
||||
setPointValue(equipment, tag, total_pf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 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.
|
||||
|
||||
@@ -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,32 +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 Phs A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs 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("Percentage Load", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("Battery Time Remaining", new RampStrategy(0.0f, 3.0f, 1000));
|
||||
addStrategy("Percentage Load", new RampStrategy(0.0f, 5.0f, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,80 +96,88 @@ 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 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 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) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Battery State...");
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
@@ -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(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0F, 1.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(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.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(0.0F, 1.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase B", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("Bypass Input Power Phase C", new RampStrategy(0.0F, 1.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(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0F, 1.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(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Power Phase C", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs C", new RampStrategy(0.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,20 +143,20 @@ 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");
|
||||
@@ -191,13 +191,13 @@ State<ModbusIP>* BypassState<ModbusIP>::update(Equipment<ModbusIP>* equipment) {
|
||||
//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");
|
||||
@@ -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.
|
||||
|
||||
@@ -40,58 +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(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Input RMS Current Phase C", new RampStrategy(0.0F, 1.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(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Power Phase C", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs A", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs B", new RampStrategy(0.0F, 5.0f, 1000));
|
||||
addStrategy("System Input Apparent Power Phs C", new RampStrategy(0.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 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(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase B", new RampStrategy(0.0F, 1.0f, 1000));
|
||||
addStrategy("System Output RMS Current Phase C", new RampStrategy(0.0F, 1.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 Phs A", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs B", new RampStrategy(10.0F, 5.0f, 1000));
|
||||
addStrategy("System Output Apparent Power Phs 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("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, 1.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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,19 +130,22 @@ 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");
|
||||
@@ -169,13 +174,13 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
//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");
|
||||
|
||||
@@ -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, 3, 187); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 3, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress local_IP(172, 17, 33, 187); /**< @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;
|
||||
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user