diff --git a/src/Base_RTU/README.md b/src/Base_RTU/README.md new file mode 100644 index 0000000..4f156e3 --- /dev/null +++ b/src/Base_RTU/README.md @@ -0,0 +1,48 @@ +# Daikin Chiller (RTU) Emulator + +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. + +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 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`. + +--- + +## How to Customize for a New Chiller + +To adapt this template for a new chiller, follow these steps. + +### 1. Configure Device-Specific Parameters (`config.h`) + +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 \ No newline at end of file diff --git a/src/00_Base_RTU/State_Fail.cpp b/src/Base_RTU/State_Fail.cpp similarity index 100% rename from src/00_Base_RTU/State_Fail.cpp rename to src/Base_RTU/State_Fail.cpp diff --git a/src/00_Base_RTU/State_Running.cpp b/src/Base_RTU/State_Running.cpp similarity index 100% rename from src/00_Base_RTU/State_Running.cpp rename to src/Base_RTU/State_Running.cpp diff --git a/src/00_Base_RTU/State_Standby.cpp b/src/Base_RTU/State_Standby.cpp similarity index 100% rename from src/00_Base_RTU/State_Standby.cpp rename to src/Base_RTU/State_Standby.cpp diff --git a/src/00_Base_RTU/config.h b/src/Base_RTU/config.h similarity index 100% rename from src/00_Base_RTU/config.h rename to src/Base_RTU/config.h diff --git a/src/00_Base_RTU/main.cpp b/src/Base_RTU/main.cpp similarity index 100% rename from src/00_Base_RTU/main.cpp rename to src/Base_RTU/main.cpp diff --git a/src/Base_TCP/README.md b/src/Base_TCP/README.md new file mode 100644 index 0000000..4f156e3 --- /dev/null +++ b/src/Base_TCP/README.md @@ -0,0 +1,48 @@ +# Daikin Chiller (RTU) Emulator + +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. + +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 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`. + +--- + +## How to Customize for a New Chiller + +To adapt this template for a new chiller, follow these steps. + +### 1. Configure Device-Specific Parameters (`config.h`) + +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 \ No newline at end of file diff --git a/src/00_Base_TCP/State_Fail.cpp b/src/Base_TCP/State_Fail.cpp similarity index 100% rename from src/00_Base_TCP/State_Fail.cpp rename to src/Base_TCP/State_Fail.cpp diff --git a/src/00_Base_TCP/State_Running.cpp b/src/Base_TCP/State_Running.cpp similarity index 100% rename from src/00_Base_TCP/State_Running.cpp rename to src/Base_TCP/State_Running.cpp diff --git a/src/00_Base_TCP/State_Standby.cpp b/src/Base_TCP/State_Standby.cpp similarity index 100% rename from src/00_Base_TCP/State_Standby.cpp rename to src/Base_TCP/State_Standby.cpp diff --git a/src/00_Base_TCP/config.h b/src/Base_TCP/config.h similarity index 100% rename from src/00_Base_TCP/config.h rename to src/Base_TCP/config.h diff --git a/src/00_Base_TCP/main.cpp b/src/Base_TCP/main.cpp similarity index 100% rename from src/00_Base_TCP/main.cpp rename to src/Base_TCP/main.cpp