Data acquisition methods, devices, equipment, storage media, and data processing systems
By collecting and uploading data in batches during PLC idle and busy states, the problem of excessive PLC load or incomplete data is solved, achieving efficient collection and storage of full data.
Patent Information
- Application Number
- CN202311516194.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-11-14
AI Technical Summary
Existing technologies, when collecting data from programmable logic controllers (PLCs), either directly collect the full amount of data, which increases the operating load of the PLC and prevents it from operating normally, or collect only a portion of the data, which results in incomplete data.
By sending data acquisition requests to the PLC, recording the response time, determining the waiting time based on the PLC's idle/busy status, collecting data in batches and uploading it to the database, the system ensures that the PLC operates normally while acquiring all the data.
Without affecting the normal operation of the PLC, it achieves the acquisition and storage of all PLC data, ensuring the integrity and accuracy of the data.
Smart Images

Figure CN117707035B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to a data acquisition method, apparatus, device, storage medium, and data processing system. Background Technology
[0002] A Programmable Logic Controller (PLC) is a real-time data exchange system that is typically used to connect with various testing instruments to detect and acquire the operating status and data of various devices, and then control the industrial equipment based on the acquired operating status and data.
[0003] However, if the data acquired by the PLC (such as the operating status and operating data of the equipment) is not saved, the historical data will be overwritten and lost as the PLC acquires new data. Therefore, how to collect and store the data acquired by the PLC is a key concern. Currently, there are two main methods for collecting historical data acquired by the PLC: the first is to directly collect all the data acquired by the PLC; the second is to manually configure the PLC to collect only a portion of the data.
[0004] However, while the first acquisition method can collect all the data obtained by the PLC, the large amount of data collected increases the operating load of the PLC, causing it to malfunction. The second acquisition method results in incomplete data collection, leading to an incomplete data volume. Therefore, how to ensure the normal operation of the PLC while collecting all its data has become an urgent technical problem to be solved. Summary of the Invention
[0005] To address the aforementioned technical problems, this disclosure provides a data acquisition method, apparatus, device, storage medium, and data processing system.
[0006] A first aspect of this disclosure provides a data acquisition method, including:
[0007] Send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data;
[0008] The idle / busy state of the programmable logic controller is determined based on the first duration;
[0009] The first waiting time for sending the second data acquisition request to the programmable logic controller is determined based on the idle / busy state of the programmable logic controller.
[0010] After the first waiting period, a second data acquisition request is sent to the programmable logic controller (PLC), and the second data returned by the PLC based on the second data acquisition request is received. The second time required for the PLC to return the second data is recorded.
[0011] Upload the first and second data to the preset database.
[0012] A second aspect of this disclosure provides a data acquisition device, comprising:
[0013] The first transmission module is used to send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data.
[0014] The first determining module is used to determine the idle / busy state of the programmable logic controller based on a first duration;
[0015] The second determining module is used to determine the first waiting time for sending the second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller;
[0016] The second transmission module is used to send a second data acquisition request to the programmable logic controller after the first waiting time, and to receive the second data returned by the programmable logic controller based on the second data acquisition request, and to record the second time required for the programmable logic controller to return the second data.
[0017] The data upload module is used to upload the first and second data to a preset database.
[0018] A third aspect of this disclosure provides a data acquisition device, including:
[0019] processor;
[0020] Memory, used to store executable instructions;
[0021] The processor is used to read executable instructions from memory and execute the executable instructions to implement the data acquisition method provided in the first aspect above.
[0022] A fourth aspect of this disclosure provides a data processing system, including a data acquisition device, a server, and a data processing device, wherein the data acquisition device, the server, and the data processing device are connected in communication.
[0023] The data acquisition device is the data acquisition device provided in the third aspect above;
[0024] The server includes a pre-set database for storing data collected by the data acquisition devices;
[0025] A data processing device is used to send a data acquisition request to at least one of a data acquisition device and a server to obtain data collected by the data acquisition device, process the data, and perform operations corresponding to the processing results.
[0026] A fifth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the data acquisition method provided in the first aspect.
[0027] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0028] The data acquisition method, apparatus, device, storage medium, and data processing system provided in this disclosure can send a first data acquisition request to a programmable logic controller (PLC), receive first data returned by the PLC based on the first data acquisition request, record a first duration required for the PLC to return the first data, determine the idle / busy state of the PLC based on the first duration, determine a first waiting time for sending a second data acquisition request to the PLC based on the idle / busy state of the PLC, send a second data acquisition request to the PLC after the first waiting time, receive second data returned by the PLC based on the second data acquisition request, record a second duration required for the PLC to return the second data, and upload the received first and second data to a preset database. Therefore, when acquiring data from the PLC, the idle / busy state of the PLC can be considered, and the frequency of sending data acquisition requests can be determined based on the idle / busy state of the PLC, thereby ensuring that the normal operation of the PLC is not affected while acquiring all the data from the PLC. Attached Figure Description
[0029] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0030] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 This is a flowchart of a data acquisition method provided in an embodiment of this disclosure;
[0032] Figure 2This is a flowchart illustrating how to determine the idle / busy state of a programmable logic controller according to an embodiment of this disclosure;
[0033] Figure 3 This is a flowchart of a method for determining the waiting time based on the idle / busy state of a programmable logic controller, provided in an embodiment of this disclosure.
[0034] Figure 4 This is a flowchart of another data acquisition method provided in this embodiment of the disclosure;
[0035] Figure 5 This is a flowchart of a data playback method provided in an embodiment of this disclosure;
[0036] Figure 6 This is a schematic diagram of the structure of a data acquisition device provided in an embodiment of this disclosure;
[0037] Figure 7 This is a schematic diagram of the structure of a data playback device provided in an embodiment of this disclosure;
[0038] Figure 8 This is a schematic diagram of the structure of a data processing system provided in an embodiment of this disclosure. Detailed Implementation
[0039] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0040] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0042] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0043] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0044] Generally, there are two main methods for collecting historical data from a PLC: the first is to directly collect all the data acquired by the PLC; the second is to manually configure the PLC to collect only a portion of the data. However, while the first method can collect all the data from the PLC, the large amount of data increases the PLC's operating load, potentially causing it to malfunction. The second method results in incomplete data collection. To address this issue, this disclosure provides a data acquisition method, which will be described below with reference to specific embodiments.
[0045] Figure 1 This is a flowchart of a data acquisition method provided in an embodiment of the present disclosure. The method can be executed by a data acquisition device, which can be implemented in software and / or hardware. The data acquisition device can be configured in a data acquisition equipment, such as a server or terminal.
[0046] like Figure 1 As shown, the data acquisition method provided in this embodiment includes the following steps.
[0047] S110. Send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data.
[0048] In this embodiment of the disclosure, a programmable logic controller (PLC) is a real-time data exchange system, which is typically used to connect with various testing instruments to acquire the operating status and operating data of various devices.
[0049] When the data acquisition device needs to acquire data from the programmable logic controller (PLC), it retrieves a variable table from the configuration file and generates a data acquisition request based on the size of the data to be acquired in the variable table. The variable table includes the size of the data to be acquired, the location information of the data to be acquired in the PLC, the identification information of the PLC corresponding to the data to be acquired, the variable name, variable type, block type, and block number corresponding to all the data to be acquired, and sends the data acquisition request to the PLC.
[0050] Specifically, the data acquisition device sends a first data acquisition request to the programmable logic controller (PLC), receives the first data returned by the PLC based on the first data acquisition request, and after receiving the first data, calculates the difference between the first time and the second time based on the first time of sending the first data acquisition request and the second time of receiving the first data, determines the first duration required for the PLC to return the first data based on the difference, and records the first duration.
[0051] In this embodiment of the disclosure, the first data acquisition request can be either the first data acquisition request sent or a data acquisition request sent before.
[0052] S120. Determine the idle / busy state of the programmable logic controller based on the first duration.
[0053] In this embodiment of the disclosure, after recording a first duration, the data acquisition device determines the idle / busy state of the programmable logic controller based on the first duration.
[0054] The idle / busy state of the programmable logic controller can include a first state, a second state, and a third state. The first state indicates that the programmable logic controller is in a busy state. The second state indicates the state in which the programmable logic controller needs to trigger an additional waiting time after entering the first state every preset period of time. The preset period of time is determined based on the time when the number of warning messages issued reaches a preset warning threshold. The third state indicates that the programmable logic controller is in an unbusy state.
[0055] In the second state, the increased waiting time is significantly greater than the waiting time when the programmable logic controller (PLC) is in the first state. In other words, while the waiting time for sending the second data acquisition request increases slowly when the PLC is in the first state, the second state indicates that the PLC is busy throughout a preset period. Therefore, based on the waiting time for sending the second data acquisition request determined in the first state, the waiting time is further increased substantially to alleviate the PLC's workload.
[0056] In some embodiments of this disclosure, when the first data acquisition request is the first data acquisition request sent, the programmable logic controller is directly determined to be in the third state, i.e., the unbusy state.
[0057] In other embodiments of this disclosure, when the first data acquisition request is not the first data acquisition request sent, the idle / busy state of the programmable logic controller is determined based on whether the first duration is greater than a preset time threshold.
[0058] In some embodiments of this disclosure, when the first data acquisition request is a data acquisition request exceeding a preset number of times, the idle / busy state of the programmable logic controller (PLC) is determined based on whether the first duration is greater than a preset time threshold. When the first data acquisition request is a data acquisition request not exceeding the preset number of times, the PLC is directly determined to be in the third state, i.e., the unbusy state. For example, the preset number of times is 3. If the first data acquisition request is the first 3 data acquisition requests, the PLC is directly determined to be in the third state, i.e., the unbusy state. If the first data acquisition request is the 4th or subsequent data acquisition requests, the idle / busy state of the PLC is determined based on whether the first duration is greater than a preset time threshold. The preset number of times can be set according to the user's specific needs and is not limited here.
[0059] S130. Determine the first waiting time for sending the second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller.
[0060] In some embodiments of this disclosure, when the data acquisition device determines that the programmable logic controller is in the third state, i.e., the unbusy state, it directly sets the first waiting time to zero, i.e., it does not need to wait and directly sends the second data acquisition request to the programmable logic controller.
[0061] In other embodiments of this disclosure, when the data acquisition device determines that the programmable logic controller is in a busy state, it determines a first waiting time based on the waiting time corresponding to the previous data acquisition request before the first data acquisition request.
[0062] S140. After the first waiting period, send a second data acquisition request to the programmable logic controller and receive the second data returned by the programmable logic controller based on the second data acquisition request, and record the second time required for the programmable logic controller to return the second data.
[0063] In this embodiment of the disclosure, after determining a first waiting time, the data acquisition device sends a second data acquisition request to the programmable logic controller (PLC) after waiting for the first waiting time, and receives the second data returned by the PLC based on the second data acquisition request, and records the second time required for the PLC to return the second data.
[0064] The first data acquisition request and the second data acquisition request are different data acquisition requests corresponding to the same acquisition cycle.
[0065] S150. Upload the first data and the second data to the preset database.
[0066] In this embodiment of the disclosure, the preset database can be at least one of a database in a server, a cloud database, or a database in a data acquisition device, and there is no limitation herein.
[0067] The database to which data is uploaded can be determined based on the size of the first and second data, as well as the collection and storage times of the first and second data.
[0068] Specifically, after acquiring the first data and the second data, the data acquisition device determines the upload type of the first data and the second data. If the upload type of the first data and the second data is determined to be full data upload, the first data and the second data are directly uploaded to the preset database. If the first data and the second data are determined to be partial data upload, the target data to be uploaded is determined and the target data is uploaded to the preset database.
[0069] In this embodiment, a first data acquisition request can be sent to a programmable logic controller (PLC), first data returned by the PLC based on the first data acquisition request can be received, and a first duration required for the PLC to return the first data can be recorded. Based on the first duration, the idle / busy state of the PLC can be determined, and then a first waiting time for sending a second data acquisition request to the PLC can be determined based on the idle / busy state of the PLC. After the first waiting time, a second data acquisition request can be sent to the PLC, and second data returned by the PLC based on the second data acquisition request can be received. The second duration required for the PLC to return the second data can be recorded, and the received first and second data can be uploaded to a preset database. Thus, when collecting data acquired by the PLC, the idle / busy state of the PLC can be taken into account, and the frequency of sending data acquisition requests can be determined based on the idle / busy state of the PLC, thereby ensuring that the normal operation of the PLC is not affected while collecting all the data of the PLC.
[0070] Based on the above embodiments disclosed herein, the process of determining the idle / busy state of the programmable logic controller based on a first duration is further described in detail when the first data acquisition request is a non-first-time data acquisition request.
[0071] Figure 2 This is a flowchart illustrating how to determine the idle / busy state of a programmable logic controller according to an embodiment of this disclosure, such as... Figure 2 As shown, determining the idle / busy state of a programmable logic controller based on a first duration may include the following steps:
[0072] S210. Calculate the first average value by averaging the first duration with the data return duration corresponding to at least one historical data collection request before the first data collection request.
[0073] In this embodiment of the disclosure, at least one historical data collection request can be understood as one or more data collection requests sent before the first data collection request, wherein each data collection request corresponds to a data return duration.
[0074] Specifically, after obtaining the first duration, the data acquisition device obtains the data return duration corresponding to all historical data acquisition requests prior to the first data acquisition request, adds the first duration to the data return duration corresponding to all historical data acquisition requests, and calculates the average to obtain the first average value.
[0075] For example, the first data acquisition request is the fourth data acquisition request. After obtaining the first duration, the data return durations T1, T2 and T3 corresponding to the first to third data acquisition requests are obtained respectively. The first duration is summed with T1, T2 and T3 and the average value is calculated. The calculated average value is determined as the first average value.
[0076] S220. Obtain at least one second average value corresponding to at least one historical data collection request prior to the first data collection request.
[0077] In this embodiment of the disclosure, the second average value is the average value corresponding to the historical data collection request. The specific calculation method is similar to the calculation method of obtaining the first average value in S210, and will not be described in detail here.
[0078] Specifically, after obtaining the second average value corresponding to each historical data acquisition request, the data acquisition device records and stores the second average value corresponding to the historical data acquisition request in a preset location, so that at least one second average value can be directly obtained from the preset location.
[0079] For example, when the first data acquisition request is the fourth data acquisition request, the number of second average values is 2, that is, the average value corresponding to the third data acquisition request and the average value corresponding to the second data acquisition request. The average value corresponding to the third data acquisition request is the average value of the data return time corresponding to the first to third data acquisition requests respectively, and the average value corresponding to the second data acquisition request is the average value of the data return time corresponding to the first and second data acquisition requests respectively.
[0080] S230. Select the minimum average value from the first average value and at least one second average value.
[0081] Specifically, after obtaining the first average value and at least one second average value, the data acquisition device sorts the first average value and at least one second average value, determines the smallest average value among the first average value and at least one second average value, and identifies it as the minimum average value.
[0082] In some embodiments of this disclosure, the minimum target average value corresponding to a historical data acquisition request that precedes and is adjacent to the first data acquisition request is directly obtained. The first average value is directly compared with the minimum target average value corresponding to the historical data acquisition request that precedes and is adjacent to the first data acquisition request, and the minimum value between the first average value and the minimum target average value is determined and set as the minimum average value. This improves the efficiency of obtaining the minimum average value corresponding to the first data acquisition request and improves the efficiency of data acquisition.
[0083] For example, when the first data acquisition request is the 100th data acquisition request, the minimum target average value corresponding to the 99th data acquisition request is directly obtained. The minimum target average value corresponding to the 99th data acquisition request is the minimum average value determined when calculating the waiting time corresponding to sending the 100th data acquisition request.
[0084] S240. Calculate the first product of the first preset value and the minimum average value, and compare the first duration with the first product.
[0085] In this embodiment of the disclosure, the first preset value is a pre-set value used to determine the waiting time. The first preset value can be set differently according to the needs of different users and the operating parameters of the device. For example, the first preset value can be 3, 4, etc.
[0086] In this embodiment of the disclosure, when the comparison result of the first duration and the first product is that the first duration is greater than or equal to the first product, S250 is executed; when the comparison result of the first duration and the first product is that the first duration is less than the first product, the state of the programmable logic controller corresponding to the data acquisition request sent this time is determined to be the third state.
[0087] S250: When the first duration is greater than or equal to the first product, obtain the number of times the warning information is issued, and determine whether the programmable logic controller is in the first state or the second state based on the number of times the warning information is issued.
[0088] In this embodiment of the disclosure, the warning information is issued when it is determined that the programmable logic controller is in a first state. The first state indicates that the programmable logic controller is in a busy state, and the busy level of the programmable logic controller corresponding to the second state is higher than that of the programmable logic controller corresponding to the first state.
[0089] S260. When the number of warning messages issued is less than or equal to the preset warning threshold, the programmable logic controller is determined to be in the first state, and a warning message is issued, and the number of warning messages issued is recorded.
[0090] In this embodiment of the disclosure, the preset warning threshold is a pre-set threshold used to determine whether the programmable logic controller is in a first state or a second state.
[0091] S270. When the number of warning messages issued exceeds the preset warning threshold, the programmable logic controller is determined to be in the second state, and the number of warning messages issued is cleared to zero.
[0092] In this embodiment of the disclosure, when the number of times the data acquisition device issues warning messages equals the preset warning threshold, it indicates that the programmable logic controller (PLC) is busy. Therefore, the PLC is determined to be in the second state, and the number of warning messages issued when the PLC is in the first state is cleared to zero. When the number of warning messages issued is greater than the preset warning threshold, the number of warning messages issued is kept cleared to zero.
[0093] Furthermore, Figure 3 A flowchart is provided for a method to determine the waiting time based on the idle / busy state of a programmable logic controller, as shown below. Figure 3 As shown, the method for determining the waiting time based on the idle / busy state of a programmable logic controller includes the following steps:
[0094] S310. Determine whether the programmable logic controller is in the first state or the second state.
[0095] In this embodiment, the specific implementation of S310 is similar to the implementation of determining whether the programmable logic controller is in the first state or the second state in the above embodiments, and will not be described in detail here.
[0096] S320. When it is determined that the programmable logic controller is in the first state, calculate the second product of the second preset value and the minimum average value. When the number of warning messages issued is less than or equal to the preset warning threshold, determine the first waiting time as the sum of the second waiting time corresponding to the last data acquisition request and the second product.
[0097] In this embodiment of the disclosure, when the programmable logic controller is first determined to be in the first state, that is, when the programmable logic controller was in the third state (i.e., not busy) before, the second waiting time corresponding to the previous data acquisition request is 0, that is, the first waiting time is the second product; when the programmable logic controller is not first determined to be in the first state, the second waiting time corresponding to the previous data acquisition request is not 0, and the sum of the second waiting time corresponding to the previous data acquisition request and the second product is determined as the first waiting time.
[0098] In this embodiment of the disclosure, the second preset value is predetermined based on the user's needs and the operating parameters of the device.
[0099] For example, taking the fourth data acquisition request as the first data acquisition request, if the number of warning messages issued during the fourth data acquisition request is 1, it indicates that the programmable logic controller (PLC) is detected to be in the first state for the first time. In this case, the first product of the first preset quantity and the minimum average value is directly determined as the first waiting time. If the number of warning messages issued during the fourth data acquisition request is 3, that is, the PLC is detected to be in the first state multiple times, it indicates that the PLC is relatively busy. In this case, the waiting time should be increased based on the second waiting time corresponding to the second data acquisition request. That is, the sum of the second waiting time and the first product of the first preset quantity and the minimum average value is determined as the first waiting time, so as to slow down the frequency of sending data acquisition requests and thus ensure the normal operation of the PLC.
[0100] S330. When it is determined that the programmable logic controller is in the second state, calculate the third product of the third preset value and the minimum average value, and determine the first waiting time as the sum of the second waiting time corresponding to the previous data acquisition request and the third product.
[0101] In this embodiment of the disclosure, the third preset value is predetermined based on the user's needs and the operating parameters of the device.
[0102] In this embodiment of the disclosure, the third preset value is greater than or much greater than the second preset value, that is, the third product is greater than the second product. For example, the second preset value is 2, and the second preset value may be 20. This is just an example and is not intended to limit the value or relationship of the second preset value and the third preset value.
[0103] In some embodiments of this disclosure, a third preset value when the programmable logic controller (PLC) is in the second state is greater than a second preset value when the PLC is in the first state, so that the waiting time for sending the next data acquisition request when the PLC is in the second state is longer, thereby significantly or more effectively alleviating the busyness of the PLC.
[0104] Furthermore, when the programmable logic controller is determined to be in the second state, after determining the sum of the second and third products corresponding to the previous data acquisition request as the first waiting time, the third waiting time corresponding to the next data acquisition request is determined based on the second duration of the second data acquisition request, the second preset value, and the number of warning messages issued. That is, only when the programmable logic controller is in the second state (i.e., when the number of warning messages issued is greater than the preset warning threshold) will the waiting time for sending the next data acquisition request be increased by the product of the third preset value and the minimum average value based on the waiting time of the previous data acquisition request. Otherwise, the waiting time for the next data acquisition request is always increased by the product of the second preset value and the minimum average value based on the waiting time of the previous data acquisition request, where the minimum average value is always the minimum average value corresponding to the previous data acquisition request.
[0105] For example, the preset warning threshold is 10, the first data acquisition request is the 20th data acquisition request, and when the 20th data acquisition request is sent, the number of warning messages issued is 11. Then, the programmable logic controller (PLC) is determined to be in the second state, and the number of warning messages issued is reset to zero. At this time, the condition for triggering an increase in the waiting time is met. The waiting time for sending the 21st data acquisition request (the second data acquisition request) is determined as the sum of the product of the waiting time for sending the 20th data acquisition request, a third preset value, and the minimum average value corresponding to the 20th data acquisition request. Based on the target duration of the returned data corresponding to the 21st data acquisition request, the minimum average value corresponding to the 21st data acquisition request is determined. When the target duration is greater than the first preset value and the number of warning messages issued is 11, the PLC is determined to be in the second state. When the minimum average value corresponding to 21 data acquisition requests is reached, an early warning message is issued, and the recording of the number of early warning messages issued is restarted. The number of early warning messages issued is set to 1. At this time, when determining the waiting time corresponding to the 22nd data acquisition request, the sum of the product of the waiting time corresponding to the 21st data acquisition request, the second preset value, and the minimum average value corresponding to the 21st data acquisition request is determined as the waiting time corresponding to the 22nd data acquisition request. This process continues until the number of early warning messages issued exceeds the preset early warning threshold. Only then will the condition for increasing the waiting time be triggered. At this time, the waiting time of the previous data acquisition request, the third preset value, and the minimum average value corresponding to the previous data request are determined as the waiting time for sending the next data acquisition request.
[0106] In this embodiment of the disclosure, the idle / busy state of the programmable logic controller can be determined based on a first duration, and the first waiting duration can be determined based on the number of times the programmable logic controller issues warning information when it is in the first state. This improves the flexibility of adjusting the frequency of sending data acquisition requests and further ensures that the normal operation of the programmable logic controller is not affected while collecting all the data of the programmable logic controller.
[0107] The following example, starting with the first data acquisition request, demonstrates the process. First, a first data acquisition request is sent to the programmable logic controller (PLC). Data 1 is returned by the PLC based on this request, and the time (1) required for the PLC to return data 1 is recorded. At this point, without waiting, a second data acquisition request is sent directly to the PLC. Data 2 is returned by the PLC based on this request, and the time (2) required for the PLC to return data 2 is recorded. The average of time 1 and time 2 (1) is calculated. The product (1) of a first preset value and the average (1) is calculated. Time 2 is compared to the product (1). If time 2 is less than or equal to the product (1), it indicates that the PLC is in a state of readiness. In the third state, which is the non-busy state, the third data acquisition request is sent directly. If the duration 2 is greater than the product 1, it indicates that the programmable logic controller (PLC) is in the first state (which can be understood as a relatively busy state), and an early warning message is issued. The number of times the early warning message is issued is recorded as 1. At the same time, the product 2 of the second preset value and the average value 1 is calculated, and the product 2 is determined as the waiting duration 1 corresponding to sending the third data acquisition request. After waiting for the third data acquisition request, the third data acquisition request is sent to the PLC, and the data 3 returned by the PLC based on the third data acquisition request is received. The duration 3 required for the PLC to return data 3 is recorded, and the average value 2 of duration 3, duration 1, and duration 2 is calculated. The average value 2 and the average value 3 are then processed. The algorithm compares the values and selects the minimum average. Assuming average 3 is the minimum average, it calculates the product of the first preset value and average 3 (3). It then compares the duration 3 with this product. If duration 3 is greater than the product, the programmable logic controller (PLC) is in the first state and issues a warning message. The number of warning messages issued is recorded as 2. Simultaneously, it calculates the product of the second preset value and average 3 (4). The sum of the waiting duration 1 and the product 4 is determined as the waiting duration 2 corresponding to the fourth data acquisition request. Similarly, the waiting duration N for subsequent data acquisition requests is calculated sequentially. When the number of times a preset message is issued exceeds a preset warning threshold, the PLC is determined to be in the second state, and the number of warning messages issued is reset to zero. At this point, the second preset value... The value is adjusted to the third preset value, which is greater than the second preset value. At the same time, the sum of the products of the waiting time for sending the last data acquisition request and the third preset value and the minimum average value corresponding to the last data acquisition request is determined as the waiting time for sending the next data acquisition request. Since the number of warning messages issued is reset to zero, when determining the waiting time for subsequent data acquisition requests, the number of warning messages issued is used to determine whether the waiting time for sending data acquisition requests is based on the sum of the products of the second preset value and the minimum average value or on the sum of the products of the third preset value and the minimum average value. The specific calculation method is similar to the method for calculating the waiting time when the programmable logic controller is in the first state, and will not be elaborated here.
[0108] In some embodiments of this disclosure, when the programmable logic controller (PLC) is first determined to be in a first state, during the actual data acquisition process, when the PLC's state recovers from busy to idle, in order to quickly adjust the frequency of sending data acquisition requests to the PLC, a target average value can be reduced based on the determined waiting time. This reduction occurs each time, regardless of whether the first waiting time is greater than or equal to the product or less than the product. The target average value is the minimum average value corresponding to each data acquisition request, until the waiting time corresponding to the next data acquisition request is 0. For example, when the first data acquisition request is the 4th data acquisition request, and the PLC is first determined to be in the first state based on the first waiting time, the first waiting time corresponding to the first data acquisition request is determined to be N*A1, where N is a preset quantity corresponding to the first state, and A1 is the minimum average value corresponding to the first data acquisition request. In this case, a target average value, A1, can be reduced after determining the first waiting time.
[0109] In this embodiment of the disclosure, before uploading the first data and the second data to a preset database, the data acquisition method may further include: determining the upload type of the first data and the second data, wherein the upload type includes two types: full data upload and partial data upload.
[0110] Specifically, the data acquisition device can determine the upload type of the first and second data based on whether the data acquisition request corresponding to the traffic table is the first time it is sent (i.e., whether the acquisition period corresponding to the data acquisition request is the first acquisition period). When it is determined that the data acquisition request corresponding to the traffic table is the first time it is sent, the upload type of the first and second data is determined to be full data upload. When it is determined that the data acquisition request corresponding to the traffic table is not the first time it is sent, the upload type of the first and second data is determined to be partial data upload.
[0111] If the upload type of the first data and the second data is determined to be full data upload, then both the first data and the second data will be directly uploaded to the preset database.
[0112] When the upload type of the first data and the second data is determined to be partial data upload, uploading the first data and the second data to the preset database may specifically include: comparing the first data with the first historical data located at the corresponding position of the first data in the preset database, and simultaneously comparing the second data with the second historical data located at the corresponding position of the second data in the preset database, wherein the first historical data and the second historical data are data collected in adjacent collection cycles of the first data collection request and the second data collection request; uploading the first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data to the preset database.
[0113] The first data location refers to the location of the variable value corresponding to the variable name of the first data in the flow table.
[0114] For example, during the first data collection, the device's first operating parameter is 1 (first historical data). During the second data collection, the device's first operating parameter is still 2 (first data). At this time, it is determined that the device's operating parameter has changed, and the first data is uploaded. During the first data collection, the device's second operating parameter is 3 (second historical data). During the second data collection, the device's second operating parameter is still 3 (second data). At this time, it is determined that the device's operating parameter has not changed, and the second data is not uploaded.
[0115] In this embodiment of the disclosure, the data upload type can be determined according to the data collection cycle, thereby improving data upload efficiency while ensuring comprehensive data volume.
[0116] After uploading the first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data to the preset database, the data acquisition method may further include: obtaining the target data corresponding to at least one data acquisition request in the next acquisition cycle; when the interval between the next acquisition cycle and the acquisition cycle corresponding to the first data acquisition request meets the preset interval time, determining the upload type of the target data as full data upload, and uploading the target data to the preset database.
[0117] In this embodiment of the disclosure, the preset interval time can be a pre-set interval time.
[0118] In this embodiment, the method of obtaining the target data is similar to the method of obtaining the first data and the second data in the above embodiments, and will not be described in detail here.
[0119] The next data collection cycle can be any collection cycle following the one corresponding to the first data collection request.
[0120] For example, if the collection period corresponding to the first data collection request is the first collection period, and the preset interval is 3 times the collection period interval, then when the next collection period is the fourth collection period, the upload type of the data collected in the fourth collection period will be determined as full data upload.
[0121] In this embodiment of the disclosure, the collected data can be fully uploaded after a preset interval, thereby updating the comparison benchmark when some data is uploaded. This prevents data loss or incomplete data collection due to programmable logic controller failure, network failure, or other factors during the collection process, thus improving the completeness and accuracy of the collected data.
[0122] Figure 4 This is a flowchart of another data acquisition method provided in this disclosure embodiment, such as... Figure 4 As shown, the data acquisition method includes the following steps:
[0123] S410. Obtain the flow table and establish a connection with the programmable logic controller based on the identification information of the programmable logic controller in the flow table.
[0124] Specifically, when data acquisition is required, the data acquisition device can load a flow table from a configuration file, parse the flow table, obtain the identification information of the programmable logic controller (PLC), locate the corresponding PLC, and then establish a connection with the PLC corresponding to the data acquisition according to the PLC transmission protocol.
[0125] S420: Obtain the maximum payload of the programmable logic controller.
[0126] In the embodiments of this disclosure, the maximum payload can be understood as the maximum amount of effective data transmitted by the programmable logic controller in a single transmission. It should be noted that the maximum payload of each type of programmable logic controller is a fixed value.
[0127] Specifically, after establishing a connection with the programmable logic controller (PLC), the data acquisition device sends a maximum payload acquisition request to the PLC. After receiving the maximum payload acquisition request, the PLC sends the maximum payload to the data acquisition device. The data acquisition device receives the maximum payload sent by the PLC and thus obtains the maximum payload of the PLC.
[0128] S430. Determine the number of data collection requests corresponding to the flow table based on the size of the data to be collected in the flow table and the maximum effective payload.
[0129] Specifically, after the data acquisition device obtains the maximum effective payload of the programmable logic controller, it can obtain the number of data acquisition requests by rounding up the ratio of the size of the data to be acquired to the maximum effective payload.
[0130] In some embodiments of this disclosure, when the size of the data to be collected is greater than the maximum effective payload, the number of data collection requests is at least two, splitting a flow table into multiple data collection requests.
[0131] In other embodiments of this disclosure, when the size of the data to be collected is less than the maximum effective payload, multiple flow tables are obtained, and the data collection requests corresponding to the multiple flow tables are merged into a large data collection request.
[0132] S440. When the number of data acquisition requests is multiple, send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data.
[0133] S450: Determine the idle / busy state of the programmable logic controller based on the first duration.
[0134] S460. Determine the first waiting time for sending the second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller.
[0135] S470: After the first waiting period, send a second data acquisition request to the programmable logic controller and receive the second data returned by the programmable logic controller based on the second data acquisition request.
[0136] S480. Upload the first and second data to the preset database.
[0137] It should be noted that the specific implementation methods of S440-S480 are similar to those described above, and will not be repeated here.
[0138] In this embodiment of the disclosure, the number of data collection requests can be determined based on the size of the data to be collected in the flow table and the maximum effective load of the programmable logic controller before sending the data collection request. When the data to be collected in a single flow table is too large, the data to be collected is divided into multiple collections. At the same time, during the collection process, the frequency of sending data collection requests can be determined based on the idle / busy state of the programmable logic controller. This not only ensures the high efficiency of data collection, but also ensures that the normal operation of the programmable logic controller is not affected while collecting all the data of the programmable logic controller.
[0139] Figure 5 This is a flowchart of a data playback method provided in an embodiment of this disclosure. The method can be executed by a data playback device, which can be implemented in software and / or hardware. The data playback device can be configured in a data playback equipment, such as a terminal, where the terminal specifically includes a mobile phone, computer, or tablet computer, etc. Figure 5 As shown, the data playback method may include the following steps:
[0140] S510, Send a data playback request to the server and / or data acquisition device, and receive playback data corresponding to the data playback request sent by the server and / or data acquisition device.
[0141] In this embodiment of the disclosure, the playback data is data obtained based on the data acquisition method in the above embodiments and stored in a preset database.
[0142] Specifically, after the data playback device sends a data playback request to the server and / or the data acquisition device, the server and / or the data acquisition device retrieve the playback data corresponding to the data playback request from a preset database based on the data type or the data storage address in the data playback request, and then send the playback data to the data playback device to obtain the playback data.
[0143] S520: Playback and display of the replay data.
[0144] Specifically, after acquiring the playback data, the data playback device will play back and display the playback data so that users can see the playback data and then perform operations such as viewing and analyzing the playback data.
[0145] In this embodiment of the disclosure, a data playback request can be sent to a server and / or a data acquisition device, playback data corresponding to the data playback request can be received from the server and / or the data acquisition device, and the playback data can be displayed, which facilitates users to view and analyze the playback data and improves the user experience.
[0146] Figure 6 This is a schematic diagram of the structure of a data acquisition device provided in an embodiment of this disclosure.
[0147] In this embodiment, the data acquisition device can be housed within a data acquisition device and is understood as a functional module within the aforementioned data acquisition device. Specifically, the data acquisition device can be a server or a terminal, and no limitation is made herein.
[0148] like Figure 6 As shown, the data acquisition device 600 may include a first transmission module 610, a first determination module 620, a second determination module 630, a second transmission module 640, and a data upload module 650.
[0149] The first transmission module 610 can be used to send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data.
[0150] The first determining module 620 can be used to determine the idle / busy state of the programmable logic controller based on a first duration.
[0151] The second determining module 630 can be used to determine the first waiting time for sending the second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller.
[0152] The second transmission module 640 can be used to send a second data acquisition request to the programmable logic controller after a first waiting period, receive the second data returned by the programmable logic controller based on the second data acquisition request, and record the second time required for the programmable logic controller to return the second data.
[0153] The data upload module 650 can be used to upload the first data and the second data to a preset database.
[0154] In this embodiment, a first data acquisition request can be sent to a programmable logic controller (PLC), first data returned by the PLC based on the first data acquisition request can be received, and a first duration required for the PLC to return the first data can be recorded. Based on the first duration, the idle / busy state of the PLC can be determined, and then a first waiting time for sending a second data acquisition request to the PLC can be determined based on the idle / busy state of the PLC. After the first waiting time, a second data acquisition request can be sent to the PLC, and second data returned by the PLC based on the second data acquisition request can be received. The second duration required for the PLC to return the second data can be recorded, and the received first and second data can be uploaded to a preset database. Thus, when collecting data acquired by the PLC, the idle / busy state of the PLC can be taken into account, and the frequency of sending data acquisition requests can be determined based on the idle / busy state of the PLC, thereby ensuring that the normal operation of the PLC is not affected while collecting all the data of the PLC.
[0155] In some embodiments of this disclosure, the first data acquisition request is a data acquisition request that is not sent for the first time.
[0156] The first determining module 620 may include an average value calculation unit, an average value acquisition unit, an average value filtering unit, and an idle / busy status determining unit.
[0157] The average value calculation unit can be used to calculate the average value of the first duration and the data return duration corresponding to at least one historical data collection request before the first data collection request, so as to obtain the first average value.
[0158] The average value acquisition unit can be used to acquire at least one second average value corresponding to at least one historical data acquisition request prior to the first data acquisition request.
[0159] The average value filtering unit can be used to filter out the minimum average value from a first average value and at least one second average value.
[0160] The idle / busy state determination unit can be used to calculate the first product of the first preset value and the minimum average value, compare the first duration with the first product, and determine the idle / busy state of the programmable logic controller based on the comparison result.
[0161] In some embodiments of this disclosure, the idle / busy state determination unit can be specifically used to obtain the number of times a warning message is issued when the first duration is greater than or equal to the first product, and determine whether the programmable logic controller (PLC) is in a first state or a second state based on the number of warning messages issued. The warning message is issued when the PLC is determined to be in the first state, where the first state indicates that the PLC is in a busy state. The second state indicates the state in which the PLC needs to trigger an increase in waiting time after entering the first state every preset time period. The preset time period is determined based on the time when the number of warning messages issued reaches a preset warning threshold. When the number of warning messages issued is less than or equal to the preset warning threshold, the PLC is determined to be in the first state, and a warning message is issued, and the number of warning messages issued is recorded. When the number of warning messages issued is greater than the preset warning threshold, the PLC is determined to be in the second state, and the number of warning messages issued is reset to zero.
[0162] In some embodiments of this disclosure, the second determining module 630 may be specifically used to calculate the second product of the second preset value and the minimum average value when the programmable logic controller is determined to be in the first state, and when the number of warning messages issued is less than or equal to the preset warning threshold, the sum of the second waiting time corresponding to the previous data acquisition request and the second product shall be determined as the first waiting time.
[0163] In some embodiments of this disclosure, the second determining module 630 may also be specifically used to calculate the third product of the third preset value and the minimum average value when the programmable logic controller is determined to be in the second state, and to determine the sum of the second waiting time corresponding to the previous data acquisition request and the third product as the first waiting time.
[0164] In some embodiments of this disclosure, the data acquisition device 600 may further include an upload type determination module.
[0165] The upload type determination module can be used to determine the upload type of the first data and the second data before uploading the first data and the second data to the preset database. The upload type includes two types: full data upload and partial data upload.
[0166] In some embodiments of this disclosure, the data upload module 650 may be specifically used to compare the first data with the first historical data located at the corresponding position of the first data in a preset database when it is determined that the upload type of the first data and the second data is partial data upload, and at the same time compare the second data with the second historical data located at the corresponding position of the second data in the preset database. The first historical data and the second historical data are data collected in adjacent collection cycles of the first data collection request and the second data collection request; and upload the first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data to the preset database.
[0167] In some embodiments of this disclosure, the data acquisition device 600 may further include a third determining module.
[0168] The third determining module can be used to, after uploading the first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data to the preset database, obtain the target data corresponding to at least one data collection request in the next collection cycle; when the interval between the next collection cycle and the collection cycle corresponding to the first data collection request meets the preset interval time, determine the upload type of the target data as full data upload, and upload the target data to the preset database.
[0169] In some embodiments of this disclosure, the data acquisition device 600 may further include a preprocessing module.
[0170] The preprocessing module can be used to obtain a flow table before sending the first data acquisition request to the programmable logic controller (PLC); establish a connection with the PLC based on the PLC's identification information in the flow table; obtain the maximum payload of the PLC; determine the number of data acquisition requests corresponding to the flow table based on the size of the data to be collected in the flow table and the maximum payload; and split or merge the flow table based on the number of data acquisition requests.
[0171] It should be noted that, Figure 6 The data acquisition device 600 shown can execute the various steps in the above method embodiments and realize the various processes and effects in the above method embodiments, which will not be elaborated here.
[0172] Figure 7 This is a schematic diagram of the structure of a data playback device provided in an embodiment of this disclosure. In this embodiment, the data playback device can be disposed within a data playback equipment and can be understood as a part of the functional modules of the aforementioned data playback equipment. Specifically, the data playback equipment can be a terminal, wherein the terminal specifically includes mobile phones, computers, or tablet computers, etc., without limitation.
[0173] like Figure 7 As shown, the data playback device 700 may include a data acquisition module 710 and a data playback module 720.
[0174] The data acquisition module 710 can be used to send data playback requests to the server and / or data acquisition device, and receive playback data corresponding to the data playback requests sent by the server and / or data acquisition device.
[0175] The data playback module 720 can be used to play back and display the playback data.
[0176] In this embodiment of the disclosure, a data playback request can be sent to a server and / or a data acquisition device, playback data corresponding to the data playback request can be received from the server and / or the data acquisition device, and the playback data can be displayed, which facilitates users to view and analyze the playback data and improves the user experience.
[0177] Figure 8 This is a schematic diagram of the structure of a data processing system provided in an embodiment of this disclosure.
[0178] In the embodiments disclosed herein, such as Figure 8 As shown, the data processing system 80 may include a data acquisition device 81, a data processing device 82, and a server 83, wherein the data acquisition device 81, the data processing device 82, and the server 83 are connected in communication.
[0179] The data acquisition device 81 can be used to send a first data acquisition request to the programmable logic controller (PLC), receive first data returned by the PLC based on the first data acquisition request, and record a first duration required for the PLC to return the first data; determine the idle / busy state of the PLC based on the first duration; determine a first waiting time for sending a second data acquisition request to the PLC based on the idle / busy state of the PLC; send a second data acquisition request to the PLC after the first waiting time, receive second data returned by the PLC based on the second data acquisition request, and record a second duration required for the PLC to return the second data; and upload the first data and the second data to a preset database in the server 83.
[0180] Server 83 includes a preset database that can be used to store data collected by data acquisition device 81, wherein the data includes first data and second data.
[0181] The data processing device 82 can be used to send a data acquisition request to at least one of the data acquisition device 81 and the server 83 to obtain data collected by the data acquisition device, process the data, and perform operations corresponding to the processing results.
[0182] The processing may include at least one of the following: data filtering, analysis, and statistics. Of course, it may also include other data processing, which is not limited here.
[0183] The operations may include issuing warning information to the user, providing feedback on the processing results to the user, performing equipment maintenance operations, performing equipment optimization operations, and sending control commands to the target device to cause the target device to perform operations corresponding to the control commands. The target device may include a robot that can be used to perform equipment maintenance operations, a device that can perform equipment optimization operations, etc.
[0184] In some embodiments of this disclosure, the data processing system 80 may further include a data playback device.
[0185] The data playback device can be used to send data playback requests to the server 83 and / or the data acquisition device 81, receive playback data corresponding to the data playback request sent by the server 83 and / or the data acquisition device 81, and display the playback data.
[0186] Server 83 can also be used to receive data playback requests sent by the data playback device, search for playback data corresponding to the data playback request from the preset database, and send the playback data to the data playback device.
[0187] The data processing device 82 can also be used to send a data acquisition request to the data playback device to obtain the data collected by the data acquisition device, process the data, and perform operations corresponding to the processing results based on the processing results.
[0188] In some embodiments of this disclosure, the data acquired by the data processing device 82 may be all the data acquired by the data acquisition device 81, or a portion of the data acquired by the data acquisition device 81. For example, it may be data stored in the data acquisition device 81, data stored in the server 83, data played back and displayed by the data playback device, or all the data acquired by the data acquisition device 81. The specific data acquired may be determined according to the user's settings or the purpose of the data, and is not limited here.
[0189] Acquiring data collected by data acquisition device 81 may include sending a data acquisition request to at least one of data acquisition device 81, server 83, and data playback device, and receiving data returned by at least one of data acquisition device 81, server 83, and data playback device.
[0190] In this embodiment of the disclosure, the data processing system can be used to collect, store and play back the data corresponding to the programmable logic controller. At the same time, the collected data can be used for equipment fault analysis, equipment maintenance and equipment optimization. In addition to achieving the technical effects in the above embodiments, the user experience is further improved.
[0191] This disclosure also provides a computer-readable storage medium that can store a computer program, which, when executed by a processor, causes the processor to implement the embodiments of this disclosure. Figures 1 to 4 The provided data collection methods and Figure 5 The provided data playback method.
[0192] The aforementioned storage medium may include, for example, a memory for computer program instructions, which can be executed by the processor of the data acquisition device to perform the embodiments of this disclosure. Figures 1 to 4 The provided data acquisition method or the data playback device's processor is used to complete the task. Figure 5 The provided data playback method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, such as ROM, random access memory (RAM), compact disc-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0193] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data acquisition method, characterized in that, include: Send a first data acquisition request to the programmable logic controller, receive the first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data; The idle / busy state of the programmable logic controller is determined based on the first duration; The first waiting time for sending the second data acquisition request to the programmable logic controller is determined based on the idle / busy state of the programmable logic controller. After the first waiting period, the programmable logic controller (PLC) sends the second data acquisition request and receives the second data returned by the PLC based on the second data acquisition request. The second time required for the PLC to return the second data is recorded. Upload the first data and the second data to a preset database; Determining the idle / busy state of the programmable logic controller based on the first duration includes: When the first data acquisition request is not the first data acquisition request sent, the idle / busy state of the programmable logic controller is determined based on whether the first duration is greater than a preset time threshold. The determination of the first waiting time for sending the second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller includes: When it is determined that the programmable logic controller is in a busy state, the minimum average value is obtained, the product of the preset value and the minimum average value is calculated, and the sum of the second waiting time corresponding to the previous data acquisition request before the first data acquisition request and the product is determined as the first waiting time. To obtain the minimum average, including: The first average value is obtained by averaging the first duration with the data return duration corresponding to at least one historical data collection request before the first data collection request. Obtain at least one second average value corresponding to at least one historical data collection request prior to the first data collection request; The minimum average value is selected from the first average value and the at least one second average value.
2. The method according to claim 1, characterized in that, The first data acquisition request is not the first data acquisition request sent; determining the idle / busy state of the programmable logic controller based on the first duration includes: Calculate the first product of the first preset value and the minimum average value, compare the first duration with the first product, and determine the idle / busy state of the programmable logic controller based on the comparison result.
3. The method according to claim 2, characterized in that, Determining the idle / busy state of the programmable logic controller based on the comparison result includes: When the first duration is greater than or equal to the first product, the number of times a warning message is issued is obtained. Based on the number of times the warning message is issued, it is determined whether the programmable logic controller is in a first state or a second state. The warning message is issued when it is determined that the programmable logic controller is in the first state. The first state indicates that the programmable logic controller is in a busy state. The second state is used to indicate the state in which the programmable logic controller needs to trigger an increase in waiting time every preset period after entering the first state. The preset period is determined based on the time when the number of warning messages issued reaches a preset warning threshold.
4. The method according to claim 3, characterized in that, Determining whether the programmable logic controller is in a first state or a second state based on the number of warning messages issued includes: When the number of warning messages issued is less than or equal to a preset warning threshold, the programmable logic controller is determined to be in the first state, and a warning message is issued, and the number of times the warning message is issued is recorded. When the number of warning messages issued exceeds the preset warning threshold, the programmable logic controller is determined to be in the second state, and the number of warning messages issued is reset to zero.
5. The method according to claim 4, characterized in that, When the programmable logic controller (PLC) is determined to be in the first state, the first waiting time for sending the second data acquisition request to the PLC based on the PLC's idle / busy state includes: Calculate the second product of the second preset value and the minimum average value. When the number of times the warning information is issued is less than or equal to the preset warning threshold, the sum of the second waiting time corresponding to the previous data collection request and the second product is determined as the first waiting time.
6. The method according to claim 4, characterized in that, When it is determined that the programmable logic controller (PLC) is in the second state, the step of determining the first waiting time for sending the second data acquisition request to the PLC based on the PLC's idle / busy state includes: Calculate the third product of the third preset value and the minimum average value, and determine the first waiting time by the sum of the second waiting time corresponding to the previous data acquisition request and the third product.
7. The method according to claim 1, characterized in that, Before uploading the first data and the second data to the preset database, the method further includes: Determine the upload type of the first data and the second data, wherein the upload type includes two types: full data upload and partial data upload; When it is determined that the upload type of the first data and the second data is partial data upload, the step of uploading the first data and the second data to the preset database includes: The first data is compared with the first historical data located at the corresponding position of the first data in the preset database, and the second data is compared with the second historical data located at the corresponding position of the second data in the preset database. The first historical data and the second historical data are data collected in adjacent collection cycles of the first data collection request and the second data collection request. The first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data are uploaded to the preset database.
8. The method according to claim 7, characterized in that, After uploading the first change data that is inconsistent with the first historical data and the second change data that is inconsistent with the second historical data to the preset database, the method further includes: Obtain the target data corresponding to at least one data acquisition request in the next acquisition cycle; When the interval between the next collection cycle and the collection cycle corresponding to the first data collection request meets the preset interval time, the upload type of the target data is determined to be full data upload, and the target data is uploaded to the preset database.
9. The method according to claim 1, characterized in that, Before sending the first data acquisition request to the programmable logic controller, the method further includes: Obtain the flow table, and establish a connection with the programmable logic controller based on the identification information of the programmable logic controller in the flow table; Obtain the maximum effective load of the programmable logic controller; The number of data collection requests corresponding to the flow table is determined based on the size of the data to be collected in the flow table and the maximum effective payload. The flow table is then split or merged based on the number of data collection requests.
10. A data acquisition device, characterized in that, include: The first transmission module is configured to send a first data acquisition request to the programmable logic controller, receive first data returned by the programmable logic controller based on the first data acquisition request, and record the first time required for the programmable logic controller to return the first data. The first determining module is used to determine the idle / busy state of the programmable logic controller based on the first duration; The second determining module is used to determine a first waiting time for sending a second data acquisition request to the programmable logic controller based on the idle / busy state of the programmable logic controller; The second transmission module is used to send the second data acquisition request to the programmable logic controller after the first waiting time, and to receive the second data returned by the programmable logic controller based on the second data acquisition request, and to record the second time required for the programmable logic controller to return the second data; The data upload module is used to upload the first data and the second data to a preset database; The first determining module is specifically used to determine the idle / busy state of the programmable logic controller based on whether the first duration is greater than a preset time threshold when the first data acquisition request is not the first data acquisition request sent. The second determining module is specifically used to obtain the minimum average value when it is determined that the programmable logic controller is in a busy state, calculate the product of the preset value and the minimum average value, and determine the first waiting time as the sum of the second waiting time corresponding to the previous data acquisition request before the first data acquisition request and the product. The second determining module is further specifically configured to calculate the average of the first duration and the data return duration corresponding to at least one historical data collection request before the first data collection request to obtain a first average; obtain at least one second average corresponding to at least one historical data collection request before the first data collection request; and filter out the minimum average from the first average and the at least one second average.
11. A data acquisition device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the data acquisition method according to any one of claims 1-9.
12. A data processing system, characterized in that, It includes a data acquisition device, a server, and a data processing device, and the data acquisition device, the server, and the data processing device are communicatively connected to each other. The data acquisition device is the data acquisition device as described in claim 11 above; The server includes a preset database for storing the data collected by the data acquisition device; The data processing device is configured to send a data acquisition request to at least one of the data acquisition device and the server to obtain data acquired by the data acquisition device, process the data, and perform an operation corresponding to the processing result based on the processing result.
13. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, causes the processor to implement the data acquisition method described in any one of claims 1-9.
Citation Information
Patent Citations
Data processing system and processing method in industry wireless sensing network
CN101231781A
Data transfer device and data transfer system, and method, image processing unit and recording medium thereof
JP2000059402A