## 3 Methodology
### Communication Platform Based on Modbus for Temperature Control  
The Modbus protocol, one of several communication methods used in industrial automation, is widely adopted due to its simple communication structure, ease of driver implementation, flexibility in connecting various devices, and compatibility with existing temperature controllers. In this study, Modbus is implemented as a TCP/IP-based communication protocol within an AI-based indoor temperature control system to facilitate real-time data exchange between a central AI controller (main-part) and distributed temperature control devices (sub-parts). This Modbus TCP implementation ensures efficient temperature control, continuous monitoring, and seamless communication between HVAC components. The proposed temperature control system employs a client-server architecture based on the Modbus TCP protocol. The central AI-based controller (main-part) acts as the Modbus TCP master, issuing control commands and requesting sensor data. In contrast, the distributed controllers installed in individual rooms (sub-parts) function as Modbus TCP slaves, responding to these commands and transmitting local sensor data, such as temperature, humidity, and power consumption, back to the master controller [19; 20]. This master-slave communication structure leverages Modbus TCP's capability to overcome limitations related to multiplex communication inherent in traditional RS-485 communication. The system architecture is based on individual Modbus transactions, each consisting of a master request and a corresponding slave response. The implementation adopts an Ethernet-based Modbus TCP frame structure to ensure minimal latency and optimal reliability. The architecture utilizes dedicated Modbus registers for efficient data management: Input registers (function code (0x04) store temperature and humidity sensor readings, while holding registers (function code 0x03) hold HVAC control parameters. The implemented system primarily uses three standard Modbus TCP function codes: 0x03 to read HVAC parameters, 0x04 to acquire sensor data, and 0x06 to dynamically adjust HVAC settings. During temperature monitoring tasks, the AI controller initiates a Read Input Registers (0x04) request to access sensor data, receiving a 16-bit numeric response from the relevant  
Figure 2: Architecture and Configuration of predictive optimal control mechanism for indoor temperature. control devices. The message protocol for temperature collection follows the standardized Modbus TCP frame structure. For instance, to accurately transmit a temperature reading such as 25.0 \({}^{\circ}\)C, the numeric value is multiplied by an agreed-upon scaling factor (e.g., 100) prior to transmission, converting it into an integer format (e.g., 2500). Upon receiving the transmitted data, the master or slave device divides the integer by the same scaling factor (100) to convert it back into its original floating-point format, ensuring precise and consistent handling of real numbers in control algorithms. The communication protocol conforms to the standardized Modbus TCP frame structure, which includes the following components:  
* A 2-byte Transaction ID serving as a unique request identifier. * A static 2-byte Protocol ID (0x000) for Modbus TCP. * A 2-byte Length field indicating request size. * A single-byte Unit ID for slave device identification. * A Function Code byte specifying the operation type. * A 2-byte Register Address indicating data location. * A 2-byte Register Count specifying the read scope. To acquire temperature data from register 0x000A, the system exchanges the following messages:  
Request (Master \(\rightarrow\) Slave):  
[0x01] [0x04] [0x00] [0x0A] [0x00] [0x01] [CRC]  
Response (Slave \(\rightarrow\) Master):  
[0x01] [0x04] [0x02] [0x01] [0x90] [CRC]  
After establishing the data acquisition protocol, the system implements mechanisms for the dynamic control of HVAC operations [21; 22].