A script scheduling and distribution method and an interactive system

By acquiring resource usage information of industrial control HMI devices, filtering and distributing scripts to idle devices within the local area network, the problem of industrial control HMI devices with limited hardware resources being unable to efficiently run a large number of scripts is solved, thereby improving the flexibility and efficiency of script execution.

CN122195660APending Publication Date: 2026-06-12XIAMEN HAIWELL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAMEN HAIWELL TECH CO LTD
Filing Date
2026-03-13
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Industrial control HMI devices have limited hardware resources, making it impossible to efficiently run large amounts of data processing scripts, resulting in insufficient script execution flexibility.

Method used

By obtaining the resource usage estimate information of the set of scripts to be executed, the scripts that exceed the current idle resources of the device are filtered out. The local area network self-discovery mechanism is used to find candidate idle devices, establish a distribution link, and distribute the scripts to devices with sufficient idle resources for execution, thereby realizing automatic scheduling and distribution.

Benefits of technology

It improves the flexibility and effectiveness of script execution, makes full use of idle resources within the local area network, and enables low-cost and efficient operation of large-scale data processing scripts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122195660A_ABST
    Figure CN122195660A_ABST
Patent Text Reader

Abstract

The application discloses a script scheduling distribution method and an interactive system, and relates to the technical field of industrial control. The method comprises the following steps: analyzing a obtained to-be-executed script set to obtain first resource occupation estimation information; when the first resource occupation estimation information exceeds first idle resources of a current device, screening scripts in the to-be-executed script set, constructing a to-be-distributed script set, and entering a script distribution mode; when the current device enters the script distribution mode, obtaining candidate idle devices in a target local area network and first resource state information corresponding to the candidate idle devices based on a local area network device self-discovery mechanism; establishing a distribution link based on the to-be-distributed script set, the candidate idle devices and the first resource state information; and sending target distribution scripts to the candidate idle devices based on the distribution link, and receiving script execution results returned by the candidate idle devices. The application can improve the flexibility of script execution and the script execution effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial control technology, and in particular to a script scheduling and allocation method and interactive system. Background Technology

[0002] In the field of industrial control, some industrial HMI devices support script execution, but there is a limit to the number of scripts that can be executed. Users download the completed scripts to the industrial HMI devices, and these scripts can only be executed on the receiving devices.

[0003] Industrial HMI devices are typically manufactured with limited hardware resources due to cost considerations and the general state of industry applications. However, in certain scenarios, some industrial HMI devices require the execution of extensive data processing scripts. In such cases, it is difficult to resolve the contradiction between limited hardware resources, numerous scripts, and the need for efficient operation. Summary of the Invention

[0004] The purpose of this application is to provide a script scheduling and allocation method and an interactive system, which can improve the flexibility and effectiveness of script execution.

[0005] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a script scheduling and allocation method, including: Obtain a set of scripts to be executed, and parse the set of scripts to be executed to obtain first resource usage estimation information; the first resource usage estimation information includes the number of scripts to be executed, the first total CPU usage estimate, and the first total memory usage estimate.

[0006] When the first resource occupancy estimate exceeds the first idle resource of the current device, the scripts in the script set to be executed are filtered based on the first idle resource of the current device, and a script set to be distributed is constructed based on the filtered scripts, and the script distribution mode is entered.

[0007] When the current device enters the script distribution mode, it obtains the candidate idle devices in the target local area network and the first resource status information corresponding to the candidate idle devices based on the local area network device self-discovery mechanism; the target local area network is a local area network constructed by multiple industrial control HMI devices.

[0008] A distribution link is established based on the set of scripts to be distributed, the candidate idle devices, and the first resource status information.

[0009] Based on the distribution link, the target distribution script is sent to the corresponding candidate idle device, and the script execution result returned by the candidate idle device is received; the target distribution script is one or more scripts in the set of scripts to be distributed.

[0010] Secondly, this application provides an interactive system including multiple industrial control HMI devices, and each industrial control HMI device is used to execute the script scheduling and allocation method described above.

