CN117632206A - Basic algorithm and control logic program online updating method and system of industrial controller - Google Patents

Basic algorithm and control logic program online updating method and system of industrial controller Download PDF

Info

Publication number
CN117632206A
CN117632206A CN202311634974.0A CN202311634974A CN117632206A CN 117632206 A CN117632206 A CN 117632206A CN 202311634974 A CN202311634974 A CN 202311634974A CN 117632206 A CN117632206 A CN 117632206A
Authority
CN
China
Prior art keywords
task
program
information
control logic
function
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
CN202311634974.0A
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.)
NARI Nanjing Control System Co Ltd
Original Assignee
NARI Nanjing Control System Co Ltd
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 NARI Nanjing Control System Co Ltd filed Critical NARI Nanjing Control System Co Ltd
Priority to CN202311634974.0A priority Critical patent/CN117632206A/en
Publication of CN117632206A publication Critical patent/CN117632206A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a basic algorithm and control logic program online updating method and system of an industrial controller, wherein the controller receives and transmits a functional block program to be updated online, firstly, a basic algorithm program part in the functional block program is dynamically loaded into a memory, then, the basic algorithm program is dynamically instantiated according to a control logic program part in the functional block program, finally, a scheduling sequence of a functional block task in the system is updated, and the scheduling sequence is directly used in the next task scheduling period, so that the dynamic updating and online effective execution of the functional block program of the industrial controller are realized.

Description

