Method for checking repetition and conflicts by using co-prime characteristics for electrical automation control
By assigning coprime factors to methods in electrical automation control and using a shared characteristic variable Y, the problem of increased variable and pin counts in existing technologies is solved, and intuitive judgment of method execution counts and conflicts is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-04-10
AI Technical Summary
Existing methods for checking for conflicts or duplicates in electrical automation control require setting flag variables for each method, which increases the number of variables and pins, and the flag status cannot intuitively reflect the number of executions and conflict situations.
A coprime property check method is adopted, which assigns coprime factors to the methods to be checked and uses a shared characteristic variable Y to judge the execution status of the methods, including multiplication update and division check to determine duplication or conflict.
It effectively reduces the overhead of pins and variables, simplifies method management, and allows for a clear understanding of the number of times a method is executed and conflict situations.
Smart Images

Figure CN121832503A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a method for checking repetition and conflict, in particular to a method for checking repetition and conflict by using co-prime characteristics in electrical automation control. BACKGROUND
[0002] In the prior art application of electrical automation control, the method for checking the conflict or repetition of the execution method method, generally sets a characteristic variable for each method method, and finally judges each characteristic variable respectively, and then compares and confirms the repetition or conflict. Specifically, a flag bit variable is set for the execution of each method method, and then the flag bit is set when the method method is executed. When checking, the state of the flag bit of each method method is compared to determine whether the execution of each method is repeated or conflicted.
[0003] The above method needs to set a flag bit variable for the execution of each method method, and the transmission of the flag bit between methods method needs input and output pins, which increases the number of variable requirements, the number of pins, and also increases the management difficulty of the method method. In addition, since the flag bit variable usually has only two states of TRUE and FALSE, it cannot directly reflect the number of repeated executions and the conflict situation of the method method. SUMMARY
[0004] The present application proposes a method for checking repetition and conflict by using co-prime characteristics in electrical automation control, which aims to overcome the above-mentioned deficiencies in the prior art, The technical solution of the present application: the method for checking repetition and conflict by using co-prime characteristics in electrical automation control, comprising the following steps: S1, assigning co-prime factors X to each method method to be checked n respectively. n .
[0005] S2, setting a characteristic variable Y for checking, and the initial value is 1.
[0006] S3, updating the characteristic variable Y when the method is executed.
[0007] S4, checking the characteristic variable Y to confirm the repetition or conflict.
[0008] Preferably, X in step S1 n is an integer, all X n are co-prime numbers, and the factor X corresponding to each method is unique and not repeated.
[0009] Preferably, the characteristic variable Y in step S2 is a characteristic variable Y of all methods methodn A common characteristic variable Y is used to store the execution status of the methods, Y is an integer variable.
[0010] Preferably, the characteristic variable Y in step S2 is an unsigned long integer ULINT.
[0011] Preferably, step S3 is specifically, when a certain method method n is executed, the characteristic variable Y is multiplied by the corresponding factor X n , and then the characteristic variable Y is updated, i.e. Y=Y*X n ; if the method is not executed, the characteristic variable Y is not updated, and the characteristic variable Y remains unchanged.
[0012] Preferably, step S4 is specifically, the characteristic variable Y is divided by the factors of the methods to be checked, to check whether there is a remainder, or whether it can be divided by the factors, and the result of the division, to determine whether there is a conflict or repetition.
[0013] Preferably, step S4 determines whether a method method a is executed repeatedly, by taking the factor X a as the divisor, Y as the dividend, to obtain M=Y MOD X a and N=Y / X a ; if M is not zero, the method method a is not executed repeatedly; if M is zero and N is 1, the method method a is not executed repeatedly, but only once; if M is zero and N is greater than 1, the method method a is executed repeatedly, and N is the number of times of execution.
[0014] Preferably, step S4 determines whether two conflicting methods method a and method b are executed to cause a conflict, by taking the product A of the factors X a and X b as the divisor, and the characteristic variable Y as the dividend, to obtain M=Y MOD A; if M is not zero, the methods method a and method b are not executed simultaneously, and there is no conflict; if M is zero, the methods method a and method b are both executed, and there is a conflict.
[0015] Preferably, step S4 determines whether two coupled methods method a and method bIf both are executed, if there is an exception that the method is not executed, take two methods method a , method b The factor X of a and the product A of X b is the divisor, and the characteristic variable Y is the dividend, M=Y MOD A; if M is not zero, the method method a and the method method b are not executed simultaneously, and there is an exception; if M is zero, the method method a and the method method b are executed, and there is no exception.
[0016] The advantages of the present application: the method design is reasonable, compared with the prior art inspection method, only one characteristic variable needs to be set, which can effectively reduce the pin channel and the variable on the variable. Specifically, since all methods method share a characteristic variable Y, the variable consumption is smaller, and the pins of each method method can be unified, which is convenient for method management. And because of the coprime characteristic, the number of repetitions and the conflict of the method method can be determined by the remainder and the quotient. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 is a flow chart of an embodiment of the method for checking repetition and conflict using the coprime characteristic for electrical automation control. DETAILED DESCRIPTION
[0018] The present application will be further described in detail below in combination with embodiments and specific implementation manners.
[0019] The method for checking repetition and conflict using the coprime characteristic for electrical automation control comprises the following steps: S1, each method method n to be checked is respectively assigned a coprime factor X n .
[0020] Specifically, X n is preferably a relatively small integer, and all X n must be coprime to each other, and the factor X corresponding to each method method is unique and not repeated.
[0021] S2, set a characteristic variable Y for checking, and the initial value is 1.
[0022] Specifically, this step establishes a characteristic variable Y shared by all methods method n to be checked, which is used to store the execution of the method. Y is a large integer variable, such as an unsigned long integer ULINT.
[0023] S3. When executing the method, update the feature variables.
[0024] Specifically, when executing a method to be checked... n When the characteristic variable Y is multiplied by the corresponding factor X, n Then, update the feature variable Y, i.e., Y = Y * X. n If this method is not executed, the feature variable Y will not be updated, and the feature variable Y will retain its original value.
[0025] S4. Check the characteristic variables to identify duplicates or conflicts.
[0026] Specifically, during the inspection, the characteristic variable Y is divided by the factors of each method to be inspected, and the remainder, divisibility, and divisibility result are checked to determine whether there are conflicts or duplicates.
[0027] The following are examples of conflicting or repetitive judgments: Determine a method a If the operation has not been executed repeatedly, take its factor X. a With Y as the divisor and X as the dividend, we get M = Y MOD X a (Remainder instruction) and N=Y / X a If M is not zero, then the method... a Not executed; if M is zero and N is 1, then the method is executed. a It was not executed repeatedly; it was executed only once. If M is zero and N is greater than 1, then the method... a It is executed repeatedly multiple times, where N is the number of times it is executed.
[0028] When determining whether two conflicting methods have been executed, resulting in a conflict, take the two methods to be checked for conflict. a method b Factor X a and X b Using the product A as the divisor and the characteristic variable Y as the dividend, we get M = Y MOD A (the remainder instruction). If M is not zero, then the method... a and method b If they are not executed simultaneously, there is no conflict; if M is zero, then the method... a and method b Both were executed, resulting in a conflict.
[0029] Determine which two coupled methods must be executed simultaneously. a and method b To determine whether all methods were executed, and whether there were any exceptions indicating that a method was not executed, take the two methods to be checked.a , method b of factor X a and X b , the product A of X and Y as the divisor, the characteristic variable Y as the dividend, M=Y MOD A (remainder instruction). If M is not zero, the method method a and the method method b are not executed simultaneously, there is an exception; if M is zero, the method method a and the method method b are executed, there is no exception.
[0030] For the conflict and coupling judgment of three or more methods method, the processing process can be analogized in the above manner.
[0031] The above only describes the preferred embodiments of the present application, and it should be noted that, for those skilled in the art, without departing from the inventive concept, several modifications and improvements can be made, which are all within the protection scope of the present application.
Claims
1. A method for checking duplicates and conflicts using coprime properties in electrical automation control, characterized in that, Includes the following steps: S1 represents the methods to be checked. n Assign coprime factors X to each of them. n ; S2. Set the feature variable Y used for inspection, with an initial value of 1; S3. When executing the method, update the feature variable Y; S4. Check the characteristic variable Y to confirm duplicates or conflicts.
2. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 1, characterized in that, X in step S1 n For integers, all X n The numbers are coprime to each other, and the factor X corresponding to each method is unique and not repeated.
3. The method for checking duplicates and conflicts using coprime characteristics for electrical automation control as described in claim 2, characterized in that, The feature variable Y in step S2 is all the methods to be checked. n A shared feature variable is used to store the execution status of the method; Y is an integer variable.
4. The method for checking duplicates and conflicts using coprime characteristics for electrical automation control as described in claim 3, characterized in that, The characteristic variable Y in step S2 is an unsigned long integer ULINT.
5. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 3 or 4, characterized in that, Specifically, step S3 involves executing a method to be checked. n When the characteristic variable Y is multiplied by the corresponding factor X, n Then, update the feature variable Y, i.e., Y = Y * X. n If this method is not executed, the feature variable Y will not be updated, and the feature variable Y will retain its original value.
6. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 5, characterized in that, Specifically, step S4 involves dividing the feature variable Y by the factors of each method to be investigated, checking for any remainders, divisibility, and the divisibility result, and determining whether there are any conflicts or duplicates.
7. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 6, characterized in that, Step S4 determines a method. a If the operation has not been executed repeatedly, take its factor X. a With Y as the divisor and X as the dividend, we get M = Y MOD X a and N=Y / X a If M is not zero, then the method... a Not executed; if M is zero and N is 1, then the method is executed. a It was not executed repeatedly; it was executed only once. If M is zero and N is greater than 1, then the method... a It is executed repeatedly multiple times, where N is the number of times it is executed.
8. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 6, characterized in that, When determining in step S4 whether both conflicting methods have been executed, resulting in a conflict, the two methods to be checked for conflict are selected. a method b Factor X a and X b Using the product A as the divisor and the characteristic variable Y as the dividend, we get M = Y MODA; if M is not zero, then the method... a and method b If they are not executed simultaneously, there is no conflict; if M is zero, then the method... a and method b Both were executed, resulting in a conflict.
9. The method for checking duplicates and conflicts using coprime properties for electrical automation control as described in claim 6, characterized in that, Step S4 determines the two coupled methods that must be executed simultaneously. a and method b To determine whether all methods were executed, and whether there were any exceptions indicating that a method was not executed, take the two methods to be checked. a method b Factor X a and X b Using the product A as the divisor and the characteristic variable Y as the dividend, we get M = Y MOD A; if M is not zero, then the method... a and method b An exception occurs if the methods are not executed simultaneously; if M is zero, then the method... a and method b All were executed without any exceptions.