MVG Template created
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
default_envs = MVG_SC_EC_M505_TCP ; Select here the name of the configuration you want to download
|
||||
|
||||
[env]
|
||||
upload_port = COM16
|
||||
upload_port = COM26
|
||||
|
||||
[common_env_options]
|
||||
framework = arduino
|
||||
@@ -251,7 +251,6 @@ build_src_filter = -<*> +<Base_TCP>
|
||||
platform = espressif32
|
||||
board = dfrobot_firebeetle2_esp32e
|
||||
extends = common_env_options
|
||||
build_flags =
|
||||
-D USE_MODBUS_IP,
|
||||
-D USE_LED
|
||||
build_src_filter = -<*> +<EPMS/MVG_SC_EC_M505_TCP>
|
||||
build_flags = -D USE_MODBUS_IP,
|
||||
build_src_filter = -<*> +<EPMS/MVG/MVG_SC_EC_M505_TCP>
|
||||
|
||||
|
||||
@@ -1,33 +1,48 @@
|
||||
# EQUIPMENT_TYPE MANUFACTURER MODEL TCP
|
||||
# Daikin Chiller (RTU) Emulator
|
||||
|
||||
## Brief Introduction
|
||||
Equipment specifc details that make it different from other devices
|
||||
This project is an Arduino-based emulator for a Daikin Chiller unit, communicating over Modbus RTU. It is designed to be a flexible template that can be adapted to simulate different types of chillers by modifying the configuration and state logic.
|
||||
|
||||
## List of Equipmentt
|
||||
This cofiguration has been used for these models:
|
||||
* **Model**: 09-15-22
|
||||
* **Model**: 09-15-23
|
||||
* **Model**: 09-15-25
|
||||
The emulator operates on a state machine with three core states:
|
||||
* **Standby**: The chiller is idle but ready.
|
||||
* **Running**: The chiller is active and operational.
|
||||
* **Fail**: The chiller has encountered a fault condition.
|
||||
|
||||
## Features
|
||||
|
||||
* **Modbus RTU Communication**: Emulates a Modbus slave device.
|
||||
* **State Machine Logic**: Simulates different operational states (Standby, Running, Fail).
|
||||
* **Dynamic Value Simulation**: Uses "Strategies" (e.g., PID, Ramp) to generate realistic, changing values for Modbus points.
|
||||
* **Configurable Modbus Map**: The entire Modbus register map is defined in a single, easy-to-modify file (`config.h`).
|
||||
* **Extensible Design**: The structure allows for the addition of new states and behaviors.
|
||||
|
||||
## Hardware Prerequisites
|
||||
|
||||
The code is written for an ESP8266/ESP32-style microcontroller with WiFi capabilities.
|
||||
* **Microcontroller**: [Firebeetle 2 ESP32.](https://www.dfrobot.com/product-2231.html)
|
||||
The code is written for an ESP8266/ESP32-style microcontroller with WiFi capabilities and at least one hardware serial port for RS485 communication.
|
||||
|
||||
* **Microcontroller**: ESP8266, ESP32, or similar.
|
||||
* **RS485 Transceiver**: A module like the MAX485 to interface with the Modbus RTU bus.
|
||||
|
||||
## Software Dependencies
|
||||
|
||||
This project relies on a Modbus library. Ensure you have the correct library installed in your Arduino IDE.
|
||||
|
||||
* **Modbus Library**: The code uses a library that provides `ModbusRTU.h` and optionally `ModbusIP_ESP8266.h`.
|
||||
|
||||
---
|
||||
|
||||
## States and Strategies
|
||||
Provide a brief description of what variables and strategies were used in this configuraiton
|
||||
## How to Customize for a New Chiller
|
||||
|
||||
### Standby State
|
||||
* **Equipment running**: set to 0
|
||||
* **Common Alarm**: set to 0
|
||||
* **SAT temperature**: set to 85
|
||||
To adapt this template for a new chiller, follow these steps.
|
||||
|
||||
### Running State
|
||||
* **Equipment running**: set to 1
|
||||
* **SAT temperature**: **Ramp Strategy** set to 65 deg setpoint
|
||||
### 1. Configure Device-Specific Parameters (`config.h`)
|
||||
|
||||
### Fail State
|
||||
* **Commong Alarm**: set to 1
|
||||
* **SAT temperature**: **Ramp Strategy** set to 105 deg setpointset
|
||||
Open `CH_Daikin_AWV026B_RTU/config.h`. This is the main file for device-specific settings.
|
||||
|
||||
#### Modbus RTU Settings
|
||||
Update the following constants for your device's serial communication setup.
|
||||
```c++
|
||||
const int BAUDRATE = 19200; // The serial communication speed
|
||||
const int RX_PIN = 17; // The GPIO pin for receiving data (RX)
|
||||
const int TX_PIN = 16; // The GPIO pin for transmitting data (TX)
|
||||
const int RST_PIN = 4; // The GPIO pin for RS485 direction control
|
||||
const int MODBUS_ID = 1; // The unique slave ID for this device
|
||||
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
template<>
|
||||
RunningState<ModbusIP>::RunningState() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +60,7 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
Serial.println("Running update function");
|
||||
float StateCtrl = getPointValue(equipment, "Px_Mode");
|
||||
if (StateCtrl == 1.0f) {
|
||||
return new RunningState<ModbusIP>();
|
||||
return new StandbyState<ModbusIP>();
|
||||
}
|
||||
|
||||
float W1 = getPointValue(equipment, "Px_W1");
|
||||
@@ -68,6 +69,7 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
float W4 = getPointValue(equipment, "Px_W4");
|
||||
float W5 = getPointValue(equipment, "Px_W5");
|
||||
float W6 = getPointValue(equipment, "Px_W6");
|
||||
// Apply any strategies defined for the standby state
|
||||
|
||||
switch (static_cast<int>(W1)){
|
||||
case 0:
|
||||
@@ -236,10 +238,6 @@ State<ModbusIP>* RunningState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
setBitValue(equipment, "MVG_STS_03", 1, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -269,4 +267,5 @@ void RunningState<ModbusIP>::exitState(Equipment<ModbusIP>* equipment) {
|
||||
setPointValue(equipment, "MVG_STS_01", 0);
|
||||
setPointValue(equipment, "MVG_STS_02", 0);
|
||||
setPointValue(equipment, "MVG_STS_03", 0);
|
||||
|
||||
}
|
||||
@@ -39,7 +39,6 @@ template<>
|
||||
StandbyState<ModbusIP>::StandbyState() {
|
||||
// You can add initialization code here if needed
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +59,6 @@ State<ModbusIP>* StandbyState<ModbusIP>::update(Equipment<ModbusIP>* equipment)
|
||||
if (StateCtrl == 2.0f) {
|
||||
return new RunningState<ModbusIP>();
|
||||
}
|
||||
|
||||
|
||||
// Apply any strategies defined for the standby state
|
||||
_applyStrategies(equipment);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -77,8 +73,10 @@ template<>
|
||||
void StandbyState<ModbusIP>::enterState(Equipment<ModbusIP>* equipment) {
|
||||
// Logic to run when the equipment enters this state
|
||||
Serial.println("Enter Standby State...");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief Logic to execute once when exiting the standby state.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
|
||||
@@ -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 = "ArduinoWifiB"; /**< @brief The SSID of the WiFi network. */
|
||||
const char *password = "123abc456"; /**< @brief The password for the WiFi network. */
|
||||
IPAddress local_IP(172, 17, 32, 82); /**< @brief The static IP address for the device. */
|
||||
IPAddress gateway(172, 17, 32, 1); /**< @brief The gateway IP address. */
|
||||
IPAddress subnet(255, 255, 255, 0); /**< @brief The subnet mask. */
|
||||
|
||||
ModbusIP mb;
|
||||
|
||||
Reference in New Issue
Block a user