[go: up one dir, main page]

CN115421917A - A load balancing method for embedded system multiprocessor modules - Google Patents

A load balancing method for embedded system multiprocessor modules Download PDF

Info

Publication number
CN115421917A
CN115421917A CN202211124000.3A CN202211124000A CN115421917A CN 115421917 A CN115421917 A CN 115421917A CN 202211124000 A CN202211124000 A CN 202211124000A CN 115421917 A CN115421917 A CN 115421917A
Authority
CN
China
Prior art keywords
processor module
control
instruction
slave processor
computing unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211124000.3A
Other languages
Chinese (zh)
Inventor
潘雁鹏
赵昶宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Jinhang Computing Technology Research Institute
Original Assignee
Tianjin Jinhang Computing Technology Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Jinhang Computing Technology Research Institute filed Critical Tianjin Jinhang Computing Technology Research Institute
Priority to CN202211124000.3A priority Critical patent/CN115421917A/en
Publication of CN115421917A publication Critical patent/CN115421917A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)

Abstract

本发明涉及一种嵌入式系统多处理器模块负载均衡方法,属于嵌入式系统通讯技术和冗余管理技术领域。本发明无需人工干预,在处理器模块上能够自动实现终端设备控制流程的指定和分配;通过实时动态监控每个从处理器模块的程序执行时间,实现各个从处理器模块运行时间和执行效率的负载均衡,提高了整个系统资源利用率;通过对控制流程资源的合理优化配置,提高了控制台任务执行的效率和系统分布式处理的能力。

Figure 202211124000

The invention relates to a load balancing method for multiprocessor modules of an embedded system, which belongs to the technical fields of embedded system communication technology and redundancy management. The invention does not require manual intervention, and can automatically realize the designation and distribution of the control process of the terminal equipment on the processor module; through real-time dynamic monitoring of the program execution time of each slave processor module, the control of the running time and execution efficiency of each slave processor module is realized. Load balancing improves the resource utilization of the entire system; the efficiency of console task execution and the distributed processing capability of the system are improved through reasonable and optimal configuration of control process resources.

Figure 202211124000

Description

一种嵌入式系统多处理器模块负载均衡方法A load balancing method for embedded system multiprocessor modules

技术领域technical field

本发明属于嵌入式系统通讯技术和冗余管理技术领域,具体涉及一种嵌入式系统多处理器模块负载均衡方法。The invention belongs to the field of embedded system communication technology and redundant management technology, and in particular relates to a load balancing method for multiprocessor modules of an embedded system.

背景技术Background technique

在某控制系统中,控制台设备需要通过处理器计算单元实现对多个终端设备的控制。处理器计算单元通过以太网接收控制台设备发送的控制指令,并对控制指令进行解析处理,将解析处理后的控制指令通过不同接口发送给各个终端设备。各个终端设备将自身生成的命令反馈数据通过不同接口向处理器计算单元发送。处理器计算单元接收到各个终端设备的命令反馈数据后,对命令反馈数据按照以太网报文进行组包处理,生成控制台反馈指令,将生成的控制台反馈指令通过以太网发送给控制台设备。In a certain control system, the console device needs to realize the control of multiple terminal devices through the processor computing unit. The processor calculation unit receives the control instructions sent by the console device through the Ethernet, analyzes and processes the control instructions, and sends the analyzed and processed control instructions to each terminal device through different interfaces. Each terminal device sends the command feedback data generated by itself to the processor computing unit through different interfaces. After the processor calculation unit receives the command feedback data of each terminal device, the command feedback data is grouped and processed according to the Ethernet message, and the console feedback command is generated, and the generated console feedback command is sent to the console device through the Ethernet .

在上述控制系统中,处理器计算单元是该控制系统的核心部件,为了确保该核心部件工作的可靠性,需要对处理器计算单元进行冗余备份。处理器计算单元是由多块处理器模块组成,包括一块主处理器模块和多块从处理器模块。控制台设备通过以太网向不同的终端设备发送控制流程,每个终端设备的控制流程是相同的。主处理器模块接收控制台设备发送的所有终端设备的控制流程后,根据负载均衡原理,让某个从处理器模块控制一个或多个终端设备执行并完成其控制流程。上述控制系统的核心是主处理器模块如何将控制台设备发送的终端设备控制流程合理分配到不同的从处理器模块上。现有的终端设备控制流程分配策略通常依靠操作人员的经验值,随机地将终端设备控制流程分配给不同的从处理器模块,这种做法会导致两种不良后果:(1)不同操作人员经验不同,导致一部分从处理器模块处于较繁忙状态,而另一部分从处理器模块处于较空闲状态,导致不同终端设备的执行效率差异较大;(2)在某种极端情况下,某个从处理器由于执行多个终端设备控制流程,运行负荷较重,该处理器程序的实际运行周期大于程序中设计的执行周期,导致程序无法正常运行,控制流程异常中断。In the above control system, the processor computing unit is the core component of the control system. In order to ensure the reliability of the core component, it is necessary to perform redundant backup on the processor computing unit. The processor computing unit is composed of multiple processor modules, including a master processor module and multiple slave processor modules. The console device sends control processes to different terminal devices through Ethernet, and the control process of each terminal device is the same. After the main processor module receives the control process of all terminal devices sent by the console device, according to the principle of load balancing, let a certain slave processor module control one or more terminal devices to execute and complete the control process. The core of the above control system is how the main processor module reasonably distributes the terminal device control process sent by the console device to different slave processor modules. The existing terminal equipment control process allocation strategy usually relies on the experience value of the operator, and randomly allocates the terminal equipment control process to different slave processor modules. This approach will lead to two adverse consequences: (1) Different operator experience different, resulting in a part of the slave processor module being in a relatively busy state, while another part of the slave processor module is in a relatively idle state, resulting in a large difference in the execution efficiency of different terminal devices; (2) in some extreme cases, a slave processor module Because the processor executes multiple terminal equipment control processes, the operating load is heavy. The actual operating cycle of the processor program is greater than the execution cycle designed in the program, resulting in the program not running normally and the control process being interrupted abnormally.

发明内容Contents of the invention

(一)要解决的技术问题(1) Technical problems to be solved

本发明要解决的技术问题是:如何解决目前控制系统中“处理器计算单元的多个从处理器模块控制流程资源分配不均”的问题,增强控制台和处理器计算单元以及终端设备之间通讯的可靠性,提高终端设备控制流程的处理效率。The technical problem to be solved by the present invention is: how to solve the problem of "uneven distribution of control process resources of multiple slave processor modules of the processor computing unit" in the current control system, and enhance the communication between the console, the processor computing unit and the terminal equipment. The reliability of communication improves the processing efficiency of terminal equipment control process.

(二)技术方案(2) Technical solution

为了解决上述技术问题,本发明提供了一种嵌入式系统多处理器模块负载均衡方法,该方法基于一种控制系统实现,该控制系统包括:控制台设备、处理器计算单元和终端设备;In order to solve the above-mentioned technical problems, the present invention provides a load balancing method for embedded system multiprocessor modules, the method is implemented based on a control system, the control system includes: a console device, a processor computing unit and a terminal device;

所述控制台设备用于通过以太网发送控制指令给处理器计算单元,并通过以太网接收处理器计算单元发送的控制台设备反馈指令,控制台设备发送的所有控制指令都是按照既定的流程执行的,从而实现对每个终端设备发送控制流程,对每个终端设备发送的控制流程是相同的;The console device is used to send control instructions to the processor computing unit through the Ethernet, and receive the console device feedback instructions sent by the processor computing unit through the Ethernet, and all control commands sent by the console device follow the established process Executed, so as to realize the control flow sent to each terminal device, and the control flow sent to each terminal device is the same;