[0011] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a script scheduling and allocation method and interactive system. After obtaining the set of scripts to be executed, the set of scripts to be executed is first parsed to obtain the first resource occupancy estimate information. It is then determined whether the first resource occupancy estimate information exceeds the first idle resource of the current device. If it does, some or all of the scripts in the set of scripts to be executed (i.e., the scripts that construct the set of scripts to be distributed) are selected and distributed (entering the script distribution mode). In the script distribution mode, candidate idle devices and their first resource status information are obtained based on the local area network device self-discovery mechanism. This allows for a comprehensive understanding of the distribution of all idle resources in the target local area network. Then, a distribution link is established to distribute the scripts in the set of scripts to be distributed to candidate idle devices with sufficient idle resources. This fully utilizes the idle resources of the candidate idle devices, realizes the automatic scheduling and distribution of all scripts to be executed, improves the flexibility of script execution, and enhances the script execution effect. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 A flowchart illustrating a script scheduling and allocation method provided in an embodiment of this application; Figure 2 A schematic diagram of the interaction timing of an interactive system provided in an embodiment of this application; Figure 3 This application provides another interactive timing diagram of an interactive system according to an embodiment of the present application; Figure 4 This is a schematic diagram of an interactive system structure provided in an embodiment of this application. Detailed Implementation

[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0015] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0016] The script scheduling and allocation method provided in this application embodiment can be applied to industrial control HMI devices. Such industrial control HMI devices support script execution and can establish a local area network with other industrial control HMI devices.

[0017] In one exemplary embodiment, such as Figure 1 As shown, a script scheduling and allocation method is provided, which can be executed by an industrial control HMI device, including steps 100 to 500. Wherein: Step 100: Obtain the set of scripts to be executed, and parse the set of scripts to be executed to obtain the first resource usage estimation information; the first resource usage estimation information includes the number of scripts to be executed, the first total CPU usage estimate, and the first total memory usage estimate.

[0018] Step 200: When the first resource occupancy estimate exceeds the first idle resource of the current device, the scripts in the script set to be executed are filtered based on the first idle resource of the current device, and a script set to be distributed is constructed based on the filtered scripts, and the script distribution mode is entered; the script set to be distributed is the script set to be executed or the script set to be distributed is a subset of the script set to be executed.

[0019] Step 300: When the current device enters script distribution mode, it obtains candidate idle devices and their corresponding first resource status information within the target local area network (LAN) based on the LAN device self-discovery mechanism. The target LAN is a LAN constructed by multiple industrial control HMI devices. Both the candidate idle devices and the current device are industrial control HMI devices, meaning the target LAN is a LAN constructed by the current device and multiple (at least one) candidate idle devices.

[0020] In one embodiment, the local area network (LAN) device self-discovery mechanism is implemented through the LAN UDP broadcast protocol. The self-discovery UDP protocol packet contains basic information of the discovered device (candidate idle device) (such as device IP information and software version) and first resource status information; the first resource status information is also the resource usage status, including CPU utilization, memory usage, number of running scripts, etc.

[0021] Step 400: Establish a distribution link based on the set of scripts to be distributed, the candidate idle devices, and the first resource status information.

[0022] Step 500: Based on the distribution link, the target distribution script is sent to the corresponding candidate idle device, and the script execution result returned by the candidate idle device is received; the target distribution script is one or more scripts in the set of scripts to be distributed.

[0023] In this embodiment, obtaining the set of scripts to be executed in step 100 refers to the set of scripts sent directly from the user / client to the current device, excluding scripts distributed from other devices in the target local area network.

[0024] Implementing steps 100 to 500 above, after obtaining the set of scripts to be executed, the set of scripts to be executed is first parsed to obtain the first resource occupancy estimation information, and it is determined whether the first resource occupancy estimation information exceeds the first idle resource of the current device. If it exceeds, some or all of the scripts (i.e., the scripts that construct the set of scripts to be distributed) are selected from the set of scripts to be executed and distributed (entering the script distribution mode). In the script distribution mode, candidate idle devices and their first resource status information are obtained based on the local area network device self-discovery mechanism. In this way, the distribution of all idle resources in the target local area network can be fully understood. Then, a distribution link is established to distribute the scripts in the set of scripts to be distributed to candidate idle devices with sufficient idle resources, making full use of the idle resources of the candidate idle devices, realizing the automatic scheduling and distribution of all scripts to be executed, improving the flexibility of script execution and improving the script execution effect.

