Siemens PLC data acquisition system and method
By interacting with Siemens PLCs through Java programs, efficient and flexible data acquisition is achieved, solving the problems of low efficiency and poor compatibility of traditional PLC data acquisition, and providing real-time monitoring and ease of use.
Patent Information
- Application Number
- CN202511048775.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-11-25
AI Technical Summary
Traditional PLC data acquisition methods are inefficient, have poor compatibility, and lack efficient and flexible data acquisition solutions.
It uses a Java program to interact with Siemens PLCs, and achieves real-time monitoring and data acquisition through point configuration modules, data acquisition modules, data processing modules and user interface. It includes TCP connection, data reading and writing units, data parsing, conversion and storage units, and supports S7 protocol communication connection.
It improves the efficiency and accuracy of data acquisition, has good scalability and ease of use, and is suitable for various Siemens PLC data acquisition scenarios.
Smart Images

Figure CN121008522A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a Siemens PLC data acquisition system and method, and belongs to the technical field of automatic control systems and methods. BACKGROUND
[0002] In industrial automation, PLCs (programmable logic controllers) are widely used in device control and data acquisition. Traditional data acquisition methods require third-party plug-ins, which have problems such as low efficiency and poor compatibility, and there is an urgent need for an efficient and flexible data acquisition solution. SUMMARY
[0003] The application aims to provide a Siemens PLC data acquisition system and method, which realizes real-time monitoring and data acquisition of the running state of industrial equipment by interacting with Siemens PLC through Java programs, improves the efficiency and accuracy of data acquisition, has good scalability and ease of use, and is suitable for various application scenarios that require data acquisition from Siemens PLC, effectively solving the above problems in the background art.
[0004] The technical scheme of the application is: a Siemens PLC data acquisition system, comprising a point configuration module, a data acquisition module, a data processing module and a user interface, wherein the point configuration module, the data acquisition module, the data processing module and the user interface are connected in sequence; the point configuration module configures the PLC point address; the data acquisition module is provided with an S7 connector, and the data acquisition module establishes a communication connection between the Java program and the Siemens PLC through the S7 connector and acquires data in the PLC; and the user interface is provided with a user interaction interface.
[0005] The data acquisition module comprises a TCP connection establishment unit, a data reading unit and a data writing unit, the TCP connection establishment unit establishes a communication connection with the Siemens PLC through the S7 protocol; the data reading unit is connected to the input end of the data processing module and reads data from the PLC according to the preset address and data length; and the data writing unit is connected to the output end of the data processing module and writes the processed data back to the specified address of the PLC.
[0006] The data processing module comprises a data analysis unit, a data conversion unit, a data sending unit and a data storage unit, the data analysis unit is connected to the data conversion unit and the data sending unit, and the data conversion unit is connected to the data storage unit.
[0007] The user interface comprises a data display unit and a control operation unit, the data display unit is connected to the data processing module, and the control operation unit is connected to the data display unit through the user interaction interface.
[0008] A Siemens PLC data acquisition method comprises the following steps: (1) Establish a communication connection with the Siemens PLC through the S7 protocol connector in the Java program; (2) Send a read command to the PLC, specifying the starting address and length of the data; (3) Receive the data returned by the PLC and perform parsing and conversion; (4) Send the read point data to the message queue; (5) Store the processed data in the database or file; (6) Display the collected data through the user interface and provide user interaction functions.
[0009] It also includes real-time monitoring and data preprocessing. During data acquisition, the communication state and data integrity are monitored in real time; filtering and denoising data preprocessing is performed.
[0010] A computer-readable storage medium stores computer instructions, which, when executed by a processor, implement a Siemens PLC data acquisition method.
[0011] The beneficial effects of the present application are: through Java program and Siemens PLC data interaction, real-time monitoring and data acquisition of industrial equipment running state are realized, which not only improves the efficiency and accuracy of data acquisition, but also has good scalability and ease of use, and is suitable for various application scenarios that need to collect data from Siemens PLC. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 The flowchart of the data acquisition of the present application. DETAILED DESCRIPTION
[0013] In order to make the purpose, technical scheme and advantages of the embodiment of the application clearer, the technical scheme of the embodiment of the application will be described clearly and completely in conjunction with the drawings in the embodiment. Obviously, the embodiment expressed is only a part of the embodiments of the application, not all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor belong to the protection scope of the application.
[0014] A Siemens PLC data acquisition system comprises a point configuration module, a data acquisition module, a data processing module and a user interface, wherein the point configuration module, the data acquisition module, the data processing module and the user interface are connected in sequence; the point configuration module configures the PLC point address; the data acquisition module is provided with an S7 connector; the data acquisition module establishes a communication connection between the Java program and the Siemens PLC through the S7 connector and acquires data in the PLC; and the user interface is provided with a user interaction interface.
[0015] The data acquisition module comprises a TCP connection establishment unit, a data reading unit and a data writing unit, the TCP connection establishment unit establishes a communication connection with the Siemens PLC through an S7 protocol; the data reading unit is connected to the input end of the data processing module and reads data from the PLC according to a preset address and data length; the data writing unit is connected to the output end of the data processing module and writes the processed data back to the specified address of the PLC.
[0016] The data processing module comprises a data analysis unit, a data conversion unit, a data sending unit and a data storage unit, the data analysis unit is connected to the data conversion unit and the data sending unit, and the data conversion unit is connected to the data storage unit.
[0017] The user interface comprises a data display unit and a control operation unit, the data display unit is connected to the data processing module, and the control operation unit is connected to the data display unit through a user interaction interface.
[0018] A Siemens PLC data acquisition method comprises the following steps: (1) a communication connection is established between the S7 protocol connector in the Java program and the Siemens PLC; (2) a reading command is sent to the PLC, and the starting address and length of data are specified; (3) the data returned by the PLC is received and analyzed and converted; (4) the read point data is sent to a message queue; (5) the processed data is stored in a database or a file; (6) the acquired data is displayed through a user interface, and a user interaction function is provided.
[0019] Real-time monitoring and data preprocessing are further included, in the data acquisition process, the communication state and data integrity are monitored in real time; the data preprocessing of filtering and denoising is performed.
[0020] A computer readable storage medium stores computer instructions, the computer instructions are executed by a processor to implement the Siemens PLC data acquisition method.
[0021] In practical application, the implementation process of the present application is as follows: I. Configuration of point information 1. Confirm the type of Siemens PLC used (S200, S200_SMART, S300, S400, S1200, S1500, SINUMERIK_828D); 2. Determine the communication protocol supported by the PLC, this invention is based on S7 protocol, S7 protocol is a widely used communication protocol for Siemens PLC, used for data exchange between PLC and host computer or other PLCs; 3. Configure PLC address, port number, rack number in the project, these parameters will be used to establish communication connection with PLC; 4. When configuring point address in the project, consider multiple key parameters, including whether to reverse, point type, type of collection and collection frequency, etc. These parameters together determine the collection identifier of the point.
[0022] II. Initialization data 1. Read the specific information of PLC points from the database configuration table, such as point name, data type, address, etc. 2. Initialize and store these point information in Java memory, use Map data structure for storage, which is convenient for fast access and reading point data later; III. Data collection 1. Using the S7 protocol library written in Java, we can establish communication connection with PLC and read data in PLC according to pre-set point information.
[0023] 2. Create a thread for each PLC to manage its communication connection and data reading process.
[0024] 3. According to the specific data type of the data point, convert the received byte data into appropriate data format (such as integer, floating point, boolean, etc.).
[0025] 4. Record log information to track any failures or exceptions that occur when PLC reads points.
[0026] IV. Message queue sending process 1. Using RabbitMQ's Java client library, we configure and build the producer of the message queue. The main responsibility of the producer is to encapsulate the data read from PLC into message format and send it to the preset RabbitMQ queue.
[0027] 2. Once PLC data is read, we quickly encapsulate it into a message and deliver it to the corresponding queue by calling the send method of the RabbitMQ producer. This process ensures that data can be transmitted in real time to other systems or components that rely on these data for processing.
[0028] V. Consume data 1. Using the Java client library for RabbitMQ, we configure and build consumers for the message queue. These consumers continuously monitor specific RabbitMQ queues, ready to receive messages transmitted from the PLC system at any time.
[0029] 2. Consumers need to maintain continuous listening to the designated RabbitMQ queue and quickly process messages when they arrive. The processing flow involves key steps such as parsing the message content, storing data, and triggering events.
[0030] 3. To facilitate tracking and auditing, we record detailed history of message consumption, including the time of message reception, processing results, and other key information. These records will be saved in a database or log file for subsequent query and analysis work.
Claims
1. A Siemens PLC data acquisition system characterized by: The application relates to a data acquisition method for a Siemens PLC, which comprises the following steps: (1) establishing a communication connection between a Java program and a Siemens PLC through an S7 protocol connector in the Java program; (2) sending a reading command to the PLC and specifying the starting address and length of data; (3) receiving data returned by the PLC and performing analysis and conversion; (4) sending point data to a message queue; (5) storing processed data in a database or a file; and (6) displaying the acquired data through a user interface and providing user interaction functions.
2. The Siemens PLC data acquisition system of claim 1, wherein: The data acquisition module comprises a TCP connection establishing unit, a data reading unit and a data writing unit, the TCP connection establishing unit establishes a communication connection with the Siemens PLC through an S7 protocol, and the data reading unit is connected with the input end of the data processing module and reads data from the PLC according to a preset address and data length. The data writing unit is connected with the output end of the data processing module and writes processed data back to a specified address of the PLC.
3. The method for controlling the tail loop of a large-size special steel wire rod according to claim 1, characterized in that: The data processing module comprises a data analysis unit, a data conversion unit, a data sending unit and a data storage unit, the data analysis unit is connected with the data conversion unit and the data sending unit, and the data conversion unit is connected with the data storage unit.
4. The method for controlling the tail loop of a large-size special steel wire rod according to claim 1, characterized in that: The user interface comprises a data display unit and a control operation unit, the data display unit is connected with the data processing module, and the control operation unit is connected with the data display unit through a user interaction interface.
5. A method of data acquisition for a Siemens PLC, characterized by The application further comprises real-time monitoring and data preprocessing, the communication state and data integrity are monitored in real time during the data acquisition process, and filtering and denoising data preprocessing is performed. The application further comprises a computer instruction, the computer instruction is executed by a processor to realize the Siemens PLC data acquisition method. 6. The method of claim 5, wherein: 7. A computer-readable storage medium, characterized in that: