Write stabilization method and system based on untrusted opc services
By managing subscription and write queues, and employing interval time and counting mechanisms to prioritize the processing of pins with low counts, the problem of unstable pin writing in OPC services was solved, enabling large-scale, efficient, and accurate data writing, and improving writing efficiency and success rate.
Patent Information
- Application Number
- CN202211357021.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-11-01
AI Technical Summary
Existing technologies for writing tag pins based on OPC services in factories suffer from instability and high latency, making it difficult to achieve large-scale data writing and prone to misjudgment and failure.
By using subscription and write queue management, and employing an interval and counting mechanism, pins with low counts are prioritized for processing. Combined with database storage of result data, multiple write attempts are made, reducing server load and improving write success rate.
It enables large-scale, efficient, and accurate writing of tag pins, improving writing efficiency and success rate, reducing server load, and enhancing writing accuracy.
Smart Images

Figure CN116048383B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer data processing, in particular to a write stabilization method and system based on untrusted OPC services. BACKGROUND
[0002] Businesses such as job working conditions and position number audits in factories need to write a large number of position pin values, and the distributed component object model service provided by the OPC (OLE for Process Control) manufacturer has instability, and the writing of data may be delayed to a high degree, or it may fail. It is difficult to write pin values in such an uncertain scenario.
[0003] In the prior art, most technical solutions are to write data separately and judge the correctness of the data, which can easily lead to misjudgment and failure. There is a problem of being unable to write data on a large scale.
[0004] For example, a "cache memory single write structure of computer system" disclosed in Chinese patent documents, publication number: CN1115891A, application date: July 26, 1994, the invention places the data line in a shared state to perform the first write hit write operation, and leaves a variable state record on the device, and controls the storage write mode input signal of the main processor to change the storage write to a write-back mode, so that the subsequent write-out operation can be retained without being immediately written out, thereby saving clock cycles, but there is a problem of being unable to write data on a large scale. SUMMARY
[0005] In view of the shortcomings of the prior art that cannot write data on a large scale, the present application provides a write stabilization method and system based on untrusted OPC services, which can write data on a large scale.
[0006] The technical solution of the present application is as follows: the write stabilization method based on untrusted OPC services comprises the following steps:
[0007] S1: receiving a third-party system data request;
[0008] S2: subscribing to position pins and saving the position pin information of the successful subscription;
[0009] S3: writing position pin values and saving the result data to a database;
[0010] S4: reading the result data and transmitting it to the third-party system.
[0011] In the scheme, the third party system sends a data request, the write stable system receives the data request, subscribes and writes according to the data request, saves the subscription success pin number pin information, writes the pin number pin value, saves the result data to the database, at this time, the data processing is completed, the result data is read from the database and transmitted to the third party system, and large-scale write operation can be performed.
[0012] As preferred, S2 comprises the following steps:
[0013] S21: load the subscription configuration parameters into the memory;
[0014] S22: add the bit number pin to be subscribed to the subscription queue;
[0015] S23: periodically subscribe to several bit number pins from the subscription queue;
[0016] S24: judge whether the bit number pin is successfully subscribed? If yes, kick the bit number pin out of the subscription queue and save the subscription success information to the database; if no, increase the subscription count by one;
[0017] S25: judge whether the subscription count is greater than the maximum subscription times? If yes, kick the bit number pin out of the subscription queue and save the subscription failure information to the database; if no, proceed to step S23.
[0018] In the scheme, the subscription configuration parameters in the database are read into the memory, the subscription configuration parameters include the subscription interval time, the number of each subscription and the maximum subscription times of each bit number pin, the bit number pin to be subscribed is added to the subscription queue, the value corresponding to the bit number pin is found in the subscription queue, if the subscription of the bit number pin is found, it is directly returned; if not, the bit number pin is added to the subscription queue, the bit number pins with the minimum subscription count are selected from the subscription queue according to the interval time, the bit number pins are subscribed, according to the subscription return value, if the subscription is successful, the bit number pin is kicked out of the subscription queue and the subscription success information is saved to the database, the front-end subscription success information is notified, if the subscription fails, the subscription count is increased by one, if the subscription count of the bit number pin is greater than the maximum subscription times, the subscription fails, the bit number pin is kicked out of the subscription queue and the subscription failure information is saved to the database, the front-end subscription failure information is notified, if the subscription count of the bit number pin is not greater than the maximum subscription times, the bit number pins are periodically subscribed from the subscription queue.
[0019] As preferred, the subscription configuration parameters include the subscription interval time, the number of each subscription and the maximum subscription times.
[0020] In the scheme, the bit number pin needs to be subscribed again after a certain time interval to avoid frequent operations and cause the server to be unable to respond. Each batch of subscription can only subscribe to a certain number to prevent network traffic from increasing and the server from being overloaded.
[0021] As preferred, S3 comprises the following steps:
[0022] S31: load the write value configuration parameters into the memory;
[0023] S32: add the bit number pin to be written to the write value queue;
[0024] S33: periodically write several bit number pin values from the write value queue;
[0025] S34: determine whether the real value of the bit number pin and the value to be written are consistent? If yes, kick the bit number pin out of the write value queue and save the write success result data to the database; if no, increase the write count by one;
[0026] S35: determine whether the write count is greater than the maximum write count? If yes, when the current time exceeds the sum of the write time and the silence time, kick the bit number pin out of the write value queue and save the write failure result data to the database; if no, proceed to step S33.
[0027] In the scheme, the write value configuration parameters in the database are read into the memory. The write value configuration parameters include the write value interval time, the number of each write value, the maximum write count of each bit number pin, and the silence time after the bit number pin write failure. If the requested bit number pin allows write value, the bit number pin to be written is added to the write value queue. The value corresponding to the bit number pin is found in the write value queue. If the item of the bit number pin is found, the write count is reset and the value is written, and the process is directly returned. If the item of the bit number pin is not found, the value of the bit number pin is added to the write value queue. According to the interval time, several bit number pins with the write count not reaching the maximum write count and the minimum write count are selected from the write value queue. The values corresponding to the bit number pins are written. The real value of the bit number pin is read and compared with the value to be written. If the real value and the value to be written are consistent, it indicates that the bit number pin value is written successfully. The bit number pin is kicked out of the queue and the write success result data is saved to the database. The front-end application is notified. If the real value and the value to be written are not consistent, the write count is increased by one. When the write count is greater than the maximum write count and the current time exceeds the sum of the write time and the silence time, it indicates that the write fails. The bit number pin is kicked out of the queue and the write failure result data is saved to the database. The front-end application is notified. When the write count is not greater than the maximum write count, several bit number pin values are periodically written from the write value queue.
[0028] As preferred, the write value configuration parameters include the write value interval time, the number of each write value, the maximum write count, and the silence time.
[0029] In this scheme, the bit number pin value needs to be written after a certain time interval to prevent frequent operation and cause the server to respond. Each batch of write value can only be written in a certain number to prevent network traffic from increasing and the server from being overloaded.
[0030] As a preferred, the write time is the time when the bit number pin value is written, and the range of the silent time is 1 to 30 seconds.
[0031] In this scheme, after multiple attempts, a silent death time is needed, the range of the silent time is 1 to 30 seconds, and the last processing time is given to the server to prevent misjudgment and improve the write accuracy.
[0032] As a preferred, the bit number pin with less subscription count is subscribed first, and the bit number pin with less write count is written first.
[0033] In this scheme, the bit number pin with less subscription count is subscribed first, and the bit number pin with less write count is written first to reduce the number of failures and improve efficiency.
[0034] As a preferred, the write count of the bit number pin does not exceed the maximum write count and the subscription count does not exceed the maximum subscription count.
[0035] In this scheme, the write count of the bit number pin does not exceed the maximum write count and the subscription count does not exceed the maximum subscription count to prevent the OPC system from responding frequently and causing performance degradation.
[0036] As a preferred, the front end displays the subscription result and the write result in text, image or voice.
[0037] In this scheme, when the subscription is successful, the front end is notified of the subscription success information, when the write is successful, the front end is notified of the write success information, and when the write fails, the front end is notified of the write failure information. The text information, voice information or image information of the front end corresponds to the write result. The front end obtains the write result, displays the write result in the form of a pop-up window or a log, calls the corresponding voice according to the write result and plays it, and displays the corresponding image according to the write result.
[0038] The write stable system based on untrusted OPC service includes:
[0039] The configuration module is configured to configure the subscription configuration parameters and the write value configuration parameters.
[0040] The receiving module is configured to receive a data request of a third-party system and perform subscription and write value according to the data request.
[0041] The subscription module is configured to subscribe to the bit number pin according to the data request, and is connected to the receiving module and the configuration module.
[0042] The write value module is configured to write values to the bit number pin, and is connected with the subscription module and the configuration module.
[0043] The storage module is configured to store the result data of the subscription module and the write value module, and is connected with the subscription module and the write value module.
[0044] The return module is configured to read the result data in the storage module and transmit the result data to the third-party system, and is connected with the storage module and the third-party system.
[0045] In the scheme, the configuration module configures the subscription configuration parameters and the write value configuration parameters, which are read into the memory during use, the receiving module receives the data request of the third-party system and performs subscription and write value according to the data request, the subscription module subscribes to the bit number pin according to the data request, the write value module writes values to the bit number pin, the storage module stores the result data of the subscription module and the write value module, and the return module reads the result data in the storage module and transmits the result data to the third-party system. Multiple variable parameters can be configured, different performance write-in can be provided according to the server performance, and the write-in operation is suitable for similar mass high-accuracy write-in operation, and the write-in efficiency is improved. Multiple interval times are adopted to reduce the server pressure and improve the write-in success rate.
[0046] The beneficial effects of the present application are: multiple variable parameters can be configured, different performance write-in can be provided according to the server performance, and the write-in operation is suitable for similar mass high-accuracy write-in operation, and the write-in efficiency is improved. Multiple interval times are adopted to reduce the server pressure and improve the write-in success rate. The actual value is compared with the preset value, and the write-in accuracy is improved. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 The present application is based on the flow chart of the write stabilization method of the untrusted OPC service.
[0048] Figure 2 The present application is based on the schematic diagram of the write stabilization system of the untrusted OPC service.
[0049] In the figure, 1 is a configuration module, 2 is a receiving module, 3 is a subscription module, 4 is a write value module, 5 is a storage module, 6 is a return module, and 7 is a third-party system. DETAILED DESCRIPTION
[0050] The technical scheme of the present application will be further specifically described below by examples and in combination with the drawings.
[0051] Example one: as shown in the figure, the write stabilization method based on the untrusted OPC service includes the following steps: Figure 1
[0052] S1: receiving the data request of the third-party system 7;
[0053] S2: subscribing to the bit number pin and saving the bit number pin information of the subscription success;
[0054] S3: Write the bit number pin value, save the result data to the database;
[0055] S4: Read the result data and transmit to the third party system 7.
[0056] S1: Receive the third party system 7 data request.
[0057] Specifically, the write stable system and the third party system 7 are connected through an interface, the third party system 7 sends a data request to the write stable system, the write stable system receives the data request and processes the data, and returns the processed data to the third party system 7.
[0058] S2: Subscribe to the bit number pin, save the bit number pin information of the successful subscription;
[0059] Specifically, subscribing to the bit number pin and saving the bit number pin information of the successful subscription includes the following steps:
[0060] S21: Load the subscription configuration parameters into the memory.
[0061] Specifically, the subscription configuration parameters in the database are read into the memory, and the subscription configuration parameters include the subscription interval time T1, the number of subscriptions P1 each time, and the maximum number of subscriptions N1 for each bit number pin.
[0062] S22: Add the bit number pin to be subscribed to the subscription queue.
[0063] Specifically, the bit number pin to be subscribed is added to the subscription queue, and the value corresponding to the bit number pin (TAG1+COND1) is searched in the subscription queue. If a subscription of this bit number pin is found, it is returned directly; if not found, this bit number pin is added to the subscription queue.
[0064] S23: Periodically subscribe to several bit number pins from the subscription queue.
[0065] Specifically, the interval time T1, the bit number pins with the smallest subscription count C1 are selected from the subscription queue, and at most P1 bit number pins are selected, and these batch of bit number pins are subscribed.
[0066] S24: Determine whether the bit number pin is successfully subscribed? If yes, kick the bit number pin out of the subscription queue and save the subscription success information to the database; if not, increase the subscription count by one.
[0067] Specifically, according to the subscription return value, if the subscription is successful, the bit number pin is kicked out of the subscription queue and the subscription success information is saved to the database, and the front-end subscription success information is notified.
[0068] If the subscription fails, the subscription count C1=C1+1,
[0069] S25: Determine whether the subscription count is greater than the maximum number of subscriptions? If yes, kick the bit number pin out of the subscription queue and save the subscription failure information to the database; if no, proceed to step S23.
[0070] Specifically, if the subscription count C1 of the bit number pin is greater than the maximum number of subscriptions N1, the subscription fails, the bit number pin is kicked out of the subscription queue and the subscription failure information is saved to the database, and the front end is notified of the subscription failure information.
[0071] If the subscription count C1 of the bit number pin is not greater than the maximum number of subscriptions N1, proceed to step S23 for subscription.
[0072] The front end is notified of the subscription success information when the subscription succeeds, and the front end is notified of the subscription failure information when the subscription fails, and the text information, voice information or image information of the front end corresponds to the subscription result.
[0073] S3: Write the bit number pin value and save the result data to the database;
[0074] Specifically, writing the bit number pin value and saving the result data to the database includes the following steps:
[0075] S31: Load the write value configuration parameters into the memory.
[0076] Specifically, read the write value configuration parameters in the database into the memory, and the write value configuration parameters include the write value interval time T2, the number of write values P2 each time, the maximum number of write values N2 for each bit number pin, and the silence time D2 after the bit number pin write fails. The range of silence time D2 is 1-30 seconds.
[0077] S32: Add the bit number pin to be written to the write value queue.
[0078] Specifically, if the requested bit number pin allows write value, add the bit number pin to be written to the write value queue, find the value corresponding to the bit number pin (TAG1+COND1) in the write value queue, if the item of this bit number pin is found, reset the write count C2, write the value V2, and return directly; if not found, add this bit number pin value to the write value queue.
[0079] S33: Periodically write several bit number pin values from the write value queue.
[0080] Specifically, interval time T2, select the bit number pins with write count C2 not meeting the maximum write count N2 and the smallest write count C2 from the write value queue, select at most P2 bit number pins, and write the values corresponding to the bit number pins. The time when the bit number pin value is written is the write time.
[0081] S34: judge whether the real value of the bit number pin and the to-be-written value are consistent, if yes, kick out the bit number pin from the queue and save the write success result data to the database, if not, add one to the write count.
[0082] Specifically, the real value R2 of the bit number pin is read and compared with the to-be-written value V2. If the real value R2 and the to-be-written value V2 are consistent, it indicates that the value of the bit number pin is written successfully, the bit number pin is kicked out of the queue and the write success result data is saved to the database, and the front-end application is notified.
[0083] If the real value R2 and the to-be-written value V2 are inconsistent, the write count C2 = C2 + 1.
[0084] S35: judge whether the write count is greater than the maximum write count, if yes, the current time exceeds the sum of the write time and the silence time, the bit number pin is kicked out of the queue and the write failure result data is saved to the database, if not, step S33 is performed.
[0085] Specifically, the write count C2 is greater than the maximum write count N2, and the current time exceeds the sum of the write time and the silence time D2, if yes, it indicates that the write fails, the bit number pin is kicked out of the queue and the write failure result data is saved to the database, and the front-end application is notified.
[0086] When the write count C2 is not greater than the maximum write count N2, step S33 is performed.
[0087] The front-end is notified of the write success information when the write succeeds, and is notified of the write failure information when the write fails, and the text information, voice information or image information of the front-end correspond to the write result. The front-end obtains the write result, displays the write result in the form of a pop-up window or a log, calls the corresponding voice according to the write result and plays it, and displays the corresponding image according to the write result.
[0088] S4: read the result data and transmit it to the third-party system 7.
[0089] Specifically, according to actual needs, the result data is processed twice, the function result is reflected to the multi-working condition or the audit system, or is sent to the user mailbox through an email.
[0090] Embodiment two: as shown in the figure, the write stabilization system based on the untrusted OPC service includes: Figure 2
[0091] The configuration module 1 is configured to configure the subscription configuration parameter and the write value configuration parameter.
[0092] The receiving module 2 is configured to receive the data request of the third-party system 7 and perform subscription and write value according to the data request.
[0093] Subscription module 3, for subscribing to bit number pins according to data requests, connected to receiving module 2 and configuration module 1;
[0094] Write module 4, for writing values to bit number pins, connected to subscription module 3 and configuration module 1;
[0095] Storage module 5, for storing result data of subscription module 3 and write module 4, connected to subscription module 3 and write module 4;
[0096] Return module 6, for reading result data in storage module 5 and transmitting to third-party system 7, connected to storage module 5 and third-party system 7.
[0097] Embodiment three: the purpose of this embodiment is to provide a computing device.
[0098] A computing device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the write stabilization method based on untrusted OPC services when executing the program.
[0099] Embodiment four: the purpose of this embodiment is to provide a computer-readable storage medium.
[0100] A computer-readable storage medium having a computer program stored thereon, the program being executable by a processor to perform the steps of the write stabilization method based on untrusted OPC services.
[0101] Configurable multi-variable parameters provide different performance writes according to server performance, suitable for similar large-scale high-accuracy write operations. Batch writing improves write efficiency. Multiple interval times are used to reduce server pressure and improve write success rate. Comparing actual values with preset values improves write accuracy.
Claims
1. A method for write stabilization based on untrusted OPC service, characterized in that, Comprising: S1 receiving a third-party system data request; S2 subscribing to the bit number pin, and saving the bit number pin information of the successful subscription; Comprising S21 loading the subscription configuration parameters into the memory; S22 adding the bit number pin to be subscribed to the subscription queue; S23 periodically subscribing to multiple bit number pins from the subscription queue; S24 judging whether the bit number pin is successfully subscribed; if yes, kicking the bit number pin out of the subscription queue and saving the subscription success information to the database; if no, increasing the subscription count by one; S25 judging whether the subscription count is greater than the maximum subscription times; if yes, kicking the bit number pin out of the subscription queue and saving the subscription failure information to the database; if no, performing S23; S3 writing the bit number pin value and saving the result data to the database; S4 reading the result data and transmitting to the third-party system.
2. The write stabilization method based on untrusted OPC service according to claim 1, wherein, The subscription configuration parameters include the subscription interval time, the number of each subscription and the maximum subscription times.
3. The write stabilization method based on untrusted OPC service according to claim 1, wherein, S3 comprises the following steps: S31: loading the write value configuration parameters into the memory; S32: adding the bit number pin to be written to the write value queue; S33: periodically writing the values of several bit number pins from the write value queue; S34: judging whether the real value of the bit number pin and the value to be written are consistent; if yes, kicking the bit number pin out of the write value queue and saving the write success result data to the database; if no, increasing the write count by one; S35: judging whether the write count is greater than the maximum write times; if yes, kicking the bit number pin out of the write value queue and saving the write failure result data to the database when the current time exceeds the sum of the write time and the silence time; if no, performing step S33.
4. The write stabilization method based on untrusted OPC service according to claim 3, wherein, The write value configuration parameters include the write value interval time, the number of each write value, the maximum write times and the silence time.
5. The write stabilization method based on untrusted OPC service according to claim 3, wherein, The write time is the time when the bit number pin value is written, and the silence time ranges from 1 to 30 seconds.
6. The write stabilization method based on untrusted OPC service according to claim 1, wherein, The bit number pin with less subscription count is preferentially subscribed, and the bit number pin with less write count is preferentially written.
7. The write stabilization method based on untrusted OPC service according to claim 1 or 6, wherein, The write count of the bit number pin does not exceed the maximum write count, and the subscription count does not exceed the maximum subscription count.
8. The write stabilization method based on untrusted OPC service according to claim 1, wherein, The front end displays the subscription result and the write result by text, image or voice.
9. A write stabilization system based on untrusted OPC services, adapted to the write stabilization method based on untrusted OPC services according to any of claims 1 to 8, characterized in that, Comprising: A configuration module for configuring the subscription configuration parameters and the write value configuration parameters; A receiving module for receiving the data request of the third-party system and performing subscription and write value according to the data request; A subscription module for subscribing to the bit number pin according to the data request, connected to the receiving module and the configuration module; A write value module for writing the bit number pin, connected to the subscription module and the configuration module; A storage module for storing the result data of the subscription module and the write value module, connected to the subscription module and the write value module; A return module for reading the result data in the storage module and transmitting to the third-party system, connected to the storage module and the third-party system.
Citation Information
Patent Citations
Single write structure in cache of computer system
CN1115891A
Real-time database subscription system and method
CN104539583A
Method and system for storing wind power plant data
CN109634926A