A method and device for writing data from a host computer
By building data tables in the industrial control system and performing data reading and writing rounds, the writing strategy of the upper computer is optimized, the problem of insufficient data source writing speed is solved, and high-speed real-time control in the industrial control field is achieved.
Patent Information
- Application Number
- CN202111121413.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-09-24
AI Technical Summary
In the field of industrial control, data sources such as DCS and PLC can only perform limited data writing and updates within each control cycle due to hardware performance and security policies, resulting in the on-site computer platform being unable to achieve high-speed real-time control when writing out data.
By pre-constructing the data table corresponding to the data source, determining the offset step size based on the total number of data, setting the offset to perform data reading and writing rounds, ensuring that the data in the data table has an equal reading and writing probability, thereby optimizing the writing strategy , improve data writing efficiency.
It realizes data writing in a short control cycle, meets the needs of high-speed real-time control, reduces the control cycle, and shortens from 5 to 10 seconds to 0.5 to 1 second.
Smart Images

Figure CN113849511B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of industrial control technology, and in particular, to a method and device for writing data from a host computer. Background Art
[0002] Database and data communication technologies are basic technologies in all fields of modern society. Information is transmitted between data sources through data interaction, and improving the data interaction rate has always been a key direction of technology research and development.
[0003] In the industrial field, control systems such as DCS (Distributed Control Systems) and PLC (Programmable Logic Controller) are common data sources. Due to hardware performance constraints or security policy restrictions, these data sources are only allowed to write and update limited data per control cycle (seconds). If the host computer platform software wants to write a large amount of data to this type of data source, the write speed allowed by the data source and the host computer's management strategy for write data will restrict the selection of the shortest write control cycle, that is, a longer control cycle needs to be set, and high-speed real-time control cannot be achieved. Summary of the invention
[0004] In view of the problems existing in the above content, the present application provides a host computer data writing method and device to improve the data writing efficiency, so that a shorter control cycle can be set to ensure that all data can be written within one control cycle to achieve high-speed real-time control.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] A method for writing data from a host computer, characterized in that a data table corresponding to each data source is pre-built, the method comprising:
[0007] When the platform is started or the data point of the data source is modified, the data table of the corresponding data source is updated, and the corresponding offset step length is determined according to the total number of data in the data table;
[0008] When the preset condition is met, an offset is set, and data read and write polling is performed on the data table queue according to the offset so that the data in the data table has an equal read and write probability. The preset condition is that the platform allows the data read and write logic to run.
[0009] Further, the determining the corresponding offset step size according to the total number of data in the data table includes:
[0010] Determine whether the total amount of data in the data table is greater than or equal to a preset threshold;
[0011] If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value;
[0012] The data table and the offset step are stored for periodic reading and writing logic calls.
[0013] Furthermore, when the preset condition is met, an offset is set, and data read and write patrol is performed on the data table queue according to the offset, so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the operation of data read and write logic, including:
[0014] Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table;
[0015] Determine whether the decrement amount of the total amount of data in the data table is greater than zero;
[0016] If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table;
[0017] Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value;
[0018] If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool;
[0019] Performing a read operation on the retrieved data to read the latest value in the data source;
[0020] Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
[0021] Furthermore, it also includes:
[0022] When the amount of decrease in the total amount of data in the data table is not greater than zero, or the current state does not meet the preset write condition, the corresponding data is cleared from the write queue.
[0023] Furthermore, it also includes:
[0024] If the patrol point is less than zero, the total amount of data in the data table is increased for the patrol point so that the patrol point is not a negative value.
[0025] A host computer data writing device pre-builds a data table corresponding to each data source, the device comprising:
[0026] A first processing unit is used to update the data table of the corresponding data source when the platform is started or the data point of the data source is modified, and determine the corresponding offset step length according to the total number of data in the data table;
[0027] The second processing unit is used to set an offset when a preset condition is met, and perform data reading and writing patrols on the data table queue according to the offset so that the data in the data table has an equal reading and writing probability. The preset condition is that the platform allows the data reading and writing logic to run.
[0028] Furthermore, the first processing unit is specifically configured to:
[0029] Determine whether the total amount of data in the data table is greater than or equal to a preset threshold;
[0030] If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value;
[0031] The data table and the offset step are stored for periodic reading and writing logic calls.
[0032] Furthermore, the second processing unit is specifically configured to:
[0033] Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table;
[0034] Determine whether the decrement amount of the total amount of data in the data table is greater than zero;
[0035] If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table;
[0036] Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value;
[0037] If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool;
[0038] Performing a read operation on the retrieved data to read the latest value in the data source;
[0039] Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
[0040] A storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the host computer data writing method as described above.
[0041] An electronic device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the host computer data writing method as described above.
[0042] The host computer data writing method and device described in the present application, the method pre-constructs the data table corresponding to each data source, updates the data table of the corresponding data source when the platform is started or the data point of the data source is modified, and determines the corresponding offset step according to the total number of data in the data table; when the preset condition is met, the offset is set, and the data table queue is patrolled for data reading and writing according to the offset, so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the operation of data reading and writing logic. The present application can improve the efficiency of data writing by dynamically constructing a write sequence and optimizing the host computer write strategy, so that a shorter control cycle can be set to ensure that all data can be written out within one control cycle, and high-speed real-time control can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A schematic diagram of a method for writing data from a host computer disclosed in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the update process of the offset step condition triggering of the data table disclosed in the embodiment of the present application;
[0046] Figure 3 A schematic diagram of a logic flow of periodic calls for data reading and writing disclosed in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of another data reading and writing periodic call logic flow disclosed in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the structure of a host computer data writing device disclosed in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The applicant found in the research that in the field of industrial control, the upper computer software initiates the most write applications for PID controllers, sequential control, interlocking and other control algorithms, as well as the operator's operation on the interface. In terms of quantity, most write applications are sporadic, that is, not every scan cycle needs to be written, but once a write application is initiated, it is hoped that the write process will be completed as soon as possible. Therefore, when designing a write algorithm, the statistical characteristics of the write application should be fully utilized, and the limited data write bandwidth provided by controllers such as DCS and PLC should be fully and efficiently utilized by dynamically constructing a write sequence.
[0051] According to development practice, for a scale of 100 to 300 write points, the existing technology requires a control cycle of 5 to 10 seconds to complete the writing task. However, the host computer data writing method provided in this application can achieve the same effect within a control cycle of 0.5 to 1 second, thereby enabling the host computer platform to be applied to the field of high-speed control.
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] Please see attached Figure 1 , is a flow chart of a method for writing data from a host computer provided in an embodiment of the present application. Figure 1 As shown, the embodiment of the present application provides a method for writing data from a host computer, which pre-builds a data table corresponding to each data source. The method includes the following steps:
[0054] S101: When the platform is started or the data point of the data source is modified, the data table of the corresponding data source is updated, and the corresponding offset step length is determined according to the total amount of data in the data table.
[0055] In this step, the above-mentioned determination of the corresponding offset step according to the total amount of data in the data table includes: judging whether the total amount of data in the data table is greater than or equal to a preset threshold; if so, setting the offset step to a first preset value, if not, setting the offset step to a second preset value; storing the data table and the offset step for periodic read and write logic calls.
[0056] It should be noted that the data source is an information source that provides or receives data on a data network. Offset step size: a parameter set with reference to the bandwidth of the data source receiving the write data, which can make the data to be written out periodically arranged at the front of the write queue.
[0057] It should be noted that if Figure 2 As shown, in the embodiment of the present application, taking each data source independently establishing a data table as an example, when the platform is started, the data point of the data source is modified, etc., the data table of the corresponding data source is updated. According to whether the total number of data in the data table is greater than or equal to a certain threshold (set to 20 in the example figure), the offset step is set to a certain value (set to 10 in the example figure, which can be modified as needed).
[0058] The details are as follows, taking the example of establishing a data table independently for each data source:
[0059] A1: Initially, this logic is called when the platform is started or when data source data points are modified.
[0060] A2: Update the data table of the corresponding data source.
[0061] A3: Determine whether the total number of data in the data table is greater than or equal to the threshold (set to 20 in the example figure, which can be modified as needed).
[0062] A4: If the total number of data in the data table is greater than or equal to the threshold, set the offset step length to a certain value (set to 10 in the example figure, which can be modified as needed).
[0063] A5: If the total number of data in the data table is not greater than the threshold, set the offset step length to a certain value (set to 0 in the example figure, which can be modified as needed).
[0064] A6: Save the above data table and offset step length for periodic read and write logic calls.
[0065] S102: When a preset condition is met, an offset is set, and data read and write polling is performed on the data table queue according to the offset so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the data read and write logic to run.
[0066] In this step, when the preset condition is met, an offset is set, and data read and write patrol is performed on the data table queue according to the offset, so that the data in the data table has an equal read and write probability. The preset condition is that the platform allows the data read and write logic to run, including:
[0067] Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table;
[0068] Determine whether the decrement amount of the total amount of data in the data table is greater than zero;
[0069] If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table;
[0070] Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value;
[0071] If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool;
[0072] Performing a read operation on the retrieved data to read the latest value in the data source;
[0073] Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
[0074] Furthermore, based on the above steps, the method further includes:
[0075] When the amount of data in the data table decreases by no more than zero, or the current state does not meet the preset write condition, the corresponding data is cleared from the write queue;
[0076] If the patrol point is less than zero, the total amount of data in the data table is increased for the patrol point so that the patrol point is not a negative value.
[0077] In the embodiment of the present application, the write accuracy is set to reduce the write load. When the absolute value of the deviation between the read-in value and the write-out value is lower than this value, the write action will no longer be performed. The write queue sorts the data planned to be written. The total amount of data in the data table decreases by 1 bit in each logical cycle. Retrieval access to each data in the data table is achieved. The offset setting value is set after completing a patrol, and the data starting point position of the next patrol is relocated by setting the offset setting value. Specifically, the patrol point is the current data retrieval position, which will be periodically cycled at all positions in the data table.
[0078] It should be noted that if Figure 3 As shown, in the embodiment of the present application, the data reading and writing logic is realized through periodic scanning, which mainly includes setting an offset, realizing the offset of the starting point of the data table queue according to the offset, and after completing a data reading and writing patrol, the offset is modified according to the offset step set above, and the cycle is repeated.
[0079] The details are as follows:
[0080] (1) Start. When the platform allows the data read and write logic to run, the following logic is repeatedly called according to the set control cycle.
[0081] (2) Set the initial value of the decrease amount of the total amount of data in the data table to be equal to the total amount of data in the data table.
[0082] (3) Determine whether the decrease in the total amount of data in the data table is greater than 0. If it is greater than 0, proceed to step (4). If it is not greater than 0, proceed to step (12).
[0083] (4) Perform a decrement operation (minus one) on the total amount of data in the data table.
[0084] (5) Calculate the patrol point, patrol point = the total amount of data in the data table decreasing amount - the offset setting value.
[0085] (6) Determine whether the patrol point calculated above is less than 0. If so, proceed to step (7); if greater than 0, proceed to step (8).
[0086] (7) The patrol points calculated above increase the total amount of data in the data table so that the patrol points are not negative.
[0087] (8) Take out the value from the data table according to the patrol point. Depending on the programming tool used, it is generally the address pointing to the data body.
[0088] (9) Perform a read operation on the data retrieved above, that is, read the latest value of the data from the data source.
[0089] (10) Write out condition judgment, condition 1: the data write out flag is valid, condition 2: the absolute value of the deviation between the latest data value and the planned data write out value is greater than the set write out precision. The write out precision can be set according to the application needs, such as setting it to a value of one millionth. If both conditions are met, go to step (11), otherwise, go to step (12).
[0090] (11) Add the data to the write queue and execute the data write operation.
[0091] (12) Clear the data from the write-out queue. Some write-out methods will automatically clear the data if it is not added to the write-out queue, so this step does not need to be run.
[0092] (13) After the above steps (3) to (12), a read / write patrol has been completed according to the current offset setting value. In step (13), the offset setting value is calculated incrementally according to the preset offset step size.
[0093] (14) Determine whether the above-mentioned incremental offset setting value has exceeded the total amount of data in the data table. If so, proceed to step (15); if not, proceed to step (16).
[0094] (15) The offset setting value returns to 0.
[0095] (16) Repeat the cycle again.
[0096] After the above steps (1) to (16), the entire data table is fully patrolled according to the set offset step size, and each data in the data table has an equal read and write probability.
[0097] In addition, the embodiment of the present application uses the operation of decreasing the total amount of data to realize the round-robin search of the data table. If it is changed to increasing the amount, the same effect can be achieved. Figure 4 As shown: Figure 3 The changes include:
[0098] (2) "Decrease amount of data in the data table" is changed to "Increase amount of data in the data table", and the initial value is adjusted from "equal to the total amount of data in the data table" to "equal to 0";
[0099] (3) The logical judgment is adjusted from "whether the decrease in the total amount of data in the data table is greater than 0" to "whether the increase in the total amount of data in the data table is less than the total amount of data in the data table";
[0100] (4) Change from "the total amount of data in the data table decreases by amount" to "the total amount of data in the data table increases by amount";
[0101] (5) The “decreasing amount of the total amount of data in the data table” in the patrol point calculation formula is changed to “increasing amount of the total amount of data in the data table”.
[0102] It should be noted that the embodiment of the present application recommends the use of a minus-one decrementing operation. If the data table is patrolled twice each time, a minus-two operation can also be used to implement a patrol of the entire data table, and so on.
[0103] The embodiment of the present application provides a method for writing data to a host computer. The method pre-constructs a data table corresponding to each data source. When the platform is started or the data point of the data source is modified, the data table of the corresponding data source is updated, and the corresponding offset step is determined according to the total number of data in the data table; when the preset condition is met, the offset is set, and the data table queue is patrolled for data reading and writing according to the offset, so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the operation of data reading and writing logic. The embodiment of the present application can improve the efficiency of data writing by dynamically constructing a write sequence and optimizing the write strategy of the host computer, so that a shorter control cycle can be set to ensure that all data can be written out within one control cycle, and high-speed real-time control can be achieved.
[0104] See also Figure 5 Based on the host computer data writing method disclosed in the above embodiment, this embodiment correspondingly discloses a host computer data writing device, which pre-builds a data table corresponding to each data source, and the device includes:
[0105] The first processing unit 51 is used to update the data table of the corresponding data source when the platform is started or the data point of the data source is modified, and determine the corresponding offset step length according to the total number of data in the data table;
[0106] The second processing unit 52 is used to set an offset when a preset condition is met, and perform data read and write patrols on the data table queue according to the offset so that the data in the data table has an equal read and write probability. The preset condition is that the platform allows the data read and write logic to run.
[0107] Furthermore, the first processing unit 51 is specifically configured to:
[0108] Determine whether the total amount of data in the data table is greater than or equal to a preset threshold;
[0109] If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value;
[0110] The data table and the offset step are stored for periodic reading and writing logic calls.
[0111] Furthermore, the second processing unit 52 is specifically configured to:
[0112] Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table;
[0113] Determine whether the decrement amount of the total amount of data in the data table is greater than zero;
[0114] If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table;
[0115] Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value;
[0116] If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool;
[0117] Performing a read operation on the retrieved data to read the latest value in the data source;
[0118] Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
[0119] The host computer data writing device includes a processor and a memory. The first processing unit and the second processing unit are stored in the memory as program units. The processor executes the program units stored in the memory to realize corresponding functions.
[0120] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the efficiency of data writing can be improved by adjusting the kernel parameters, so that a shorter control cycle can be set to ensure that all data can be written out within one control cycle, achieving the purpose of high-speed real-time control.
[0121] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the host computer data writing method is implemented.
[0122] An embodiment of the present application provides a processor, which is used to run a program, wherein the host computer data writing method is executed when the program is running.
[0123] The present application embodiment provides an electronic device, such as Figure 6 As shown, the electronic device 60 includes at least one processor 601, and at least one memory 602 and a bus 603 connected to the processor; wherein the processor 601 and the memory 602 communicate with each other through the bus 603; the processor 601 is used to call the program instructions in the memory 602 to execute the above-mentioned host computer data writing method.
[0124] The electronic devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0125] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the following method steps:
[0126] When the platform is started or the data point of the data source is modified, the data table of the corresponding data source is updated, and the corresponding offset step length is determined according to the total number of data in the data table;
[0127] When the preset condition is met, an offset is set, and data read and write polling is performed on the data table queue according to the offset so that the data in the data table has an equal read and write probability. The preset condition is that the platform allows the data read and write logic to run.
[0128] Further, determining the corresponding offset step size according to the total number of data in the data table includes:
[0129] Determine whether the total amount of data in the data table is greater than or equal to a preset threshold;
[0130] If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value;
[0131] The data table and the offset step are stored for periodic reading and writing logic calls.
[0132] Furthermore, when the preset condition is met, an offset is set, and data read and write patrol is performed on the data table queue according to the offset, so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the operation of data read and write logic, including:
[0133] Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table;
[0134] Determine whether the decrement amount of the total amount of data in the data table is greater than zero;
[0135] If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table;
[0136] Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value;
[0137] If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool;
[0138] Performing a read operation on the retrieved data to read the latest value in the data source;
[0139] Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
[0140] Furthermore, it also includes:
[0141] When the amount of decrease in the total amount of data in the data table is not greater than zero, or the current state does not meet the preset write condition, the corresponding data is cleared from the write queue.
[0142] Furthermore, it also includes:
[0143] If the patrol point is less than zero, the total amount of data in the data table is increased for the patrol point so that the patrol point is not a negative value.
[0144] The present application is described by flowcharts and / or block diagrams of the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0145] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0146] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0147] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0148] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0149] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0150] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for writing data from a host computer, characterized in that: Pre-building a data table corresponding to each data source, the method includes: When the platform is started or the data point of the data source is modified, the data table of the corresponding data source is updated, and the corresponding offset step length is determined according to the total number of data in the data table; When the preset condition is met, an offset is set, and data reading and writing rounds are performed on the data table queue according to the offset, so that the data in the data table has an equal reading and writing probability, and the preset condition is that the platform allows the data reading and writing logic to run; Wherein, when the preset condition is met, an offset is set, and data reading and writing rounds are performed on the data table queue according to the offset, so that the data in the data table has an equal reading and writing probability, and the preset condition is that the platform allows the operation of data reading and writing logic, including: Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table; Determine whether the decrement amount of the total amount of data in the data table is greater than zero; If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table; Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value; If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool; Performing a read operation on the retrieved data to read the latest value in the data source; Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
2. The method according to claim 1, characterized in that The determining the corresponding offset step size according to the total number of data in the data table includes: Determine whether the total amount of data in the data table is greater than or equal to a preset threshold; If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value; The data table and the offset step are stored for periodic reading and writing logic calls.
3. The method according to claim 1, characterized in that Also includes: When the amount of decrease in the total amount of data in the data table is not greater than zero, or the current state does not meet the preset write condition, the corresponding data is cleared from the write queue.
4. The method according to claim 1, characterized in that Also includes: If the patrol point is less than zero, the total amount of data in the data table is increased for the patrol point so that the patrol point is not a negative value.
5. A host computer data writing device, characterized in that: A data table corresponding to each data source is pre-built, and the device includes: A first processing unit is used to update the data table of the corresponding data source when the platform is started or the data point of the data source is modified, and determine the corresponding offset step length according to the total number of data in the data table; A second processing unit is used to set an offset when a preset condition is met, and perform data read and write rounds on the data table queue according to the offset so that the data in the data table has an equal read and write probability, and the preset condition is that the platform allows the data read and write logic to run; The second processing unit is specifically used for: Set the initial value of the decrement amount of the total amount of data in the data table to be equal to the total amount of data in the data table; Determine whether the decrement amount of the total amount of data in the data table is greater than zero; If the decrement amount of the total amount of data in the data table is greater than zero, a decrement operation is performed on the decrement amount of the total amount of data in the data table; Calculate the patrol point according to a preset calculation formula, the preset calculation formula is: patrol point = the total amount of data in the data table decreasing amount - the offset setting value; If it is determined that the patrol point is not less than zero, then taking out a value from the data table according to the patrol point using a preset programming tool; Performing a read operation on the retrieved data to read the latest value in the data source; Determine whether the current state meets the preset write conditions. If so, add the data to the write queue and perform a data write operation. The preset write conditions include: the data write flag is valid and the absolute value of the deviation between the latest data value and the planned write value of the data is greater than the set write accuracy.
6. The device according to claim 5, characterized in that The first processing unit is specifically configured to: Determine whether the total amount of data in the data table is greater than or equal to a preset threshold; If yes, the offset step is set to the first preset value; if no, the offset step is set to the second preset value; The data table and the offset step are stored for periodic reading and writing logic calls.
7. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the host computer data writing method according to any one of claims 1 to 4.
8. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the host computer data writing method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Method for managing dynamic internal memory base on discontinuous page
CN101231619A
Storage management method based on NOR Flash
CN103853669A
Data reading and writing method and device, and circle queue
CN108733344A
Queue-based data processing method, device, apparatus and medium
CN109271242A
Data read-write processing method and device
CN110765209A
