Translation program, translation device and translation process
The translation program addresses platform dependency issues in PLCs by converting source code to store monitoring target variables in shared or non-shared memory, facilitating easy observation and speed adjustment, thus reducing workload and complexity.
Patent Information
- Authority / Receiving Office
- DE · DE
- Patent Type
- Applications
- Current Assignee / Owner
- MITSUBISHI ELECTRIC CORP
- Filing Date
- 2023-07-20
- Publication Date
- 2026-05-28
AI Technical Summary
Existing programs for programmable logic controllers (PLCs) require complex rewriting and translation to observe behavior, leading to increased workload due to platform dependency and lack of observability in different environments.
A translation program that converts first source code into a second source code, selectively storing monitoring target variables in shared memory for observability and non-shared memory for execution speed, using a PLC programming environment to adjust observability and execution speed by specifying monitoring target variables.
Reduces workload by allowing easy observation of program behavior while maintaining execution speed through flexible specification of monitoring target variables, balancing observability and execution speed.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical field
[0001] The present disclosure relates to a translation program, a translation device and a translation process. State of the art
[0002] At factory automation (FA) sites, sequence control is implemented for various devices. Since the introduction of programmable logic controllers (PLCs), programming languages for defining the content of such sequence control have been developed by PLC vendors, resulting in a number of independent programming languages. In response to this situation, the International Electrotechnical Commission (IEC) published IEC 61131-3, which defines five programming languages for sequence control.
[0003] Programs written in sequential control programming languages still have platform-dependent aspects. In particular, in many cases a program that can run on one vendor's programmable logic controller (PLC) cannot run on another vendor's controller, and such cases require reimplementation of the program.
[0004] Therefore, a technique was proposed to obtain a program with low platform dependency (see, for example, patent reference 1). Patent reference 1 discloses a program generation device that translates a program written in a sequence instruction language into a program written in a higher-level language for general-purpose computers. With this device, a program is available that performs functions equivalent to those of a program written in a sequence instruction language and exhibits low platform dependency. List of citations Patent literature
[0005] Patent literature 1: Unexamined Japanese patent application, publication number H07-295612 Brief description of the invention: Technical problem
[0006] Programs obtained through a translation method as described in patent literature 1 may not meet the on-site requirement to observe the behavior of a program running in the programmable logic controller (PLC) for debugging and development purposes. This necessitates that on-site workers repeatedly attempt to rewrite and then translate a program serving as the translation target into a sequence instruction language until a program is obtained that meets the aforementioned requirement, resulting in potentially complicated work. Furthermore, even once a program has been created according to such a requirement, each new requirement to observe different behavior may again necessitate the complicated work of rewriting the program into a sequence instruction language.Accordingly, there is room for a reduction in the workload required to obtain a new program that, by translating a program for sequential control, fulfills such a requirement to observe its behavior.
[0007] The present disclosure is made in view of the above circumstances, and one purpose of the present disclosure is to reduce the workload for obtaining a program obtained by translating a program for a flow control system that meets the requirement of observing its behavior. Solution to the problem
[0008] To achieve the aforementioned task, a translation program according to the present disclosure causes a translation device, which is trained to translate a first source code written in a first language for a program to be executed by a programmable logic controller for controlling a control target device, into a second source code written in a second language different from the first language, in order to act as a receiving means for receiving a specification of a monitoring target variable from variables contained in the first source code, to which a value is to be assigned as a monitoring target during the execution of the program;and as a translation means for translating the first source code into the second source code, by converting, for each variable code of the first source code that refers to a shared-memory variable whose value is to be stored in shared memory contained in the programmable logic controller and shared with the target control device, the variable code into a first conversion code that refers to a variable whose value is to be stored in the shared memory if the shared-memory variable is the target monitoring variable, and the variable code into a second conversion code that refers to a variable whose value is to be stored in non-shared memory contained in the programmable logic controller and different from the shared memory if the shared-memory variable is not the target monitoring variable. Advantageous effects of the invention
[0009] The present disclosure makes it possible to reduce the workload for obtaining a new program obtained by translating a flow control program that meets the requirement of observing its behavior. Brief description of the drawings Fig. Figure 1 shows an overview of a programmable logic controller (PLC) according to embodiment 1; Fig. 2 is a first representation, which depicts the execution of a program according to a comparative example; Fig. Figure 3 is a second representation, which depicts the execution of a program according to a further comparative example; Fig. Figure 4 represents the hardware configuration of a PLC programming environment according to embodiment 1; Fig. Figure 5 represents a functional configuration of the PLC programming environment according to embodiment 1; Fig. 6 represents a first example translation according to embodiment 1; Fig. 7 represents a second example translation according to embodiment 1; Fig. Figure 8 represents an example of a monitoring target variable list according to embodiment 1; Fig. Figure 9 presents written code examples of a second source code according to embodiment 1; Fig. 10 represents a first example translation according to embodiment 1, wherein monitoring target variables are specified; Fig. Figure 11 represents a second example translation according to embodiment 1, wherein the monitoring target variables are specified; Fig. 12 is a flowchart representing a translation processing operation according to embodiment 1; Fig. Figure 13 is a flowchart representing an indicator value calculation process according to embodiment 1; Fig. Figure 14 represents a functional configuration of a PLC programming environment according to embodiment 2; Fig. 15 represents attribute information according to embodiment 2; Fig. 16 presents an example according to a modified example for specifying monitoring target variables; and Fig. Figure 17 represents a functional configuration of a PLC programming environment according to embodiment 3. Description of embodiments
[0010] A PLC programming environment according to embodiments of the present disclosure is described in detail below with reference to the drawings. Design 1
[0011] As in Fig. As shown in Figure 1, a PLC programming environment 10 according to the present embodiment corresponds to a support terminal connected to a PLC 30, which is a programmable logic controller, and which assists a user in developing a program 23 to cause the PLC 30 to control a control target device 40. Specifically, the PLC programming environment 10 corresponds to an example of a translation device that translates a first source code 21 written in a first language for sequential control into a second source code 22 written in a higher-level, general-purpose language different from the first, and which writes the program 23 obtained by compiling the second source code 22 into a non-shared memory 302 of the PLC 30.When executed, program 23 causes the values of monitoring target variables used by program 23 to be stored in shared memory 301. Shared memory 301 is a memory shared with control target device 40, and in many cases, tools are available externally for real-time data acquisition from this memory. Thus, using these tools to monitor the values of the monitoring target variables allows for easy observation of program 23's behavior. Fig. Figure 1 represents the monitoring of the values of the monitoring target variables by means of a monitor 17, which is included as the support terminal in the PLC program development environment 10.
[0012] In cases where the number of monitoring target variables is large, the execution speed of program 23 slows down due to an increase in the number of steps in which program 23 accesses shared memory 301 from non-shared memory 302, even though the behavior of program 23 can be observed in detail. Conversely, in cases where the number of monitoring target variables is small, the execution speed is fast, even though the observable area for the behavior of program 23 is small. Hereinafter, the property of a program that its behavior during execution is observable is also referred to as observability.Observability and execution speed have a conflicting goal relationship, as described above, and a user of the PLC programming environment 10 can adjust observability and execution speed to meet the user's requirements by specifying the monitoring goal variables accordingly. Program execution by PLC 30
[0013] The PLC 30 is a control device for controlling the target control device 40 in a factory. Various processes, such as the machining and inspection of workpieces flowing along a production line, are achieved through control by the PLC 30. Although Fig. Where 1 represents a control target device 40, in typical cases several control target devices 40 are controlled for coordination. For example, a result of the acquisition by a control target device 40, which is a sensor, is input into the PLC 30, and an operating command, determined by the program based on this input, is issued by the PLC 30 to another control target device 40, which is a robot, to perform processing on the workpieces. The PLC 30 and the control target device 40 are connected via a signal line that transmits a current or voltage signal, or via a network, such as a field network or a local area network (LAN).
[0014] In addition to the previously described shared memory 301 and non-shared memory 302, the PLC 30 includes an input / output (I / O) terminal 31 for inputting signals from the control target device 40 into it and for outputting signals from it to the control target device 40, a processor 32, an operating system (OS) 33 and a control platform 34 that operates on the OS 33.
[0015] Each of the shared memory 301 and the non-shared memory 302 corresponds to a random access memory (RAM). The processor 32 contains a central processing unit (CPU) or a microprocessing unit (MPU) as its processing circuitry and executes programs.
[0016] The control platform 34 is part of application software that runs on the BS 33 and performs functions as the basis for control by the PLC 30. Specifically, the control platform 34 calls and executes other programs at predetermined times and manages the shared memory 301, which stores the results of the execution. Multiple programs can be called via the control platform 34. Similarly, the following can be done in Fig. The program shown in 1 may be multiple programs. The time at which a program call is executed can be different for each program, and this call is executed, for example, at a specific time, at each predetermined cycle, or at the time of the occurrence of a specific event.
[0017] In addition to the execution results described above, the shared memory 301 stores input / output information that is periodically synchronized by the control platform 34 with the state of the I / O terminal 31. Because of this configuration, signals input by the target control device 40 to the PLC 30 are reflected in the shared memory 301, and data in the shared memory 301 is reflected in signals output by the PLC 30 to the target control device 40. Since all programs stored in the PLC 30 are typically programs that can access the data in the shared memory 301 via the control platform 34, the data in the shared memory 301 is treated as global data among multiple programs.The Shared-Memory 301 is a standard component for achieving the basic functions of the PLC 30 and has a capacity that corresponds to a specification value to be included in the PLC 30 catalog.
[0018] In the case where a program 211 is executed in the first source code 21 without translating the first source code 21 into the second source code 22 by a Fig. When the translator 12 shown in Figure 1 is executed, the program 211 is loaded into shared memory 301, and the values of all variables contained in the first source code 21 are also stored in shared memory 301, as shown in Figure 1. Fig. Figure 2 shows the variables of values to be stored in the shared memory 301, also referred to as devices or labels.
[0019] The first language for writing the first source code 21 is a programming language to instruct the PLC 30 to execute a sequence control, such as an instruction list, a ladder diagram, a function block diagram, structured text, and a sequential function chart, as described in IEC 61131-3. Hereinafter, structured text may be referred to as ST, and an instruction list may be referred to as AL.
[0020] Fig. Figure 2 represents an exemplary program execution by the PLC 30 in the conventional manner. In this way, the first source code 21 and the program 211 are highly platform-dependent, even though the values of all variables are observable. As can be seen from... Fig. As can be seen in Figure 2, the first source code 21 corresponds to an example of source code of the program 211, which can be executed by the PLC 30 without storing the values of variables in the non-shared memory 302.
[0021] Conversely, if the first source code 21 is translated into the second source code 22, but the monitoring target variable is not set to this translation, the program 23 is loaded into non-shared memory 302 and executed, as in Fig. 3 is shown, and the values of the variables contained in the second source code 22 are also stored in the non-shared memory 302.
[0022] The example of Fig. 3 corresponds to the technology disclosed in the patent literature 1 described above. Using the example of Fig. In the case where a second language for writing the second source code 22 is a general-purpose high-level language and the program 23 is executed by a general-purpose processor, the platform dependency is low, but observability is also low. Here, the high-level language is, for example, C, and the program 23 corresponds to object code compiled from the second source code 22. The second language is not limited to C and can be another language.
[0023] Furthermore, the general-purpose processor executing program 23 can be processor 32, which executes control platform 34, or a processor different from processor 32. Although the Fig. 1 and Fig. Where 3 represents a (single) processor 32, the PLC 30 can contain separate processors, that is, a processor 32 for operating the control platform 34 and a general-purpose processor 32 for executing the program 23. The processor 32 that executes the control platform 34 can be a dedicated processor for the PLC 30 or a general-purpose processor.
[0024] For programs written in general-purpose high-level languages, the accumulation of techniques for high-speed execution on general-purpose processors can make this possible. Fig. The program 23 shown in Figure 3 is to be executed at high speed. To achieve high-speed execution of the program 23, the non-shared memory 302, into which the program 23 is loaded, is preferably a memory dedicated to general-purpose processors, separate from the shared memory 301 managed by the control platform 34. If the PLC 30's ability to execute a program with a general-purpose processor is treated by its vendor as non-standard or optional, the non-shared memory 302 can be an additional component in the PLC 30 and therefore implemented as a memory device separate from the shared memory 301.
[0025] To emphasize that the values of variables to be handled by program 23 are stored in non-shared memory 302, the values stored in shared memory 301 are shown in Fig. 3 omitted. Since program 23 is called and executed by the control platform 34, the shared memory 301 also stores data during actual execution that is to be processed by program 23. Examples of such data include input data that is entered into program 23, execution results of program 23, input / output data from PLC 30 that is to be processed by program 23, and global data that is shared by program 23 with other programs. These different data types can be stored in the shared memory 301 as the values of variables.
[0026] It should be noted that in the example of Fig. 3. Intermediate data and values of local variables, which are handled entirely within the program 23, are stored in the non-shared memory 302. In contrast, the PLC programming environment 10 according to the present embodiment, in order to observe the behavior of the program 23 during execution, generates the second source code 22, which causes the values of the monitoring target variables, which are at least some of the variables handled by the program 23, to be stored in the shared memory 301, as shown in Fig. 1. In other words, the PLC programming environment 10 can be viewed as an element that defines the memory destination of the values of the variables that are in the non-shared memory 302 in the example of Fig. 3 are stored, appropriately in shared memory 301 changes, as in Fig. 1 shown.
[0027] Hardware Configuration of PLC Programming Environment 10: The PLC Programming Environment 10 is an industrial personal computer (PC) and is connected to the PLC 30 via a communication line, such as a USB cable (Universal Serial Bus - USB), or via the network mentioned above. The PLC Programming Environment 10 contains hardware components to function as a computer. More specifically, the PLC Programming Environment 10 contains, as described in Fig. Figure 4 shows a processor 101, a main memory 102, an auxiliary memory 103, an input device 104, an output device 105, and a communicator 106. The main memory 102, the auxiliary memory 103, the input device 104, the output device 105, and the communicator 106 are connected to the processor 101 via an internal bus 107.
[0028] Processor 101 comprises a CPU or MPU as a processing circuit. Processor 101 executes a program P1 stored in the auxiliary memory 103 to perform various functions and carries out the processing described below. Program P1 is an engineering tool and an example of a translation program to enable the PLC programming environment 10 to function as described below.
[0029] Main memory 102 contains RAM. Program P1 is loaded from auxiliary memory 103 into main memory 102. Main memory 102 serves as the working area of processor 101.
[0030] The auxiliary memory 103 contains non-volatile memory, such as an electrically erasable programmable read-only memory (EEPROM) or a hard disk drive (HDD). In addition to the program P1, the auxiliary memory 103 stores various data sets used for processing by the processor 101. The auxiliary memory 103 provides the processor 101 with data to be used by the processor 101 according to the processor 101's instructions. The auxiliary memory 103 stores data provided by the processor 101.
[0031] The input device 104 comprises an input device, such as a hardware switch, an enter key, a keyboard, and a pointing device. The input device 104 acquires information entered by the user and provides the acquired information to the processor 101.
[0032] The output 105 includes an output device, such as a light-emitting diode (LED), a liquid crystal display (LCD), and a speaker. The output 105 makes various data sets available to the user according to instructions from the processor 101.
[0033] The communicator 106 includes a communication interface circuit for communicating with an external device. The communicator 106 receives a signal from the external device and outputs the data specified by the signal to the processor 101. The communicator 106 also transmits signals indicating the data output by the processor 101 to external devices.
[0034] Functional Configuration of the PLC Program Development Environment 10 Through the cooperation of the components described above, the PLC program development environment 10 functions as an engineering tool, providing an environment for developing the program to be executed by the PLC 30. This engineering tool provides the function of translating the first source code 21 into the second source code 22. The PLC program development environment 10 corresponds to an example of a translation device that translates the first source code, written in the first language, for a program to be executed by the programmable logic controller to control the target device, into the second source code, written in a second language different from the first. As in Fig. As shown in Figure 5, the PLC programming environment 10 functionally includes an acquirer 11, which obtains the first source code 21; a translator 12, which translates the first source code 21 into the second source code 22; a receiver 13, which receives a setting of information required for the translation of the first source code 21; an indicator value calculator 14, which calculates an indicator value that specifies an execution speed when executing the second source code 22; an indicator value presenter 15, which presents the calculated indicator value; a compiler 16, which compiles the second source code 22; and a monitor 17 for monitoring the values of the monitoring target variables. Although the translator 12, the compiler 16, and the monitor 17 are also in Fig. The functions shown in Figure 1 are described below in more detail.
[0035] The acquirer 11 is primarily implemented by the input device 104 or the communicator 106. The acquirer 11 can obtain the first source code 21 created by the user using the engineering tool, or it can obtain it by reading the first source code 21 stored at an address specified by the user.
[0036] The translator 12 is primarily implemented by the processor 101. The translator 12 analyzes the first source code 21 and generates the second source code 22 by sequentially converting code components contained in the first source code 21 into code components of the second language that correspond to the code components contained in the first source code 21. The term "translation" means the conversion of a first source code into a second source code in a different format, enabling the PLC 30 to execute a program to perform equivalent functions.
[0037] The Fig. 6 and Fig. Seven each represent an example of the translation by translator 12. In the example of Fig. 6. The IF statements in the first language, i.e., ST, are converted into IF statements in the second language, i.e., C. In the example of Fig. 7. The FOR statement in ST is converted into the FOR statement in C. Through these translations, the variables COND, VAR0, and ITR, contained in the first source code 21, are transformed into the variables Cond, Var0, and Itr, respectively, contained in the second source code 22. None of the variables in the second source code 22, which are in the Fig. 6 and Fig. Figure 7 represents the monitoring target variables, and the values of these variables are to be stored in non-shared memory 302. That is, with the second source code 22 of the Fig. 6 and Fig. 7. Program 23 is generated, which is based on the in Fig. 3. It is to be carried out in the manner shown.
[0038] Receiver 13 is primarily implemented by input device 104 or communicator 106. Receiver 13 receives a specification of those variables from the first source code 21 that are to be set as the monitoring target variables during translation. Receiver 13 can receive a monitoring target variable list 51 entered by the user or can receive it by reading the monitoring target variable list 51 stored at an address specified by the user. Fig. Figure 8 presents an example of the monitoring target variable list 51. This monitoring target variable list 51 is used to track the values of two variables in the first source code 21, which is located in the Fig. 6 and Fig. Figure 7 shows COND and VAR0 set as a monitoring target. Receiver 13 corresponds to an example of receiving means for receiving a specification of a monitoring target variable from variables contained in the first source code to which a value is to be assigned as a monitoring target when a program is executed.
[0039] Fig. Figure 9 presents examples of code in the second language, generated according to the setting of the monitoring target variable. The code 61 “Var0 = Var1 + 100;” from Fig. Code 9 represents an operation to assign the sum of the values of the variables Var1 and 100 to the variable Var0 when no watch target variable is set. Code 62, "Var0 = API_PF_READ (VAR1) + 100;", represents an operation equivalent to code 61 in which VAR1 is set as the watch target variable and the value of this watch target variable, stored in shared memory 301, is read using the API_PF_READ function. The variable Var1 corresponds to the variable VAR1.
[0040] The code 63 “API_PF_WRITE (VAR0, Var1 + 100);” from Fig. Code 9 represents an operation corresponding to code 61, where VAR0 is set as the watch target variable and the result of the operation is written to this watch target variable using the API_PF_WRITE function. Code 64 represents the execution of an operation corresponding to code 61, where both VAR0 and VAR1 are set as the watch target variables. The in Fig. The 9 described functions are each provided as an application programming interface (API) for the control platform 34.
[0041] Fig. 10 represents an example translation, where the monitoring target variable list is 51 of Fig. 8 on the IF statements of Fig. 6 using functions such as those in Fig. 9 is applied. Fig. 10 are those from the second source code 22 of Fig. The 6 changed parts are shown in bold. For example, the description for reading the value of the monitoring target variable COND is "API_PF_READ (COND)" and the description for writing the value of 100 to the monitoring target variable VAR0 is "API_PF_WRITE (VAR0, 100)". Fig. 11 represents an example translation, where the monitoring target variable list is 51 of Fig. 8 on the FOR statement of Fig. 7 is applied.
[0042] Referring again to Fig. The indicator value calculator 14 is primarily implemented by the processor 101. The indicator value calculator 14 calculates the indicator value of the execution speed during the execution of the second source code 22, which is generated according to the specification of the monitoring target variable received by the receiver 13. A procedure for calculating the indicator value is described below.
[0043] The indicator value presenter 15 is primarily implemented by the outputter 105. By presenting the calculated indicator value to the user, the indicator value presenter 15 sends a notification to the user indicating how much faster the execution speed will be due to the user's specification of the monitoring target variable, and provides the user with information for determining the trade-off between observability and execution speed. In response to the presentation of the indicator value, the user causes the initial source code 21 to be compiled with a new specification of the monitoring target variable, thereby adjusting the observability and the execution speed. The indicator value presenter 15 corresponds to an example of indicator value presenters for presenting a calculated indicator value.
[0044] Compiler 16 is primarily implemented by processor 101. Compiler 16 is used when the second language is C, for example, GNU Compiler Collection (gcc) or Clang.
[0045] The monitor 17 is primarily implemented through the cooperation of the processor 101, the communicator 106, and the output 105. The monitor 17 reads the values of the monitoring target variables stored in the shared memory 301 and displays these values to the user. Translation processing
[0046] Next, a translation processing operation performed by the PLC programming environment 10 will be carried out with reference to the Fig. 12 to Fig. 13 described. The translation processing corresponds to an example of a translation procedure performed by the translation device.
[0047] At the in Fig. In the translation processing shown in Figure 12, the acquirer 11 receives the first source code 21 (step S1), and the receiver 13 receives the specification of the monitoring target variables (step S2). Then, the translator 12 analyzes the lexemes and syntax of the first source code 21 (step S3). More precisely, the translator 12 decomposes the first source code 21 into lexemes and analyzes the meaning of statements from the sequence of lexemes, thereby extracting code components from the first source code 21 that can be converted into the second language.
[0048] Then, translator 12 selects an unselected code component from those obtained in step S3, starting with the topmost of the unselected code components (step S4), and determines whether the selected code component is a description of a variable (step S5). If it is determined that the selected code component is not a variable (NO in step S5), translator 12 converts the selected code component into the corresponding code in the second language (step S6), after which processing proceeds to step S10. For example, translator 12 translates as in Fig. 6 shows the code component “ELSEIF” in the first source code 21 in the code “} else if (”.
[0049] Conversely, if the selected code component is determined to be a variable (YES in step S5), translator 12 determines whether the code component that is the variable is specified as the monitoring target variable (step S7). This code component corresponds to an example of variable code that references a shared memory variable. If the code component is specified as the monitoring target variable (YES in step S7), translator 12 transforms this code component into code for referencing shared memory 301 (step S8). More specifically, translator 12 transforms the code component into a description for accessing shared memory 301 using the API for the control platform 34, as described in Fig. Figure 9 shows the code obtained through the conversion in step S8, which corresponds to an example of a first conversion code. The processing then proceeds to step S10 using the PLC programming environment 10.
[0050] Otherwise, if the code component that is the variable is not specified as the monitoring target variable (NO in step S7), translator 12 converts this code component into code to reference the non-shared memory 302 (step S9). Specifically, without using the API for the control platform 34, translator 12 converts as shown in Fig. Figure 9 shows the code component being converted into a description in the second language to easily reference the variable. The code obtained by the conversion in step S9 corresponds to an example of a second conversion code. As described above, the execution speed slows down in the case where program 23 references the monitoring target variables in shared memory 301, so that program 23 in the second source code 22, which is obtained by converting the variable code in the first source code 21 into the second conversion code, has a shorter execution time when executed by PLC 30 than in the case of conversion into the first conversion code.
[0051] Translator 12 then determines whether all code components have been selected (step S10). If it is determined that not all code components have been selected (NO in step S10), translator 12 repeats the processing in step S4 and beyond. This processing selects the code components contained in the first source code 21 sequentially, starting with the topmost component of the first source code 21, and converts them into code in the second language.
[0052] If it is determined that all code components have been selected (YES in step S10), the translator 12 combines the converted codes to generate the second source code 22 (step S11). In this process, if the order of the described code components differs between the first and second languages, the translator 12 combines the code components with appropriate changes to the order.
[0053] Then, the indicator value calculator 14 performs an indicator value calculation process to calculate an indicator value for the second source code 22 generated in step S11 (step S12). During the Fig. In the indicator value calculation processing shown in step 13, the indicator value calculator counts the number of references for each variable (step S121). For example, for the second source code 22 of Fig. 10. The number of references to the variable COND is counted as one, and the number of references to the variable VAR0 is counted as one. For the second source code 22 of Fig. In 11, the number of references to the variable Itr is counted as ten due to the iterative process, and for the variable VAR0, the number of references is counted as twenty due to ten iterations of the process, which includes a read and a write.
[0054] Then the indicator value calculator 14 calculates a value of indicator value A using the following formula (1), where B is a sum of the number of references of all variables and C is a sum of the number of references of the monitoring target variable (step S122). A=C / B×100
[0055] This indicator value A is 100 in the case where all variables are the monitoring target variables, a relative value that decreases with increasing execution speed, and a value that corresponds to the execution time. For example, in the example of Fig. The indicator value is calculated as 10 times 100, and in the case where the example of Fig. 10 with the variable Var0 as in Fig. If a command is written without using the "API_PF_WRITE" function, the indicator value is calculated as 40. Afterwards, the processing by the PLC programming environment 10 reverts to the indicator value calculation processing of Fig. 13 to the translation processing of Fig. 12 back. The indicator value calculator 14 corresponds to an example of an indicator value calculation tool for calculating an indicator value that corresponds to the length of an execution time when executing a program in the second source code.
[0056] Once again on Fig. Referring to step S12, the indicator value presenter 15 presents the indicator value calculated in step S12 to the user (step S13) following the indicator value calculation processing in step S12. The presentation by the indicator value presenter 15 can be a screen display, an audio playback, or output over a network to a user interface (UI) terminal.
[0057] Then, receiver 13 determines whether a change to the monitoring target variable is made (step S14). Specifically, receiver 13 determines whether a new monitoring target variable has been specified that differs from the monitoring target variables for which the specification was received in the previous step S2. In step S14, a positive determination is made in response to a change to the monitoring target variable that is not a previous monitoring target variable and / or the exclusion of the previous monitoring target variable from the monitoring target.
[0058] When a determination is made that a change has been made to the monitoring target variable (YES in step S14), the PLC programming environment 10 repeats the processing in step S2 and beyond. This allows the user to modify the monitoring target variable while checking the indicator value and easily find a balance between observability and execution speed that meets the user's requirements. For example, if the variable VAR0 of the monitoring target for the second source code 22 of Fig. If variable 10 is excluded, the user can verify that the indicator value improves to 50. Additionally, if variable VAR0 is excluded from the monitoring target, while variable ITR, corresponding to variable Itr, is used as the monitoring target variable for the second source code 22 of Fig. When setting 11, check that the indicator value improves to 33.3.
[0059] If otherwise no change is made to the monitoring target variable and the user determines that the second source code 22 is complete and enters a write instruction (NO in step S14), the compiler 16 generates the program 23 by compiling the second source code 22, the generated program 23 is written to the PLC 30 (step S15), and the translation processing ends. Effects
[0060] As described above, the receiver 13 receives the specification of the monitoring target variables, and for each code component that references a variable in the initial source code 21, the translator 12 converts the code component into code to reference shared memory 301 if that variable is the monitoring target variable, and converts the code component into code to reference non-shared memory 302 if that variable is different from the monitoring target variables. This configuration allows the user to adjust the execution speed and observability of the program 23 by changing the specification of the monitoring target variables, thereby reducing the workload for obtaining a new program that is obtained by translating a program for a flow controller and that meets the requirement of observing its behavior.
[0061] In the case of using a technique such as that described in Fig. As shown in Figure 3, where the first source code 21, written in the first language for a sequence control, is simply translated into the second source code 22, written in the second language, a configuration is conceivable in which, during the creation phase of the first source code 21, variables to which values are to be assigned that are to be the monitoring target are set as global variables to be stored in the shared memory 301. However, such creation of the first source code 21 is a complicated process. In contrast, the PLC programming environment 10, according to the present embodiment, allows the user to easily obtain the program 23 by simply specifying the monitoring target variables without any changes to the first source code 21.
[0062] Translator 12 corresponds to an example of a translation means for translating a first source code into a second source code, in that for each variable code of the first source code that refers to a shared-memory variable whose value is to be stored in shared memory contained in a programmable logic controller and shared with a control target device, the variable code is converted into a first conversion code that refers to a variable whose value is to be stored in shared memory if the shared-memory variable is a monitoring target variable, and the variable code is converted into a second conversion code that refers to a variable whose value is to be stored in non-shared memory contained in the programmable logic controller and different from the shared memory if the shared-memory variable is not the monitoring target variable.
[0063] Furthermore, the indicator value calculated by the indicator value calculator 14 is presented to the user. After the presentation of the indicator value, the receiver 13 receives the specification of the monitoring target variables again, and the translator 12 translates the first source code 21 into the second source code 22 according to the again received specification. This allows the user to set suitable monitoring target variables while quantitatively evaluating the execution speed of the program 23.
[0064] The indicator value described above is calculated based on the number of references, which is the number of times shared memory 301 is referenced during the execution of program 23. Specifically, the indicator value is calculated by comparing this number of references with a default number, which is the number of times shared memory 301 is referenced during the execution of program 23 when all variables contained in the second source code 22 are the monitoring target variables. This allows the indicator value, corresponding to the execution time, to be obtained depending on whether or not the monitoring target variable specification is present.
[0065] Furthermore, receiver 13 receives a list of variable names, in which each variable is individually specified as the monitoring target variable. This allows the user to flexibly specify the monitoring target variables.
[0066] In iterative processing, as in the example of Fig. Since the number of iterations is defined as ten, the number of references can be easily calculated. However, a case is conceivable where the number of iterations is determined by the value of the variable. In such a case, an estimate of the number of iterations can be used. This estimate could be, for example, a predetermined fixed value, a value obtained by prompting the user for input, or a value calculated by other means.
[0067] Although the above is an example of a case with the IF statements of Fig. As described in section 10, where the variable VAR0 is referenced in arbitrary processes as branches according to different conditions, a further case is conceivable in which the variable to be referenced differs depending on the branch destination. In such a case, for example, an average of the number of references in branch destinations can be calculated by dividing the sum of the number of references at each branch destination by the number of branches. Furthermore, the average can be calculated with a weighting for the branches. Factors for such weighting can be specified by the user.
[0068] Although an example has been described above in which “reading” and “writing” are treated equally when counting the number of references, the number of references can also be counted by assigning a weight greater than 1 to the number of times “reading”, which takes more time. Design 2
[0069] Next, embodiment 2 is described, focusing on the differences from embodiment 1. Components that are identical or similar to the components of embodiment 1 described above are assigned the same reference numerals. Although the monitoring target variables are individually specified in embodiment 1, increasing the program size leads to an increase in the number of variables, making such individual specification difficult. Thus, a configuration that allows specifying a group of monitoring target variables facilitates the creation of program 23. The present embodiment differs from embodiment 1 in that the monitoring target variables are specified by specifying an attribute of them.
[0070] As in Fig. As shown in Figure 14, the receiver 13 receives attribute information 52 according to the present embodiment, which specifies an attribute of the monitoring target variable. Fig. Item 15 presents a list of examples of attribute information. Fig. Section 15 presents four different strings as examples of attribute information 52, each specifying a type of variable. Specifically, if the string "ATTR_IO" is specified, variables relating to the input / output of PLC 30 are specified as the monitoring target variables. Furthermore, if the string "ATTR_POU" is specified, variables forming a Program Organization Unit (POU) are specified as the monitoring target variables. If the string "ATTR_FB" is specified, variables forming a Function Block are specified as the monitoring target variables. If the string "ATTR_GLOBAL" is specified, variables that are global variables are specified as the monitoring target variables.
[0071] Furthermore, it Fig. 15 As examples of attribute information, 52 present four different strings, each specifying an attribute used in a conditional expression of a particular control syntax of the first language. Specifically, if the string "ATTR_IF_CONDITION" is specified, variables used in a conditional expression of the IF statement are specified as the monitoring target variables. If the string "ATTR_FOR_CONDITION" is specified, variables used in a controlling expression in the FOR statement are specified as the monitoring target variables. If the string "ATTR_WHILE_CONDITION" is specified, variables used in a conditional expression in the WHILE statement are specified as the monitoring target variables.When the string “ATTR_CASE_CONDITION” is specified, variables used in a conditional expression in the CASE statement are specified as the monitoring target variables.
[0072] Furthermore, it Fig. 15 shows that the string “ATTR_EXPRESSION” specifies the attribute information for 52 variables used in an arithmetic expression, which differs from a conditional expression of a control syntax, as the monitoring target variables. Furthermore, it states Fig. Section 15 shows that variables with names beginning with iBASE are specified as the target variables using the string "iBASE.*". Thus, a name containing a specific string can be specified as an attribute. The names of the target variables can be specified in any way, for example, using a regular expression. Furthermore, the example strings of Fig. 15 can be freely combined.
[0073] As described above, the configuration that allows variables to be specified as the monitoring target variables with a specification of one of their attributes enables flexible adjustment of observability and execution speed, even in the case where many variables are used in the initial source code.
[0074] Although an example of specifying the attribute of variables is described, a percentage can be specified for variables used in the first source code 21. For example, if the string "50%" is specified, as in the example of Fig. As shown in Figure 16, 50% of the variables contained in the first source code (Figure 21) can be randomly selected and specified as the target variables for monitoring. Furthermore, if the string "RANK_50%" is specified, the top 50% of the variables with the most references, as counted in embodiment 1, can be specified as the target variables for monitoring. embodiment 3
[0075] Next, embodiment 3 is described, focusing on the differences from embodiment 1. Components that are identical or similar to the components of embodiment 1 described above are assigned the same reference numerals. As described above in embodiment 1, the non-shared memory 302 can be an additional component, and in such a case, the non-shared memory 302 can have a relatively small capacity. Here, an attempt to maintain program 23 at a fast execution speed results in many of the variables being stored in the non-shared memory 302, creating a possibility that the non-shared memory 302 will become overloaded or exceed its capacity. In other words, there is a trade-off between execution speed and the use of the non-shared memory 302.Therefore, it is desirable that the execution speed and the use of the non-shared memory 302 be adjustable. An embodiment is described below in which the use of the non-shared memory 302 is indicated to the user for the second source code 22 obtained by translation.
[0076] As in Fig. As shown in Figure 17, the PLC programming environment 10 according to the present embodiment includes a usage calculator 18, which calculates the usage of the non-shared memory 302 based on the second source code 22, and an information presenter 19, which presents information about the calculated usage.
[0077] The usage calculator 18 is primarily implemented by processor 101. Usage calculator 18 calculates the sum of the sizes of the variables contained in the second source code 22, excluding the variables that are the target variables. For example, usage calculator 18 considers four bytes for each variable of type int and considers 4 × (array size) bytes for each array of type int. Usage calculator 18 corresponds to an example of usage computational means for calculating the usage of non-shared memory 302 during the execution of program 23.
[0078] The Information Presenter 19 is primarily implemented by the Output 105 or the Communicator 106. The Information Presenter 19 can, for example, present the calculated usage as it is, or it can present the result of a comparison between this usage and a predetermined threshold. The threshold is, for example, an upper limit corresponding to the capacity of the Non-Shared Memory 302. If the usage exceeds the threshold, the Information Presenter 19 can warn the user accordingly and, as supporting information for reducing usage, display a memory capacity corresponding to the amount by which the threshold was exceeded, as well as a list of the size of each variable.By presenting this support information to the user, the user can reduce the use of non-shared memory (302) to avoid exceeding the threshold by selecting a variable whose memory capacity corresponds to the amount of the overage and specifying this variable as a new monitoring target variable. The support information presented by Information Presenter 19 can be information that specifies a list of the size of each variable in order of size or a ranking of the number of their references. Information Presenter 19 corresponds to an example of information presenters for presenting information about calculated usage.
[0079] As described above, calculating the usage of the non-shared memory 302 and presenting information about its usage allows the user to pre-adjust the actual use of the non-shared memory 302. That is, the usage calculator 18 calculates the usage as the sum of the sizes of variables containing values to be stored in the non-shared memory by variables contained in the second source code 22. The usage is presented to the user. The receiver 13 receives a new specification of the monitoring target variables after the information presenter 19 presents information about the usage. The translator 12 translates the first source code 21 into the second source code 22 according to the newly received specification.
[0080] Although embodiments of the present disclosure are described above, the present disclosure is not limited to the embodiments described above.
[0081] Although the configuration described, for example, involves sharing the shared memory 301 with the target control device 40, it is also possible not to share all data in the shared memory 301 with every target control device 40. The shared memory 301 can be any storage device that shares data with the target control device 40, provided that data is stored in at least part of its memory space.
[0082] Although the configuration in which the program 23 is written to the shared memory 301 using the PLC programming environment 10 is further described, a configuration can also be used in which the program 23, which was written to an unrepresented non-volatile memory of the PLC 30 using the PLC programming environment 10, is loaded into the shared memory 301 at a suitable time using the control platform 34.
[0083] Furthermore, a translation system can be developed that includes the PLC programming environment 10 and the PLC 30, and this translation system can be provided for an FA site.
[0084] Although an example is further described in which the translator 12 sequentially transforms the code components contained in the first source code 21, the code component as the target of the transformation may contain another code component, and the translator 12 may perform a suitable transformation by analyzing nested code components.
[0085] Although an example is further described in which the default count used to calculate the indicator value is the number of times shared memory 301 is referenced in the case where all variables contained in the second source code 22 are the monitoring target variables, this configuration is not restrictive. The default count can be the number of times shared memory 301 is referenced during program execution, in the case where variables contained in the second source code 22 that satisfy a predetermined condition are the monitoring target variables. The predetermined condition can be, for example, that a certain value actually stored during program execution 21 is a local variable that can be set as the monitoring target variable, a variable of a specific type, or satisfies any other conditions.
[0086] Furthermore, the aforementioned embodiments can be freely combined. In particular, presenting both the indicator value and the information about its use when combining embodiments 1 and 3 enables the user to create program 23 taking into account the three conflicting objectives between observability, execution speed, and memory usage.
[0087] The functions of the PLC programming environment 10 according to the above-mentioned embodiments can be achieved by a dedicated hardware device or by a common computer system.
[0088] For example, the program P1 can be stored for distribution on a non-volatile, computer-readable recording medium, such as a flexible disk, a compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), or a magneto-optical (MO) disk, and installing the program P1 on a computer makes it possible to achieve a device that performs the above-mentioned processing.
[0089] Furthermore, the program P1 can be stored on a disk device contained in a server device in a communication network, such as the Internet, and can, for example, be superimposed on a carrier wave that is to be downloaded to a computer.
[0090] Furthermore, the processing mentioned above can also be carried out by the program P1, which is activated and executed while being transmitted through a communication network, such as the Internet.
[0091] The processing described above can also be carried out by running the program P1 wholly or partially on a server device, while a computer transmits and receives information about the processing through a communication network.
[0092] In cases where the aforementioned functions are achieved by an operating system through allocation to the operating system or implemented through cooperation between the operating system and an application, it is permissible, for example, to store and distribute only parts of program P1 that differ from a part of program P1 executed by the operating system on a single medium. Alternatively, such parts of program P1 can be downloaded to a computer.
[0093] Furthermore, the means of achieving the functions of the PLC programming environment 10 is not limited to software, and the functions can be achieved partially or entirely through dedicated hardware or a dedicated circuit.
[0094] The foregoing describes some exemplary embodiments for illustrative purposes. Although the preceding discussion has presented specific embodiments, those skilled in the art will recognize that changes in form and detail can be made without departing from the broader concept and scope of the invention. Accordingly, the specification and the drawings are to be understood in an illustrative, not a limiting, sense. This detailed description is therefore not to be understood in a limiting sense, and the scope of the invention is defined only by the included claims, together with the full range of equivalents to which such claims entitle. Commercial applicability
[0095] The present disclosure is suitable for the development of a tax program to be used at a tax office location. Reference symbol list 10 PLC programming environment 11 Acquirers 12 translators 13 recipients 14 Indicator Value Calculator 15 Indicator Value Presenters 16 compilers 17 monitors 18 Usage Calculator 19 Information Presenters 101 processor 102 main memory 103 additional storage 104 inputters 105 editors 106 Communicator 107 internal bus 21 first source code 211, 23, P1 Program 22 second source code 30 PLCs 31 I / O Terminal 32 processor 33 BS 34 Control platform 301 Shared Memory 302 Non-Shared Memory 40 Control target device 51 Monitoring target variable list 52 attribute information Code 61 to 64 QUOTES INCLUDED IN THE DESCRIPTION
[0000] This list of documents cited by the applicant was automatically generated and is included solely for the reader's convenience. The list is not part of the German patent or utility model application. The DPMA accepts no liability for any errors or omissions. Cited patent literature
[0000] JP 07 - 295 612
[0005]
Claims
Translation program for a translation device trained to translate a first source code written in a first language for a program to be executed to control a control target device by a programmable logic controller into a second source code written in a second language different from the first language, to function as: a receiving means for receiving a specification of a monitoring target variable from variables contained in the first source code, to which a value is to be assigned as a monitoring target when the program is executed;and translation means for translating the first source code into the second source code, for each variable code of the first source code that refers to a shared-memory variable with a value to be stored in a shared-memory contained in the programmable logic controller and shared with the target control device, converting the variable code into a first conversion code that refers to a variable with a value to be stored in the shared-memory if the shared-memory variable is the target monitoring variable, and converting the variable code into a second conversion code that refers to a variable with a value to be stored in a non-shared-memory contained in the programmable logic controller and different from the shared-memory if the shared-memory variable is different from the target monitoring variable. Translation program according to claim 1, wherein the first source code is a source code of the program that can be executed by the programmable logic controller without storing a value of a variable in the non-shared memory. Translation program according to claim 1 or 2, wherein the first language is an instruction list, a ladder diagram, a function block language, a structured text or a sequence language. Translation program according to one of claims 1 to 3, wherein the program in the second source code, which is obtained by converting the variable code into the second conversion code, has a shorter execution time when executed by the programmable logic controller than in a case where the program in the second source code is obtained by converting the variable code into the first conversion code. Translation program according to one of claims 1 to 4, further comprising the translation device functioning as: an indicator value calculation means for calculating an indicator value corresponding to the length of an execution time during the execution of the program in the second source code; and an indicator value presentation means for presenting the calculated indicator value, wherein the receiving means receives the specification of the monitoring target variable again after the indicator value is presented by the indicator value presentation means, and the translation means translates the first source code into the second source code according to the specification received again. Translation program according to claim 5, wherein the indicator value calculation means calculates the indicator value based on a number of times the shared memory is referenced in the second source code during the execution of the program. Translation program according to claim 6, wherein the indicator value calculation means calculates the indicator value based on a comparison between the count and a standard count, which is a number of times the shared memory is referenced during program execution when a variable contained in the second source code and satisfying a predetermined condition is the monitoring target variable. Translation program according to any one of claims 1 to 7, further comprising the translation device functioning as: a usage calculation means for calculating a usage of the non-shared memory during the execution of the program in the second source code; and an information presentation means for presenting information about the calculated usage, wherein the receiving means receives the specification of the monitoring target variable again after the information is presented by the information presentation means, and the translation means translates the first source code into the second source code according to the specification received again. Translation program according to claim 8, wherein the usage calculation means calculates as the usage a sum of sizes of variables of values to be stored in the non-shared memory by variables contained in the second source code, and the information presentation means presents the information to support a reduction in usage. Translation program according to one of claims 1 to 9, wherein the receiving means receives a list of variable names in which each variable is individually specified as the monitoring target variable. Translation program according to one of claims 1 to 9, wherein the receiving means receives a specification of an attribute that is to be the variable which is to be the monitoring target variable, and the attribute is of a type of variable which is an input / output, a global variable, a program organization unit or a function block of the programmable logic controller, is used in a conditional expression of a certain control syntax of the first language, is used in an arithmetic expression which is different from the conditional expression, or has a name which contains a specific string. Translation device designed to translate a first source code written in a first language for a program to be executed by a programmable logic controller to control a control target device into a second source code written in a second language different from the first language, wherein the translation device comprises: receiving means for receiving a specification of a monitoring target variable from variables contained in the first source code, to which a value is to be assigned as a monitoring target when the program is executed;and translation means for translating the first source code into the second source code, for each variable code of the first source code that refers to a shared-memory variable with a value to be stored in a shared-memory contained in the programmable logic controller and shared with the target control device, converting the variable code into a first conversion code that refers to a variable with a value to be stored in the shared-memory if the shared-memory variable is the target monitoring variable, and converting the variable code into a second conversion code that refers to a variable with a value to be stored in a non-shared-memory contained in the programmable logic controller and different from the shared-memory if the shared-memory variable is different from the target monitoring variable. Translation method performed by a translation device trained to translate a first source code written in a first language for a program to be executed by a programmable logic controller to control a control target device into a second source code written in a second language different from the first language, wherein the translation method comprises: by means of receiving a specification of a monitoring target variable of variables in the first source code to which a value is to be assigned as a monitoring target when the program is executed;and by means of translation, translating the first source code into the second source code, for each variable code of the first source code that refers to a shared-memory variable with a value to be stored in a shared-memory contained in the programmable logic controller and shared with the control target device, by converting the variable code into a first conversion code that refers to a variable with a value to be stored in the shared-memory if the shared-memory variable is the monitoring target variable, and by converting the variable code into a second conversion code that refers to a variable with a value to be stored in a non-shared-memory contained in the programmable logic controller and different from the shared-memory if the shared-memory variable is different from the monitoring target variable.