ATS logic added

This commit is contained in:
Emmanuel HC
2025-09-29 11:20:25 -05:00
parent 3efa2c6cf5
commit 1fa38a47b1
5 changed files with 113 additions and 45 deletions

View File

@@ -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, 30, 241); /**< @brief The static IP address for the device. */
IPAddress gateway(172, 17, 30, 1); /**< @brief The gateway IP address. */
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
ModbusIP mb;
@@ -60,36 +60,38 @@
*/
modbusMap mb_map[] =
{
{HR, 15, 0, "State Control"}, //Internal to control from Modscan
{HR, 16, 0, "Fault Code"}, //Internal Fault code from Modscan
{IR, 6298, 0, "Alarm Status Bits"},
{IR, 6159, 0, "Amps A"},
{IR, 6160, 0, "Amps B"},
{IR, 6161, 0, "Amps C"},
{IR, 6172, 0, "Power Factor (PF)"},
{IR, 6264, 0, "Number of Transfers"},
{IR, 6152, 0, "Volts AB"},
{IR, 6153, 0, "Volts BC"},
{IR, 6154, 0, "Volts CA"},
{IR, 6155, 0, "Source 1 Frequency"},
{IR, 6145, 0, "Source 1 Volts AB"},
{IR, 6146, 0, "Source 1 Volts BC"},
{IR, 6147, 0, "Source 1 Volts CA"},
{IR, 6156, 0, "Source 2 Frequency"},
{IR, 6148, 0, "Source 2 Volts AB"},
{IR, 6149, 0, "Source 2 Volts BC"},
{IR, 6150, 0, "Source 2 Volts CA"},
{IR_LONG, 6170, 0, "Total Apparent Power (kVA)"},
{IR_LONG, 6166, 0, "Total Active Power (kW)"},
{DI, 1014, 0, "Summary Alarm"},
{DI, 1020, 0, "Transfer Inhibit"},
{DI, 1002, 0, "Source 1 Active"},
{DI, 1000, 0, "Source 1 Available"},
{DI, 1004, 0, "Source 1 Preferred"},
{DI, 1003, 0, "Source 2 Active"},
{DI, 1001, 0, "Source 2 Available"},
{DI, 1005, 0, "Source 2 Preferred"},
{HR, 9, 0, "ATS_Source"}, //Internal to control from Modscan
{HR, 10, 0, "ATS_Load"}, //Internal Fault code from Modscan
{HR, 11, 0, "ATS_Input"}, //Internal Fault code from Modscan
{HR, 12, 0, "ATS_Fault"}, //Internal Fault code from Modscan
{DI, 999, 0, "Source 1 Available"},
{DI, 1000, 0, "Source 2 Available"},
{DI, 1001, 0, "Source 1 Active"},
{DI, 1002, 0, "Source 2 Active"},
{DI, 1003, 0, "Source 1 Preferred"},
{DI, 1004, 0, "Source 2 Preferred"},
{DI, 1013, 0, "Summary Alarm"},
{DI, 1019, 0, "Transfer Inhibit"},
{IR, 6144, 0, "Source 1 Volts AB"},
{IR, 6145, 0, "Source 1 Volts BC"},
{IR, 6146, 0, "Source 1 Volts CA"},
{IR, 6147, 0, "Source 2 Volts AB"},
{IR, 6148, 0, "Source 2 Volts BC"},
{IR, 6149, 0, "Source 2 Volts CA"},
{IR, 6151, 0, "Volts AB"},
{IR, 6152, 0, "Volts BC"},
{IR, 6153, 0, "Volts CA"},
{IR, 6154, 0, "Source 1 Frequency"},
{IR, 6155, 0, "Source 2 Frequency"},
{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, 6263, 0, "Number of Transfers"},
{IR, 6297, 0, "Alarm Status Bits"},
};
//Size of modbus map used in FOR cycles, automatically calculated.