Method for generating a control program that can be executed on a control system

09928803 ยท 2018-03-27

Assignee

Inventors

Cpc classification

International classification

Abstract

A computer-implemented method for generating a control program that is executable on a control system from a graphical control model. A better utilization of the control system is achieved in that the graphical control model is translated into program code such that the generated program code has at least one FXP operation and at least one FLP operation, and in that the generated program code is translated into the executable control program such that when the control program is executed on the control system a portion of the control program is executed on the FXP unit and another portion of the control program is executed on the FLP unit.

Claims

1. A computer-implemented method for generating an executable control program that is executable on a control system from a graphical control model, the control system having a process interface and configured, through the process interface, for at least one process quantity of a physical process to be sensed by the control system and/or for an output quantity for influencing the physical process to be output by the control system, the control system having at least one electronic computing unit with at least one fixed-point (FXP) execution unit and with at least one floating-point (FLP) execution unit, and the graphical control model having a plurality of operations and a plurality of multiple parallel processing threads, the method comprising: translating the graphical control model into program code such that the generated program code has at least one FXP operation and at least one FLP operation; and translating the generated program code into the executable control program such that when the executable control program is executed on the control system a first portion of the executable control program is executed on the FXP unit and a second portion of the executable control program is executed on the FLP unit, wherein at least a first thread of the multiple parallel process threads is translated into the at least one FXP operation of the program code, wherein at least a second thread of the multiple parallel process threads is translated into the at least one FLP operation of the program code, and wherein translation of the program code to the at least one FXP operation or the at least one FLP operation is selected to balance processing load between the at least one fixed-point (FXP) execution unit and the at least one floating-point (FLP) execution unit of the computing unit.

2. The computer-implemented method according to claim 1, wherein some of the operations of the control model are converted into FXP operations and FLP operations of the program code such that, averaged over time, the FXP units and the FLP units of the computing unit of the control system are utilized equally.

3. The computer-implemented method according to claim 1, wherein a mixing of FXP operations of the program code with FLP operations of the program code is such that when the executable control program is executed on the control unit of the control system, the program code is executed substantially simultaneously on the FXP units and the FLP units of the computing unit.

4. The computer-implemented method according to claim 1, wherein a first ratio of FXP operations to FLP operations of the program code substantially equals a second ratio of FXP operations that are executable on the FXP units per unit time to FLP operations that are executable on the FLP units per unit time.

5. The computer-implemented method according to claim 1, wherein integer operations of the control model are converted into FXP operations of the program code for processing on the FXP unit for incrementing or decrementing counters for loops, switch case operations, or bit operations.

6. A computer-implemented method for generating an executable control program that is executable on a control system from a graphical control model, the control system having a process interface and configured such that it is possible, through the process interface, for at least one process quantity of a physical process to be sensed by the control system and/or for an output quantity for influencing the physical process to be output by the control system, the control system having at least one electronic computing unit with at least one fixed-point execution unit and with at least one floating-point execution unit, and the graphical control model having a number of model operations, the method comprising: translating the graphical control model into program code such that the generated program code has at least one FXP operation and at least one FLP operation; and translating the generated program code into the executable control program such that when the executable control program is executed on the control system a portion of the executable control program is executed on the FXP unit and another portion of the executable control program is executed on the FLP unit, wherein a model operation of the control model that would undergo a fixed-point rescaling when implemented as an FXP operation in the program code is converted into an FLP operation of the program code.

7. The computer-implemented method according to claim 1, wherein, if the computing unit has an m-bit FLP unit but does not have an m-bit FXP unit, a model operation in the control model that would result in one or more m-bit FXP operations in the program code when converted into FXP operations in the program code is instead converted into one or more m-bit FLP operations in the program code.

8. A computer-implemented method for generating an executable control program that is executable on a control system from a graphical control model, the control system having a process interface and configured such that it is possible, through the process interface, for at least one process quantity of a physical process to be sensed by the control system and/or for an output quantity for influencing the physical process to be output by the control system, the control system having at least one electronic computing unit with at least one fixed-point execution unit and with at least one floating-point execution unit, and the graphical control model having a number of model operations, the method comprising: translating the graphical control model into program code such that the generated program code has at least one FXP operation and at least one FLP operation; and translating the generated program code into the executable control program such that when the executable control program is executed on the control system a portion of the executable control program is executed on the FXP unit and another portion of the executable control program is executed on the FLP unit, wherein for multiple parallel processing threads of the control model, threads of model operations of the control model that would have the most FXP rescalings in the program code when converted into FXP operations are converted into FLP operations of the program code.

