modbus updates
This commit is contained in:
@@ -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
|
||||
102
src/EPMS/STS/Vertiv STA0600A32A572/config.h
Normal file
102
src/EPMS/STS/Vertiv STA0600A32A572/config.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @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"}, //Internal Fault code from Modscan
|
||||
{HR, 289, 0, "Alarm Status Word 1"},
|
||||
{HR, 290, 0, "Alarm Status Word 2"},
|
||||
{HR, 291, 0, "Alarm Status Word 3"},
|
||||
{HR, 292, 0, "Alarm Status Word 4"},
|
||||
{HR, 24, 0, "Status Word"},
|
||||
{HR, 3, 0, "Active Source"},
|
||||
{HR, 2, 0, "Preferred Source"},
|
||||
{HR, 1, 0, "Total Transfer Count"},
|
||||
{HR, 19, 0, "Output kVA"},
|
||||
{HR, 18, 0, "Output kW"},
|
||||
{HR, 7, 0, "Source 1 Amps A"},
|
||||
{HR, 8, 0, "Source 1 Amps B"},
|
||||
{HR, 9, 0, "Source 1 Amps C"},
|
||||
{HR, 10, 0, "Source 1 Frequency"},
|
||||
{HR, 4, 0, "Source 1 Volts A-B"},
|
||||
{HR, 5, 0, "Source 1 Volts B-C"},
|
||||
{HR, 6, 0, "Source 1 Volts C-A"},
|
||||
{HR, 14, 0, "Source 2 Amps A"},
|
||||
{HR, 15, 0, "Source 2 Amps B"},
|
||||
{HR, 16, 0, "Source 2 Amps C"},
|
||||
{HR, 17, 0, "Source 2 Frequency"},
|
||||
{HR, 11, 0, "Source 2 Volts A-B"},
|
||||
{HR, 12, 0, "Source 2 Volts B-C"},
|
||||
{HR, 13, 0, "Source 2 Volts C-A"},
|
||||
};
|
||||
//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
|
||||
Reference in New Issue
Block a user