所述处理器计算单元用于通过以太网接收控制台设备发送的控制流程,对每个控制流程进行解析处理;处理器计算单元由多块处理器模块组成,包括一块主处理器模块和多块从处理器模块;其中,主处理模块用于接收并保存控制台设备发送的所有控制流程,将控制流程向从处理器模块发送;从处理器模块用于解析并执行主处理器模块发送的控制流程,将控制流程中的每条控制指令的控制指令有效数据内容通过不同接口发送给终端设备,并接收终端设备发送的命令反馈数据,对命令反馈数据按照以太网报文进行组包处理,生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备;每个从处理器模块中运行的程序是相同的;处理器计算单元中的主处理模块还用于根据每个从处理器模块中程序的执行时间动态调整每个从处理器模块执行的控制流程的个数;The processor calculation unit is used to receive the control flow sent by the console device through Ethernet, and analyze and process each control flow; the processor calculation unit is composed of multiple processor modules, including a main processor module and multiple From the processor module; wherein, the main processing module is used to receive and save all the control flow sent by the console device, and send the control flow to the slave processor module; the slave processor module is used to analyze and execute the control sent by the main processor module process, the effective data content of each control command in the control process is sent to the terminal device through different interfaces, and the command feedback data sent by the terminal device is received, and the command feedback data is packaged according to the Ethernet message to generate Console device feedback command, send the generated console device feedback command to the console device through Ethernet; the program running in each slave processor module is the same; the main processing module in the processor computing unit is also used to The execution time of the program in each slave processor module dynamically adjusts the number of control processes executed by each slave processor module;

终端设备用于通过不同接口接收处理器计算单元发送的控制指令有效数据内容,并将自身生成的命令反馈数据通过不同接口向处理器计算单元发送;The terminal device is used to receive the effective data content of the control command sent by the processor computing unit through different interfaces, and send the command feedback data generated by itself to the processor computing unit through different interfaces;

基于所述控制系统实现的负载均衡方法包括以下步骤:The load balancing method realized based on the control system includes the following steps:

S1:处理器计算单元中的主处理器模块通过以太网接收并保存控制台设备发送的所有控制流程;S 1 : The main processor module in the processor computing unit receives and saves all the control processes sent by the console device through Ethernet;

控制台设备将预先设定好的控制流程通过以太网发送给处理器计算单元,通过以太网接收处理器计算单元发送的控制台设备反馈指令。The console device sends the preset control process to the processor computing unit through the Ethernet, and receives the console device feedback instructions sent by the processor computing unit through the Ethernet.

S2:处理器计算单元中的主处理器模块基于每个从处理器模块中当前程序的运行时间值,应用负载均衡原理将控制台设备发送的控制流程通过以太网发送给不同的从处理器模块,实现对所有从处理器模块的负载均衡管理,从处理器模块对控制流程中的控制指令进行解析处理,将解析处理后的控制指令有效数据内容通过不同接口发送给终端设备;S 2 : The main processor module in the processor computing unit is based on the running time value of the current program in each slave processor module, and applies the load balancing principle to send the control process sent by the console device to different slave processors through Ethernet The module realizes the load balancing management of all slave processor modules, parses and processes the control instructions in the control process from the processor module, and sends the effective data content of the parsed and processed control instructions to the terminal device through different interfaces;

S3:终端设备将自身生成的命令反馈数据通过不同接口向处理器计算单元发送;S 3 : The terminal device sends the command feedback data generated by itself to the processor computing unit through different interfaces;

S4:处理器计算单元接收到终端设备的命令反馈数据后,对命令反馈数据按照以太网报文进行组包处理,生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。S 4 : After the processor calculation unit receives the command feedback data of the terminal equipment, it packs the command feedback data according to the Ethernet message, generates a console device feedback command, and sends the generated console device feedback command through Ethernet to the console device.

优选地,处理器计算单元中的1块主处理器模块和N块从处理器模块基于CORBA中间件建立以消息为中心的模型;每个从处理器模块实时计算当前整个程序的实际运行时间值,并保存当前程序运行时间值的最大值;每个从处理器模块会发布自身的编号、自身正在执行的控制流程个数以及当前程序运行时间值的最大值,主处理器模块通过CORBA中间件的同步更新机制能够访问到每个从处理器模块的编号、正在执行的控制流程个数以及当前程序运行时间值的最大值。Preferably, 1 main processor module and N slave processor modules in the processor computing unit set up a message-centric model based on CORBA middleware; each slave processor module calculates the actual running time value of the current entire program in real time , and save the maximum value of the current program running time; each slave processor module will issue its own number, the number of control processes it is executing, and the maximum value of the current program running time, and the main processor module will pass the CORBA middleware The synchronous update mechanism can access the number of each slave processor module, the number of control processes being executed and the maximum value of the current program running time.

优选地,步骤S2中,处理器计算单元中的主处理器模块对接收到的控制流程按照如下步骤实现对所有从处理器模块的负载均衡管理:Preferably, in step S2 , the main processor module in the processor computing unit implements load balancing management for all slave processor modules according to the following steps for the received control flow:

S21:由于终端设备的个数为M,M≥1,因此控制台设备发送的控制流程个数最大值为M;假设处理器计算单元中只有1块主处理器模块和1块从处理器模块,通过测试分别计算出控制台设备发送1至M个控制流程时,从处理器模块程序实际运行时间的最大值Ti,1≤i≤M;S 21 : Since the number of terminal devices is M, and M≥1, the maximum number of control processes sent by the console device is M; assuming that there is only one main processor module and one slave processor in the processor computing unit Module, through testing, calculate the maximum value T i of the actual running time of the slave processor module program when the console device sends 1 to M control processes, 1≤i≤M;

S22:假设每个从处理器模块中程序的执行周期为T执行S 22 : Assume that the execution cycle of the program in each slave processor module is T execution ;

当TM<T执行时,表明在1块从处理器模块上能够正确执行M个控制流程;主处理器模块每次给从处理器模块分配控制流程时,读取每个从处理器模块当前程序运行时间的最大值,找出这些最大值当中运行时间最小的那个从处理器模块的编号,将本次控制流程分配给该从处理器模块;该从处理器模块在执行新的控制流程时,将正在执行的控制流程个数加1,实时更新并保存本从处理器模块当前程序运行时间值的最大值和该从处理器模块正在执行的控制流程个数;若每个从处理器模块程序的执行周期T执行等于程序的运行时间,主处理器模块也按照TM<T执行条件下同样的方法来执行控制流程的分配;When T M < T is executed , it indicates that M control processes can be correctly executed on one slave processor module; each time the master processor module assigns a control process to a slave processor module, it reads the current The maximum value of the program running time, find out the number of the slave processor module with the smallest running time among these maximum values, and assign this control flow to the slave processor module; when the slave processor module executes a new control flow , add 1 to the number of control processes being executed, update and save the maximum value of the current program running time of the slave processor module and the number of control processes being executed by the slave processor module in real time; if each slave processor module The execution period T of the program is equal to the running time of the program, and the main processor module also executes the distribution of the control flow in the same way under the execution condition of T M <T;