9. The computer-implemented method according to claim 1, wherein at least one of the operations in the control model intended as an FLP operation is converted into one of the at least one FXP operation of the program code, or wherein at least one of the operations in the control model intended as an FXP operation is converted into one of the at least one FLP operation of the program code.

10. The computer-implemented method according to claim 9, wherein a selection of the operations intended as FLP operations of the control model are converted into FXP operations of the program code, or wherein a selection of the operations intended as FXP operations of the control model are converted into FLP operations of the program code such that a number of translations caused by the conversion from a fixed-point data type to a floating-point data type in the program code or from the floating-point data type to the fixed-point data type in the program code is at least locally minimal.

11. The computer-implemented method according to claim 1, wherein the program code generated from the graphical control model is present in a hardware description language, wherein the program code describes the computing unit of the control system with the at least one FXP unit and with the at least one FLP unit, wherein the computing unit implements the functionality of the control model.

12. The computer-implemented method according to claim 11, wherein the hardware description language describes and programs a field programmable gate array.

13. A computer program product with a computer program that has software for performing the method according to claim 8, the computer program being executed with a computer.

14. The product according to claim 13, wherein the computer has a memory, a processor, and a display device.

15. The computer-implemented method according to claim 1, and wherein the parallel processing threads that require FXP rescalings, if implemented as the at least one FXP operation in the program code, are converted into the at least one FLP operation of the program code.

Description

BRIEF DESCRIPTION OF THE DRAWINGS

(1) The present invention will become more fully understood from the detailed description given hereinbelow and the accompanying drawings which are given by way of illustration only, and thus, are not limitive of the present invention, and wherein:

(2) FIG. 1 shows a method for generating an executable control program on a control system;

(3) FIG. 2 schematically shows a method according to an embodiment of the invention for generating a control program for a control system;

(4) FIG. 3 schematically shows an embodiment of the method according to the invention for generating a control program;

(5) FIG. 4 schematically shows an embodiment, based on FIG. 3, of the method according to the invention for generating a control program;

(6) FIG. 5 shows a graphical control model that is to be translated into a control program;

(7) FIG. 6 shows the graphical control model from FIG. 5 with a marked model portion that is implemented with FLP operations; and

(8) FIG. 7 shows the control model from FIG. 5 with another marked model portion that is translated into FLP operations.

DETAILED DESCRIPTION

(9) FIG. 1 shows a computer-implemented method 1 for generating a control program 3 that can be executed on a control system 2 from a graphical control model 4, wherein the control system 2 has a process interface 5. The control system 2 is configured such that at least one process quantity x of a physical process 6 can be sensed by the control system 2 through the process interface 5 and/or an output quantity y for influencing the physical process 6 can be output by the control system 2 through the process interface. The control system 2 has an electronic computing unit 7 with a fixed-point execution unit (FXP unit) 8 and with a floating-point execution unit (FLP unit) 9.

(10) The graphical control model 4 in the example shown comprises a number of model operations 10, 11. The model operations 10, 11 of the control model 4 are nonspecific with regard to data type in the present case. If a simulation is to be carried out directly with the control model 4 (offline simulation), the calculations are as a general rule carried out completely as FLP operations; however, this has nothing directly to do with the code generation process from the control model 4 that is of interest here and is the subject of the rest of the description.

(11) Pursuant to FIG. 1, it is known from the prior art to translate all model operations 10, 11 of the graphical control model 4 into FXP operations 12 of the program code 13, so that the generated program code 13 is in a sense universally usable, since customary control systems 2 have at least one FXP unit 8 for processing integer or fixed-point numbers, but do not necessarily have an FLP unit 9 for processing floating-point operations. This practice has the result that the control system 2 is only partially utilized, since no use is made of the FLP unit 9.

(12) In contrast, in the computer-implemented method according to the invention shown in FIG. 2, provision is made that the graphical control model 4 is translated into program code 13 such that the generated program code 13 has at least one FXP operation 12 and at least one FLP operation 14, and the generated program code 13 is translated into the executable control program 3 such that when the control program 3 is executed on the control system 2, a portion of the control program 3 is executed on the FXP unit 8 and another portion of the control program 3 is executed on the FLP unit 9. This can mean that both units 8, 9 of the computing unit 7 of the control system 2 are used.

