Zach equipment added

This commit is contained in:
Emmanuel HC
2025-09-24 13:54:54 -05:00
parent 8f7bad74e5
commit 1ee3d27d4b
65 changed files with 2138 additions and 1043 deletions

View File

@@ -1,152 +0,0 @@
/**
* @file config.h
* @brief Main configuration file for the CRAH Unit (TCP) emulator.
* @author Emmanuel Hernandez Cruz
* @date 2025-09-02
*
* This file contains two important configurations: WiFi network parameters
* and the Modbus register map for the device.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "core.h"
#include "Equipment/Equipment.h"
#if defined(USE_MODBUS_IP)
/**
* @defgroup ModbusTCPConfig Modbus IP Configuration
* @brief Parameters for Modbus TCP communication.
* @{
*/
#include <ModbusIP_ESP8266.h>
const char *ssid = "wifi_name"; /**< @brief The SSID of the WiFi network. */
const char *password = "wifi_password"; /**< @brief The password for the WiFi network. */
IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */
IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
ModbusIP mb;
#else
/**
* @defgroup ModbusRTUConfig Modbus RTU Configuration
* @brief Parameters for serial Modbus RTU communication.
* @{
*/
#include <ModbusRTU.h>
const int BAUDRATE = 19200; /**< @brief The serial communication speed in bits per second. */
const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */
const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */
const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */
const int MODBUS_ID = 1; /**< @brief The unique slave ID for this device on the Modbus bus. */
/** @} */
/** @brief Global instance of the Modbus RTU server. */
ModbusRTU mb;
#endif
/**
* @defgroup ModbusMapConfig Modbus Map Configuration
* @brief Defines the Modbus register map and related parameters for the emulator.
* @{
*/
/**
* @brief The Modbus map for the Equipment device.
* This array defines all the Modbus points available on the emulated device.
* The `description` field is crucial as it's used to look up points within the application logic.
*/
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"},
{COIL, 264, 0, "Alarm Reset"}
};
//Size of modbus map used in FOR cycles, automatically calculated.
/**
* @brief The total number of entries in the `mb_map` array.
* This is calculated at compile time and used for iterating over the map.
*/
const int map_size = sizeof(mb_map) / sizeof(mb_map[0]);
/** @brief The main loop update interval in milliseconds. */
int interval = 250;
/** @} */ // End of ModbusMapConfig group
#endif // CONFIG_H

View File