当TM≥T执行时,表明在一个从处理器模块上无法正确执行M个控制流程;根据步骤S21中获取的Ti值,计算出当Ti≥T执行时i的最小值,该值是一个从处理器模块能够同时正确执行控制流程个数的最大值,记为Cmax,然后执行步骤S23When T M ≥ T is executed , it indicates that M control processes cannot be correctly executed on a slave processor module; according to the T i value obtained in step S21 , the minimum value of i is calculated when T i ≥ T is executed , the The value is the maximum value that a slave processor module can correctly execute the number of control processes at the same time, which is denoted as C max , and then step S23 is executed;

S23:主处理器模块每次给从处理器模块分配控制流程时,读取每个从处理器模块正在执行的控制流程个数,记为Ci,若Ci<Cmax,则执行步骤S24;若Ci等于Cmax,则比较Ci+1与Cmax的大小,若Ci+1<Cmax,则执行步骤S24;若所有的Ci值均等于Cmax,表明没有一块从处理器模块能够执行当前控制台设备发送的控制流程,主处理器模块通过以太网向控制台设备发送“无可用的从处理器模块”信息;S 23 : Every time the master processor module assigns a control flow to the slave processor module, it reads the number of control flows being executed by each slave processor module, which is recorded as C i , and if C i <C max , then execute the step S 24 ; if C i is equal to C max , then compare the size of C i+1 and C max , if C i+1 < C max , then execute step S 24 ; if all the values of C i are equal to C max , it means that there is no A slave processor module can execute the control process sent by the current console device, and the master processor module sends the "no slave processor module available" message to the console device through Ethernet;

S24:将本次控制流程分配给该从处理器模块;该从处理器模块在执行新的控制流程时,将正在执行的控制流程个数加1,实时更新并保存本从处理器模块当前程序运行时间值的最大值和该从处理器模块正在执行的控制流程个数。S 24 : Assign this control flow to the slave processor module; when the slave processor module executes a new control flow, it adds 1 to the number of the currently executing control flow, and updates and saves the current state of the slave processor module in real time. The maximum value of program running time and the number of control processes being executed by the slave processor module.

优选地,步骤S2中,当从处理器模块的一个控制流程执行结束后,将正在执行的控制流程个数减1;若从处理器模块负责的所有控制流程均执行结束,将正在执行的控制流程个数和程序运行时间最大值均清零;然后,实时更新并保存本模块当前程序运行时间值的最大值和该模块正在执行的控制流程个数。Preferably, in step S2, after the execution of a control flow of the slave processor module is completed, the number of control flows being executed is decremented by 1 ; The number of control processes and the maximum value of the program running time are cleared; then, the maximum value of the current program running time of the module and the number of control processes being executed by the module are updated and saved in real time.

优选地,步骤S2中,处理器计算单元采用如下方法对控制台设备发送的控制流程进行解析处理:Preferably, in step S2 , the processor computing unit uses the following method to analyze and process the control flow sent by the console device:

控制台设备发送的控制流程的报文格式由“指令标识”+“信源标识”+“信宿标识”+“指令序号”+“指令长度”+“指令个数”+“指令1类型”+“指令1间隔时间”+“指令1有效字段内容”+“指令2类型”+“指令2间隔时间”+“指令2有效字段内容”+……+“指令k类型”+“指令k间隔时间”+“指令k有效字段内容”+“校验和”组成;k为大于2的整数;The message format of the control process sent by the console device consists of "command identification" + "source identification" + "sink identification" + "command serial number" + "command length" + "command number" + "command 1 type" + "Instruction 1 interval time" + "Instruction 1 effective field content" + "Instruction 2 type" + "Instruction 2 interval time" + "Instruction 2 effective field content" + ... + "Instruction k type" + "Instruction k interval time "+" effective field content of instruction k"+"checksum"; k is an integer greater than 2;

处理器计算单元中的处理器模块根据所述报文格式,判断当前控制流程的长度和校验和是否正确;其中,当前控制流程的最后一个字的内容为校验和,将当前控制流程中除了“校验和”字段的其余字段内容按照CRC16校验算法计算出校验和;若控制流程长度和校验和均正确,则根据指令个数从当前控制流程中分别提取出控制流程中每个控制指令的有效字段内容,记为控制台设备控制指令有效数据内容,并保存每条控制指令的指令间隔时间;处理器计算单元按照每条控制指令的指令间隔时间,将控制台设备控制流程中每条控制指令有效数据内容发送给终端设备;处理器计算单元通过不同接口接收到终端设备的命令反馈数据后,处理器计算单元中的处理器模块提取命令反馈数据中的“数据字段”的内容作为报文内容,并计算该内容中有效数据的长度以及校验和,校验和的计算方法与控制台设备控制指令校验和的计算方法相同,然后按照“指令标识”+“信源标识”+“信宿标识”+“指令序号”+“指令长度”+“指令有效字段内容”+“校验和”的格式生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。The processor module in the processor calculation unit judges whether the length and the checksum of the current control flow are correct according to the message format; wherein, the content of the last word of the current control flow is a checksum, and the current control flow The content of the other fields except the "checksum" field is calculated according to the CRC16 checksum algorithm; if the length of the control flow and the checksum are both correct, extract each command in the control flow from the current control flow according to the number of instructions. The effective field content of each control instruction is recorded as the effective data content of the console device control instruction, and the instruction interval time of each control instruction is saved; the processor calculation unit divides the console device control process according to the instruction interval time of each control instruction. The effective data content of each control command in the command is sent to the terminal device; after the processor computing unit receives the command feedback data of the terminal device through different interfaces, the processor module in the processor computing unit extracts the "data field" in the command feedback data The content is used as the content of the message, and the length of the valid data in the content and the checksum are calculated. The calculation method of the checksum is the same as that of the control command checksum of the console device, and then according to "command identification" + "source ID" + "sink ID" + "command number" + "command length" + "command effective field content" + "checksum" format to generate a console device feedback command, and the generated console device feedback command will be sent via Ethernet sent to the console device.

优选地,步骤S3中,终端设备通过RS-422A接口、GJB289A接口、开关量接口、CAN总线接口之一将自身生成的命令反馈数据发送给处理器计算单元。Preferably, in step S3, the terminal device sends the command feedback data generated by itself to the processor calculation unit through one of the RS - 422A interface, the GJB289A interface, the switch interface, and the CAN bus interface.

优选地,步骤S4中,处理器计算单元采用如下方法将生成的控制台设备反馈指令通过以太网发送给控制台设备:Preferably, in step S4 , the processor computing unit sends the generated console device feedback instruction to the console device via Ethernet using the following method:

处理器计算单元中的从处理器模块提取终端设备命令反馈数据中的“数据字段”的内容作为报文内容,并计算该内容中有效数据的长度和校验和,校验和的计算方法与控制台设备控制指令校验和计算方法相同,然后按照“指令标识”+“信源标识”+“信宿标识”+“指令序号”+“指令长度”+“指令有效字段内容”+“校验和”的格式生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。The slave processor module in the processor calculation unit extracts the content of the "data field" in the terminal device command feedback data as the message content, and calculates the length and checksum of the valid data in the content. The calculation method of the checksum is the same as The verification and calculation method of console device control commands is the same, and then follow the "command ID" + "source ID" + "sink ID" + "command serial number" + "command length" + "command effective field content" + "verify and" format to generate a console device feedback command, and send the generated console device feedback command to the console device via Ethernet.

优选地,指令的有效字段内容是4的正整数倍。Preferably, the effective field content of the instruction is a positive integer multiple of 4.

本发明还提供了一种所述方法在嵌入式系统通讯技术领域中的应用。The invention also provides an application of the method in the technical field of embedded system communication.

本发明还提供了一种所述方法在和冗余管理技术领域中的应用。The invention also provides an application of the method in the technical field of redundancy management.