(13) The transmission of the control program 3 to both the FXP unit 8 and the FLP unit 9 of the control system 2 is indicated in FIG. 2 by the double arrow between the control program 3 and the computing unit 7. The measure that the generated program code 13 has at least one FXP operation 12 and at least one FLP operation 14 ensures that both the FXP unit 8 and the FLP unit 9 of the computing unit 7 of the control system 2 are used, which improves the run-time behavior as compared to the exemplary embodiment shown in FIG. 1.

(14) FIG. 3 shows again in greater detail that some model operations 10, 11 of the control model 4 are translated into FXP operations 12 of the program code 13 and that some model operations 10, 11 of the control model 4 are converted into FLP operations 14 of the program code 13. The conversions take place here with the provision that a sufficient number of model operations 10, 11 of the control model 4 have been converted into FXP operations 12 of the program code 13 and a sufficient number of model operations 10, 11 of the control model 4 have been converted into FLP operations 14 of the program code 13 that averaged over time, comparable utilizations of the FXP unit 8 and the FLP unit 9 of the computing unit 7 result.

(15) In selecting the model operations 10, 11 of the control model 4 to be converted, it is also taken into account that the mixing of FXP operations 12 of the program code 13 with FLP operations 14 of the program code 13 is sufficiently high that when the control program 3 is executed on the computing unit 7 of the control system 2, the program code 13 is executed simultaneously on the FXP unit 8 and the FLP unit 9 of the computing unit 7. The simultaneous execution of the operations and the simultaneous use of the units 8, 9 of the computing unit 7 achieves the greatest effect with regard to optimized run time of the control program 3.

(16) It is further evident from FIG. 3 that as a result of the measures described above, a mixing of FLP and FXP instructions is also achieved in the instruction flowindicated between the control program 3 and the units 8, 9 of the computing unit 7so that simultaneous utilization of both processing units 8, 9 is also ensured in supplying both units 8, 9.

(17) The method flow 1 depicted in FIG. 4 is based largely on the method flow 1 depicted in FIG. 3. The primary difference is that some model operations are already designated or provided in the control model 4 as FXP operations 10, and some model operations as FLP operations 11, for the code generation. According to the method, it now is not just FXP operations 10 of the control model 4 that are translated into FXP operations 12 of the program code 3, and FLP operations 11 of the control model 4 that are translated into FLP operations 14 of the program code 13. Instead, provision is made that at least one FLP operation 11 of the control model 4 is converted into an FXP operation 12 of the program code 13 and/or that at least one model operation provided as an FXP operation 10 in the control model 4 is converted into an FLP operation 14 of the program code 13. In this process, it is preferable to proceed such that a selection of model operations intended as FLP operations 11 of the control model 4 are converted into FXP operations 12 of the program code 13, and/or that a selection of model operations intended or provided as FXP operations 12 of the control model 4 are converted into FLP operations 14 of the program code 13, such that the number of translations caused by the conversion from the fixed-point data type to the floating-point data type in the program code 13 and/or from the floating-point data type to the fixed-point data type in the program code 13 is at least locally minimal.

(18) FIGS. 5, 6, and 7 each depict the same graphical control model 4 in the form of a block diagram with transmission elements. The control deviation e is first produced from the two input quantities. The control deviation e is multiplied by the factor Kp in an upper processing thread and, after a fed-back delay element (unit delay), is multiplied by the factor Ki in a lower processing thread. The results of the two processing threads are added in the subsequent summation element sU to produce the output quantity U.

(19) The result of a translation of the control model 4 into program code that contains exclusively FXP operations is shown below with reference to FIG. 4. This exampleas is also the case for the examples of program codes that followis implemented in the C programming language. Since FXP operations operate only with quantities of the integer data type, the program code contains only int variables. In order to be able to combine the differently scaled integer and fixed-point numbers with one another, appropriate shift operations (<<, >>) must be performed. The details of fixed-point arithmetic, which is known per se, are not important here; all that is important is the circumstance that the program code example shown ultimately results in a control program that can be executed solely on the FXP unit 8 from FIGS. 1 to 4, so the hardware resources are only partially utilized.