[0025] This invention enables the automatic scheduling and distribution of scripts downloaded to industrial control HMI devices to other industrial control HMI devices with idle resources in the target local area network for execution, ultimately achieving low-cost, high-efficiency execution of large-scale data processing scripts.

[0026] In another exemplary embodiment of this application, the target distribution script in step 500 includes script logic content and data involved in the script (real-time changing device values ​​or variable values; for example, in the industrial control industry, the data can be values ​​collected by a temperature sensor). The target distribution script supports timed scripts and condition-triggered scripts.

[0027] Step 500 also includes: The current device generates a data subscription list of candidate idle devices and distributes all necessary variables / data to the candidate idle devices based on the distribution link between the two (which is maintained for a long time and used for data interaction).

[0028] Candidate idle devices will return the script execution results (e.g., results after data changes, script execution status results, and executed data read / write operations) to the current device via the distribution link (sent in real time). The current device obtains and caches the subscribed data based on the script execution results returned by the candidate idle devices.

[0029] In another exemplary embodiment of this application, step 100, which involves parsing the set of scripts to be executed to obtain the first resource consumption estimation information, is replaced by steps 101-103: Step 101: Count the number of scripts in the set of scripts to be executed and determine them as the number of scripts to be executed.

[0030] Step 102: Calculate the estimated CPU utilization of each script to be executed, and sum them to obtain a first total estimated CPU utilization. The estimated CPU utilization of each script to be executed = loop characteristic value + operation characteristic value + read / write characteristic value; the loop characteristic value is a value determined based on the number of loops in the script to be executed, the operation characteristic value is a value determined based on the operation type in the script to be executed, and the read / write characteristic value is a value determined based on the read / write frequency of the script to be executed.

[0031] The method for determining the cyclic feature value is as follows: no cycle, assign 1%; simple cycle (≤100 times), assign 3%; complex cycle (>100 times), assign 5%.

[0032] The method for determining the operational eigenvalue is as follows: no operation, assign 1%; only basic operations (addition, subtraction, multiplication, and division), assign 2%; including complex operations (floating-point / matrix), assign 4%.

[0033] The method for determining the read / write characteristic value can be as follows: no device read / write, assign 1%; low frequency read / write (≤10 times / second), assign 2%; high frequency read / write (>10 times / second), assign 3%.

[0034] Step 103: Calculate the estimated memory usage of each script to be executed and sum them to obtain the first estimated total memory usage. The memory usage of each script to be executed = base memory value + variable usage value + cache usage value; wherein, the base memory value is a preset memory value (e.g., each script to be executed has a default base memory usage of 1MB), the variable usage value is a value determined based on the total number of variables in the script to be executed (e.g., for every 10 variables, the variable usage value increases by 0.5MB, variables include sensor values, intermediate calculated values, etc.), and the cache usage value is a value determined based on the number of data entries that the script to be executed needs to cache (e.g., for every 100 cached data entries, the cache usage value increases by 0.5MB; when no caching is required, the cache usage value is 0MB).

[0035] In another exemplary embodiment of this application, the first free resource includes the number of executable scripts, the idle CPU utilization rate, and the idle memory usage; the first resource usage estimate exceeds the current device's first free resource when any of the following conditions are met: The number of scripts to be executed is greater than the number of executable scripts, the estimated total CPU utilization is greater than the idle CPU utilization, or the estimated total memory usage is greater than the idle memory usage.

[0036] The device calculates the first resource occupancy estimate based on the execution content of each script to be executed, and determines the first idle resource of the device based on the resource information already occupied by the device.

[0037] In another exemplary embodiment of this application, the current device can also directly calculate the total occupied resources (the sum of the first resource occupation estimate information and the resource information already occupied by the current device). When the total occupied resources exceed a certain limit (for example, the current CPU utilization rate is 20%, the first total CPU utilization rate estimate is 45%, and the sum of the two is 65%, which is greater than the limit value of 60%), the script distribution and scheduling logic is automatically triggered, that is, it is directly determined that "the first resource occupation estimate information exceeds the first idle resources of the current device".

[0038] In another exemplary embodiment of this application, in order to ensure the execution effect of important scripts, the scripts to be executed and candidate idle devices can be matched, and a distribution link can be established based on the matching results. Step 400 specifically includes steps 401 to 404. Wherein: Step 401: For each candidate idle device, determine the load value of the candidate idle device based on the corresponding first resource status information.