(三)有益效果(3) Beneficial effects

本发明与现有技术相比的优点在于:The advantage of the present invention compared with prior art is:

1、无需人工干预,在处理器模块上能够自动实现终端设备控制流程的指定和分配;1. Without manual intervention, the designation and distribution of the terminal equipment control process can be automatically realized on the processor module;

2、通过实时动态监控每个从处理器模块的程序执行时间,实现各个从处理器模块运行时间和执行效率的负载均衡,提高了整个系统资源利用率;2. Through real-time dynamic monitoring of the program execution time of each slave processor module, the load balance of the running time and execution efficiency of each slave processor module is realized, and the resource utilization rate of the entire system is improved;

3、通过对控制流程资源的合理优化配置,提高了控制台任务执行的效率和系统分布式处理的能力。3. The efficiency of console task execution and the distributed processing capability of the system are improved through the rational optimization and allocation of control process resources.

附图说明Description of drawings

图1为本发明的实现原理图;Fig. 1 is the realization schematic diagram of the present invention;

图2为本发明的方法流程图。Fig. 2 is a flow chart of the method of the present invention.

具体实施方式detailed description

为使本发明的目的、内容和优点更加清楚,下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述。In order to make the purpose, content and advantages of the present invention clearer, the specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments.

本发明提出的一种嵌入式系统多处理器模块负载均衡方法是基于控制系统实现的,控制系统包括:控制台设备、处理器计算单元和终端设备;该方法能够实现控制台设备、处理器计算单元以及终端设备之间的通讯,并且对通讯的实时性和可靠性有较高的要求。A load balancing method for embedded system multiprocessor modules proposed by the present invention is realized based on a control system, and the control system includes: a console device, a processor computing unit and a terminal device; the method can realize console devices, processor computing The communication between the unit and the terminal equipment has high requirements on the real-time and reliability of the communication.

控制台设备用于通过以太网发送控制指令给处理器计算单元,并通过以太网接收处理器计算单元发送的控制台设备反馈指令,控制台设备发送的所有控制指令都是按照既定的流程执行的,从而实现对每个终端设备发送控制流程,对每个终端设备发送的控制流程是相同的;The console device is used to send control instructions to the processor computing unit through Ethernet, and receive the console device feedback instructions sent by the processor computing unit through Ethernet. All control instructions sent by the console device are executed according to the established process , so that the control flow sent to each terminal device is realized, and the control flow sent to each terminal device is the same;

处理器计算单元用于通过以太网接收控制台设备发送的终端设备控制流程,对每个控制流程进行解析处理;处理器计算单元是控制系统的核心部件,为了确保该核心部件工作的可靠性,需要对处理器计算单元进行冗余备份;处理器计算单元由多块处理器模块组成,包括一块主处理器模块和多块从处理器模块;其中,主处理模块用于接收并保存控制台设备发送的所有终端设备控制流程,将终端设备控制流程向从处理器模块发送;从处理器模块用于解析并执行主处理器模块发送的终端设备控制流程,将控制流程中的每条控制指令的控制指令有效数据内容通过不同接口发送给终端设备,并接收终端设备发送的命令反馈数据,对命令反馈数据按照以太网报文进行组包处理,生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。每个从处理器模块中运行的程序是相同的。为了提高控制台设备对每个终端设备控制流程的处理效率,处理器计算单元中的主处理模块还根据每个从处理器模块中程序的执行时间动态调整每个从处理器模块执行的终端设备控制流程的个数,从而实现每个从处理器模块的终端设备控制流程资源的负载均衡。The processor computing unit is used to receive the terminal device control process sent by the console device through Ethernet, and analyze and process each control process; the processor computing unit is the core component of the control system. In order to ensure the reliability of the core component, Redundant backup is required for the processor computing unit; the processor computing unit is composed of multiple processor modules, including a main processor module and multiple slave processor modules; among them, the main processing module is used to receive and save the console equipment All the terminal device control processes sent, send the terminal device control process to the slave processor module; the slave processor module is used to parse and execute the terminal device control process sent by the main processor module, and send the control process of each control command in the control process The effective data content of the control command is sent to the terminal device through different interfaces, and the command feedback data sent by the terminal device is received, the command feedback data is packaged according to the Ethernet message, and the console device feedback command is generated, and the generated console device Feedback commands are sent to the console device via Ethernet. The programs run in each slave processor module are identical. In order to improve the processing efficiency of the control process of each terminal device by the console device, the main processing module in the processor computing unit also dynamically adjusts the terminal device executed by each slave processor module according to the execution time of the program in each slave processor module The number of control processes, so as to realize the load balancing of the terminal device control process resources of each slave processor module.

终端设备用于通过不同接口接收处理器计算单元发送的控制指令有效数据内容,并将自身生成的命令反馈数据通过不同接口向处理器计算单元发送。The terminal device is used to receive the effective data content of the control instruction sent by the processor computing unit through different interfaces, and send the command feedback data generated by itself to the processor computing unit through different interfaces.

如图1、图2所示,本发明提出的一种嵌入式系统多处理器模块负载均衡方法,步骤如下:As shown in Fig. 1 and Fig. 2, a kind of embedded system multiprocessor module load balancing method proposed by the present invention, the steps are as follows:

S1:处理器计算单元中的主处理器模块通过以太网接收并保存控制台设备发送的所有控制流程;S 1 : The main processor module in the processor computing unit receives and saves all the control processes sent by the console device through Ethernet;

对每个终端设备的控制流程是相同的,控制台设备将预先设定好的终端设备控制流程通过以太网发送给处理器计算单元,通过以太网接收处理器计算单元发送的控制台设备反馈指令。The control process for each terminal device is the same. The console device sends the preset terminal device control process to the processor computing unit through Ethernet, and receives the console device feedback command sent by the processor computing unit through Ethernet. .

S2:处理器计算单元中的主处理器模块基于每个从处理器模块中当前程序的运行时间值,应用负载均衡原理将控制台设备发送的控制流程通过以太网发送给不同的从处理器模块,实现对所有从处理器模块的负载均衡管理,从处理器模块对控制流程中的控制指令进行解析处理,将解析处理后的控制指令有效数据内容通过不同接口发送给终端设备;S 2 : The main processor module in the processor computing unit is based on the running time value of the current program in each slave processor module, and applies the load balancing principle to send the control process sent by the console device to different slave processors through Ethernet The module realizes the load balancing management of all slave processor modules, parses and processes the control instructions in the control process from the processor module, and sends the effective data content of the parsed and processed control instructions to the terminal device through different interfaces;

处理器计算单元中的1块主处理器模块和N块从处理器模块基于CORBA中间件建立以消息为中心的发布-订阅服务模型;每个从处理器模块实时计算当前整个程序的实际运行时间值,并保存当前程序运行时间值的最大值。每个从处理器模块会发布自身的编号、自身正在执行的终端设备控制流程个数以及当前程序运行时间值的最大值,主处理器模块通过CORBA中间件的同步更新机制能够访问到每个从处理器模块的编号、正在执行的终端设备控制流程个数以及当前程序运行时间值的最大值。One main processor module and N slave processor modules in the processor computing unit establish a message-centric publish-subscribe service model based on CORBA middleware; each slave processor module calculates the actual running time of the current entire program in real time value, and save the maximum value of the current program running time value. Each slave processor module will publish its own number, the number of terminal device control processes it is executing, and the maximum value of the current program running time. The main processor module can access each slave through the synchronous update mechanism of CORBA middleware. The number of the processor module, the number of terminal device control processes being executed, and the maximum value of the current program running time.