Basic algorithm and control logic program online updating method and system of industrial controller
Technical Field
The invention belongs to the technical field of industrial controllers, and particularly relates to a basic algorithm and control logic program online updating method and system of an industrial controller.
Background
Industrial controllers are processor systems that control industrial processes, run specific logic and algorithmic programs, and have high requirements for reliability and real-time. Industrial controllers typically include major modules for data acquisition, logic and algorithm computation, and control output. In order to meet the strong real-time requirements of certain industrial control fields, it is generally required that the time from data acquisition to the production equipment being controlled is as short as possible, which puts a hard index on the control response period of the industrial controller, for example a millisecond control response. Meanwhile, the industrial controller generally controls the operation of the industrial process, if the controller fails, the production is stopped slightly, and the serious person can have disastrous results, so that the general industrial controller is provided with a dual-machine redundancy system, and the reliability of the controller system is improved.
On the one hand, different industrial application scenes are different, and according to the process characteristics of a controlled object, the logic and algorithm programs of the industrial controller need to be customized, such as a new basic algorithm program needs to be developed; on the other hand, even in the face of the same industrial scenario and controlled object, when the operation mode of the controlled object is changed, the industrial controller needs to adjust the operation control logic to adapt to the new control strategy. Generally, most industrial controllers facing large distributed control systems adopt function block programming languages, that is, function blocks in corresponding programs of a basic algorithm and control logic of the controller, so that the running program update requirement of the industrial controller is the function block program update requirement of the controller.
The update process of the functional block program of the industrial controller has requirements on update time, generally, the program update time is required to be shortened as much as possible, the exit running time of the controller is reduced, and the availability of the dual-machine redundancy of the controller is ensured. Meanwhile, the influence scope of the update is required, when a single controller simultaneously controls a plurality of controlled objects, the logic algorithm of the single controlled object is required to be updated, and the algorithm operation of other controlled objects is not influenced.
Chinese patent application No. 201610878434.0 discloses a system for updating a control program that is controlling an industrial process, which may be any controller behavior (including instructions) that relies on loadable libraries of an operating system and inline code. Updates are made between different controller program versions through patching processes for different components, such as library patching and inline patching.
The application number 201710369592.8 of China discloses an industrial control board for online program update through a network and an updating method thereof. And after the controller is electrified, the updated application program is loaded from the program storage area, so that the industrial controller application program is updated through network remote operation, and the industrial controller is effective after power-off restarting.
The invention discloses a DCS controller configuration updating system and method based on configuration difference identification, which supports issuing configuration files to an industrial controller by defining a combinational logic relationship among functional blocks through the configuration files, and the controller analyzes and uses the new configuration files to change the execution flow of functional block programs in the controller so as to achieve the effect of online updating of control logic of the controller.
The update method or system disclosed above suffers from the following drawbacks:
(1) The application number 201610878434.0 is a Chinese patent application, and the online update of the update library program is realized by adopting a dynamic library loading mechanism of an operating system, because of the uncertainty of task scheduling time of the operating system and the problem of mutual preemption among tasks with different priorities, the task scheduling period generally reaches 100ms class based on a general operating system, and the program execution of a strictly equally-spaced periodic scheduling functional block cannot be ensured, so that the requirements of a strong real-time industrial control scene cannot be met.
(2) According to the Chinese patent application with the application number of 201710369592.8, by updating the application program stored in the controller in a solidifying way, the controller needs to be powered off and restarted to realize the updating effect of the application program, the equipment is powered on and initialized for seconds or even tens of seconds, and during the updating period, the industrial controller must exit the dual-machine redundancy operation mode, so that the risk that a controlled system is out of protection and cannot work normally if a single machine fault occurs during the updating period of the controller program is greatly increased.
(3) The chinese patent application with application number 201910968572.1 changes the logic relationship and execution timing between the existing control block programs by updating the configuration file, so that the update of the control block program corresponding to the basic algorithm program cannot be realized, and the application scenario that the existing control block program needs to be updated due to the operation failure or the basic algorithm program in the controller needs to be expanded cannot be satisfied.
Disclosure of Invention
The invention aims to: in order to solve the problem that the function block program of the industrial controller applied to the strong real-time control scene can not realize the online update, the invention provides a basic algorithm and control logic program online update method and system of the industrial controller.
The technical scheme is as follows: an online updating method of basic algorithm programs of an industrial controller, wherein each basic algorithm program uniquely corresponds to a function block library;
the function block library comprises a plurality of function blocks, each function block comprises a function block template name, function block external data and a processing function for data, and the external data comprises: input information, output information, parameter information and control information, wherein the processing function of the data comprises: constructing functions and task functions, wherein the constructing functions are used for memory allocation of function block data and initialization processing of internal data of corresponding algorithms, so as to realize instantiation of the function block; the task function is used for executing specific algorithm logic of the functional block;
The basic algorithm program comprises the number of functional blocks, descriptive information of each functional block and executable instruction data; the description information of each functional block comprises a functional block template name, the length of an executable instruction data area, the relative offset address of a construction task in the executable instruction data area and the relative offset address of an operation task in the executable instruction data area; the executable instruction data is binary executable code at least comprising a construction task and an operation task corresponding function;
the online updating method of the basic algorithm program comprises the following steps:
step 1: analyzing and updating the issued basic algorithm program to obtain a function block of a function block library corresponding to the basic algorithm program;
step 2: loading the executable instruction data area into a specified memory space by taking the function block as a unit according to the length of the executable instruction data area of each function block and the relative offset address in the basic algorithm program, so as to obtain the loading offset head address of the construction task and the running task in the executable instruction data area;
step 3: according to the relative offset addresses of the construction task and the operation task in the executable instruction data area, the memory call addresses of the construction task and the operation task of the functional block are corrected by combining the loading offset head address;
Step 4: according to the template name of the functional block, obtaining the symbol names of the construction task and the operation task of the functional block, and adding the symbol names and the memory call addresses of the construction task and the operation task into a system symbol address mapping table;
step 5: and (3) repeating the steps (2) to (4) until the symbol names and the memory call addresses of the construction tasks and the running tasks in all the functional blocks are added to the system symbol address mapping table, so as to complete online updating of the basic algorithm program, and executable instruction data corresponding to the running tasks in the functional blocks can be called and executed online.
Further, the input information includes: channel number, channel name, data type;
the output information includes: channel number, channel name, data type;
the parameter information includes: channel number, parameter name, data type;
the control information includes: channel number, control name, data type.
Further, the functional blocks are compiled according to the following programming specifications:
the function cannot be directly called between the function blocks according to the first programming specification;
the second programming specification and the functional blocks cannot directly refer to the variables of the other side;
and the second programming specification can only realize the mutual reference of external data through the input-output connection relation between the functional blocks.
The invention discloses an on-line updating system of basic algorithm program of industrial controller, comprising:
the loading module is used for loading the updated basic algorithm program;
the analysis module is used for analyzing the updated basic algorithm program to obtain a function block of a function block library corresponding to the basic algorithm program; loading the executable instruction data area into a specified memory space by taking the function block as a unit according to the length of the executable instruction data area of each function block and the relative offset address in the basic algorithm program, and obtaining the loading offset head address of the construction task and the running task in the executable instruction data area;
the instantiation module is used for correcting the memory call addresses of the construction task and the operation task of the functional block according to the relative offset addresses of the construction task and the operation task in the executable instruction data area and the loading offset head address, obtaining the symbol names of the construction task and the operation task of the functional block according to the template name of the functional block, and adding the symbol names and the memory call addresses of the construction task and the operation task to the system symbol address mapping table; when the symbol names and the memory calling addresses of the construction tasks and the running tasks in all the functional blocks are added to the system symbol address mapping table, the online updating of the basic algorithm program is completed, and executable instruction data corresponding to the running tasks in the functional blocks can be called and executed online.
The invention discloses a control logic program online updating method of an industrial controller, wherein the control logic program comprises self basic description information, model information of a function block library corresponding to a basic algorithm program, instantiation information of the function blocks and input and output connection information between the instantiated function blocks;
the self basic description information comprises a sequence number of a control logic program, a task scheduling level and a subtask scheduling sequence number;
the model information of the function block library comprises a function block name, an input data quantity, a description of each input information, an output data quantity, a description of each output information, a parameter data quantity, a description of each parameter information, a control data quantity and a description of each control information;
the instantiation information of the functional block comprises a template name, an instance name, a functional block serial number, an execution serial number and a parameter initialization value of the functional block to be instantiated;
the input and output connection information between the instantiated functional blocks comprises: the number of the connecting lines, the output signal index and the input signal index of each connecting line;
the control logic program online updating method comprises the following steps:
step 1: analyzing and updating the issued control logic program to obtain the model information of the function block library, the number of the function blocks to be instantiated and the input-output connection information among the function blocks;
Step 2: analyzing one by taking the functional blocks as units to obtain instantiation information of the functional blocks, and distributing address spaces of input information, output information, parameter information and control information for the functional blocks;
step 3: retrieving a system symbol address mapping table, and acquiring memory call addresses of corresponding construction tasks and operation tasks according to the template names of the functional blocks;
step 4: calling a construction task of the functional block to complete other data space allocation and specific initialization processing of the functional block;
step 5: adding the running task of the functional block into a subtask scheduling sequence of the control logic program according to the execution sequence number of the functional block;
step 6: repeating the steps 2 to 5 until all the functional blocks are processed;
step 7: establishing the association between the memory address of the input channel and the memory address of the output channel of the functional block according to the input-output connection information between the functional blocks;
step 8: and updating the subtask scheduling sequence of the control logic program into a system task scheduling sequence of a corresponding scheduling level of the industrial controller, and executing the industrial controller according to the updated system task scheduling sequence when the next interrupt is processed, and calling the running tasks of the functional blocks one by one to realize the online updating and the effectiveness of the control logic program.
Further, the formats of the output signal index and the input signal index of each connecting line are as follows: sequence number of control logic program + function block sequence number + output/input channel sequence number;
the index format allows unique positioning of the specific signals of the specific functional blocks in the specific control logic program in the industrial controller.
Further, the system task scheduling sequence comprises a task scheduling level, the number of subtask scheduling sequences and information of each subtask scheduling sequence;
the subtask scheduling sequence information includes: the execution sequence number of the subtask scheduling sequence, the task number of the functional blocks and the memory call address of each functional block operation task;
the execution of the system task scheduling sequences sequentially schedules each sub task scheduling sequence according to the execution sequence number of the sub task scheduling sequence; execution of each sub-task scheduling sequence sequentially schedules running tasks of each functional block according to the execution sequence number of each functional block.
The invention discloses an on-line update system of a control logic program of an industrial controller, which comprises:
the loading module is used for loading the updated control logic program;
the analysis module is used for analyzing the updated control logic program to obtain model information of the function block library, the number of the function blocks to be instantiated and input and output connection information among the function blocks, and analyzing the function blocks one by one to obtain instantiation information of the function blocks;
The instantiation module is used for distributing address spaces of input information, output information, parameter information and control information for the functional blocks, retrieving a system symbol address mapping table, acquiring memory calling addresses of corresponding construction tasks and operation tasks according to template names of the functional blocks, calling the construction tasks of the functional blocks, and completing other data space distribution and specific initialization processing of the functional blocks; adding the running task of the functional block into a subtask scheduling sequence of the control logic program according to the execution sequence number of the functional block; after the instantiation of all the functional blocks is completed, establishing the association of the memory address of the input channel and the memory address of the output channel of the functional blocks according to the input and output connection information among the functional blocks;
and the updating module is used for updating the subtask scheduling sequence of the control logic program into the system task scheduling sequence of the corresponding scheduling level of the industrial controller, and when the next interrupt is processed, the industrial controller executes according to the updated system task scheduling sequence, and calls the running tasks of the functional blocks one by one to realize the online updating and the effective of the control logic program.
The invention discloses equipment, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of a basic algorithm program online updating method of an industrial controller or realizes the steps of a control logic program online updating method of the industrial controller when executing the computer program.
The invention discloses a storage medium which stores a program online updating program, wherein the program online updating program realizes the steps of a basic algorithm program online updating method of an industrial controller or realizes the steps of a control logic program online updating method of the industrial controller when being executed by at least one processor.
The beneficial effects are that: compared with the prior art, the invention has the following advantages:
(1) The updating of the functional block program of the controller is independent of a dynamic library loading mechanism provided by an operating system, and a basic algorithm program and a control logic program directly run on a bare core system, so that the running task of the functional block program can be scheduled and executed in real time, and the requirement of millisecond-level strong real-time control response of the industrial controller is met;
(2) The basic algorithm program and the control logic program are issued to the controller through the equipment debugging port, the system program of the controller directly updates the executable instruction data of the functional blocks, the combination logic relation among the functional blocks and the system task scheduling queue, and is switched to the updated task scheduling queue for execution in 1 interrupt period, the controller does not need to be restarted after power failure or to exit the double-host standby operation, the dynamic update and online effectiveness of the functional block program are realized, the normal execution of other functional block programs which are irrelevant to the update in the controller is not influenced, and the reliability of the running system of the controller is improved;
(3) The method not only supports the control logic program update of the controller, but also supports the basic algorithm program update, and solves the problem that the basic algorithm program corresponding to the functional block needs to be maintained and updated due to operation defects, or the application scene of the basic algorithm program in the controller needs to be correspondingly updated in the transformation and the expansion of the industrial production object.
Drawings
FIG. 1 is a schematic diagram of a functional block abstraction model;
FIG. 2 is a schematic diagram of a basic algorithm program format;
FIG. 3 is a schematic diagram of a control logic program format;
FIG. 4 is a functional block operation task scheduling diagram;
FIG. 5 is a diagram of the controller software system;
FIG. 6 is a flowchart of an online update of a basic algorithm program;
FIG. 7 is a flow chart of an online update of a control logic program.
Detailed Description
The technical scheme of the invention is further described with reference to the accompanying drawings and the embodiments.
The programs of the industrial controller are divided into functional block programs and system programs according to whether online updating is required. The function block program is basic algorithm code for realizing specific arithmetic, logic and control logic code for describing how to build specific control logic through basic algorithm combination relation. The function block program is closely related to industrial control objects and application scenes, and online updating is required to be realized. The system program is responsible for the power-on initialization of the industrial controller, the scheduling execution of the loading functional block program, the monitoring and auxiliary debugging of the equipment operation, is generally called as an equipment platform program which is irrelevant to the specific control logic of the industrial controller, does not need to be updated on line, generally adopts maintenance to exit operation, and is put into operation after the completion of debugging and verification.
The function block programs are divided into basic algorithm programs and control logic programs. The basic algorithm program realizes specific arithmetic, logic and control operation, is the minimum unit of the industrial controller algorithm program, and corresponds to the function block library provided by the equipment one by one.
Example 1:
as shown in fig. 1, the present embodiment provides an abstract model of a functional block corresponding to a basic algorithm program, including a functional block template name, external data of the functional block, and a processing function of the data, where the external data includes: input information, output information, parameter information and control information, and the processing function for data includes: construction functions and task functions.
Wherein, the input information includes: channel number, channel name, data type; the output information includes: channel number, channel name, data type; the parameter information includes: channel number, parameter name, data type; the control information includes: channel number, control name, data type; the construction function is used for the instantiation of the functional block and mainly comprises memory allocation of the functional block data and initialization processing of the internal data of the corresponding algorithm. The task function is used for executing specific algorithm logic of the functional block and mainly comprises the steps of reading input information, calculating according to parameter information, synchronizing a result to output information, and receiving control information and responding to a control command supported by the algorithm.
The embodiment also provides a programming framework of the functional block, wherein the programming framework constrains programming specifications of the functional block, and the programming framework comprises the steps that the functional block only declares a constructor and a task function as global symbols and provides system program call; other algorithmic intermediate functions are declared as local symbols, and do not support external calls.
The programming framework provided in this embodiment further includes a memory allocation manner of the functional block data, which is classified into 3 types according to the data usage: the first type is temporary data used for single calculation, which is declared as a local variable, and space is dynamically allocated on a stack; the second type is that the data which are used by calculation and are not required to be displayed externally are declared as the internal variables of the functional blocks and are distributed on the heap dynamically during the operation of the functional blocks; the third class is data which is used by the functional blocks and needs to be calculated and used during the operation of the functional blocks and needs to refer to other functional blocks or used by other functional blocks, and is declared to be external data of the functional blocks and is dynamically distributed on the heap.
The programming framework proposed in this embodiment specifies that the function blocks cannot be directly called by each other, and the variables of the other side cannot be directly referenced by each other, and only the mutual reference of external data can be realized through the input-output connection relationship between the function blocks.
As shown in fig. 2, the present embodiment provides a file format of a basic algorithm program, where the basic algorithm program is constructed by compiling codes conforming to an abstract model and a programming specification of a functional block in an upper computer, generating a controller target binary executable file, and according to the basic algorithm program file format.
The basic algorithm program mainly comprises the number of functional blocks in a functional block library, description information of each functional block and executable instruction data, and does not contain global variable data. The description information of the functional block comprises a functional block template name, the length of an executable instruction data area of the functional block, a relative offset address of a construction task in the executable instruction data area, a relative offset address of an operation task in the executable instruction data area and a file starting offset. The executable instruction data includes binary executable code corresponding to all functions implementing the complete function of the functional block, such as functional block construction tasks, execution tasks, and other intermediate functions. The jump instructions corresponding to the inter-calling of other intermediate functions are in a relative addressing mode, namely calling address correction is not needed after the jump instructions are loaded into the memory. The function block construction task and the running task are called by the system program, and call address correction is needed after the function block construction task and the running task are loaded into the memory.
The target program file compiled and generated by the function block library code corresponding to the basic algorithm program only contains executable instruction data and global variable data without static allocation; each basic algorithm program uniquely corresponds to one function block library program, and the function block library programs have no function call and no direct reference variable relation; the basic algorithm program can be updated by a single functional block alone, or can be updated by packing a plurality of functional blocks at a time.
For online updating of the basic algorithm program, as shown in fig. 7, the main steps include:
step 1: the controller receives the updated and issued basic algorithm program, analyzes the issued basic algorithm program and obtains the number of function block libraries corresponding to the basic algorithm program;
step 2: loading the executable instruction data area into a specified memory space by taking the function block as a unit according to the length of the executable instruction data area of each function block and the relative offset address of the file, and obtaining loading offset head addresses of the construction task and the running task in the executable instruction data area;
step 3: according to the relative offset addresses of the construction task and the operation task connected in the executable instruction data area, the memory call addresses of the construction task and the operation task of the function block library are corrected by combining the loading offset head address;
Step 4: obtaining symbol names of construction tasks and operation tasks of the function block library according to the template name of each function block, and adding the symbol names and memory calling addresses of the two task functions to a symbol address mapping table of the system function block library;
step 5: repeating the steps 2 to 4 until all the function block libraries are processed;
and after the updating of the basic algorithm program is finished, the executable instruction data corresponding to the running task for updating the function block library can be called and executed on line. The basic algorithm program is updated by matching with the corresponding control logic program, and the online updating of the function block program is finally completed according to the step of updating the control logic program.
Example 2:
the control logic program is modeling description of a function block library corresponding to the basic algorithm program and configuration description of a combination relation among the function block libraries, and the specific information comprises control logic program description information, function block library model description information, instantiation information of the function block library, input-output connection relation information among the instantiated function blocks and task scheduling information of the instantiated function blocks. The control logic program description information comprises a self sequence number, a task scheduling level and a subtask scheduling sequence number. The function block library model description information comprises a function block template name, input information, output information, parameter information and control information of a function block. The instantiation information of the function block library comprises a template name, an instance name, a serial number, an input default value, a parameter default value and the like of the function block. Instantiating the input-output connection relationship between the functional blocks includes: and outputting the control logic program serial number, the instance name and the channel serial number of the functional block, and inputting the control logic program serial number, the instance name and the channel serial number of the functional block. The task scheduling information of the instantiated function block includes a task execution sequence number of the function block.
As shown in fig. 3, the present embodiment provides a file format of a control logic program, where the control logic program specifically includes model description information of a function block library corresponding to a basic algorithm program, instantiation information of the function block library, an input-output connection relationship between the instantiated function blocks, and task scheduling information of the instantiated function blocks. The control logic program and the basic algorithm program together construct the calculation and control logic of the actual running program in the controller.
The file format of the control logic program comprises a common data area, a function block instance area, a data connection area and a function block model description area. The common data area configures basic description information of the control logic program, including self sequence number of the control logic program, task scheduling level, and scheduling execution sequence number in the system. The function block instance area configures each function block instance data, including a function block serial number, an execution serial number of the function block in the control logic program, and a parameter initialization value. The data connection area is configured with an input-output connection relation between the instantiation function blocks, wherein the input-output connection relation comprises the number of connection lines, and an output signal index and an input signal index of each connection line. The output and input signal index format is: the sequence number of the control logic program, the sequence number of the functional block and the sequence number of the output/input channel can uniquely position the designated signal of the designated functional block in the control logic program through an index format. The model description area configures model information of each function block library, and comprises a function block name, an input data quantity and description of each input information; outputting the number of data and the description of each piece of output information; the number of parameter data, the description of each parameter information; the amount of control data, a description of each control information.
As shown in fig. 4, the present embodiment provides a function block task scheduling manner that maximally supports function block task scheduling of 10-level interrupt periods by priority.
The functional block tasks of the 10-level interrupt period are in one-to-one correspondence with 10 groups of system task scheduling sequences, and each group of task scheduling sequences comprises task scheduling levels, the number of scheduling subtask sequences and each scheduling subtask sequence information. The scheduling subtask sequence information comprises a sequence execution sequence number, the number of functional block tasks and a memory call address of each functional block running task. And the execution of each stage of system task scheduling sequence sequentially schedules each scheduling sub-task sequence according to the execution sequence number of the sub-task scheduling sequence. Scheduling execution of each scheduling sub-task sequence sequentially schedules running tasks of each functional block according to the execution sequence number of each functional block.
The controller system program is responsible for updating a system task scheduling sequence and actually scheduling and executing tasks, and is divided into two parts of main circulation processing and interrupt processing. The main circulation processing part generates a new control logic program corresponding scheduling sub-task sequence according to the control logic program and the basic algorithm program which are issued to the controller. The interrupt processing part respectively runs at the tail part of the task scheduling sequence corresponding to each level of interrupt, after the current system task scheduling sequence finishes execution, if the scheduling sub task sequence needing to be updated exists at the current level, the newly generated scheduling sub task sequence is used for replacing the corresponding old sequence in the system task scheduling queue, and the updated new system task scheduling sequence is directly used for execution during the next interrupt processing.
For online updating of the control logic program, as shown in fig. 6, the main steps include:
step 1: the controller receives the updated and issued control logic program, analyzes the control logic program, and analyzes the description information of the functional block model and the number of the functional blocks to be instantiated;
step 2: analyzing instantiation information and task scheduling information of the functional blocks one by taking the functional blocks as units, applying for a memory, and distributing address spaces of input, output, parameters and control information for the functional blocks;
step 3: retrieving a symbol address mapping table of the functional block library, and acquiring call address information of a corresponding construction task and operation task according to the symbol name of the functional block library;
step 4: calling a construction task of a function block library to finish other data space allocation and specific initialization processing of the function block;
step 5: adding the running task of the functional block into a subtask scheduling sequence of the current control logic program according to the task scheduling information of the functional block;
step 6: repeating the steps 2 to 5 until all the functional blocks are processed;
step 7: analyzing to obtain input and output connection information between the functional blocks, and establishing the association between the memory address of the input channel and the memory address of the output channel of the functional blocks;
Step 8: and updating the subtask scheduling sequence of the current control logic program into the system task scheduling sequence of the corresponding scheduling level of the industrial controller, wherein the next interrupt period is executed by the controller according to the updated system task scheduling sequence, and the running tasks of the functional blocks are called one by one to realize the online updating and the effectiveness of the control logic program.
The updated and issued basic algorithm program and the control logic program are solidified and stored in a nonvolatile storage medium of the controller, and after the controller is powered off and restarted, the controller can still calculate, process and operate according to the updated function block program through the method and the description.
Example 3:
as shown in fig. 5, the present embodiment provides an example of an online update system for a control logic program and a basic algorithm program of an industrial controller, including: the system comprises a basic algorithm program dynamic loading module, a control logic program analyzing module, a function block algorithm instantiation module and a function block algorithm task scheduling module.
The basic algorithm program dynamic loading module is used for analyzing the executable instruction data of the corresponding function block library by the basic algorithm program and dynamically loading the executable instruction data into the memory, calculating the symbol address information of the construction task and the operation task of the function block library, and providing support for the instantiation and the scheduling operation of the function block; the specific operation comprises the following steps: as shown in fig. 1, the basic algorithm program dynamic loading module analyzes the updated basic algorithm program, and extracts executable instruction data of each function block library and relative offset addresses of a construction task interface and an operation task interface thereof in units of function blocks according to the method shown in fig. 2.
Loading executable instruction data of the function block libraries into the appointed and allocated memory space by taking the function blocks as units to obtain the memory head address of the executable instruction data of each function block library;
and correcting the memory head address and the relative offset address, and adding the memory call addresses of the construction task and the operation task to the symbol address mapping table of the functional block.
As shown in fig. 1, the control logic program analysis module analyzes the updated control logic program, and extracts the description information of the function block library model, the information of the instantiation function blocks, the input and output connection information between the instantiation function blocks and the task scheduling information of the instantiation function blocks according to the function blocks as shown in fig. 3.
The function block algorithm instantiation module is used for distributing the use memory of input, output, parameters and control data for the instantiated function blocks, managing the input and output connection information among the function blocks, and instantiating the function block algorithm through a construction task interface provided by the function block library. The specific operation is as follows:
the function block algorithm instantiation module obtains the number and names of the function blocks to be instantiated according to the instantiated function block information obtained through analysis;
the function block algorithm instantiation module retrieves the description information of the function block library model one by one according to the names of the function blocks to be instantiated, acquires the specific quantity and data types of the input information, the output information, the parameter information and the control information of the function block model, and dynamically allocates the data memory space of the input information, the output information, the parameter and the control information;
The function block algorithm instantiation module retrieves a symbol address mapping table of the function block library according to the name of the function block to be instantiated to obtain a memory call address of a construction task in executable instruction data corresponding to the function block library;
the function block algorithm instantiation module calls the construction task one by one, the function block algorithm codes acquire the memory space of the input, output, parameters and control channels through function input parameters, dynamically allocate other data memory space required by the function block, initialize the data, complete the instantiation of the function block library, and form an instantiation function block and use data;
the function block algorithm instantiation module can respectively retrieve the memory address of the channel data corresponding to the output function block and the memory address of the channel data corresponding to the input function block according to the input-output connection information between the instantiation function blocks and the input signal index according to the illustration of fig. 3, and correlate the input memory address and the output memory address to realize the function block operation stage, and transmit the value of the output signal to the memory address pointed by the input signal;
the function block algorithm instantiation module retrieves a symbol address mapping table of the function block library according to the name of the function block to be instantiated to obtain a memory call address of an operation task in executable instruction data corresponding to the function block library;
And the function block algorithm instantiation module adds the memory call addresses of the function blocks into the subtask scheduling sequence one by one according to the task scheduling grade in the task scheduling information of the instantiated function block and the execution sequence number sequence of the instantiated function. The function block algorithm task scheduling module is used for generating a subtask scheduling sequence of the control logic program according to the task execution sequence of the instantiation function block, updating the corresponding system task scheduling sequence, and executing the system task scheduling sequence in interrupt processing. The specific operation comprises the following steps: as shown in fig. 1, the task scheduling module of the function block algorithm parses the subtask scheduling sequence, and updates the system task scheduling queue corresponding to the task level according to the task scheduling level and the sequence execution sequence number of the subtask scheduling sequence as shown in fig. 4, so as to obtain a new system task scheduling queue.
And the function block algorithm task scheduling module schedules a system task scheduling sequence of a corresponding grade in interrupt processing of the corresponding grade. According to the memory call address of the operation task of each instantiation function block in the sequence, directly jumping to the binary code position of the operation task function in the executable instruction data to execute, and simultaneously obtaining the instantiation function block and the use data by the operation task function through function entry to complete the operation processing of the function block.
Example 4:
the embodiment discloses a computer device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the steps disclosed in any one of the embodiments.
Example 5:
the present embodiment discloses a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps disclosed in any of the embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. An online updating method of basic algorithm program of industrial controller is characterized in that:
each basic algorithm program uniquely corresponds to one functional block library;
the function block library comprises a plurality of function blocks, each function block comprises a function block template name, function block external data and a processing function for data, and the external data comprises: input information, output information, parameter information and control information, wherein the processing function of the data comprises: constructing functions and task functions, wherein the constructing functions are used for memory allocation of function block data and initialization processing of internal data of corresponding algorithms, so as to realize instantiation of the function block; the task function is used for executing specific algorithm logic of the functional block;
The basic algorithm program comprises the number of functional blocks, descriptive information of each functional block and executable instruction data; the description information of each functional block comprises a functional block template name, the length of an executable instruction data area, the relative offset address of a construction task in the executable instruction data area and the relative offset address of an operation task in the executable instruction data area; the executable instruction data is binary executable code at least comprising a construction task and an operation task corresponding function;
the online updating method of the basic algorithm program comprises the following steps:
step 1: analyzing and updating the issued basic algorithm program to obtain a function block of a function block library corresponding to the basic algorithm program;
step 2: loading the executable instruction data area into a specified memory space by taking the function block as a unit according to the length of the executable instruction data area of each function block and the relative offset address in the basic algorithm program, so as to obtain the loading offset head address of the construction task and the running task in the executable instruction data area;
step 3: according to the relative offset addresses of the construction task and the operation task in the executable instruction data area, the memory call addresses of the construction task and the operation task of the functional block are corrected by combining the loading offset head address;
Step 4: according to the template name of the functional block, obtaining the symbol names of the construction task and the operation task of the functional block, and adding the symbol names and the memory call addresses of the construction task and the operation task into a system symbol address mapping table;
step 5: and (3) repeating the steps (2) to (4) until the symbol names and the memory call addresses of the construction tasks and the running tasks in all the functional blocks are added to the system symbol address mapping table, so as to complete online updating of the basic algorithm program, and executable instruction data corresponding to the running tasks in the functional blocks can be called and executed online.
2. The method for online updating of basic algorithm programs of an industrial controller according to claim 1, wherein: the input information includes: channel number, channel name, data type;
the output information includes: channel number, channel name, data type;
the parameter information includes: channel number, parameter name, data type;
the control information includes: channel number, control name, data type.
3. The method for online updating of basic algorithm programs of an industrial controller according to claim 1, wherein: the functional blocks are compiled according to the following programming specifications:
The function cannot be directly called between the function blocks according to the first programming specification;
the second programming specification and the functional blocks cannot directly refer to the variables of the other side;
and the second programming specification can only realize the mutual reference of external data through the input-output connection relation between the functional blocks.
4. An on-line updating system of basic algorithm program of industrial controller is characterized in that: comprising the following steps:
the loading module is used for loading the updated basic algorithm program;
the analysis module is used for analyzing the updated basic algorithm program to obtain a function block of a function block library corresponding to the basic algorithm program; loading the executable instruction data area into a specified memory space by taking the function block as a unit according to the length of the executable instruction data area of each function block and the relative offset address in the basic algorithm program, and obtaining the loading offset head address of the construction task and the running task in the executable instruction data area;
the instantiation module is used for correcting the memory call addresses of the construction task and the operation task of the functional block according to the relative offset addresses of the construction task and the operation task in the executable instruction data area and the loading offset head address, obtaining the symbol names of the construction task and the operation task of the functional block according to the template name of the functional block, and adding the symbol names and the memory call addresses of the construction task and the operation task to the system symbol address mapping table; when the symbol names and the memory calling addresses of the construction tasks and the running tasks in all the functional blocks are added to the system symbol address mapping table, the online updating of the basic algorithm program is completed, and executable instruction data corresponding to the running tasks in the functional blocks can be called and executed online.
5. An online updating method of a control logic program of an industrial controller is characterized in that:
the control logic program comprises self basic description information, model information of a function block library corresponding to the basic algorithm program, instantiation information of the function blocks and input and output connection information between the instantiated function blocks;
the self basic description information comprises a sequence number of a control logic program, a task scheduling level and a subtask scheduling sequence number;
the model information of the function block library comprises a function block name, an input data quantity, a description of each input information, an output data quantity, a description of each output information, a parameter data quantity, a description of each parameter information, a control data quantity and a description of each control information;
the instantiation information of the functional block comprises a template name, an instance name, a functional block serial number, an execution serial number and a parameter initialization value of the functional block to be instantiated;
the input and output connection information between the instantiated functional blocks comprises: the number of the connecting lines, the output signal index and the input signal index of each connecting line;
the control logic program online updating method comprises the following steps:
Step 1: analyzing and updating the issued control logic program to obtain the model information of the function block library, the number of the function blocks to be instantiated and the input-output connection information among the function blocks;
step 2: analyzing one by taking the functional blocks as units to obtain instantiation information of the functional blocks, and distributing address spaces of input information, output information, parameter information and control information for the functional blocks;
step 3: retrieving a system symbol address mapping table, and acquiring memory call addresses of corresponding construction tasks and operation tasks according to the template names of the functional blocks;
step 4: calling a construction task of the functional block to complete other data space allocation and specific initialization processing of the functional block;
step 5: adding the running task of the functional block into a subtask scheduling sequence of the control logic program according to the execution sequence number of the functional block;
step 6: repeating the steps 2 to 5 until all the functional blocks are processed;
step 7: establishing the association between the memory address of the input channel and the memory address of the output channel of the functional block according to the input-output connection information between the functional blocks;
step 8: and updating the subtask scheduling sequence of the control logic program into a system task scheduling sequence of a corresponding scheduling level of the industrial controller, and executing the industrial controller according to the updated system task scheduling sequence when the next interrupt is processed, and calling the running tasks of the functional blocks one by one to realize the online updating and the effectiveness of the control logic program.
6. The method for online updating of control logic of an industrial controller according to claim 5, wherein: the formats of the output signal index and the input signal index of each connecting line are as follows: sequence number of control logic program + function block sequence number + output/input channel sequence number;
the index format allows unique positioning of the specific signals of the specific functional blocks in the specific control logic program in the industrial controller.
7. The method for online updating of control logic of an industrial controller according to claim 5, wherein: the system task scheduling sequence comprises a task scheduling level, the number of subtask scheduling sequences and the information of each subtask scheduling sequence;
the subtask scheduling sequence information includes: the execution sequence number of the subtask scheduling sequence, the task number of the functional blocks and the memory call address of each functional block operation task;
the execution of the system task scheduling sequences sequentially schedules each sub task scheduling sequence according to the execution sequence number of the sub task scheduling sequence; execution of each sub-task scheduling sequence sequentially schedules running tasks of each functional block according to the execution sequence number of each functional block.
8. An on-line update system for a control logic program of an industrial controller is characterized in that: comprising the following steps:
The loading module is used for loading the updated control logic program;
the analysis module is used for analyzing the updated control logic program to obtain model information of the function block library, the number of the function blocks to be instantiated and input and output connection information among the function blocks, and analyzing the function blocks one by one to obtain instantiation information of the function blocks;
the instantiation module is used for distributing address spaces of input information, output information, parameter information and control information for the functional blocks, retrieving a system symbol address mapping table, acquiring memory calling addresses of corresponding construction tasks and operation tasks according to template names of the functional blocks, calling the construction tasks of the functional blocks, and completing other data space distribution and specific initialization processing of the functional blocks; adding the running task of the functional block into a subtask scheduling sequence of the control logic program according to the execution sequence number of the functional block; after the instantiation of all the functional blocks is completed, establishing the association of the memory address of the input channel and the memory address of the output channel of the functional blocks according to the input and output connection information among the functional blocks;
and the updating module is used for updating the subtask scheduling sequence of the control logic program into the system task scheduling sequence of the corresponding scheduling level of the industrial controller, and when the next interrupt is processed, the industrial controller executes according to the updated system task scheduling sequence, and calls the running tasks of the functional blocks one by one to realize the online updating and the effective of the control logic program.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for online updating a basic algorithm program of an industrial controller according to any one of claims 1 to 3 or the steps of the method for online updating a control logic program of an industrial controller according to any one of claims 5 to 7 when the computer program is executed by the processor.
10. A storage medium storing a program on-line update program which, when executed by at least one processor, implements the steps of a basic algorithm program on-line update method of an industrial controller according to any one of claims 1 to 3 or implements the steps of a control logic program on-line update method of an industrial controller according to any one of claims 5 to 7.
CN202311634974.0A 2023-11-30 2023-11-30 Basic algorithm and control logic program online updating method and system of industrial controller Pending CN117632206A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311634974.0A CN117632206A (en) 2023-11-30 2023-11-30 Basic algorithm and control logic program online updating method and system of industrial controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311634974.0A CN117632206A (en) 2023-11-30 2023-11-30 Basic algorithm and control logic program online updating method and system of industrial controller

