A method and device for real-time data acquisition and display of a factory PLC device
By configuring basic data and task modes, unified management and real-time data acquisition of factory PLC equipment are realized, solving the problems of long acquisition time and low efficiency in the existing technology, improving data acquisition performance and reducing costs.
Patent Information
- Application Number
- CN202210010078.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-05
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-01-05
AI Technical Summary
The real-time data acquisition method of existing factory PLC equipment cannot be managed in a centralized and unified manner, resulting in long collection time and low efficiency.
By configuring the basic data of factory modeling, brand basic data, communication protocol basic data and production line basic data, matching the PLC equipment with brand, communication protocol and production line, configuring the basic data of the acquisition point, and using single-task mode or multi-task mode for data acquisition and display.
It realizes unified management of real-time data of various PLC equipment in the factory, reduces acquisition delay time, improves data acquisition performance, and reduces production costs.
Smart Images

Figure CN114564486B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial manufacturing data acquisition, and in particular to a method and device for real-time data acquisition and display of factory PLC equipment. Background Art
[0002] Factory manufacturing faces a wide variety of PLC device brands and communication protocols. Data collection from various PLC devices lacks unified, standardized management, and data from collection points within PLC devices is distributed across different application systems and cannot be managed uniformly. Consequently, when workshop teams review equipment production data, they must manually identify key information such as the production line, workshop, and PLC device where the collection point is located, resulting in extremely low accuracy and efficiency. Prior art invention patent application number 201711143888.4 provides a data collection method, which includes: configuring a plurality of preset query modules based on user query requirements; generating a task configuration table based on the preset query modules and their corresponding data source address information; obtaining user instructions, parsing the plurality of user query requirements involved in the user instructions, and writing the user query requirements into a preset task record table; the task record table retrieves the corresponding preset query module in the task configuration table based on the user query requirements, and inserts query conditions into the preset query module to obtain a customized query statement; and querying a database based on the customized query statement and its corresponding data source address information to obtain target data. This method cannot centrally collect and display the real-time data of PLC devices in the application scenario of real-time data collection in factories. Summary of the Invention
[0003] A major problem solved by the present invention is that the existing factory PLC real-time data acquisition method cannot centrally acquire real-time data, and has a long acquisition time and low acquisition efficiency.
[0004] The present invention provides a method for collecting and displaying real-time data of factory PLC equipment, comprising:
[0005] Configure basic data for factory modeling;
[0006] Configure the brand basic data, communication protocol basic data and production line basic data of each PLC device;
[0007] Matching the factory modeling basic data with the brand basic data, the communication protocol basic data, and the production line basic data, respectively, and associating each of the PLC devices with the corresponding brand, communication protocol, and production line;
[0008] Configure basic data of collection points corresponding to PLC devices;
[0009] Associate each of the PLC devices with the corresponding collection point according to the basic data of the collection points;
[0010] Configure task mode information;
[0011] According to the configuration of the factory server data, start the corresponding task mode, collect the real-time data of the PLC devices and update it to the database;
[0012] Read the data in the database and display it.
[0013] Preferably, the task mode information includes: single task mode, multi-task mode, collection mode and collection frequency.
[0014] Preferably, starting the corresponding task mode according to the configuration of the factory server parameters includes the steps of:
[0015] When the number of the PLC devices is less than the preset value and the total number of collection points of all the PLC devices is less than the threshold, start the single task mode.
[0016] Preferably, starting the corresponding task mode according to the configuration of the factory server data includes the steps of:
[0017] When the number of the PLC devices is not less than the preset value and the total number of collection points of all the PLC devices is not less than the threshold, start the multi-task mode.
[0018] Preferably, the basic data of factory modeling includes factory code, factory name and factory type, and
[0019] The factory code is a unique code.
[0020] Preferably, the basic data of the brand includes brand code and brand name, and the brand code is a unique code.
[0021] Preferably, the basic data of the communication protocol includes protocol code, protocol name, brand to which the protocol belongs and communication protocol help class, and the protocol code is a unique code.
[0022] Preferably, the collection mode includes a fixed cycle collection mode and a collection mode for collecting data according to the change of real-time data of the collection points.
[0023] Preferably, the fixed cycle collection mode is:
[0024] A preset collection frequency;
[0025] Collect the real-time data of the PLC devices regularly according to the collection frequency.
[0026] According to another aspect of the present invention, the present invention discloses a device for real-time data acquisition and display of factory PLC devices, characterized in that when the device runs, it is used to implement a method for real-time data acquisition and display of factory PLC devices as described in any of the previous ones. The device includes:
[0027] A data configuration module, used to configure the basic data for factory modeling, configure the basic data of the brand of each PLC device, the basic data of the communication protocol, and the basic data of the production line, configure the basic data of the collection points corresponding to the PLC devices, and configure the task mode information;
[0028] A data association module, used to match the basic data for factory modeling with the basic data of the brand, the basic data of the communication protocol, and the basic data of the production line respectively, associate each PLC device with the corresponding brand, communication protocol, and production line respectively, and according to the basic data of the collection points, associate each PLC device with the corresponding collection point;
[0029] A data acquisition module, used to start the corresponding task mode according to the data configuration of the factory server, acquire the real-time data of the PLC device and update it to the database;
[0030] A data display module, used to read the data in the database and display it.
[0031] The present invention realizes the unified management of real-time data acquisition of various factory PLC devices, and has the positive significance of reducing the acquisition delay time, improving the performance of data acquisition, and reducing production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings forming a part of the specification describe embodiments of the present invention and, together with the description, are used to explain the principles of the present invention.
[0033] Figure 1 It is a schematic flow chart of the method for acquiring and displaying real-time data of PLC devices in an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0034] The following will describe various exemplary embodiments of the present invention in detail with reference to the accompanying drawings. It should be noted that: unless otherwise specifically stated, the relative arrangements, numerical expressions, and numerical values of the components and steps described in these embodiments do not limit the scope of the present invention.
[0035] At the same time, it should be understood that, for the sake of convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0036] The description of at least one exemplary embodiment below is actually only illustrative and in no way limits the present invention and its application or use.
[0037] To make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to specific embodiments and the accompanying drawings.
[0038] Technologies, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the said technologies, methods and devices should be regarded as part of the authorization specification.
[0039] In all the examples shown and discussed here, any specific values should be construed as merely exemplary and not as a limitation. Therefore, other examples of the exemplary embodiments may have different values.
[0040] It should be noted that like reference numerals and letters denote like items in the following drawings, and thus, once an item is defined in one drawing, further discussion thereof in subsequent drawings is not necessary.
[0041] Embodiment 1, as Figure 1 shown, is a schematic flowchart of a method for collecting and displaying real-time data of a PLC device. After the collection starts, it specifically includes the following steps:
[0042] Data configuration.
[0043] In the data configuration module, factory modeling basic data, PLC brand basic data, PLC communication protocol basic data, PLC device basic data, and PLC device acquisition point basic data are added to the factory server simultaneously or sequentially.
[0044] In some embodiments, the keyword fields included in the aforementioned factory modeling basic data are: factory code, factory name, factory type (such as company, factory, workshop or production line), where the factory code must be unique.
[0045] In some embodiments, the keyword fields included in the PLC device brand basic data are: brand code, brand name, where the brand code must be unique.
[0046] In some embodiments, the keyword fields included in the aforementioned PLC device communication protocol basic data are: protocol code, protocol name, affiliated brand, communication protocol help class, where the source data of the affiliated brand comes from the PLC device brand basic data, and the protocol code must be unique. Additionally, the communication protocol help class is a class library required for reading acquisition points under the PLC device.
[0047] In some embodiments, the keyword fields included in the aforementioned PLC device basic data are: device code of the PLC device, device name, affiliated brand, affiliated protocol and affiliated factory.
[0048] Among them, the source data of the affiliated brand comes from the brand basic data of the PLC device, the source data of the affiliated protocol comes from the communication protocol basic data of the PLC device, the source data of the affiliated production line comes from the factory modeling basic data (note: the factory type of the source data of the production line must be a production line to be correspondingly associated), and the device code must be unique.
[0049] In some embodiments, the key fields included in the acquisition point basic data of the PLC device are: acquisition point code, acquisition point name, data type, PLC channel register address, and affiliated device. Among them, the source data of the affiliated device comes from the basic data of the PLC device, and the acquisition point code must be unique.
[0050] In some embodiments, the source data mentioned in the above data type includes the following types:
[0051] A.Bool (Boolean type)
[0052] B.Short (short integer type)
[0053] C.UShort (unsigned short integer type)
[0054] D.Int (integer type)
[0055] E.UInt (unsigned integer type)
[0056] F.Long (long integer type)
[0057] G.ULong (unsigned long integer type)
[0058] H.Float (floating point type)
[0059] I.Double (double precision floating point type)
[0060] J.String (string type)
[0061] K.Byte (byte type)
[0062] After adding all the above basic data, add the task mode. When adding the task mode, the key fields included in the corresponding task mode information are: task mode (single task mode or multi-task mode), data acquisition mode (fixed cycle acquisition mode or value change acquisition mode), and acquisition frequency (unit: millisecond).
[0063] In some embodiments, the task mode includes a single task mode and a dual task mode:
[0064] Specifically, the single task mode is applied to the situation where there are fewer PLC devices, and the total number of acquisition points of all PLC devices is small, and the acquisition pressure is small;
[0065] The multi - task mode is applied to the following scenarios: when there are many PLC devices and a large number of acquisition points under a single PLC device, the multi - task mode is used for acquisition to share the acquisition pressure, improve the acquisition performance, and reduce the acquisition delay time. In specific applications, according to the characteristics of the single - task mode and the multi - task mode, and based on the actual situation of the factory, the corresponding task mode is selected.
[0066] In some embodiments, the data acquisition mode is specifically as follows:
[0067] 1) Fixed - cycle acquisition mode: The acquisition frequency (unit: millisecond) must be set, and data is acquired at regular intervals according to the set acquisition frequency.
[0068] 2) Value - change acquisition mode: When the real - time data of the acquisition points under the device changes, data acquisition starts.
[0069] PLC device data matching.
[0070] After the data configuration is completed, the data association module matches the factory modeling basic data with the brand basic data, communication protocol basic data, and production line basic data respectively, so as to associate each PLC device with the corresponding brand, communication protocol, and production line.
[0071] Start data acquisition.
[0072] According to the data configuration of the factory server in the previous steps, the data acquisition module selects the corresponding task mode newly added in the previous steps, and then starts all acquisition tasks. Among them, before starting the multi - task mode, multiple acquisition tasks are divided according to the number of PLC devices.
[0073] According to the configuration information of the task mode and the data information configured in the previous steps, the data acquisition module acquires the data of the acquisition points under the PLC device and updates it to the redis database.
[0074] Read and display the real - time data of the PLC device.
[0075] After acquiring the real - time data, the data display module reads the data in the redis database and displays it in the form of a list on the real - time data page of the acquisition points, thus completing the process of acquiring and displaying the real - time data of the PLC device.
[0076] The beneficial effects produced by this embodiment are as follows: By adding basic factory modeling data, the organizational structure of the factory is unified, which helps to manage and trace the storage locations of PLC devices. By adding basic data on the brands of PLC devices, communication protocols, PLC device basic data, and collection point basic data of PLC devices, all PLC devices and collection points can be classified and managed according to device brands and affiliated communication protocols. Especially in the case of a large number of PLC device brands and communication protocols, using the method provided by the present invention, when there are many PLC devices and many collection points under a single PLC device, the multi-task mode can be used for data collection to share the collection pressure.
[0077] The following will make a detailed description of the present invention in combination with actual examples.
[0078] Step 1: Add basic factory modeling data to the factory server
[0079] As shown in Table 1, add a company A1, a factory A2, a workshop A3, and three production lines a, b, and c;
[0080] Table 1 Basic factory modeling data added to the factory server
[0081]
[0082] Step 2: Add basic PLC brand data to the factory server
[0083] As shown in Table 2, add basic data for three PLC brands, namely Mitsubishi, Siemens, and Omron. Among them, the brand codes must be unique;
[0084] Table 2 Basic PLC brand data added to the factory server
[0085] Brand Code Brand Name Melsec Mitsubishi Siemens Siemens Omron Omron
[0086] Step 3: Add basic PLC communication protocol data to the factory server
[0087] As shown in Table 3, add three protocol libraries, namely S7-1200, EtherNet / IP (CIP), and Fins-Tcp. According to the brand information added in Table 2, they are respectively associated with the three brands of Siemens, Mitsubishi, and Omron. Among them, the protocol codes must be unique. In addition, the communication protocol help class is a class library required for reading the collection points under PLC devices;
[0088] Table 3 Basic PLC communication protocol data added to the factory server
[0089] Protocol Code Protocol Name Belonging Brand Communication Protocol Helper Class Name S7-1200 S7-1200 Siemens SiemensHelper MelsecCIP EtherNet / IP (CIP) Mitsubishi MelsecHelper FinsTcp Fins-Tcp Omron OmronHelper
[0090] Step 4: Add basic PLC device data to the factory server
[0091] As shown in Table 4, three PLC devices, namely Device A, Device B, and Device C, are newly added. According to the factory modeling basic data in Table 1, the brand basic data in Table 2, and the communication protocol basic data in Table 3, Devices A, B, and C are respectively associated with the corresponding production lines, brands, and protocols. The device codes must be unique.
[0092] Table 4 Newly added basic data of PLC devices in the factory server
[0093]
[0094] Step 5: Add basic data of PLC device acquisition points in the factory server
[0095] As shown in Table 5, three acquisition points are newly added. According to the brand basic data in Table 2, the three acquisition points are respectively associated with the corresponding PLC devices. The acquisition point numbers must be unique.
[0096] Table 5 Newly added basic data of PLC device acquisition points in the factory server
[0097]
[0098]
[0099] As shown in Table 6, a total of 99 acquisition points with acquisition point codes from PlcPointsD01 to PlcPointsD99, 99 acquisition points from PlcPointsE01 to PlcPointsE99, and 99 acquisition points from PlcPointsF01 to PlcPointsF99 are newly added and respectively associated with the corresponding PLC devices. Devices D, E, and F of the PLC devices also need to be newly added in advance like Devices A, B, and C. The acquisition point codes must also be unique.
[0100] Table 6 Newly added acquisition point code information
[0101] Collection Point Code Collection Point Name Data Type Register Address Belonging Device PlcPointsD01 D01 Collection Point Int DB4.001 D Device ... ... ... ... D Device PlcPointsD99 D99 Collection Point Bool DB4.099 D Device PlcPointsE01 E01 Collection Point Short DB5.001 E Device ... ... ... ... E Device PlcPointsE99 E99 Collection Point Long DB5.099 E Device PlcPointsF01 F01 Collection Point String DB6.001 F Device ... ... ... ... F Device PlcPointsF99 F99 Collection Point Float DB6.099 F Device
[0102] Step 6: Add task modes in the factory server
[0103] As shown in Table 7, information on two task modes, namely single - task mode and multi - task mode, is newly added. The task mode data includes task code, task mode, acquisition mode, and acquisition frequency (in milliseconds) information:
[0104] Table 7 Newly added task mode information in the factory server
[0105] Task Code Task Mode Collection Mode Collection Frequency (milliseconds) Job01 Single Task Fixed Period 1000 Job02 Multi-Task Value Change -
[0106] 1) Single-task mode: The data collection points of all devices are collected in one collection task, which is mainly applicable when there are few devices, the total number of collection points of all devices is small, and the single-task collection pressure is small;
[0107] 2) Multi-task: Add the same number of collection tasks according to the number of devices for data collection, which is mainly applicable when there are many devices, and the number of collection points under a single PLC device is large. Multi-task collection is used to share the collection pressure, improve the collection performance, and reduce the collection delay time;
[0108] 3) Fixed-cycle collection mode: The collection frequency (unit: millisecond) must be set, and data is collected regularly according to the set collection frequency;
[0109] 4) Value-change collection mode: When the real-time data of the collection points under the device changes, the data is collected; Step 7. According to the configuration of the factory server, select one of the task modes to start the task, and collect the data of the collection points under the device and update it to the redis database according to the set parameter configuration information, and then display it in the form of a list.
[0110] Specifically, now assume that data collection simulations are carried out for two task modes respectively:
[0111] 1) Now select a single-task mode according to the actual situation of the factory, the collection mode is fixed cycle, the collection frequency is 1000 milliseconds, and the collection task with the task number Job01 is started. As shown in Table 8, according to the 3 newly added collection points in Table 5, combined with the basic data configured in Tables 1, 2, and 4, and the communication protocol help class configured in Table 3, data is collected from the PLC device in turn, updated to the redis database, and finally the real-time data is displayed in the form of a list;
[0112] Table 8 Real-time data display
[0113]
[0114] 2) Select the task mode as multi-task mode, the collection mode as value change, and the collection task with the task number Job02 according to the actual situation of the factory, and start the task. As shown in Table 9, take the task mode with the number Job2 as the main task and split it into 3 sub-tasks: Task01, Task02, and Task03 according to the number of devices. Each task only performs the data collection operation of the same device;
[0115] Table 9 Task number information
[0116] Main Task Number Sub-Task Number Belonging Device Job02 Task01 D Device Job02 Task02 E Device Job02 Task03 F Device
[0117] As shown in Table 10, we collected data from 99 collection points under 3 devices according to the 3 sub-tasks split from Table 9. We collected data from the PLC device in sequence with the basic data configured in Tables 1, 2, and 4 and the communication protocol assistance class configured in Table 3, and updated it to the redis database. Finally, the real-time data was displayed in the form of a list, as shown in Table 10.
[0118] Table 10 The collected data after update
[0119]
[0120] In summary, the present invention has the positive significance of improving the acquisition performance, reducing the acquisition delay time, and reducing the cost; generally, it can improve the efficiency and accuracy of viewing the real-time information of the PLC device, and further reduce the management cost.
[0121] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle scope of the present invention shall be included in the protection scope of the present invention.
[0122] It should also be noted that the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent in such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of another identical element in the process, method, commodity or device including the element.
Claims
1. A method for real-time data acquisition and display of factory PLC devices, the method comprising: Configuring the basic data for factory modeling; Configuring the basic data of the brand, communication protocol, and production line for each PLC device; Matching the factory modeling basic data with the brand basic data, the communication protocol basic data, and the production line basic data respectively, and associating each PLC device with the corresponding brand, communication protocol, and production line; Configuring the basic data of the acquisition points corresponding to the PLC devices; The basic data of the acquisition points includes: acquisition point code, acquisition point name, data type, PLC channel register address, and the affiliated device, where the source data of the affiliated device comes from the brand basic data of the PLC device, and the acquisition point code must be unique; Associating each PLC device with the corresponding acquisition point according to the basic data of the acquisition points; Configuring the task mode information; The task mode information includes: single task mode, multi-task mode, acquisition mode, and acquisition frequency; Starting the corresponding task mode according to the data configuration of the factory server includes the steps of: Starting the single task mode when the number of the PLC devices is less than the preset value and the total number of acquisition points of all the PLC devices is less than the threshold; Starting the multi-task mode when the number of the PLC devices is not less than the preset value and the total number of acquisition points of all the PLC devices is not less than the threshold; The acquisition mode includes a fixed-period acquisition mode and an acquisition mode for acquiring data according to the real-time data change of the acquisition points; The fixed-period acquisition mode is: The preset acquisition frequency; Timing the acquisition of the real-time data of the PLC devices according to the acquisition frequency; Starting the corresponding task mode according to the data configuration of the factory server, acquiring the real-time data of the PLC devices and updating it to the redis database; Reading and displaying the data in the redis database, the specific steps include: reading the data in the redis database and displaying it in the form of a list on the acquisition point real-time data page, completing the process of acquiring and displaying the real-time data of the PLC devices.
2. The method according to claim 1, wherein The factory modeling basic data includes factory code, factory name, and factory type, and the factory code is a unique code.
3. The method according to claim 1, characterized in that, The brand basic data includes brand code and brand name, and the brand code is a unique code.
4. The method according to claim 1, wherein The communication protocol basic data includes protocol code, protocol name, protocol affiliated brand, and communication protocol help class, and the protocol code is a unique code.
5. A device for real-time data acquisition and display of a factory PLC device, characterized in that, When the device is running, it is used to implement a method for real-time data acquisition and display of factory PLC devices as described in any one of claims 1-4, the device includes: A data configuration module, used to configure the basic data for factory modeling, configure the basic data of the brand, communication protocol, and production line for each PLC device, configure the basic data of the acquisition points corresponding to the PLC devices, and configure the task mode information; A data association module, which is used to match the factory modeling basic data with the brand basic data, the communication protocol basic data, and the production line basic data respectively, associate each PLC device with the corresponding brand, communication protocol, and production line respectively, and associate each PLC device with the corresponding collection point according to the collection point basic data; A data acquisition module, which is used to start the corresponding task mode according to the data configuration of the factory server, acquire the real-time data of the PLC device and update it to the database; A data display module, which is used to read and display the data in the database.
Citation Information
Patent Citations
Data acquisition method and system
CN108073685A
Data acquisition monitoring system
CN109782710A