步骤S2中,处理器计算单元中的主处理器模块对接收到的终端设备控制流程按照如下步骤实现对所有从处理器模块的负载均衡管理: In step S2, the main processor module in the processor computing unit implements load balancing management for all slave processor modules according to the following steps for the received terminal device control process:

S21:由于终端设备的个数为M(M≥1),因此控制台设备发送的终端设备控制流程个数最大值为M;假设上述处理器计算单元中只有1块主处理器模块和1块从处理器模块,通过实际测试分别计算出控制台设备发送1个终端设备控制流程,2个终端设备控制流程,……,M个终端设备控制流程时,从处理器模块程序实际运行时间的最大值Ti(1≤i≤M,i为正整数);S 21 : Since the number of terminal devices is M (M≥1), the maximum number of terminal device control processes sent by the console device is M; assuming that there is only one main processor module and one From the processor module, calculate the actual running time of the slave processor module program when the console device sends 1 terminal device control process, 2 terminal device control processes, ..., M terminal device control processes. Maximum value T i (1≤i≤M, i is a positive integer);

S22:假设每个从处理器模块中程序的执行周期为T执行(T执行>0);S 22 : Assume that the execution cycle of the program in each slave processor module is T execution (T execution >0);

当TM<T执行时,表明在1块从处理器模块上能够正确执行M个终端设备控制流程;主处理器模块每次给从处理器模块分配终端设备控制流程时,读取每个从处理器模块当前程序运行时间的最大值,找出这些最大值当中运行时间最小的那个从处理器模块的编号,将本次终端设备控制流程分配给该从处理器模块;该从处理器模块在执行新的终端设备控制流程时,将正在执行的终端设备控制流程个数加1,实时更新并保存本从处理器模块当前程序运行时间值的最大值和该从处理器模块正在执行的终端设备控制流程个数;若每个从处理器模块程序的执行周期T执行等于程序的运行时间,主处理器模块也按照TM<T执行条件下同样的方法来执行终端设备控制流程的分配;When T M < T is executed , it indicates that M terminal device control processes can be correctly executed on one slave processor module; each time the master processor module assigns a terminal device control process to a slave processor module, it reads each slave The maximum value of the current program running time of the processor module, find out the number of the slave processor module with the smallest running time among these maximum values, and assign this terminal device control process to the slave processor module; the slave processor module is in When executing a new terminal device control process, add 1 to the number of terminal device control processes being executed, update and save the maximum value of the current program running time of the slave processor module and the terminal device being executed by the slave processor module in real time The number of control processes; if the execution period T of each slave processor module program is equal to the running time of the program, the master processor module also executes the distribution of the terminal device control process in the same way as under the execution condition of T M <T;

当TM≥T执行时,表明在一个从处理器模块上无法正确执行M个终端设备控制流程;根据步骤S21中获取的Ti值,计算出当Ti≥T执行时i的最小值,该值正是一个从处理器模块能够同时正确执行终端设备控制流程个数的最大值,记为Cmax(Cmax>0),然后执行步骤S23When T M ≥ T is executed , it indicates that M terminal device control processes cannot be correctly executed on a slave processor module; according to the T i value obtained in step S 21 , the minimum value of i when T i ≥ T is executed is calculated , this value is exactly the maximum value of a slave processor module that can correctly execute the number of terminal device control processes at the same time, denoted as C max (C max >0), and then perform step S23 ;

S23:主处理器模块每次给从处理器模块分配终端设备控制流程时,读取每个从处理器模块正在执行的终端设备控制流程个数,记为Ci,若Ci<Cmax,则执行步骤S24;若Ci等于Cmax,则比较Ci+1与Cmax的大小,若Ci+1<Cmax,则执行步骤S24;若所有的Ci值均等于Cmax,表明没有一块从处理器模块能够执行当前控制台设备发送的终端设备控制流程,主处理器模块通过以太网向控制台设备发送“无可用的从处理器模块”信息;S 23 : The master processor module reads the number of terminal device control processes being executed by each slave processor module each time it assigns the terminal device control process to the slave processor module, and records it as C i , if C i <C max , then perform step S 24 ; if C i is equal to C max , then compare the size of C i+1 and C max , if C i+1 <C max , then perform step S 24 ; if all C i values are equal to C max , indicating that none of the slave processor modules can execute the terminal device control process sent by the current console device, and the master processor module sends a "no slave processor module available" message to the console device through Ethernet;

S24:将本次终端设备控制流程分配给该从处理器模块;该从处理器模块在执行新的终端设备控制流程时,将正在执行的终端设备控制流程个数加1,实时更新并保存本从处理器模块当前程序运行时间值的最大值和该从处理器模块正在执行的终端设备控制流程个数;S 24 : assign this terminal device control process to the slave processor module; when the slave processor module executes a new terminal device control process, add 1 to the number of terminal device control processes being executed, update and save in real time The maximum value of the current program running time of the slave processor module and the number of terminal device control processes being executed by the slave processor module;

其中,当从处理器模块的一个终端设备控制流程执行结束后,将正在执行的终端设备控制流程个数减1;若从处理器模块负责的所有终端设备控制流程均执行结束,将正在执行的终端设备控制流程个数和程序运行时间最大值均清零;完成上述操作后,实时更新并保存本模块当前程序运行时间值的最大值和该模块正在执行的终端设备控制流程个数。Among them, when the execution of a terminal device control process of the slave processor module is completed, the number of terminal device control processes being executed is reduced by 1; The number of terminal equipment control processes and the maximum value of the program running time are cleared; after the above operations are completed, the maximum value of the current program running time of the module and the number of terminal equipment control processes being executed by the module are updated and saved in real time.

其中,处理器计算单元采用如下方法对控制台设备发送的终端设备控制流程进行解析处理:Among them, the processor computing unit uses the following method to analyze and process the terminal device control process sent by the console device:

其中,控制台设备发送的终端设备控制流程的报文格式由“指令标识(2字节)”+“信源标识(4字节)”+“信宿标识(4字节)”+“指令序号(4字节)”+“指令长度(2字节)”+“指令个数(总个数为K,K>0,2字节)”+“指令1类型(2字节)”+“指令1间隔时间(2字节)”+“指令1有效字段内容(总长度为W1字节,W1>0且W1是4的正整数倍)”+“指令2类型(2字节)”+“指令2间隔时间(2字节)”+“指令2有效字段内容(总长度为W2字节,W2>0且W2是4的正整数倍)”+……+“指令k类型(2字节)”+“指令k间隔时间(2字节)”+“指令k有效字段内容(总长度为Wk字节,Wk>0且Wk是4的正整数倍)”+“校验和(2字节)”组成。Among them, the message format of the terminal device control process sent by the console device is composed of "command identification (2 bytes)" + "source identification (4 bytes)" + "sink identification (4 bytes)" + "command serial number (4 bytes)" + "instruction length (2 bytes)" + "number of instructions (the total number is K, K>0, 2 bytes)" + "instruction 1 type (2 bytes)" + " Instruction 1 interval time (2 bytes)"+"Instruction 1 effective field content (the total length is W 1 byte, W 1 >0 and W 1 is a positive integer multiple of 4)"+"Instruction 2 type (2 bytes )" + "command 2 interval time (2 bytes)" + "command 2 effective field content (the total length is W 2 bytes, W 2 >0 and W 2 is a positive integer multiple of 4)" + ... + " Command k type (2 bytes)" + "command k interval time (2 bytes)" + "command k effective field content (the total length is W k bytes, W k >0 and W k is a positive integer multiple of 4 )" + "checksum (2 bytes)".

