Share this

Real-time control system for silkworm hatching process based on industrial computer and PLC

2026-04-06 03:16:36 · · #1
Abstract: This paper introduces a real-time control system for the silkworm egg incubation process based on an industrial control computer and a PLC. Combining communication technology, thread technology, and database technology, it successfully realizes the temperature and humidity control of the silkworm egg incubation room and the management of silkworm egg sales, with good results. Keywords: Industrial control computer; PLC; Thread; Silkworm egg incubation 1 Introduction Xiushui County is a major sericulture county in Jiangxi Province. Silk production is the economic pillar of the county and is related to the vital interests of thousands of farmers. In order to improve the yield and quality of silkworm eggs and promote the development of the sericulture economy, the county's Sericulture Bureau commissioned us to develop a real-time temperature and humidity control system for the silkworm egg incubation process. 2 System Structure and Control Flow The silkworm egg incubation building of Xiushui County Sericulture Bureau has three floors, with six incubation rooms on each floor. According to the technical requirements and the geographical location of the incubation rooms, we adopted a floor-by-floor control scheme, that is, each floor's six incubation rooms are an independent control system, using a PLC to control their temperature and humidity. Each PLC is interconnected with the industrial control computer through twisted-pair shielded cables. The entire system is monitored by a two-level computer. The system structure is shown in Figure 1. The temperature and humidity transmitter shown in the diagram is a JWSF-3AC-E model from Beijing Kunlun Coast Sensor Technology Center. This transmitter is a three-wire current transmitter with a standard 4-20mA current signal output (two channels). The inspection instrument is also an XSL/A16BS3 patrol inspection and alarm instrument from Beijing Kunlun Coast Sensor Technology Center, featuring 16 channels of 4-20mA current input (only 12 channels were actually used, including 6 temperature channels and 6 humidity channels), and a 19-bit digital signal output, with D18 to D1... 4 represents the channel code, D13 represents the polarity, and D12 to D0 represent the temperature and humidity values. The data of each channel is output in a time-division cycle. By setting the upper and lower limits of the range of each channel, the temperature and humidity values ​​of each channel can also be displayed in a cycle. The PLC uses Siemens S7-200 series CPU226 (with the addition of the expansion module EM223). Since the Siemens PLC provides an RS485 serial interface, while the industrial control computer only provides an RS232 serial interface, an RS485/232 level converter must be used between the PLC and the industrial control computer. The control scheme is as follows: Temperature and humidity transmitters installed in each incubation room convert the temperature and humidity signals of the incubation room into 4-20mA current signals and send them to the monitoring instrument. The monitoring instrument converts the current signals into temperature and humidity data according to the pre-set upper and lower limits of the range and displays them cyclically. At the same time, it also outputs these data in binary form to the PLC. The PLC acquires these binary data in the form of switch signals and converts them into temperature and humidity data for each incubation room according to the specified format. Then, it compares and judges these data in segments with the temperature and humidity data set according to the process requirements, and sends control signals. The control signals are amplified by the control board and drive the relevant actuators (air conditioners, heaters, and humidifiers) to implement segmented temperature and humidity control of the incubation room. This control scheme ensures that in the event of a failure of the industrial control computer or communication, the temperature and humidity of the incubation room can be controlled manually based on the data displayed by the monitoring instrument. It also avoids adding an A/D conversion module to the PLC, thus ensuring system reliability and reducing costs. 3. Software Design Based on the control scheme and user requirements, the industrial control computer mainly performs the following functions: setting the process flow, modifying control parameters, displaying, alarming, and saving real-time data, and managing silkworm seed sales. We chose Delphi as the front-end programming language to design various human-machine interfaces and communication programs for the industrial control computer. Microsoft Access was used as the back-end database system to save the segmented temperature and humidity setpoints, hourly actual values, alarm records, and silkworm seed sales records for each incubation room. The human-machine interface for modifying control parameters is shown in Figure 2. Since the industrial control computer needs to perform both human-machine interface operations and serial data communication with the PLC, to ensure that human-machine interface operations do not affect normal data communication, and that data communication does not cause the human-machine interface to stagnate or react untimely, we introduced a multi-threading mechanism in the program. The program's tasks are divided into two threads: a user operation response thread and a data communication thread. The user operation response thread is designated as the main thread with the highest priority to ensure the system can quickly respond to various operator operations, while the data communication thread has a lower priority. The PLC program primarily collects real-time data on the temperature and humidity of each incubator, compares and judges this data with set values, and sends control signals to control the start and stop of the air conditioner, heater, humidifier, and motors. This ensures that the minimum interval between two starts of the air conditioner, heater, and humidifier meets the system settings, and also ensures that the air conditioner (used for cooling) and heater do not start simultaneously. Another task of the PLC is serial communication with the industrial computer. The Siemens S7-200 series PLC has two main communication modes: PPI mode and free port mode. PPI mode is specifically used for communication between the Siemens PLC and its programmer or HMI product and is not publicly available. Free port mode is completely open to users; using free port mode, the S7-200 series PLC can communicate with any device with a serial port. Free port communication uses a master-slave mode, with the industrial computer as the master and the PLC as the slave. The PLC is always in a passive state, ready to receive communication request frames from the computer. Only after the PLC receives a request frame from the industrial computer can it send back the corresponding frame. The industrial control computer sends request frames using periodic communication with a period of 10 seconds. This system uses half-duplex communication, with the physical layer employing the RS485 protocol at a baud rate of 9600bps, a data length of 8 bits, and a stop bit of 1 bit, using odd parity. The communication program for the industrial control computer is implemented in Delphi. There are various methods for implementing serial communication in Delphi (such as using controls, calling API functions, embedding assembly code, and calling dynamic link libraries). We used the SPComm control for serial communication. Its main properties include CommName, BauRate, ParityCheck, ByteSize, and StopBits, which are used to set the serial port name, baud rate, parity, whether to use odd or even parity, data length, and stop bits, respectively. The main methods are StartComm and StopComm, used to open and close the serial port, respectively. In this system, two types of information are transmitted between the industrial control computer (ICC) and the PLC: configuration data sent by the ICC (temperature and humidity setpoints, minimum interval between two starts of the air conditioner, heater, and humidifier, etc.) and field data sent by the PLC (mainly temperature and humidity data of each incubation room and the status of the air conditioner, heater, humidifier, and motor). Therefore, we have defined the following communication protocol (where XX is the slave station number). Whenever the PLC receives information from the ICC, it triggers an interrupt service routine. The interrupt service routine identifies the content according to the predefined frame format (i.e., the communication protocol) and responds accordingly. When the ICC sends configuration data, if there is no response, an incorrect response, or a cumulative error, the ICC delays for 10 seconds before sending the R command. If this occurs six times consecutively, a communication error alarm is issued. When the ICC receives field data, if there is no response or an incorrect response, the host computer delays for 10 seconds before resending the T command. If this occurs six times consecutively, a communication error alarm is also issued. 5. Conclusion This system has been in operation for one year, and users have reported high reliability and good performance. Due to high control precision and correct process, the hatched silkworms are strong and easy to raise, and the cocoons are thick, with long silk threads and excellent purity, resulting in significant social and economic benefits. References: [1] Siemens. SIMATIC S7-200 Programmable Controller System Manual [S]. Shanghai Siemens, 2000.6 [2] TAMRA KERNS. The Advantages of Multithreaded Applications, National Institutes of Health. Published by EE-Evaluation Engineering [M]. 1998 Nelson Publishing [3] Zhang Ziyu, Zheng Hongxing. Delphi 5 In-Depth Programming [M]. Southeast University Press, 1999
Read next

CATDOLL Cici Soft Silicone Head

You can choose the skin tone, eye color, and wig, or upgrade to implanted hair. Soft silicone heads come with a functio...

Articles 2026-02-22