Publications (1)

Publication Number Publication Date
CN117632206A true CN117632206A (en) 2024-03-01

Family

ID=90017822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311634974.0A Pending CN117632206A (en) 2023-11-30 2023-11-30 Basic algorithm and control logic program online updating method and system of industrial controller

Country Status (1)

Country Link
CN (1) CN117632206A (en)

Similar Documents

Publication Publication Date Title
US5303170A (en) System and method for process modelling and project planning
US6779176B1 (en) Methods and apparatus for updating electronic system programs and program blocks during substantially continued system execution
KR960014191B1 (en) Programable controller which allows control information to be updated during execution
US6487455B1 (en) Distributed real time operating system
JP4836419B2 (en) Online modification of CIL code program for industrial automation
US7797680B2 (en) Method and framework for test case management
US9678867B2 (en) Method for changing the software in the memory of an electronic control unit
CN103384858B (en) Process planning apparatus
CN111861412B (en) Completion time optimization-oriented scientific workflow scheduling method and system
WO2018123456A1 (en) Programmable controller, management device, and control system
JP7266590B2 (en) A method for executing an ordering plan that guarantees low-latency communication between real-time tasks
CN108459569B (en) Method for operating an engineering system of an industrial process automation system and control program
JP6874706B2 (en) How to generate application programs, devices, programs
US10126726B2 (en) Apparatus and method for generating program
KR20230081501A (en) Apparatus and method for estabilishing production plan
US20150169375A1 (en) Method for the management of task execution in a computer system
CN117632206A (en) Basic algorithm and control logic program online updating method and system of industrial controller
US8676354B2 (en) Automation system having framework based controller
JP4366575B2 (en) tool
CN114041121A (en) Runtime server for simultaneously executing multiple runtime systems of an automation device
JP2005301520A (en) Programming system
CN112823337A (en) Method and programmable control device for data processing
US7296270B2 (en) Method and control unit for controlling technical procedures in a motor vehicle
US20080077925A1 (en) Fault Tolerant System for Execution of Parallel Jobs
US8666521B2 (en) Method for operating an automation system

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