处理器计算单元中的处理器模块根据所述报文格式,判断当前控制流程的长度和校验和是否正确;其中,当前控制流程的最后一个字的内容为校验和,将当前控制流程中除了“校验和”字段的其余字段内容按照CRC16校验算法计算出校验和;若控制流程长度和校验和均正确,则根据指令个数从当前控制流程中分别提取出控制流程中每个控制指令的有效字段内容,记为控制台设备控制指令有效数据内容,并保存每条控制指令的指令间隔时间;处理器计算单元按照每条控制指令的指令间隔时间,将控制台设备控制流程中每条控制指令有效数据内容发送给终端设备;处理器计算单元通过不同接口接收到终端设备的命令反馈数据后,处理器计算单元中的处理器模块提取命令反馈数据中的“数据字段”的内容作为报文内容,并计算该内容中有效数据的长度(报文长度)以及校验和,校验和的计算方法与控制台设备控制指令校验和的计算方法相同,然后按照“指令标识(2字节)”+“信源标识(4字节)”+“信宿标识(4字节)”+“指令序号(2字节)”+“指令长度(2字节)”+“指令有效字段内容(W字节,W>0且W是4的正整数倍)”+“校验和(2字节)”的格式生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。The processor module in the processor calculation unit judges whether the length and the checksum of the current control flow are correct according to the message format; wherein, the content of the last word of the current control flow is a checksum, and the current control flow The content of the other fields except the "checksum" field is calculated according to the CRC16 checksum algorithm; if the length of the control flow and the checksum are both correct, extract each command in the control flow from the current control flow according to the number of instructions. The effective field content of each control instruction is recorded as the effective data content of the console device control instruction, and the instruction interval time of each control instruction is saved; the processor calculation unit divides the console device control process according to the instruction interval time of each control instruction. The effective data content of each control command in the command is sent to the terminal device; after the processor computing unit receives the command feedback data of the terminal device through different interfaces, the processor module in the processor computing unit extracts the "data field" in the command feedback data The content is used as the content of the message, and the length of the valid data in the content (the length of the message) and the checksum are calculated. The calculation method of the checksum is the same as that of the console device control command checksum, and then according to the "command identification (2 bytes)" + "source identification (4 bytes)" + "sink identification (4 bytes)" + "command serial number (2 bytes)" + "command length (2 bytes)" + "command Valid field content (W byte, W>0 and W is a positive integer multiple of 4)" + "checksum (2 bytes)" format to generate a console device feedback command, and pass the generated console device feedback command through Ethernet sent to the console device.

S3:终端设备将自身生成的命令反馈数据通过不同接口向处理器计算单元发送;S 3 : The terminal device sends the command feedback data generated by itself to the processor computing unit through different interfaces;

其中,终端设备通过RS-422A接口、GJB289A接口、开关量接口、CAN总线接口等不同接口将自身生成的命令反馈数据发送给处理器计算单元。Among them, the terminal device sends the command feedback data generated by itself to the processor calculation unit through different interfaces such as RS-422A interface, GJB289A interface, switch interface, CAN bus interface and so on.

S4:处理器计算单元接收到终端设备的命令反馈数据后,对命令反馈数据按照以太网报文进行组包处理,生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。S 4 : After the processor calculation unit receives the command feedback data of the terminal equipment, it packs the command feedback data according to the Ethernet message, generates a console device feedback command, and sends the generated console device feedback command through Ethernet to the console device.

其中,为了减轻主处理器模块的通讯负荷量,提高主处理器模块的执行效率,每个终端设备将命令反馈数据都发送给对应的从处理器模块,由从处理器模块通过以太网发送给控制台设备。Among them, in order to reduce the communication load of the main processor module and improve the execution efficiency of the main processor module, each terminal device sends the command feedback data to the corresponding slave processor module, and the slave processor module sends it to the console device.

其中,处理器计算单元采用如下方法将生成的控制台设备反馈指令通过以太网发送给控制台设备:Wherein, the processor computing unit sends the generated console device feedback command to the console device via Ethernet in the following way:

处理器计算单元中的从处理器模块提取终端设备命令反馈数据中的“数据字段”的内容作为报文内容,并计算该内容中有效数据的长度(报文长度)和校验和,校验和的计算方法与控制台设备控制指令校验和计算方法相同,然后按照“指令标识(2字节)”+“信源标识(4字节)”+“信宿标识(4字节)”+“指令序号(2字节)”+“指令长度(2字节)”+“指令有效字段内容(N字节,N>0且N是4的正整数倍)”+“校验和(2字节)”的格式生成控制台设备反馈指令,将生成的控制台设备反馈指令通过以太网发送给控制台设备。The processor module in the processor calculation unit extracts the content of the "data field" in the terminal device command feedback data as the message content, and calculates the length (message length) and checksum of the valid data in the content, and checks The calculation method of the sum is the same as the calculation method of the control command checksum of the console device, and then according to "command identification (2 bytes)" + "source identification (4 bytes)" + "sink identification (4 bytes)" + "Instruction serial number (2 bytes)" + "instruction length (2 bytes)" + "instruction effective field content (N bytes, N>0 and N is a positive integer multiple of 4)" + "checksum (2 byte)” format to generate a console device feedback command, and send the generated console device feedback command to the console device via Ethernet.

可以看出,本发明提供的一种嵌入式系统多处理器模块负载均衡方法,该方法无需人工干预,在处理器模块上能够自动实现对终端设备控制流程的指定和分配;通过实时动态监控每个从处理器模块的程序执行时间,实现各个从处理器模块运行时间和执行效率的负载均衡,提高了整个系统资源利用率;通过对控制流程资源的合理优化配置,提高了控制台任务执行的效率和系统分布式处理的能力。It can be seen that a load balancing method for embedded system multiprocessor modules provided by the present invention does not require manual intervention, and can automatically realize the designation and distribution of the control process of the terminal equipment on the processor module; through real-time dynamic monitoring of each The program execution time of each slave processor module realizes the load balance of the running time and execution efficiency of each slave processor module, which improves the resource utilization of the entire system; through the reasonable optimal configuration of control process resources, the execution efficiency of console tasks is improved. Efficiency and system distributed processing capabilities.

采用本发明的方案,能够完美解决目前控制系统中“处理器计算单元的多个从处理器模块控制流程资源分配不均”问题,无需人工指定和分配终端设备控制流程,避免出现从处理器模块之间终端设备控制流程资源分配不均,甚至个别从处理器模块由于执行较多的终端设备控制流程而无法在规定时间内完成所有任务流程的现象。Adopting the scheme of the present invention can perfectly solve the problem of "uneven distribution of control flow resources of multiple slave processor modules of the processor computing unit" in the current control system, without manually specifying and allocating the control flow of the terminal equipment, and avoiding the occurrence of slave processor modules The resource allocation of terminal equipment control processes is uneven, and even individual slave processor modules cannot complete all task processes within the specified time due to the execution of more terminal equipment control processes.

以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明技术原理的前提下,还可以做出若干改进和变形,这些改进和变形也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that for those of ordinary skill in the art, without departing from the technical principle of the present invention, some improvements and modifications can also be made. It should also be regarded as the protection scope of the present invention.

Claims (10)

