s
This commit is contained in:
@@ -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, 169); /**< @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;
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
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, 2.0f, 1000));
|
||||
addStrategy("S2 Volts BC", new SingleValueStrategy(4800.0F, 2.0f, 1000));
|
||||
addStrategy("S2 Volts CA", new SingleValueStrategy(4800.0F, 2.0f, 1000));
|
||||
|
||||
addStrategy("PF", new SingleValueStrategy(90.0f, 2.0f, 1000));
|
||||
|
||||
@@ -76,9 +76,9 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float volts_BC = getPointValue(equipment, "S2 Volts BC");
|
||||
float volts_AC = 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 AN", volts_AB/17.32);
|
||||
setPointValue(equipment, "S2 Volts BN", volts_BC/17.32);
|
||||
setPointValue(equipment, "S2 Volts CN", volts_AC/17.32);
|
||||
|
||||
int I_load = getPointValue(equipment, "ATS_Load");
|
||||
int I_rating = getPointValue(equipment, "ATS_Rating");
|
||||
@@ -129,6 +129,8 @@ 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);
|
||||
setBitValue(equipment, "Source Active", 3, true);
|
||||
setBitValue(equipment, "Source Active", 4, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,6 +121,9 @@ 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);
|
||||
|
||||
setBitValue(equipment, "Source Active", 3, false);
|
||||
setBitValue(equipment, "Source Active", 4, 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. */
|
||||
|
||||
|
||||
@@ -224,8 +224,15 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
tag = "";
|
||||
tag = cb + "_L3KVar";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f * 0.9f);
|
||||
|
||||
|
||||
tag = "";
|
||||
tag = cb + "_L1KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L2KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
tag = "";
|
||||
tag = cb + "_L3KVA";
|
||||
setPointValue(equipment, tag, total_load * 1715.0f);
|
||||
}
|
||||
else{
|
||||
if (cb_status == 2.0f){
|
||||
@@ -295,9 +302,49 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
@@ -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, 181); /**< @brief The static IP address for the device. */
|
||||
IPAddress local_IP(172, 17, 33, 178); /**< @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. */
|
||||
|
||||
@@ -113,7 +113,7 @@ modbusMap mb_map[] = {
|
||||
{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, 70, 0, "CB0_TotalKVA" }, //
|
||||
{IR_LONG, 72, 0, "CB0_TotalPF" },
|
||||
{IR_LONG, 74, 0, "CB0_TotalPFLag" },
|
||||
{IR_LONG, 76, 0, "CB0_TotalPFLead" },
|
||||
@@ -563,8 +563,8 @@ modbusMap mb_map[] = {
|
||||
{IR_FLOAT, 1087, 0, "kWh" },
|
||||
{IR_FLOAT, 1091, 0, "PF" },
|
||||
|
||||
{IR, 1150, 0, "CB_Status" },
|
||||
{IR, 1151, 0, "CB_Tripped" },
|
||||
{IR, 1550, 0, "CB_Status" },
|
||||
{IR, 1551, 0, "CB_Tripped" },
|
||||
|
||||
};
|
||||
//Size of modbus map used in FOR cycles, automatically calculated.
|
||||
|
||||
Reference in New Issue
Block a user