[0039] Step 402: Parse each script to be distributed to obtain a first parsing result, and determine the first priority value of the script to be distributed based on the first parsing result; the script to be distributed is any script in the set of scripts to be distributed.

[0040] Step 403: Determine the matching order based on the load value and the first priority value, and match the script to be distributed and the candidate idle devices according to the matching order to generate a matching result.

[0041] Step 404: Establish a distribution link based on the matching results.

[0042] Further, in step 401, the first resource status information includes the CPU utilization rate, memory utilization rate, and number of currently executing scripts of the candidate idle device; the formula for calculating the load value of the candidate idle device is: ; ; Wherein, LOAD represents the load value of the candidate idle device, W_CPU represents the CPU utilization weight coefficient of the candidate idle device (default is 0.35), CPU_USED represents the CPU utilization of the candidate idle device, W_MEM represents the memory utilization weight coefficient of the candidate idle device (default is 0.45), MEM_USED represents the memory utilization of the candidate idle device, W_NUM represents the script execution quantity load weight coefficient of the candidate idle device (default is 0.2), S_RATE represents the script execution quantity load of the candidate idle device, S_RUN represents the current number of scripts being executed on the candidate idle device, and S_MAX represents the maximum number of scripts allowed to be executed on the candidate idle device.

[0043] Furthermore, step 403 specifically includes: Step 4031: Determine the candidate idle device with the lowest load value as the target candidate idle device, or when the load values ​​are the same, determine the candidate idle device with the highest load threshold as the target candidate idle device.

[0044] Among them, when the load value < When _H, the corresponding candidate idle device is allowed to execute the distribution script of other devices. At this time, the corresponding candidate idle device can be the target candidate idle device. _H represents the load threshold for candidate idle devices, which defaults to 70%.

[0045] Step 4032: The script with the highest first priority value is identified as the target script to be distributed.

[0046] Step 4033: Based on the first script resource usage estimation information of the target candidate idle device, calculate the second script resource usage estimation information after the target candidate idle device is matched with the target script to be distributed; when the target candidate device has been matched, the first script resource usage estimation information is the second script resource usage estimation information calculated when the target candidate idle device was matched for the last time; when the target candidate idle device has not been matched, the first script resource usage estimation information is determined based on the first resource status information of the target candidate idle device.

[0047] Step 4034: When the estimated resource occupancy information of the second script does not exceed the second idle resource of the target candidate idle device, generate matching information between the target candidate idle device and the target script to be distributed, remove the target script to be distributed from the set of scripts to be distributed, and return to step 4032.

[0048] Step 4035: When the second script resource occupancy estimation information exceeds the second idle resource of the target candidate idle device, the target candidate idle device is determined as the selected device and the selected device is removed from the candidate idle devices, and the process returns to step 4031.

[0049] Step 4036: When the number of scripts to be distributed is 0, generate a matching result based on all the matching information; the matching result includes all the selected devices and all scripts to be distributed that match each of the selected devices.

[0050] It should be noted that if all candidate idle devices are unable to execute the target script to be distributed, the current device will execute the script and mark it as a high-load script, prompting the user to optimize it. At the same time, return to step 200 and re-execute the step of "determining the set of scripts to be distributed".

[0051] In some examples, when all candidate idle devices are unable to receive the distribution script, and the total resources of the current device (the sum of the estimated first resource usage information and the resource information already used by the current device) exceed the limit threshold (e.g., the sum of the estimated first total CPU usage and the current CPU usage exceeds 80%), only the core script (which can be configured as a script with a first priority value ≤ 2) is forcibly executed, non-essential functions are disabled, non-core scripts are suspended, and alarms are issued, such as local pop-up alarms, and the 10 most recent simple log entries (including trigger time and list of suspended scripts) are retained.

[0052] Further, in step 402, the first parsing result includes the real-time requirement level, script type value, estimated memory usage, and estimated CPU utilization of the script to be distributed; the formula for calculating the first priority value is: ; ; ; Where P represents the first priority value of the script to be distributed. This indicates the preset first priority value (default is 3), floor() is the floor function, and R represents the total resource consumption of the script to be distributed. This indicates the preset comprehensive resource consumption value (default is 20), TYPE indicates the script type value of the script to be distributed, W_TYPE indicates the script type value weight coefficient (default is 0.5), and RT indicates the real-time requirement level of the script to be distributed (the real-time requirement level can be a preset parameter). W_RT represents the preset real-time requirement level (default is 3), W_RT represents the weight coefficient of the real-time requirement level (default is 0.5), W_CPU represents the weight coefficient of the estimated CPU utilization, CPU represents the estimated CPU utilization of the script to be distributed, W_MEM represents the weight coefficient of the estimated memory utilization, MEM_RATE represents the estimated memory utilization of the script to be distributed, MEM represents the estimated memory usage of the script to be distributed, and MEM_total represents the preset total memory.

[0053] In some examples, the first priority value can be 1-5, with 1 being the highest priority.

[0054] The script type value of a scheduled script is 0, while the script type value of a condition-triggered script is 1.

[0055] The real-time requirement level can be set from 1 to 3, with 1 being the highest, requiring millisecond-level response.

[0056] The first priority value is used to determine the priority and allocation target of the scripts to be distributed. Its purpose is to achieve the optimal matching of "high-priority scripts being allocated to low-load candidate idle devices" based on the overall resource consumption (R) of the scripts to be distributed and the load value (LOAD) of the candidate idle devices.

[0057] In this embodiment, a composite algorithm of "weighted resource evaluation + dynamic priority scheduling" is employed. This composite algorithm includes three methods: a method for calculating the first resource occupancy estimation information, a method for calculating the load value, and a method for calculating the first priority value of the script. Through this composite algorithm, optimal allocation of script execution resources is achieved, balancing the load of the current device and candidate idle devices, and avoiding resource overload on a single device.

[0058] In another exemplary embodiment of this application, when the first resource occupancy estimate exceeds the first idle resource of the current device, in order to ensure the script execution effect of the current device, it is necessary to distribute some or all of the scripts in the script set to be executed to other industrial control HMI devices. The filtering of scripts in the script set to be executed in step 200 may include: Step 201: Parse each script to be executed to obtain a second parsing result, and determine the second priority value, estimated CPU utilization, and estimated memory usage of the script to be executed based on the second parsing result. In some examples, the second parsing result contains similar content to the first parsing result, the only difference being that the parsed script object is a script in the set of scripts to be executed. Correspondingly, the calculation method of the second priority value is similar to that of the first priority value in the previous embodiment, and will not be repeated here.

[0059] Step 202: Sort the scripts to be executed in descending order of their second priority values.

[0060] Step 203: Calculate the second resource usage estimation information for the first n scripts to be executed; the second resource usage estimation information includes the number of the first n scripts to be executed, the second total CPU usage estimate, and the second total memory usage estimate; where n≥1.

[0061] Step 204: If the estimated second resource occupancy information of the current n scripts to be executed does not exceed the first free resource of the current device, then n = n + 1, and return to step 203.

[0062] Step 205: When the estimated second resource usage information of the current n scripts to be executed exceeds the first free resource of the current device, the nth script to be executed to the last script to be executed is determined as the selected scripts.

[0063] In another exemplary embodiment of this application, the first idle resource in step 200, the second idle resource in step 4034 and step 4035 all include the number of executable scripts, idle CPU utilization, and idle memory usage, etc.

[0064] The process for determining the first and second idle resources is as follows: For any industrial control HMI device in the target local area network, the number of scripts being executed, the current memory usage, and the current CPU utilization are calculated in real time.

[0065] Calculate the difference between the maximum number of scripts allowed to be executed (e.g., a maximum of 200 scripts allowed to be executed) and the number of scripts currently being executed; this difference is the number of executable scripts.

[0066] Calculate the difference between the maximum allowed CPU utilization (e.g., the maximum allowed CPU utilization is 60%, set by the customer, less than or equal to 100%) and the current CPU utilization (e.g., the current CPU utilization is 20%). This difference (e.g., 40%) is the idle CPU utilization.

[0067] Calculate the difference between the maximum allowed memory threshold (e.g., a maximum allowed memory of 500MB, set by the customer, less than or equal to the maximum memory the device can provide) and the current memory usage. This difference is the amount of free memory used.

[0068] In another exemplary embodiment of this application, when the first resource occupancy estimate does not exceed the first idle resource of the current device (meaning the current device can execute all scripts in the set of scripts to be executed, and does not need to enter script distribution mode), and the remaining idle resource of the current device is greater than a preset idle resource threshold, the current device is marked as a candidate idle device. Here, the remaining idle resource refers to the idle resource remaining after subtracting the first resource occupancy estimate from the first idle resource of the current device. The remaining idle resource may include the number of executable scripts, idle CPU utilization, and idle memory usage, etc. The preset idle resource threshold includes preset thresholds for each value in the remaining idle resource, such as an idle threshold for the number of executable scripts, an idle threshold for CPU utilization, and an idle threshold for memory usage.

[0069] As an example, when the number of executable scripts in the remaining idle resources is 50 and the idle threshold for the number of executable scripts is 40, the remaining idle resources are greater than the preset idle resource threshold.

[0070] As an example, when the idle CPU utilization rate in the remaining idle resources is 10% and the idle CPU utilization threshold is 20%, the remaining idle resources are no greater than the preset idle resource threshold.

[0071] As an example, when the amount of free memory in the remaining free resources is 200M and the free memory threshold is 100M, the remaining free resources are greater than the preset free resource threshold.

[0072] As an example, the remaining idle resources being greater than the preset idle resource threshold can be configured such that the remaining idle resources in all dimensions are greater than the corresponding preset idle resource threshold, or it can be configured such that the remaining idle resources in some dimensions are greater than the corresponding preset idle resource threshold, or it can be configured such that the remaining idle resources in any dimension are greater than the corresponding preset idle resource threshold.

[0073] When the current device is marked as a candidate idle device, the remaining idle resources of the current device are sent to the target local area network. At this time, the remaining idle resources are the first resource status information.

[0074] In another exemplary embodiment of this application, when the current device is marked as a candidate idle device, a distribution script execution request and a target distribution script are obtained; the distribution script execution request is used to establish a distribution link.

[0075] The target distribution script is executed and the script execution result of the target distribution script is sent to the target distribution device; the target distribution device is the device that sends the distribution script execution request.

[0076] As an example, the process of establishing a distribution link includes: after obtaining the distribution script execution request, and before obtaining the target distribution script, the current device also sends information allowing script distribution to the target distribution device. At this point, the distribution link is established. After obtaining the distribution script execution request, it can be determined whether the current device's configuration information allows the execution of scripts from other devices, or it can be re-evaluated whether the current device's remaining idle resources are greater than a preset idle resource threshold. If the current device is configured not to execute scripts from other devices or the current device's remaining idle resources are not greater than the preset idle resource threshold, then the current device sends information rejecting script distribution to the target distribution device, thus rejecting the establishment of the distribution link.

[0077] In another exemplary embodiment of this application, a keep-alive detection mechanism exists between the current device and candidate idle devices. When a candidate idle device goes offline abnormally, the current device will reclaim the distributed scripts and re-make scheduling decisions, including redistributing them to other candidate idle devices or executing them locally (on the current device). Simultaneously, after the connection between the current device and the candidate idle devices is lost, the target distributed scripts received by the candidate idle devices will also be terminated.

[0078] When the distribution link is interrupted, the set of scripts to be distributed is re-determined based on the abnormal device and the script execution result returned by the abnormal device, and the re-determined set of scripts to be distributed is scheduled and allocated; the abnormal device is the candidate idle device corresponding to the interrupted distribution link.

[0079] As an example, the target local area network includes four industrial control HMI devices. One device enters script distribution mode and is marked as the distribution industrial control HMI device. The other three devices are marked as candidate idle devices, namely the first execution industrial control HMI device, the second execution industrial control HMI device, and the third execution industrial control HMI device.

[0080] The distribution industrial control HMI device establishes distribution link 1 and distribution link 2 with the first execution industrial control HMI device and the third execution industrial control HMI device, respectively. It distributes the first part of the script set to be distributed to the first execution industrial control HMI device and the second part to the third execution industrial control HMI device. During script execution, if the first execution industrial control HMI device experiences a communication failure (e.g., device malfunction, insufficient resources, or temporary configuration to not execute scripts from other devices), distribution link 1 will be interrupted. Upon detecting the interruption of distribution link 1, the current device determines that the first execution industrial control HMI device corresponding to the interrupted link is an abnormal device, re-identifies the first part of the script set as the script set to be distributed, and re-schedules and allocates it.

[0081] The rescheduling and allocation of scripts refers to distributing the scripts in the newly determined set of scripts to be distributed to other candidate idle devices (e.g., to the second execution industrial control HMI device) according to the script scheduling and allocation method described above. This includes establishing a distribution link with the second execution industrial control HMI device, sending the target distribution script, and receiving the script execution results from the second execution industrial control HMI device, which will not be elaborated here.

[0082] like Figure 2 and Figure 3 The diagram shows the interaction timing of the distribution industrial control HMI device (distribution end), the first execution industrial control HMI device (execution end 1), and the second execution industrial control HMI device (execution end 2). Figure 2 This is to distribute the interaction process between the industrial control HMI device and the first executing industrial control HMI device. Figure 3 After the distribution link between the distribution industrial control HMI device and the first execution industrial control HMI device is interrupted, the interaction process between the distribution industrial control HMI device and the second execution industrial control HMI device is re-scheduled. Figure 2 The interaction process shown is similar, the only difference being the execution device; the interaction timing diagram has been omitted.

[0083] In one exemplary embodiment, such as Figure 4 As shown, an interactive system is provided, including multiple industrial control HMI devices, and each industrial control HMI device is used to execute the script scheduling and allocation method described in any of the above embodiments.

[0084] It should be noted that the data involved in this application (including but not limited to data used for analysis, data stored, data displayed, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data are carried out in accordance with the relevant data protection laws and policies of the country where the location is located and with the authorization of the owner of the corresponding device.

[0085] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0086] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0087] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A script scheduling and allocation method, characterized in that, The script scheduling and allocation method includes: A set of scripts to be executed is obtained, and the set of scripts to be executed is parsed to obtain first resource usage estimation information; the first resource usage estimation information includes the number of scripts to be executed, a first total CPU usage estimate, and a first total memory usage estimate. When the first resource occupancy estimate exceeds the first idle resource of the current device, the scripts in the script set to be executed are filtered based on the first idle resource of the current device, and a script set to be distributed is constructed based on the filtered scripts, and the script distribution mode is entered. When the current device enters script distribution mode, it obtains candidate idle devices and the first resource status information corresponding to the candidate idle devices in the target local area network based on the local area network device self-discovery mechanism; the target local area network is a local area network constructed by multiple industrial control HMI devices; A distribution link is established based on the set of scripts to be distributed, the candidate idle devices, and the first resource status information; Based on the distribution link, the target distribution script is sent to the corresponding candidate idle device, and the script execution result returned by the candidate idle device is received; the target distribution script is one or more scripts in the set of scripts to be distributed.

2. The script scheduling and allocation method according to claim 1, characterized in that, The first idle resources include the number of executable scripts, idle CPU utilization, and idle memory usage; the first resource usage estimate exceeds the current device's first idle resources, specifically including: The number of scripts to be executed is greater than the number of executable scripts, the estimated total CPU utilization is greater than the idle CPU utilization, or the estimated total memory usage is greater than the idle memory usage.

3. The script scheduling and allocation method according to claim 1, characterized in that, Based on the set of scripts to be distributed, the candidate idle devices, and the first resource status information, a distribution link is established, specifically including: For each of the candidate idle devices, the load value of the candidate idle device is determined based on the corresponding first resource status information; Each script to be distributed is parsed to obtain a first parsing result, and a first priority value of the script to be distributed is determined based on the first parsing result; the script to be distributed is any script in the set of scripts to be distributed. The matching order is determined based on the load value and the first priority value, and the script to be distributed and the candidate idle devices are matched according to the matching order to generate a matching result; A distribution link is established based on the matching results.