1. A load balancing method for multiprocessor modules of an embedded system is characterized in that the method is realized based on a control system, and the control system comprises: the system comprises console equipment, a processor computing unit and terminal equipment;
the control console device is used for sending a control instruction to the processor computing unit through the Ethernet and receiving a control console device feedback instruction sent by the processor computing unit through the Ethernet, all the control instructions sent by the control console device are executed according to a set flow, so that the control flow is sent to each terminal device, and the control flow sent to each terminal device is the same;
the processor computing unit is used for receiving the control flows sent by the console equipment through the Ethernet and analyzing each control flow; the processor computing unit consists of a plurality of processor modules and comprises a main processor module and a plurality of slave processor modules; the main processing module is used for receiving and storing all control flows sent by the console equipment and sending the control flows to the auxiliary processing module; the slave processor module is used for analyzing and executing the control flow sent by the master processor module, sending the effective data content of the control instruction of each control instruction in the control flow to the terminal equipment through different interfaces, receiving the command feedback data sent by the terminal equipment, packaging the command feedback data according to the Ethernet message to generate a console equipment feedback instruction, and sending the generated console equipment feedback instruction to the console equipment through the Ethernet; the programs running in each slave processor module are identical; the main processing module in the processor computing unit is also used for dynamically adjusting the number of the control flows executed by each slave processing module according to the execution time of the program in each slave processing module;
the terminal equipment is used for receiving effective data content of the control instruction sent by the processor computing unit through different interfaces and sending command feedback data generated by the terminal equipment to the processor computing unit through different interfaces;
the load balancing method based on the control system comprises the following steps:
S 1 : a main processor module in the processor computing unit receives and stores all control flows sent by the console equipment through the Ethernet;
the console device sends a preset control flow to the processor computing unit through the Ethernet, and receives a console device feedback instruction sent by the processor computing unit through the Ethernet.
S 2 : a master processor module in a processor computing unit sends a control flow sent by console equipment to different slave processor modules through Ethernet by applying a load balancing principle based on the running time value of a current program in each slave processor module, so as to realize load balancing management of all the slave processor modules, the slave processor modules analyze control instructions in the control flow and send effective data contents of the analyzed control instructions to terminal equipment through different interfaces;
S 3 : the terminal equipment sends the command feedback data generated by the terminal equipment to the processor computing unit through different interfaces;
S 4 : and after receiving the command feedback data of the terminal equipment, the processor computing unit performs packet packaging processing on the command feedback data according to the Ethernet message to generate a console equipment feedback instruction, and sends the generated console equipment feedback instruction to the console equipment through the Ethernet.
2. The method of claim 1 wherein 1 master processor module and N slave processor modules in the processor computing unit build a message-centric model based on CORBA middleware; each slave processor module calculates the actual running time value of the current whole program in real time and stores the maximum value of the current program running time value; each slave processor module can issue the number of the slave processor module, the number of the control processes being executed by the slave processor module and the maximum value of the current program running time value, and the master processor module can access the number of each slave processor module, the number of the control processes being executed and the maximum value of the current program running time value through a synchronous updating mechanism of CORBA middleware.
3. The method of claim 2, wherein step S 2 In the method, a main processor module in a processor computing unit implements load balancing management on all slave processor modules according to the following steps for a received control flow:
S 21 : the number of the terminal devices is M which is more than or equal to 1, so thatThe maximum value of the number of the control processes sent by the console equipment is M; assuming that only 1 master processor module and 1 slave processor module are arranged in the processor computing unit, the maximum value T of the actual running time of the slave processor module program when the console device sends 1 to M control flows is respectively computed through testing i ,1≤i≤M;
S 22 : assume that the execution cycle of the program in each slave processor module is T Execute
When T is M <T Execute When the flow is in the first control flow, the flow indicates that M control flows can be correctly executed on 1 slave processor module; when the master processor module allocates a control flow to the slave processor module each time, reading the maximum value of the current program running time of each slave processor module, finding out the serial number of the slave processor module with the minimum running time in the maximum values, and allocating the current control flow to the slave processor module; when the slave processor module executes a new control flow, adding 1 to the number of the control flows which are executed, and updating and storing the maximum value of the current program running time value of the slave processor module and the number of the control flows which are executed by the slave processor module in real time; if the execution period T of each slave processor module program Execute Equal to the running time of the program, the main processor module also follows T M <T Execute The same method is used to execute the distribution of the control flow under the same condition;
when T is M ≥T Execute When the M control flows are executed, the M control flows cannot be correctly executed on one slave processor module; according to step S 21 T obtained in i Value, calculate when T i ≥T Execute The minimum value of time i is the maximum value of the number of control flows which can be simultaneously and correctly executed by one slave processor module and is marked as C max Then executing step S 23
S 23 : when the master processor module distributes the control flow to the slave processor module each time, the number of the control flows which are executed by each slave processor module is read and recorded as C i If C is i <C max Then execute step S 24 (ii) a If C i Is equal to C max Then, thenComparison C i+1 And C max Size of (2), if C i+1 <C max Then execute step S 24 (ii) a If all C are i Value equal to C max If the slave processor module is not capable of executing the control flow sent by the current console device, the master processor module sends 'no available slave processor module' information to the console device through the Ethernet;
S 24 : distributing the control flow to the slave processor module; when the slave processor module executes a new control flow, the number of the control flows which are executed is added with 1, and the maximum value of the current program running time value of the slave processor module and the number of the control flows which are executed by the slave processor module are updated and stored in real time.
4. The method of claim 3, wherein step S 2 When the execution of one control flow of the slave processor module is finished, subtracting 1 from the number of the control flows which are executed; if all the control flows responsible by the slave processor module are executed, clearing the number of the control flows being executed and the maximum value of the program running time; then, the maximum value of the current program running time value of the module and the number of the control flows being executed by the module are updated and saved in real time.
5. The method of claim 4, wherein step S 2 The processor computing unit analyzes the control flow sent by the console device by adopting the following method:
the message format of the control flow sent by the console equipment consists of an instruction identifier, a source identifier, a sink identifier, a plus instruction sequence number, an instruction length, an instruction number, an instruction 1 type, an instruction 1 interval time, an instruction 1 effective field content, a plus instruction 2 type, an instruction 2 interval time, an instruction 2 effective field content, a plus 8230, an instruction k type, an instruction k interval time, an instruction k effective field content, a plus checksum; k is an integer greater than 2;
a processor module in the processor computing unit judges whether the length and the checksum of the current control flow are correct or not according to the message format; the content of the last word of the current control flow is a checksum, and the checksum is calculated according to a CRC16 check algorithm from the content of other fields except the 'checksum' field in the current control flow; if the length of the control flow and the checksum are correct, respectively extracting the effective field content of each control instruction in the control flow from the current control flow according to the number of the instructions, recording the effective field content as the effective data content of the control instruction of the console equipment, and storing the instruction interval time of each control instruction; the processor computing unit sends the effective data content of each control instruction in the control flow of the console equipment to the terminal equipment according to the instruction interval time of each control instruction; after the processor computing unit receives command feedback data of the terminal equipment through different interfaces, a processor module in the processor computing unit extracts content of a data field in the command feedback data as message content, computes the length of effective data in the content and a checksum, wherein the computation method of the checksum is the same as that of the checksum of the console equipment control command, then generates a console equipment feedback command according to the format of command identification + information source identification + information sink identification + instruction sequence + instruction length + instruction effective field content + checksum, and sends the generated console equipment feedback command to the console equipment through Ethernet.
6. The method of claim 1, wherein step S 3 And the terminal equipment sends the self-generated command feedback data to the processor computing unit through one of an RS-422A interface, a GJB289A interface, a switching value interface and a CAN bus interface.
7. The method of claim 5, wherein step S 4 In the method, the processor computing unit sends the generated console device feedback instruction to the console device through the ethernet by adopting the following method:
the processor module in the processor computing unit extracts the content of a data field in the command feedback data of the terminal equipment as message content, computes the length and the checksum of effective data in the content, the computation method of the checksum is the same as the computation method of the control instruction checksum of the console equipment, generates a console equipment feedback instruction according to the format of instruction identification plus information source identification plus information sink identification plus instruction sequence number plus instruction length plus instruction effective field content plus checksum, and sends the generated console equipment feedback instruction to the console equipment through the Ethernet.
8. The method of claim 1, wherein the valid field content of the instruction is a positive integer multiple of 4.
9. Use of a method according to any of claims 1 to 8 in the field of embedded system communication technology.
10. Use of a method according to any one of claims 1 to 8 in the field of redundancy management.
CN202211124000.3A 2022-09-15 2022-09-15 A load balancing method for embedded system multiprocessor modules Pending CN115421917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211124000.3A CN115421917A (en) 2022-09-15 2022-09-15 A load balancing method for embedded system multiprocessor modules

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211124000.3A CN115421917A (en) 2022-09-15 2022-09-15 A load balancing method for embedded system multiprocessor modules