(20) TABLE-US-00001 int e /* LSB: 2{circumflex over ()}10 OFF: 0 MIN/MAX: 32 .. 31.9990234375 */; int x /* LSB: 2{circumflex over ()}6 OFF: 0 MIN/MAX: 512 .. 511.984375 */; static unsigned int Unit_Delay = 0 /* LSB: 2{circumflex over ()}6 OFF: 0 MIN/MAX: 0 .. 1023.984375 */; e = (int) ((((int) REF) ((int) Y)) >> 1); x = (int) (((unsigned int) (int) (e >> 4)) + Unit_Delay); Unit_Delay = (unsigned int) x; sU = (int) (((int) ((((int) e) * ((int) P_Kp)) >> 7)) + ((int) ((((int) x) * ((int) P_Ki)) >> 6))); U = sU;

(21) The following code example reproduces the complete conversion of the control model 4 shown in FIG. 5 into program code that is implemented exclusively with FLP operations, and consequently contains only quantities of the float data type. Since floating-point operations are involved here, continual rescaling as in the case of the FXP operations is not necessary. Such a program code translated into a control program would be executed solely on the FLP unit of the computing unit 7 of the control system 2, so the FXP unit 8 would remain unused.

(22) TABLE-US-00002 float e; float x; static float Unit_Delay = 0.F; e = REF Y; x = e + Unit_Delay; Unit_Delay = x; sU = (e * P_Kp) + (x * P_Ki); U = sU;

(23) It is assumed in each of the exemplary embodiments from FIGS. 6 and 7 that the conversion of the graphical control model 4, or of the operations depicted there, normally takes place into FXP operations in the program code. The regions marked with dashed lines each indicate the portion of the control model 4 that is to be translated into FLP operations in the program code.

(24) The program code presented below represents the conversion of the control model 4 from FIG. 6. It is immediately evident that the program code generated has both floating-point and fixed-point operations (FLP and FXP operations), with the result that the control program created therefrom is executed both on the FXP unit 8 shown in FIGS. 1 to 4 and on the FLP unit 9.

(25) TABLE-US-00003 float Ki; float x; int Kp /* LSB: 2{circumflex over ()}6 OFF: 0 MIN/MAX: 512 .. 511.984375 */; int e /* LSB: 2{circumflex over ()}10 OFF:0 MIN/MAX: 32 .. 31.9990234375*/; e = (int) ((((int) REF) ((int) Y)) >> 1); Kp = (int) ((((int) e) * ((int) P_Kp)) >> 7); x = (((float) e) * 0.0009765625F) + Unit_Delay; Ki = x * P_Ki; sU = (int) (((((float) Kp) * 0.015625F) + Ki) * 64.F); U = sU; Unit_Delay = x;

(26) The program code that follows here represents a conversion of the control model 4 depicted in FIG. 7, wherein only the multiplication of the control deviation e by the factor Kp is carried out in floating-point arithmetic. Accordingly, only the variable Kp is of the float data type; all other variables and calculations are of the int data type or are FXP operations.

(27) TABLE-US-00004 float Kp; int Ki /* LSB: 2{circumflex over ()}6 OFF: 0 MIN/MAX: 512 .. 511.984375 */; int e /* LSB: 2{circumflex over ()}10 OFF: 0 MIN/MAX: 32 .. 31.9990234375 */; int x /* LSB: 2{circumflex over ()}6 OFF: 0 MIN/MAX: 512 .. 511.984375 */; e = (int) ((((int) REF) ((int) Y)) >> 1); Kp = ((float) e) * 0.0009765625F * P_Kp; x = (int) (((unsigned int) (int) (e >> 4)) + Unit_Delay); Ki = (int) ((((int) x) * ((int) P_Ki)) >> 6); sU = (int) ((Kp + (((float) Ki) * 0.015625F)) * 64.F); U = sU; Unit_Delay = (unsigned int) x;

(28) Comparison of the above program code examples shows that the selection of the portions of a graphical control model 4 that are to be converted into FXP operations and FLP operations of the program code has an effect on the mixing of the program code with regard to the two different types of operations. Mixings of this type can be achieved in a targeted manner with the criteria explained in the general part of the description.

(29) The invention being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the invention, and all such modifications as would be obvious to one skilled in the art are to be included within the scope of the following claims.