@@ -0,0 +1,162 @@
/**
* @file config.h
* @brief Main configuration file for the STS Powersmiths STATYS UL 600A
* @author Zach Gutierrez
* @date 2025-09-02
*
* This file contains two important configurations: WiFi network parameters
* and the Modbus register map for the device.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "core.h"
#include "Equipment/Equipment.h"
#if defined(USE_MODBUS_IP)
/**
* @defgroup ModbusTCPConfig Modbus IP Configuration
* @brief Parameters for Modbus TCP communication.
* @{
*/
#include <ModbusIP_ESP8266.h>
const char *ssid = "wifi_name"; /**< @brief The SSID of the WiFi network. */
const char *password = "wifi_password"; /**< @brief The password for the WiFi network. */
IPAddress local_IP(192, 168, 1, 234); /**< @brief The static IP address for the device. */
IPAddress gateway(192, 168, 1, 1); /**< @brief The gateway IP address. */
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
ModbusIP mb;
#else
/**
* @defgroup ModbusRTUConfig Modbus RTU Configuration
* @brief Parameters for serial Modbus RTU communication.
* @{
*/
#include <ModbusRTU.h>
const int BAUDRATE = 19200; /**< @brief The serial communication speed in bits per second. */
const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */
const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */
const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */
const int MODBUS_ID = 1; /**< @brief The unique slave ID for this device on the Modbus bus. */
/** @} */
/** @brief Global instance of the Modbus RTU server. */
ModbusRTU mb;
#endif
/**
* @defgroup ModbusMapConfig Modbus Map Configuration
* @brief Defines the Modbus register map and related parameters for the emulator.
* @{
*/
/**
* @brief The Modbus map for the Equipment device.
* This array defines all the Modbus points available on the emulated device.
* The `description` field is crucial as it's used to look up points within the application logic.
*/
modbusMap mb_map[] = {
{HR, 56, 0, "Amb_Temp_Alm" },
{HR, 70, 0, "Amps_A" },
{HR, 71, 0, "Amps_B" },
{HR, 72, 0, "Amps_C" },
{HR, 73, 0, "Amps_N" },
{HR, 49, 0, "CB1_Status" },
{HR, 49, 0, "CB2_Status" },
{HR, 49, 0, "CB3_Status" },
{HR, 49, 0, "CB3A_Status" },
{HR, 49, 0, "CB4_Status" },
{HR, 49, 0, "CB5_Status" },
{HR, 59, 0, "Comm_Fail" },
{HR, 56, 0, "Cons_Volt" },
{HR, 77, 0, "FREQ" },
{HR, 56, 0, "Gen_Alm" },
{HR, 56, 0, "Imm_Stop" },
{HR, 48, 0, "In_Ser_Mode" },
{HR, 68, 0, "kVA" },
{HR, 112, 0, "kVA_A" },
{HR, 113, 0, "kVA_B" },
{HR, 114, 0, "kVA_C" },
{HR, 69, 0, "kW" },
{HR, 115, 0, "kW_A" },
{HR, 116, 0, "kW_B" },
{HR, 117, 0, "kW_C" },
{HR, 56, 12, "Maint_Alm" },
{HR, 48, 15, "Maint_Alt" },
{HR, 56, 8, "Out_Of_Tol" },
{HR, 56, 7, "Out_Sht_Ckt_Det" },
{HR, 56, 1, "Ovrld" },
{HR, 1007, 0, "Ovrd" },
{HR, 41, 0, "Perc_Load" },
{HR, 65, 0, "Perc_Load_A" },
{HR, 66, 0, "Perc_Load_B" },
{HR, 67, 0, "Perc_Load_C" },
{HR, 121, 0, "PF_A" },
{HR, 122, 0, "PF_B" },
{HR, 123, 0, "PF_C" },
{HR, 51, 0, "S1_Active" },
{HR, 128, 0, "S1_Amps_A" },
{HR, 129, 0, "S1_Amps_B" },
{HR, 130, 0, "S1_Amps_C" },
{HR, 99, 0, "S1_FREQ" },
{HR, 92, 0, "S1_kVA" },
{HR, 80, 0, "S1_kVA_A" },
{HR, 81, 0, "S1_kVA_B" },
{HR, 82, 0, "S1_kVA_C" },
{HR, 93, 0, "S1_kW" },
{HR, 131, 0, "S1_kW_A" },
{HR, 132, 0, "S1_kW_B" },
{HR, 133, 0, "S1_kW_C" },
{HR, 2050, 0, "S1_Not_Avail" },
{HR, 51, 0, "S1_OK" },
{HR, 48, 0, "S1_Pref" },
{HR, 100, 0, "S1_Volts_AB" },
{HR, 101, 0, "S1_Volts_BC" },
{HR, 102, 0, "S1_Volts_CA" },
{HR, 51, 0, "S2_Active" },
{HR, 134, 0, "S2_Amps_A" },
{HR, 135, 0, "S2_Amps_B" },
{HR, 136, 0, "S2_Amps_C" },
{HR, 106, 0, "S2_FREQ" },
{HR, 94, 0, "S2_kVA" },
{HR, 83, 0, "S2_kVA_A" },
{HR, 84, 0, "S2_kVA_B" },
{HR, 85, 0, "S2_kVA_C" },
{HR, 95, 0, "S2_kW" },
{HR, 137, 0, "S2_kW_A" },
{HR, 138, 0, "S2_kW_B" },
{HR, 139, 0, "S2_kW_C" },
{HR, 2052, 0,"S2_Not_Avail" },
{HR, 51, 56, "S2_OK" },
{HR, 48, 7, "S2_Pref" },
{HR, 107, 0, "S2_Volts_AB" },
{HR, 108, 0, "S2_Volts_BC" },
{HR, 109, 0, "S2_Volts_CA" },
{HR, 51, 0, "SS1_Closed" },
{HR, 51, 0, "SS2_Closed" },
{HR, 59, 0, "STS_Power_Off" },
{HR, 56, 0, "SWBK_Imposs" },
{HR, 79, 0, "Temp" },
{HR, 42, 0, "Ttl_Trsfer_Cnt" },
{HR, 56, 0, "Trsfer_Impo" },
{HR, 48, 0, "Trsfer_Lock" },
{HR, 118, 0, "Volts_AB" },
{HR, 119, 0, "Volts_BC" },
{HR, 120, 0, "Volts_CA" }
};
//Size of modbus map used in FOR cycles, automatically calculated.
/**
* @brief The total number of entries in the `mb_map` array.
* This is calculated at compile time and used for iterating over the map.
*/
const int map_size = sizeof(mb_map) / sizeof(mb_map[0]);
/** @brief The main loop update interval in milliseconds. */
int interval = 250;
/** @} */ // End of ModbusMapConfig group
#endif // CONFIG_H