Publications (1)

Publication Number Publication Date
CN115421917A true CN115421917A (en) 2022-12-02

Family

ID=84204010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211124000.3A Pending CN115421917A (en) 2022-09-15 2022-09-15 A load balancing method for embedded system multiprocessor modules

Country Status (1)

Country Link
CN (1) CN115421917A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882263A (en) * 2010-06-13 2010-11-10 中国人民解放军国防科学技术大学 Demonstration and Verification Integrated System Based on Algorithm Synthesis and Integration
CN104065545A (en) * 2014-06-27 2014-09-24 浙江大学 RS485 bus communication method based on Modbus protocol and power electronic system based on the communication method
CN104123185A (en) * 2013-04-28 2014-10-29 中国移动通信集团公司 Resource scheduling method, device and system
US9612815B1 (en) * 2013-08-22 2017-04-04 Ca, Inc. Method and tool for automating deployment of reference implementation architectures for pre-integrated multi-product solutions
US20190123974A1 (en) * 2016-06-23 2019-04-25 Huawei Technologies Co., Ltd. Method for generating routing control action in software-defined network and related device
CN109753362A (en) * 2019-01-14 2019-05-14 中国水利水电科学研究院 A Convergence Parallel Scheduling Method for Distributed Hydrological Model
JP2019134234A (en) * 2018-01-29 2019-08-08 日本電信電話株式会社 Controller and communication system
CN112319498A (en) * 2020-10-12 2021-02-05 武汉蓝星科技股份有限公司 Method and system for reducing power consumption of electronic equipment based on GPS
CN113612668A (en) * 2021-06-18 2021-11-05 天津津航计算技术研究所 Communication method for bridging three protocols
CN113676386A (en) * 2021-06-18 2021-11-19 天津津航计算技术研究所 FC-AE-1553 bus protocol message communication system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882263A (en) * 2010-06-13 2010-11-10 中国人民解放军国防科学技术大学 Demonstration and Verification Integrated System Based on Algorithm Synthesis and Integration
CN104123185A (en) * 2013-04-28 2014-10-29 中国移动通信集团公司 Resource scheduling method, device and system
US9612815B1 (en) * 2013-08-22 2017-04-04 Ca, Inc. Method and tool for automating deployment of reference implementation architectures for pre-integrated multi-product solutions
CN104065545A (en) * 2014-06-27 2014-09-24 浙江大学 RS485 bus communication method based on Modbus protocol and power electronic system based on the communication method
US20190123974A1 (en) * 2016-06-23 2019-04-25 Huawei Technologies Co., Ltd. Method for generating routing control action in software-defined network and related device
JP2019134234A (en) * 2018-01-29 2019-08-08 日本電信電話株式会社 Controller and communication system
CN109753362A (en) * 2019-01-14 2019-05-14 中国水利水电科学研究院 A Convergence Parallel Scheduling Method for Distributed Hydrological Model
CN112319498A (en) * 2020-10-12 2021-02-05 武汉蓝星科技股份有限公司 Method and system for reducing power consumption of electronic equipment based on GPS
CN113612668A (en) * 2021-06-18 2021-11-05 天津津航计算技术研究所 Communication method for bridging three protocols
CN113676386A (en) * 2021-06-18 2021-11-19 天津津航计算技术研究所 FC-AE-1553 bus protocol message communication system

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
IEEE: ""IEC 62530 Ed. 1 (IEEE Std 1800(TM)-2005): Standard for SystemVerilog - Unified Hardware Design, Specification, and Verification Language"", 《HTTPS://IEEEXPLORE.IEEE.ORG/SERVLET/OPAC?PUNUMBER=4410438》, 9 December 2007 (2007-12-09) *
XI YANG等: ""Large-scale branch contingency analysis through master/slave parallel computing"", 《JOURNAL OF MODERN POWER SYSTEMS AND CLEAN ENERGY》, 30 September 2013 (2013-09-30) *
张利永;段荣;罗恒钰;: "一种面向SaaS环境的工作流系统集成和负载均衡方法", 中国电子科学研究院学报, no. 04, 31 December 2016 (2016-12-31) *
翟文正;胡越黎;冉峰;: "异构多核DAG任务模型的微粒群优化调度算法", 计算机工程与设计, no. 07, 16 July 2016 (2016-07-16), pages 2 *
赵昶宇等: ""嵌入式系统双机热备技术研究"", 《科技与创新》, 28 March 2022 (2022-03-28) *
魏海涛: ""面向多核处理器的数据流程序编译关键技术研究"", 《中国博士学位论文全文数据库》, 15 November 2010 (2010-11-15) *

Similar Documents

Publication Publication Date Title
EP3606008B1 (en) Method and device for realizing resource scheduling
US10812333B2 (en) Microservice configuration apparatus and method
US9471364B2 (en) Virtual machine specification adjustment method and apparatus
US10334034B2 (en) Virtual machine live migration method, virtual machine deployment method, server, and cluster system
US20150331715A1 (en) Reliable and deterministic live migration of virtual machines
CN111160873B (en) Running batch processing device and method based on distributed architecture
US20160378570A1 (en) Techniques for Offloading Computational Tasks between Nodes
CN102479113B (en) Abnormal self-adapting processing method and system
EP2515504B1 (en) Content delivery method, system and schedule server
US11461199B2 (en) Redundancy method, device, and system
US20190235901A1 (en) Systems and methods for organizing on-demand migration from private cluster to public cloud
WO2020098100A1 (en) Method and apparatus for allocating resources on basis of data analysis, and computer device
CN111897643B (en) Thread pool configuration system, method, device and storage medium
CN115421917A (en) A load balancing method for embedded system multiprocessor modules
CN113822485A (en) A method and system for optimizing distribution network scheduling tasks
CN113658351A (en) Product production method and device, electronic equipment and storage medium
CN115408159A (en) Embedded system multiprocessor module load balancing device
CN118363944A (en) A distributed online data migration method and system
CN109062920B (en) Memory-based data fast collision subsystem for data mining system
CN101207518A (en) An Asynchronous Maintenance System Oriented to Distributed Resource Nodes
CN109742751A (en) Power system security control device control strategy identification service method, device and system
CN115913550A (en) Password resource allocation method, device and equipment
CN106970839A (en) The expansion method and its device of a kind of automation
CN113190183A (en) Storage cluster device and equipment mounting method
CN112241304A (en) Scheduling method and device for super-converged resources in Loongson cluster and Loongson cluster

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination