Method and system for multi-task scheduling optimization based on local control unit
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]针对现有技术的不足,本发明提供了基于本地控制单元的多任务调度优化方法及系统,解决了现有控制单元采用静态调度与固定中断响应机制,导致在面对现场物理工况突变和节点通信故障时,核心算力响应滞后且系统总线资源被无效占用的问题
1.本发明通过将任务解耦为微任务并计算涵盖物理特征张力与通信探活张力的状态张力值,系统提取张力集合中数值居首的微任务进行处理,该方法改变了按设定时间步长轮转执行代码的架构,使微处理器依据外部采集参量和总线统计量直接重定向代码执行指针,减少了工况突变时状态机切换所需的时钟周期数。
Smart Images

Figure CN122261773B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial control technology, specifically to a multi-task scheduling optimization method and system based on a local control unit. Background Technology
[0002] In the field of industrial control, local control units, as the core of field-level control, need to simultaneously handle physical status monitoring of motors and interlocks, as well as data bus polling for multiple underlying sub-devices and external devices. Existing local control units mostly adopt polling scheduling based on fixed time slices or preemptive software architecture with preset static priorities for task flow.
[0003] In this static scheduling architecture, when the operating parameters of the physical execution object approach overload boundaries or the hardwired protection loop state changes abruptly, the microprocessor's kernel resources still need to be allocated to the regular network node polling program according to a fixed clock slice. This time allocation mechanism makes it difficult for the microprocessor to concentrate its underlying computing power on the code area executing power-off protection and threshold calculations at points of sudden changes in physical conditions. Meanwhile, hardware interrupt requests for external communication interfaces in existing controllers are normally kept enabled. If external devices continuously issue read or configuration commands during the control system's processing of physical anomalies, the local control unit will be forced to frequently respond to peripheral level triggers, causing the kernel to continuously execute register push and communication protocol stack parsing operations, thereby crowding out the computational cycles used for handling interlocking logic. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a multi-task scheduling optimization method and system based on a local control unit. This solves the problem that existing control units, which employ static scheduling and fixed interrupt response mechanisms, result in delayed core computing power response and ineffective occupation of system bus resources when faced with sudden changes in on-site physical conditions and node communication failures.
[0005] To achieve the above objectives, the first aspect of the present invention provides a multi-task scheduling optimization method based on a local control unit, wherein the local control unit is connected to an external device, a motor, an interlock device, and at least one sub-device; the method includes the following steps: The tasks to be executed by the local control unit are divided into multiple micro-tasks. The micro-tasks include at least physical monitoring tasks for the motor and the interlock, and device communication polling tasks for each of the sub-devices. Within the set task scheduling period, the state tension value corresponding to each micro-task is calculated, wherein the state tension value corresponding to the physical monitoring task is the physical feature tension, and the state tension value corresponding to the device communication polling task of each sub-device is the corresponding communication probing tension. The state tension values of each microtask are obtained to generate a tension set. The microtask corresponding to the state tension value with the largest value in the tension set is extracted and executed as the current microtask to be executed. During the task scheduling cycle, the interrupt response state of the local control unit in receiving instructions from the external device is adjusted according to the physical characteristic tension in the tension set. When the microtask to be executed is a device communication polling task for a target sub-device, the communication frame structure for the target sub-device is adjusted according to the communication probing tension corresponding to the target sub-device.
[0006] Furthermore, for the core tension calculation involved in the above scheduling logic, this invention establishes a specific quantitative mathematical model.
[0007] The physical characteristic tension is calculated as follows: Obtain the real-time interlock status parameters of the interlock device and the real-time motor current of the motor; if the real-time interlock status parameters indicate that the interlock is open, then set the physical characteristic tension to a preset maximum tension constant; if the real-time interlock status parameters indicate that the interlock is closed, then calculate the physical characteristic tension using the following formula: ; in: It is a physical characteristic tension; The real-time motor current of the motor is obtained by real-time sampling and conversion through the analog signal acquisition channel of the local control unit; The preset safe current threshold is read from the local non-volatile memory; The base of a constant greater than one is preset for the system; This is the scaling factor constant that is set.
[0008] The calculation method for the communication probe tension corresponding to the target sub-device adopts a negative exponential decay model, and the specific formula is as follows: ; in: The communication probe tension corresponding to the target sub-device; The current cumulative communication failure frequency of the target sub-device is obtained by the local control unit through closed-loop accumulation or deduction based on the response status code after each underlying communication interface transmit / receive task is completed. The preset basic exploration tension constant; The set attenuation coefficient constant; It is a natural constant.
[0009] Furthermore, the microtask also includes a buffer flushing task, and the corresponding state tension value is the cache backlog tension; the cache backlog tension is calculated by weighted summation of the frame backlog length to be written to the buffer in the local control unit and the waiting time of the first frame in the queue.
[0010] Furthermore, when executing the tension-based hardware-software co-processing anti-disturbance mechanism, the specific steps include: comparing the physical feature tension with a first preset threshold; if the physical feature tension is greater than or equal to the first preset threshold, generating an interrupt shielding signal, disabling the reception of instruction interrupt requests from the external device, and refusing to receive data sent by the external device; if the physical feature tension is less than the first preset threshold, enabling the reception of instruction interrupt requests from the external device.
[0011] Furthermore, when executing the communication frame topology dynamic dimensionality reduction mechanism, the specific steps include: comparing the communication activation tension corresponding to the target sub-device with a second preset threshold; when the communication activation tension is greater than or equal to the second preset threshold, sending a point-to-point read parameter frame containing a parameter acquisition request to the target sub-device; when the communication activation tension is less than the second preset threshold, stopping the sending of point-to-point read parameter frames to the target sub-device, and encapsulating the activation request for the target sub-device into a global composite broadcast activation frame for transmission; the local control unit receives a response data frame from the target sub-device, which does not contain parameter payload data.
[0012] Furthermore, in the initial stage of method execution, the system performs pre-loading initialization based on historical states: it reads the stored historical communication fault frequency matrix and assigns it as the initial fault frequency of each sub-device. After obtaining the initial physical parameters, it sends the first parameter read command to each sub-device sequentially according to the initial fault frequencies in ascending order. While the main loop is executing the buffer flushing task, the system updates the cumulative communication fault frequency of the corresponding sub-device in a closed loop according to the success, timeout, or verification failure response status codes returned by the communication interface, following a set step size, until the lower limit is zero.
[0013] A second aspect of the present invention provides a multi-task scheduling optimization system based on a local control unit, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the multi-task scheduling optimization method based on a local control unit as described in the first aspect of the present invention.
[0014] This invention provides a multi-task scheduling optimization method and system based on a local control unit. It has the following beneficial effects: 1. This invention decouples tasks into microtasks and calculates state tension values that encompass physical characteristic tension and communication probing tension. The system extracts the microtask with the highest value in the tension set for processing. This method changes the architecture of executing code in a round-robin fashion according to a set time step, allowing the microprocessor to directly redirect the code execution pointer based on externally acquired parameters and bus statistics, thereby reducing the number of clock cycles required for state machine switching when operating conditions change abruptly.
[0015] 2. In this invention, when the physical characteristic tension exceeds the first preset threshold, the controller's underlying configuration register generates an interrupt shielding signal to close the trigger request of the external data interface. This mechanism, under the conditions of interlock disconnection or current exceeding the limit, blocks the external data reception and protocol parsing process at the pin level, and concentrates the released microprocessor operation cycles on the data sampling and control word sending operations of the physical protection circuit.
[0016] 3. In this invention, when the communication activity detection tension of the target sub-device is lower than the second preset threshold, the system suspends the issuance of point-to-point reading parameter frames and instead encapsulates the activity detection command in a global composite broadcast activity detection frame. This processing logic reduces the span of time that the faulty node occupies the underlying transceiver bit by removing the parameter payload field in the response data frame, while retaining the node connectivity status acquisition channel.
[0017] 4. In the initialization phase of this invention, the system reads the historical communication fault frequency matrix and assigns the current initial fault frequency of each sub-device to the recorded value. The system sends the first parameter reading instruction to each sub-device in ascending order of initial fault frequency. This step strips the parameter payload field from the data packet, reduces the time that the node occupies the baud rate generator and communication bus, and maintains the level handshake action with the node.
[0018] 5. When the system performs the buffer flushing task, it extracts and sends the instruction frame. Then, based on the verification and timeout status codes fed back by the communication interface, it performs an increment or decrement operation with a lower limit of zero on the cumulative communication fault frequency of the corresponding sub-device. This mechanism directly modifies the frequency variable in memory with hardware status codes, providing a numerical source for the detection tension calculation and driving the control unit to switch the interface working state between point-to-point polling and global broadcast modes. Attached Figure Description
[0019] Figure 1 This is a flowchart of the multi-task scheduling optimization method of the present invention; Figure 2 This is a diagram showing the system hardware architecture and physical environment topology of the present invention; Figure 3 This is a logic block diagram of the state tension calculation and scheduling engine of the present invention; Figure 4 This is a flowchart of the hardware-software co-interrupt response state adjustment mechanism of the present invention; Figure 5 This is a flowchart of the communication topology dynamic dimensionality reduction and closed-loop feedback of the present invention. Detailed Implementation
[0020] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Please see the appendix Figure 1 To be continued Figure 5 This invention provides a multi-task scheduling optimization method and system based on a local control unit, comprising the following steps: The tasks to be executed by the local control unit are divided into multiple micro-tasks. The micro-tasks include at least physical monitoring tasks for motors and interlocks, as well as device communication polling tasks for each sub-device. Within the set task scheduling cycle, calculate the state tension value corresponding to each micro-task. The state tension value corresponding to the physical monitoring task is the physical characteristic tension, and the state tension value corresponding to the device communication polling task of each sub-device is the corresponding communication probing tension. The state tension values of each microtask are obtained to generate a tension set. The microtask corresponding to the state tension value with the largest value in the tension set is extracted and executed as the current microtask to be executed. During the task scheduling cycle, the interrupt response status of the local control unit when receiving instructions from external devices is adjusted according to the physical characteristic tension in the tension set. When the microtask to be executed is a device communication polling task for the target sub-device, the communication frame structure for the target sub-device is adjusted according to the communication probing tension corresponding to the target sub-device.
[0022] The operation of the above-described method depends on a specific underlying hardware architecture and physical environment topology. The local control unit, as the core execution carrier in this embodiment, is constructed using an embedded microprocessor with multi-threaded concurrent processing capabilities and a multi-level interrupt vector table. The local control unit integrates volatile random access memory, non-volatile storage media, an analog-to-digital converter module, and serial communication interfaces for multiple independent baud rate generators.
[0023] External devices establish a connection with the local control unit via a data communication interface equipped with a hardware interrupt trigger pin. These external devices are used to send global configuration parameters or read operation logs. The receive pin of this data communication interface is directly mapped to the external interrupt request register of the local control unit. When an external device initiates a communication request, a hardware level transition directly triggers an instruction interrupt on the local control unit.
[0024] The motor is connected to the analog-to-digital converter (ADC) module of the local control unit via a current transformer or shunt. The hardware timer of the local control unit triggers the ADC at a preset high-frequency sampling period to acquire the raw digital value of the real-time motor current. The real-time motor current data used in the physical monitoring task is obtained through the following underlying mapping formula: ; in: The real-time motor current is read and calculated by the local control unit from the conversion result register after each analog-to-digital conversion cycle. The raw digital sampled values output by the analog-to-digital conversion module are directly read from the hardware registers of the local control unit; The full-scale digital resolution constant of the analog-to-digital converter module is determined by the bit width configuration of the underlying hardware. The full-scale physical current range constant calibrated for the sensor hardware circuit.
[0025] As a hard-wired safety protection mechanism in industrial control environments, the interlock device's output is directly and physically connected to the general-purpose input / output pin of the local control unit. This pin is configured as a pull-up input. The local control unit obtains the real-time interlock status parameters without delay by directly reading the high and low levels of this pin.
[0026] Each sub-device is deployed at the lowest level of execution or sensing in the industrial field, forming a multi-node daisy-chain or star topology network via a fieldbus and a serial communication interface with the local control unit. The local control unit internally divides the data into independent write buffers and receive registers, and uses a media access control layer protocol to achieve asynchronous transmission and reception management of data from each sub-device.
[0027] In this physical environment topology, the baseline timeline for task scheduling is provided by the system tick timer within the local control unit. The system tick timer generates kernel-level clock interrupts at a fixed frequency, dividing the time slice into consecutive, predefined task scheduling cycles. At the beginning of each task scheduling cycle, the kernel of the local control unit suspends the current background operation and forces entry into the state tension value calculation and evaluation routine, thereby establishing a flexible scheduling base directly driven by the underlying hardware state.
[0028] In this embodiment, after the local control unit completes the underlying hardware reset, it immediately enters the task decoupling and system initialization phase. The tasks to be executed by the local control unit are divided into multiple independent, non-blocking micro-tasks.
[0029] In this embodiment, each microtask is allocated an independent corresponding task control block in the memory space of the local control unit. The task control block records the execution entry address, context pointer, and state tension value variable of the current microtask. Microtasks are strictly decoupled and isolated according to their specific business attributes, and are divided into physical monitoring tasks for motors and interlocks, device communication polling tasks for each sub-device, and buffer flushing tasks for processing data frame transmission and reception.
[0030] Before the main scheduling loop, which calculates the state tension values corresponding to each microtask, starts, the method also includes performing initialization steps based on historical state parameters. The processor of the local control unit accesses the non-volatile storage medium via the internal bus to read the historical communication fault frequency matrix actively saved by the system before the last power outage or hibernation.
[0031] The historical communication fault frequency matrix contains records of the historical communication fault frequencies of each sub-device in the fieldbus network. The kernel of the local control unit traverses the matrix according to the physical address identifier of the sub-devices and assigns the current initial fault frequency of each sub-device to the corresponding historical communication fault frequency in the historical communication fault frequency matrix.
[0032] After mapping the fault frequency data, the local control unit triggers the first fast self-test sequence of the physical environment. The local control unit directly reads the interlock status parameters of the interlocker through the aforementioned general-purpose input / output pins. Simultaneously, it triggers the analog-to-digital converter module to perform a single high-frequency sampling to obtain the initial motor starting current. If the interlock status parameters indicate that the interlock is open during the first self-test, or if the initial motor starting current significantly exceeds the limit, the hardware-level protection logic is directly triggered, and subsequent processes are suspended. If the physical characteristic self-test passes, the system enters the reconstruction phase of the network polling sequence.
[0033] To avoid the bus being blocked by offline or high-latency communication nodes during the initial communication phase, the local control unit reorganizes the execution order of the device communication polling tasks based on the initial fault frequencies generated by the mapping. The polling sequence of each sub-device is rearranged using an internal sorting algorithm, based on the ascending order of the initial fault frequencies corresponding to each sub-device.
[0034] The mathematical constraints for the reorganization of the polling sequence are shown in the following formula: ; in: For the recombinant sequence The identifier of the target sub-device node for each polling operation is determined by the local control unit based on the network node address information recorded in the memory array. The next adjacent number in the recombination sequence The identifier of the target sub-device node to be polled; For the first The initial fault frequency corresponding to each target sub-device is obtained by reading and parsing the variable data of the corresponding node address in the historical communication fault frequency matrix and assigning values.
[0035] After completing the sequence update according to the above reorganization logic, the local control unit sends the first parameter read command to each sub-device in sequence according to the reorganized arrangement order.
[0036] In this embodiment, after completing the initialization steps, the system enters a periodic scheduling loop driven by a system tick timer. Within the set task scheduling cycle, the microprocessor core of the local control unit needs to calculate the state tension value corresponding to each microtask in real time.
[0037] Regarding the assessment of the urgency of the physical environment, in this embodiment, the physical characteristic tension is calculated as follows: First, the real-time interlocking status parameters of the interlocker and the real-time motor current of the motor are obtained. The real-time motor current is acquired and converted in real-time by the analog-to-digital conversion channel, as previously described.
[0038] The local control unit reads the level value of the interlock status pin register. If the real-time interlock status parameter indicates that the interlock is open, it means that there is a physical safety hard blocking signal on site. At this time, the logic unit inside the local control unit directly sets the physical characteristic tension to the preset maximum tension constant. This maximum tension constant is defined in the software system as the maximum extreme value that a numerical type can represent, thereby ensuring that the physical monitoring task receives the highest priority under such extreme conditions.
[0039] If the real-time interlock status parameter indicates that the interlock is closed, it means that the hard-wired safety channel is open. The arithmetic logic unit inside the local control unit reads the real-time motor current and calculates the ratio of this real-time motor current to the preset safe current threshold. Then, using a constant greater than one as the base and the ratio as the exponent, the physical characteristic tension is calculated through an exponential function.
[0040] The mathematical model for this physical characteristic tension is specifically expressed as follows: ; in: The physical characteristic tension is used as a value to evaluate the emergency state of the physical side working conditions; The real-time motor current is obtained by sampling the analog-to-digital conversion result triggered by the timer of the local control unit; The preset safe current threshold is loaded from local non-volatile memory into static random access memory; The base of the constant is greater than one, and it is configured in the system parameter area; This is a preset scaling factor constant. Through this exponential model, when the motor operating current is stable at a low level, the physical characteristic tension remains at an extremely low level, freeing up CPU computing power; however, when the real-time current approaches the safety threshold, the physical characteristic tension value expands rapidly and non-linearly.
[0041] In the network communication dimension evaluation, for the device communication polling task of each sub-device, the corresponding communication probing tension needs to reflect the rationality of the bus resource occupation by that node. The communication probing tension corresponding to the target sub-device is calculated by obtaining the current cumulative communication failure frequency of the target sub-device. This cumulative communication failure frequency is dynamically maintained by the underlying communication protocol stack based on the historical data packet transmission and reception response status.
[0042] The local control unit stores a preset baseline liveness detection tension constant. Within each scheduling cycle, the arithmetic logic unit calculates the decay value of the baseline liveness detection tension constant using a negative exponential decay function with the cumulative communication failure frequency as the independent variable, and uses the decay value as the communication liveness detection tension corresponding to the target sub-device.
[0043] The mathematical model for the communication probe tension is specifically expressed as follows: ; in: For the communication probe tension corresponding to the target sub-device; The preset baseline liveness tension constant is initially set by the system firmware; The current cumulative communication failure frequency of the target sub-device is read and updated in real time by the local control unit in the memory variable area; This is the preset attenuation coefficient constant; is the base of the natural constant.
[0044] In addition to physical monitoring and communication polling, the system also includes a buffer flushing microtask responsible for data transmission and flow. This microtask also includes a buffer flushing task, with a corresponding state tension value of buffer backlog tension. In this embodiment, the buffer backlog tension is calculated by obtaining the frame backlog length in the buffer to be written to in the local control unit, and the waiting time of the first frame in the queue within the buffer to be written.
[0045] To measure the congestion of the buffer, the arithmetic logic unit normalizes the dimensions of the frame backlog length and the waiting time, and then performs a weighted summation calculation to finally obtain the buffer backlog tension.
[0046] The mathematical model for this cache backlog tension is specifically expressed as follows: ; in: To buffer backlog tension; The frame backlog length to be written to the buffer is calculated by the local control unit by reading the difference between the head and tail pointers of the underlying communication queue; The waiting time for the first frame in the queue is calculated by the local control unit system's clock timer, starting from the moment the first frame is pushed into the queue. and These are the preset frame length weight coefficient and waiting time weight coefficient, respectively, which are obtained by reading the system configuration parameter area.
[0047] In this embodiment, after the local control unit completes the mathematical calculation of the state tension values of each microtask within the current task scheduling cycle, the system's execution flow enters the scheduling arbitration phase.
[0048] In this embodiment, the scheduler module of the local control unit traverses the task control blocks of all microtasks in memory, obtaining the state tension values updated and calculated by each microtask within this cycle. The scheduler aggregates these tension values and generates a structured tension set array in the internal static random access memory. This tension set array contains comprehensive quantitative indicators of the system's physical monitoring pressure, multi-node communication expectations, and internal data congestion status within this cycle.
[0049] To achieve zero-latency response to high-risk tasks, the scheduler uses internal hardware sorting instructions or a software fast traversal algorithm to extract the state tension value with the largest value from the tension set. This largest value is directly mapped to the specific microtask corresponding to the tension set array. Subsequently, the scheduler executes the microtask corresponding to the state tension value with the largest value as the current microtask to be executed.
[0050] During a context switch, if there are other pending tasks in the background that have not yet been completed, the microprocessor kernel of the local control unit will actively push the current program counter pointer, working register group data, and program status word onto the system's hardware stack for storage. Subsequently, the kernel will directly redirect the program counter to the code entry address of the microtask to be executed, initiating the actual computation and hardware pin control process of this high-tension task.
[0051] Through this tension arbitration mechanism, the system can dynamically adjust its computing power focus during operation. When the motor is not overloaded, the bus status is good, and the cache is not overflowing, the scheduler switches evenly among various regular polling microtasks. However, once a sudden change in the physical environment causes the real-time motor current to approach the threshold, or if an external emergency causes a sudden increase in the backlog of frames to be written to the buffer, the corresponding physical characteristic tension or cache backlog tension will instantly occupy the absolute maximum position in the tension set, thereby forcing the kernel to deprive all other ordinary communication polling tasks of execution rights.
[0052] Because the tension assessment and extraction action is deeply bound to the system's underlying beat timer and is periodically forced to trigger, the scheduling engine in this embodiment can perceive changes in external operating conditions at the microsecond level.
[0053] In this embodiment, the local control unit also executes a low-level hardware-software co-processing anti-disturbance mechanism based on the urgency of the physical environment. During the task scheduling cycle, regardless of the type of the currently executing microtask, the system dynamically and globally adjusts the interrupt response state of the local control unit when receiving instructions from external devices based on the physical characteristic tension in the tension set.
[0054] Specifically, in this embodiment, after each tension calculation, the arithmetic logic unit inside the local control unit compares the extracted physical feature tension with a first preset threshold pre-configured in the local non-volatile memory. The mathematical judgment logic for this threshold comparison can be expressed as follows: ; in: The difference value is used to determine the degree of tension exceeding the limit; The physical characteristic tension calculated within the current scheduling cycle; The first preset threshold is set.
[0055] Based on the above calculation results, if the physical characteristic tension is greater than or equal to the first preset threshold (i.e., satisfies...) The condition indicates that the current physical operating condition of the motor is approaching the overload boundary, or that the safety interlock circuit is in a disconnected state. At this time, the kernel driver of the local control unit immediately manipulates the underlying nested vector interrupt controller to generate an interrupt mask signal for the data communication interface pins connected to the external device.
[0056] By writing a control word to a specific interrupt mask register, the local control unit completely disables the reception of instruction interrupt requests from external devices at the physical hardware level. Simultaneously, to prevent the underlying communication peripherals' receive FIFO queue from being clogged by continuously input data and causing an overflow exception, the local control unit forcibly resets the corresponding hardware receive channel and refuses to process protocol stack parsing, thereby directly rejecting any data sent by external devices at the data link layer.
[0057] Conversely, if the physical characteristic tension is less than the first preset threshold (i.e., satisfies...) The condition indicates that the current physical execution object is in a safe and stable operating range with low load and no hidden dangers. At this time, the local control unit clears the relevant interrupt mask bit, cancels the interrupt mask signal, and re-enables receiving instruction interrupt requests from external devices. Parameter sending or log reading operations from external devices can then normally wake up the communication response routine of the local control unit through standard hardware level transitions.
[0058] In this embodiment, for a multi-node bus communication environment, the system introduces a dynamic dimensionality reduction and closed-loop feedback mechanism for the communication protocol stack when scheduling and executing communication polling tasks. When the micro-task to be executed is a device communication polling task for a target sub-device, the protocol processing engine of the local control unit dynamically adjusts the communication frame structure for the target sub-device according to the communication probing tension corresponding to the target sub-device.
[0059] In this embodiment, the arithmetic logic unit of the local control unit compares the communication activity detection tension corresponding to the target sub-device with a second preset threshold set in the memory. When the communication activity detection tension is greater than or equal to the second preset threshold, it indicates that the communication link quality of the current target sub-device is in a good state. At this time, the local control unit sends a point-to-point read parameter frame containing a parameter acquisition request to the target sub-device according to the standard underlying communication protocol topology, so as to obtain complete field operation parameters and device logs.
[0060] When the communication probing tension is less than the second preset threshold, it indicates that the cumulative communication failure frequency of the target sub-device is already high. Continuing to use long-byte-distance blocking polling will severely drag down bus bandwidth and consume control kernel computing power. At this time, the local control unit directly stops sending point-to-point read parameter frames to the target sub-device at the data link layer and encapsulates the probing request for the target sub-device into a global composite broadcast probing frame for transmission.
[0061] After encapsulating the probe request for the target sub-device into a global composite broadcast probe frame for transmission, the local control unit configures a receive timer and listens to the bus pins to receive the response data frame from the target sub-device within a specified time slot. This dimensionality-reducing design of the communication topology, while maintaining a minimum level of probe for offline devices, completely releases the unnecessary occupation of underlying communication bandwidth by faulty nodes.
[0062] When the microtask to be executed is a buffer flushing task, the local control unit executes the following feedback logic: First, it extracts the instruction frame and its writing parameters from the memory space to be written to the beginning of the buffer, and controls the serial communication transmit register to send the instruction frame to the sub-device corresponding to the instruction frame.
[0063] After the data frame is sent, the receiving state machine of the local control unit obtains the corresponding response status code returned by the sub-device based on the check register and timeout timer status of the underlying communication interface. Based on the specific representation type of the response status code, the system updates the cumulative communication failure frequency of the corresponding sub-device by incrementing or decrementing the set step size.
[0064] The specific mathematical closed-loop update logic is as follows: if the response status code indicates a successful response, meaning the received data frame passed the cyclic redundancy check and did not time out, then the deduction operation is performed: ; If the response status code indicates a communication timeout or verification failure, it means there is sudden interference in the physical link or a node failure. In this case, the add operation will be executed. ; in: The updated cumulative communication failure frequency will be written into the dynamic variable area and used to calculate the communication probing tension in the next task scheduling cycle. This represents the cumulative communication failure frequency currently recorded by the system before the update. The preset first step size is used to control the frequency reduction rate of nodes that have recovered to a good communication state; The second preset step size is used to control the frequency accumulation penalty when communication deteriorates.
[0065] In this embodiment, based on the aforementioned multi-task scheduling optimization method, the present invention also provides a multi-task scheduling optimization system based on a local control unit. This system is physically deployed in edge computing nodes or underlying equipment racks in industrial settings, and through deep collaboration between hardware circuits and software instructions, it achieves the aforementioned elastic scheduling and hard-core backpressure mechanism.
[0066] This multi-task scheduling optimization system based on a local control unit includes a memory and a processor electrically connected to it via an internal high-speed silicon bus. The memory, as a non-transitory computer-readable physical medium, is internally divided into a program instruction area, a non-volatile data storage area, and a dynamic variable execution area based on its read / write properties.
[0067] Specifically, the program instruction area is used to solidify the underlying boot code and the execution logic of each microtask; the non-volatile data storage area is used to persistently save the historical communication fault frequency matrix and various preset tension threshold constants before power failure; and the dynamic variable operation area is used to load and refresh various status tension values and the cumulative communication fault frequency variables of each sub-device in real time during each task scheduling cycle.
[0068] The memory stores computer programs that can run on the processor. The processor integrates an arithmetic logic unit, a floating-point unit, and a nested vector interrupt controller. When the computer program is retrieved, decoded, and executed by the processor, the processor's underlying logic gates generate corresponding level flips according to the instruction set sequence, thereby implementing the various steps of the aforementioned multi-task scheduling optimization method based on the local control unit at the hardware level.
[0069] At the physical silicon execution level, the processor executes the computer program, and the allocation of system computing power is constrained by the clock frequency of the underlying hardware. To ensure the hard real-time performance of the scheduling engine, the processor's execution timing within a single scheduling cycle must satisfy the following physical constraint model: ; in: The task scheduling cycle constant set for the system tick timer represents the physical width of the hardware clock slice; This represents the total number of microtasks that have entered the ready state and been arbitrated during the current task scheduling cycle. For the processor's internal arithmetic logic unit to execute the first The actual microsecond-level execution time of each microtask business logic; The total hardware time required for processor interrupt response, execution of register stack protection, and context switching operations such as program counter pointer jump.
[0070] Through the physical deployment of the above system architecture, the processor can frequently drive the analog-to-digital converter module and pin status registers to obtain the field operating conditions and call the arithmetic logic unit to complete complex tension index calculations. Finally, based on the real-time generated tension set, the system can directly intervene in the masking state of the nested vector interrupt controller or reconstruct the data frame structure in the serial communication peripheral's transmit buffer.
Claims
1. A multi-task scheduling optimization method based on a local control unit, characterized in that, The local control unit is connected to external devices, a motor, an interlock, and at least one sub-device; the method includes the following steps: The tasks to be executed by the local control unit are divided into multiple micro-tasks. The micro-tasks include at least physical monitoring tasks for the motor and the interlock, and device communication polling tasks for each of the sub-devices. Within the set task scheduling period, the state tension value corresponding to each micro-task is calculated, wherein the state tension value corresponding to the physical monitoring task is the physical feature tension, and the state tension value corresponding to the device communication polling task of each sub-device is the corresponding communication probing tension. The state tension values of each microtask are obtained to generate a tension set. The microtask corresponding to the state tension value with the largest value in the tension set is extracted and executed as the current microtask to be executed. During the task scheduling cycle, the interrupt response state of the local control unit in receiving instructions from the external device is adjusted according to the physical characteristic tension in the tension set. When the microtask to be executed is a device communication polling task for a target sub-device, the communication frame structure for the target sub-device is adjusted according to the communication probing tension corresponding to the target sub-device. The physical characteristic tension is calculated as follows: Obtain the real-time interlock status parameters of the interlock device and the real-time motor current of the motor; If the real-time interlock status parameter indicates that the interlock is open, then the physical characteristic tension is set to the preset maximum tension constant; If the real-time interlock status parameter indicates that the interlock is closed, then the ratio of the real-time motor current to the preset safe current threshold is calculated, and the physical characteristic tension is calculated using a constant greater than one as the base and the ratio as the exponent. The calculation method for the communication probe tension corresponding to the target sub-device is as follows: Obtain the current cumulative communication failure frequency of the target sub-device; Obtain a preset basic detection tension constant, calculate the attenuation value of the basic detection tension constant using a negative exponential attenuation function with the cumulative communication failure frequency as the independent variable, and use the attenuation value as the communication detection tension corresponding to the target sub-device.
2. The multi-task scheduling optimization method based on a local control unit according to claim 1, characterized in that, Before calculating the state tension value corresponding to each of the microtasks, an initialization step is also included: Read the stored historical communication failure frequency matrix, which contains the historical communication failure frequencies saved by each of the sub-devices before the last power outage; The current initial fault frequency of each of the sub-devices is assigned the corresponding historical communication fault frequency; Obtain the interlock status parameters of the interlock device and the initial starting current of the motor; Based on the order of the initial fault frequencies of each sub-device from smallest to largest, the first parameter reading command is sent to each sub-device in sequence.
3. The multi-task scheduling optimization method based on a local control unit according to claim 1, characterized in that, The microtask also includes a buffer flushing task, and the corresponding state tension value is the cache backlog tension. The cache backlog tension is calculated as follows: obtain the frame backlog length of the buffer to be written in the local control unit and the waiting time of the first frame in the queue of the buffer to be written, and perform a weighted summation of the frame backlog length and the waiting time to obtain the cache backlog tension.
4. The multi-task scheduling optimization method based on a local control unit according to claim 1, characterized in that, The step of adjusting the interrupt response state of the local control unit receiving the external device command based on the physical characteristic tension in the tension set includes: The physical characteristic tension is compared with a first preset threshold. If the physical characteristic tension is greater than or equal to the first preset threshold, an interrupt shielding signal is generated to disable the reception of instruction interruption requests from the external device and to refuse to receive data sent by the external device. If the physical characteristic tension is less than the first preset threshold, then the interrupt request for receiving instructions from the external device is enabled.
5. The multi-task scheduling optimization method based on a local control unit according to claim 1, characterized in that, When the currently pending microtask is a device communication polling task targeting a target sub-device, the communication frame structure for the target sub-device is adjusted according to the communication probing tension corresponding to the target sub-device, including: The communication detection tension corresponding to the target sub-device is compared with the second preset threshold. When the communication probe tension is greater than or equal to the second preset threshold, a point-to-point parameter read frame containing a parameter acquisition request is sent to the target sub-device; When the communication activation tension is less than the second preset threshold, the sending of point-to-point read parameter frames to the target sub-device is stopped, and the activation request for the target sub-device is encapsulated into a global composite broadcast activation frame for transmission.
6. The multi-task scheduling optimization method based on a local control unit according to claim 5, characterized in that, After encapsulating the probe request for the target sub-device into a global composite broadcast probe frame for transmission, the method further includes: The local control unit receives a response data frame from the target sub-device; wherein the response data frame does not contain parameter payload data.
7. The multi-task scheduling optimization method based on a local control unit according to claim 3, characterized in that, When the currently pending microtask is the buffer flushing task, the following steps are performed: Extract the instruction frame and its writing parameters from the header of the buffer to be written, and send the instruction frame to the sub-device corresponding to the instruction frame. Obtain the response status code returned by the corresponding sub-device; If the response status code indicates a successful response, the cumulative communication failure frequency of the corresponding sub-device is deducted according to the first set step size until the lower limit is zero; If the response status code indicates a communication timeout or verification failure, the cumulative communication failure frequency of the corresponding sub-device is increased by a second set step size.
8. A multi-task scheduling optimization system based on a local control unit, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the multitasking scheduling optimization method based on a local control unit as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Distributed computing power dynamic scheduling method, equipment and medium
CN120935181A
Production optimization scheduling method and system of computer case
CN121235338A