4. The script scheduling and allocation method according to claim 3, characterized in that, The matching order is determined based on the load value and the first priority value, and the script to be distributed and the candidate idle devices are matched according to the matching order to generate a matching result, specifically including: The candidate idle device with the lowest load value is identified as the target candidate idle device; The script with the highest first priority value is identified as the target script to be distributed. Based on the first script resource usage estimation information of the target candidate idle device, the second script resource usage estimation information after the target candidate idle device is matched with the target script to be distributed is calculated; when the target candidate device has been matched, the first script resource usage estimation information is the second script resource usage estimation information calculated when the target candidate idle device was matched for the last time; when the target candidate idle device has not been matched, the first script resource usage estimation information is determined based on the first resource status information of the target candidate idle device. When the estimated resource usage information of the second script does not exceed the second idle resource of the target candidate idle device, the matching information between the target candidate idle device and the target script to be distributed is generated, and the target script to be distributed is removed from the set of scripts to be distributed. The process returns to the step of determining the script to be distributed with the highest first priority value as the target script to be distributed. When the estimated resource usage information of the second script exceeds the second idle resource of the target candidate idle device, the target candidate idle device is determined as the selected device and the selected device is removed from the candidate idle devices. Then, the process returns to the step of determining the candidate idle device with the lowest load value as the target candidate idle device. When the number of scripts to be distributed is 0, a matching result is generated based on all the matching information; the matching result includes all the selected devices and all scripts to be distributed that match each of the selected devices.

5. The script scheduling and allocation method according to claim 3, characterized in that, The first parsing result includes the real-time requirement level, script type value, estimated memory usage, and estimated CPU utilization of the script to be distributed; the formula for calculating the first priority value is: ; ; ; Where P represents the first priority value of the script to be distributed. This indicates the preset first priority value, floor() represents the floor function, and R represents the total resource consumption of the script to be distributed. This indicates the preset overall resource consumption value, TYPE indicates the script type value of the script to be distributed, W_TYPE indicates the script type value weight coefficient, and RT indicates the real-time requirement level of the script to be distributed. W_RT represents the weighting coefficient of the real-time requirement level, W_CPU represents the weighting coefficient of the estimated CPU utilization, CPU represents the estimated CPU utilization of the script to be distributed, W_MEM represents the weighting coefficient of the estimated memory utilization, MEM_RATE represents the estimated memory utilization of the script to be distributed, MEM represents the estimated memory usage of the script to be distributed, and MEM_total represents the preset total memory.

6. The script scheduling and allocation method according to claim 1, characterized in that, The scripts in the set of scripts to be executed are filtered, specifically including: Each script to be executed is parsed to obtain a second parsing result, and the second priority value, CPU utilization estimate, and memory utilization estimate of the script to be executed are determined based on the second parsing result. The scripts to be executed are sorted in descending order of their second priority value; Calculate the second resource usage estimate information for the first n scripts to be executed; the second resource usage estimate information includes the number of the first n scripts to be executed, the second total CPU utilization estimate, and the second total memory usage estimate; where n≥1; If the estimated second resource usage of the current n scripts to be executed does not exceed the first free resource of the current device, then n = n + 1, and return to the step of calculating the estimated second resource usage of the previous n scripts to be executed; When the estimated second resource usage of the current n scripts to be executed exceeds the first free resource of the current device, the nth script to be executed to the last script to be executed is determined as the selected script.

7. The script scheduling and allocation method according to claim 1, characterized in that, Also includes: When the first resource occupancy estimate does not exceed the first free resource of the current device and the remaining free resource of the current device is greater than the preset free resource threshold, the current device is marked as a candidate free device. When the current device is marked as a candidate idle device, the remaining idle resources of the current device are sent to the target local area network.

8. The script scheduling and allocation method according to claim 1, characterized in that, Also includes: When the current device is marked as a candidate idle device, obtain the distribution script execution request and the target distribution script; The distribution script execution request is used to establish a distribution link; The target distribution script is executed and the script execution result of the target distribution script is sent to the target distribution device; the target distribution device is the device that sends the distribution script execution request.

9. The script scheduling and allocation method according to claim 1, characterized in that, Also includes: When the distribution link is interrupted, the set of scripts to be distributed is re-determined based on the abnormal device and the script execution result returned by the abnormal device, and the re-determined set of scripts to be distributed is scheduled and allocated; the abnormal device is the candidate idle device corresponding to the interrupted distribution link.

10. An interactive system, characterized in that, The interactive system includes multiple industrial control HMI devices, and each industrial control HMI device is used to execute the script scheduling and allocation method according to any one of claims 1-9.