Development support device, development support method, and development support program

The development support device addresses the issue of unnecessary variables in control programs by using an editor and builder to infer and declare used variables, ensuring efficient memory usage and network connectivity.

JP7622483B2Active Publication Date: 2025-01-28OMRON CORP
View PDF 14 Cites 0 Cited by

Patent Information

Application Number
JP2021039325
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-03-11
Publication Date
2025-01-28
Estimated Expiration
2041-03-11

AI Technical Summary

Technical Problem

Existing control programs for control devices suffer from issues such as unnecessary variables being retained in the definition list, leading to inefficient memory usage and potential network inconveniences due to deleted necessary variables.

Method used

A development support device equipped with an editor and a builder that generates and edits source code, including a variable declaration generator to infer and declare only the variables used in the source code, with user input for variables whose data type cannot be inferred, ensuring proper memory allocation and network connectivity.

Benefits of technology

Prevents the generation of unnecessary variables, secures memory areas based on data types, and ensures proper network communication by declaring only used variables, enhancing control program development efficiency and reducing memory wastage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007622483000001
    Figure 0007622483000001
  • Figure 0007622483000002
    Figure 0007622483000002
  • Figure 0007622483000003
    Figure 0007622483000003
Patent Text Reader

Abstract

To provide a development support device, a development support method, and a development support program that can prevent generation of unnecessary variables not used in a control program for a controller controlling a controlled object.SOLUTION: A development support device (100) for supporting development of a control program (210) for a controller (200) controlling a controlled object (300) includes an editor and a builder. The editor generates and edits a source code for the control program according to a user operation. The builder generates an execution code for the control program from a source code, and a variable declaration defining variables referred to by command elements included in the source code. The builder includes a variable declaration generation unit that extracts the variables referred to by the command elements included in the source code and infers a data type of the extracted variables to generate the variable declaration.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to a technique for supporting the development of a control program for a control device that controls a controlled object. [Background technology]

[0002] Control devices such as PLCs (Programmable Logic Controllers) are being introduced in various manufacturing sites. Such control devices are a type of computer, and can control controlled objects such as manufacturing devices and manufacturing facilities by executing control programs designed according to the controlled objects. In general, such control programs are created using a development support device that is prepared separately from the controller.

[0003] Such a control program is generally written using variables that are declared in advance. For example, Japanese Patent Laid-Open Publication No. 2005-352612 (Patent Document 1) discloses a program development support device that can improve the efficiency of developing a control program by improving the searchability of variables. In the program development support device of Patent Document 1, when an operand for a predetermined instruction is input, in response to a keyword (character string) specification, a list of only variables whose variable names include the character string is displayed, thereby improving the searchability of variables. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] JP 2005-352612 A Summary of the Invention [Problem to be solved by the invention]

[0005] In the source program of the above control program, a definition list for declaring variables is provided, and variables declared in the definition list are available for use in the source code.

[0006] On the other hand, when the control program is modified or edited, if a variable that has been deleted from the source code remains in the definition list, a memory area corresponding to the variable is reserved when the control program is executed. Therefore, from the viewpoint of appropriately reserving memory area in the control device, it is preferable to delete unnecessary variables from the definition list.

[0007] On the other hand, when a control program is executed, a network is constructed between the control device and the controlled object to control the controlled object, so there is a concern that deleting a necessary variable may cause inconvenience to the controlled object.

[0008] The present disclosure has been made to solve the above-mentioned problems, and an object of one aspect is to provide a development support device capable of preventing the generation of unnecessary variables unused in a control program.An object of another aspect is to provide a development support method capable of preventing the generation of unnecessary variables unused in a control program.An object of yet another aspect is to provide a development support program capable of preventing the generation of unnecessary variables unused in a control program. [Means for solving the problem]

[0009] According to an example of the present disclosure, there is provided a development support device for supporting development of a control program for a control device that controls a control target. The development support device includes an editor and a builder. The editor generates and edits source code of the control program in accordance with a user operation. The builder generates execution code of the control program from the source code and a variable declaration that defines variables referenced by command elements included in the source code. The builder includes a variable declaration generation unit that extracts variables referenced by command elements included in the source code and generates variable declarations by inferring data types of the extracted variables.

[0010] According to the present disclosure, when building source code written according to user operations, for variables referenced by command elements included in the source code, variable declarations are generated that define the variables. In this way, in the generated variable declarations, only variables used in the source code are declared, and variables not used in the source code are not declared. As a result, it is possible to prevent unnecessary variables that are not referenced by command elements included in the source code from being generated in the variable declarations.

[0011] In the above disclosure, the development support device further includes an interface for interacting with a user. The variable declaration generation unit notifies the user of a first variable for which a data type cannot be inferred via the interface. The variable declaration generation unit updates the variable declaration according to a user input regarding the data type of the first variable via the interface.

[0012] According to this disclosure, for variables referenced by command elements included in source code and for which the data type cannot be inferred, the variable declaration can be completed by requesting user input using an interface, and the control device can secure memory areas according to the data types of all variables in the variable declaration.

[0013] In the above disclosure, the variable declaration generator further adds a second variable to the variable declaration in response to user input for the second variable via the interface.

[0014] According to this disclosure, since it is possible to accept user input regarding variables other than those referenced by command elements included in the source code, it is possible to declare, for example, variables that are not referenced by command elements but are used by the control target when the control program is executed in the control device, and thus it is possible to secure a memory area in the control device for storing the variables.

[0015] In the above disclosure, the second variables include variables used by the controlled object during execution of the control program.

[0016] According to this disclosure, variables accessed by a controlled object via a network can be included in a variable definition list, thereby preventing inconvenience to the controlled object.

[0017] In the above disclosure, the variable declaration generating unit infers the data type of a variable referenced by a command element based on the processing content of the command element.

[0018] According to this disclosure, variable declarations for declaring variables used in source code can be appropriately generated.

[0019] According to another example of the present disclosure, there is provided a development support method for supporting development of a control program for a control device that controls a controlled object. The development support method includes a step of generating and editing a source code of the control program in accordance with a user operation, and a step of generating an execution code of the control program from the source code and a variable declaration that defines a variable referenced by an instruction element included in the source code. The step of generating the execution code includes a step of extracting a variable referenced by an instruction element included in the source code, and a step of generating the variable declaration by inferring a data type of the extracted variable.

[0020] According to yet another example of the present disclosure, there is provided a development support program for supporting development of a control program for a control device that controls a controlled object. The development support program causes a computer to execute the steps of generating and editing source code of the control program in accordance with a user operation, and generating execution code of the control program from the source code and a variable declaration that defines variables referenced by command elements included in the source code. The step of generating execution code includes the steps of extracting variables referenced by command elements included in the source code, and generating the variable declaration by inferring the data type of the extracted variable.

[0021] According to the present disclosure, when building source code written according to user operations, for variables referenced by command elements included in the source code, variable declarations are generated that define the variables. In this way, in the generated variable declarations, only variables used in the source code are declared, and variables not used in the source code are not declared. As a result, it is possible to prevent unnecessary variables that are not referenced by command elements included in the source code from being generated in the variable declarations. Effect of the Invention

[0022] According to the present disclosure, it is possible to prevent unused and unnecessary variables from occurring in a control program for a control device that controls a controlled object. [Brief description of the drawings]

[0023] [Figure 1] 1 is a schematic diagram showing an example of a configuration of an FA system to which a development support device according to an embodiment is applied; [Diagram 2] FIG. 2 is a schematic diagram illustrating an example of a hardware configuration of a development support device. [Diagram 3] FIG. 2 illustrates an example of a functional configuration of a development support device. [Figure 4] FIG. 1 is a diagram illustrating an example of a development environment for a control program in a development support device. [Diagram 5] 1 is a flowchart showing an example of an outline process of control program development in a development support device. [Figure 6] 6 is a flowchart showing an example of the build process shown in FIG. 5. [Figure 7] FIG. 1 is a conceptual diagram illustrating a first example of source code. [Figure 8] FIG. 11 is a conceptual diagram illustrating a second example of source code. [Figure 9] FIG. 13 is a conceptual diagram illustrating a third example of source code. [Figure 10] FIG. 13 is a conceptual diagram illustrating a fourth example of source code. [Figure 11] FIG. 13 is a diagram showing an example of a variable definition list displayed on a display unit.

Best Mode for Carrying Out the Invention

[0024] Hereinafter, each embodiment according to the present invention will be described with reference to the drawings. In the following description, the same parts and components are denoted by the same reference numerals. Their names and functions are also the same. Therefore, detailed descriptions thereof will not be repeated in principle.

[0025] <A. Application Example> FIG. 1 is a schematic diagram showing an example of the configuration of a FA (Factory Automation) system 10 to which the development support apparatus according to the present embodiment is applied. First, with reference to FIG. 1, the system configuration of the FA system 10 will be described.

[0026] The FA system 10 includes one or more development support apparatuses 100, one or more control apparatuses (controllers) 200, and external devices 300 controlled by the control apparatus 200.

[0027] The development support apparatus 100 is, for example, a notebook or desktop PC (Personal Computer), a tablet terminal, a smartphone, or other information processing apparatus.

[0028] A development support program 50 is installed in the development support apparatus 100. The development support program 50 is an application for supporting the development of a control program 210 for the control apparatus 200. The development support program 50 is, for example, "Sysmac Studio" manufactured by Omron Corporation. The user can design a control program for the control apparatus 200 on the development support program 50 and download the designed control program 210 to the controller. Alternatively, the development support apparatus 100 can also upload data and the like from the control apparatus 200.

[0029] The control device 200 and the external device 300 are connected to a network NW1 to which the development support device 100 can be connected. Ethernet (registered trademark) or the like is adopted for the network NW1. The control device 200 is constituted by, for example, a PLC.

[0030] The control device 200 and the external device 300 are connected to a network NW2. It is preferable to adopt a field network that performs fixed-cycle communication in which the data arrival time is guaranteed for the network NW2. As such a field network that performs fixed-cycle communication, OPC UA (registered trademark) or the like is known.

[0031] The external device 300 is constituted by various industrial devices for automating the production process, various sensors, and HMI (Human Machine Interface) devices or the like. The external device 300 includes devices 300A to 300C connected to the network NW1 or NMW2, and devices 301A to 301C. The devices 301A to 301C are communicatively connected to the control device 200 via the networks NW1 and NW2 by the devices 300A to 300C. Thereby, the devices 301A to 301C can be controlled by a control program executed by the control device 200. That is, the external device 300 corresponds to a "control target" controlled by a control program.

[0032] In the example of FIG. 1, it is assumed that the device 300A connected to the device 301A is connected to the network NW2 to which OPCUA is applied. Also, it is assumed that the device 300B connected to the device 301B and the device 300C connected to the device 301C are connected to the network NW1 to which EtherNET is applied.

[0033] <B. Hardware Configuration of Development Support Device> With reference to FIG. 2, the hardware configuration of the development support device 100 will be described. FIG. 2 is a schematic diagram showing an example of the hardware configuration of the development support device 100.

[0034] The development support device 100 is, for example, a computer configured according to a general-purpose computer architecture. The development support device 100 includes a processor 102 such as a CPU (Central Processing Unit) or an MPU (Micro-Processing Unit), a main memory 104, a communication interface 111, an I / O (Input / Output) interface 114, a display interface 117, and a non-volatile storage device 120. These components are connected to each other via an internal bus 125 so as to be able to communicate with each other.

[0035] The processor 102 launches a development tool for a control program 210 (see FIG. 1) by expanding the development support program 50 stored in the storage device 120 into the main memory 104 and executing it. In addition to the development support program 50, the storage device 120 stores various data and programs 60. The source program of the control program 210 is stored in the main memory 104 or the storage device 120.

[0036] The communication interface 111 exchanges data with other communication devices via a network. The other communication devices include, for example, the control device 200 and the external device 300 shown in Fig. 1, and a server (not shown). The development support device 100 may be configured to be able to download various programs, such as the development support program 50, from the other communication devices via the communication interface 111.

[0037] The I / O interface 114 is connected to an operation unit 115, and receives a signal indicating a user operation from the operation unit 115. The operation unit 115 typically includes a keyboard, a mouse, a touch panel, a touch pad, etc., and accepts operations from a user. The operation unit 115 may be configured integrally with the development support device 100, or may be configured separately from the development support device 100.

[0038] The display interface 117 is connected to the display unit 118 and sends an image signal for displaying an image to the display unit 118 according to instructions from the processor 102 or the like. The display unit 118 is composed of an LCD (Liquid Crystal Display), an organic EL (Electro Luminescence) display, or the like, and presents various information to the user. The display unit 118 may be integrally configured with the development support device 100 or may be configured separately from the development support device 100.

[0039] In addition, FIG. 2 shows a configuration example in which functions necessary for the processor 102 such as a CPU execute a program. However, some or all of these provided functions may be implemented using a dedicated hardware circuit (for example, an ASIC (Application Specific Integrated Circuit) or an FPGA (Field-Programmable Gate Array)). In this case, virtualization technology may be used to execute a plurality of OSs with different uses in parallel and execute necessary applications on each OS. In the above description, an example in which the development support device 100 executes all processes is illustrated. However, the present invention is not limited to this, and a plurality of devices may cooperate to provide the functions as described above. Further, some or all of the functions may be realized using computing resources called a so-called cloud on a server.

[0040] <C. Functional Configuration of Development Support Device> Next, with reference to FIG. 3, the functional configuration of the development support device 100 will be described. FIG. 3 is a diagram showing an example of the functional configuration of the development support device 100.

[0041] An OS 240, a programming application 250, and a network setting application 280 are implemented in development support device 100. In development support device 100, OS 240 is executed, providing an environment in which programming application 250 and network setting application 280 can be executed. A development support program for realizing development support device 100 according to this embodiment includes at least programming application 250.

[0042] The programming application 250 includes an editor 252, a builder 254, a debugger 256, a GUI (Graphical User Interface) module 258, a simulator 260, and a data storage unit 270. The modules included in the programming application 250 are typically distributed in a state stored on a CD-ROM, and are installed in the development support device 100. The data storage unit 270 is configured to include the storage device 120.

[0043] The editor 252 provides functions such as input and editing for creating source code according to the specifications of a predetermined programming language. The source code can typically be written in any language such as LD (Ladder Diagram), IL (Instruction List), ST (Structured Text), FBD (Function Block Diagram), and SFC (Sequential Function Chart) defined in IEC 61131-3.

[0044] In any language, source code is written using "variables." A "variable" is an identifier given to data handled in the control program 210. Typically, a "variable" is data that represents the state of the control device 200 or an object controlled by the control device 200. In other words, a "variable" is data whose value changes in conjunction with the state of the control device 200 or the object controlled. The concept of a "variable" can include data that represents a single value, data represented as an array, data represented as a structure, and various types of data that can be defined in the control program 210.

[0045] Editor 252 provides a function of receiving the operation contents of operation unit 115 by the user, generating source code according to the received operation contents, and saving the generated source code. Editor 252 also provides a function of editing the source code according to the user operation. When the source code is generated or edited by editor 252, editor 252 displays information for supporting the editing work on display unit 118 via GUI module 258.

[0046] The builder 254 provides a function of building source code in accordance with the specifications of a predetermined programming language, and creating executable code (the control program 210) in a format that can be executed by the control device 200.

[0047] The debugger 256 provides a function for debugging source code. The contents of this debugging include partially executing a range of the source code specified by the user, and tracking temporal changes in variable values ​​during the execution of the source code. The debugger 256 displays information for supporting debugging on the display unit 118 via the GUI module 258.

[0048] The simulator 260 creates an environment within the development support device 100 for simulating the execution of a program in the control device 200 (PLC).

[0049] The data storage unit 270 stores various types of information used (read and written) by each part of the programming application 250. The content stored in the data storage unit 270 will be described later.

[0050] The network setting application 280 includes a configurator 257 and a data storage unit 299. The modules included in the network setting application 280 typically circulate in a state stored on a CD-ROM and are installed in the development support device 100.

[0051] The configurator 257 acquires network information 293 indicating the network configuration of the FA system 10 and stores the acquired network information 293 in the data storage unit 299. The network information 293 includes configuration information received (downloaded) from each control device 200 (PLC) connected to the network. Note that the configuration information included in the network information 293 includes information received from the actual control device 200 or logical (virtual) information that is not actual machine information. The logical information may include information input by the user via the editor 252 by operating the operation unit 115.

[0052] <D. Development Environment of Control Program> Next, with reference to FIG. 4, the development environment of the control program in the development support device 100 will be described. FIG. 4 is a diagram schematically showing an example of the development environment of the control program in the development support device 100.

[0053] In FIG. 4, for the sake of explanation, among the programming applications 250, the editor 252 and the builder 254 are shown and the illustration of other parts is omitted. Also, in FIG. 4, the data storage unit 270, the GUI module 258 and the transfer module 211 are shown in association with the editor 252 and the builder 254.

[0054] FIG. 4 shows, among the data in the data storage unit 270, a source code 271, a variable definition list 272, and an execution code 273 associated with the editor 252 and the builder 254.

[0055] The source code 271 includes a command section in which the process to be executed by the control device 200 is described using variables. The command section includes command elements described using variables. "Command elements" is a general term for elements that describe the command section of the source code 271, and includes, for example, operators, function blocks, functions, and operands. The source code 271 can be written in a programming language that can be displayed in the form of a circuit in which multiple command elements are connected to each other. The following describes source code written in LD as a typical example.

[0056] The variable definition list 272 is a variable declaration that defines variables referenced by command elements included in the source code 271. The variable definition list 272 is created by declaring at least the variable name and the data type of each variable.

[0057] The transfer module 211 controls the communication interface 111 to transfer (download or upload) the execution code 273 to the control device 200 (PLC).

[0058] The GUI module 258 controls the display interface 117 and the I / O interface 114 to realize interaction between the builder 254 and a user. The GUI module 258 corresponds to one embodiment of an "interface" for interacting with a user.

[0059] 4, editor 252 converts a source program written in accordance with a user operation received via operation unit 115 into source code 271 in a predetermined programming language. Editor 252 stores generated source code 271 in data storage unit 270.

[0060] The builder 254 includes a compiler and a linker for a predetermined programming language. The compiler creates a plurality of object files by dividing the source code 271 into a plurality of files and compiling them on a file-by-file basis. The linker generates the executable code 273 by combining the plurality of created object files. The executable code 273 consists of code executable by the processor of the control device 200 and is generated using the source code 271 and the variable definition list 272 stored in the data storage unit 270. Specifically, the builder 254 includes an analysis unit 212, a variable declaration generation unit 215, and an executable code generation unit 216. These units build the source code 271 and generate the executable code 273 that can be executed by the control device 200.

[0061] The development support device 100 transfers the executable code 273 to the control device 200 (PLC) by the transfer module 211. In the control device 200, a memory area for storing the variables declared in the variable definition list 272 is secured for the control program 210. At this time, for each variable, a memory area having a capacity according to its data type is secured.

[0062] The external devices 300 (devices 300A to 300C) can access the variables in the memory area through data communication via the network NW1 or NW2. When the executable code 273 is executed by the processor inside the control device 200, data exchange between the plurality of control devices 200 and control of the external device 300 to be controlled are carried out.

[0063] <E. Processing of Control Program Development> FIG. 5 is a flowchart showing an example of the outline processing of control program development in the development support device 100.

[0064] 5, in development support device 100, when generating or editing source code 271, first, editor 252 is started. Editor 252 executes an editing process of source code 271 (step S1). Specifically, editor 252 generates source code 271 according to a user operation received via operation unit 115. Editor 252 displays source code 271 on display unit 118.

[0065] Next, when building source code 271, development support device 100 starts builder 254. Builder 254 builds source code 271 and generates execution code 273 (step S2). The build process will be described later with reference to FIG.

[0066] When the execution code 273 is to be transferred to the control device 200, the transfer module 211 controls the communication interface 111 to transfer the execution code 273 to the control device 200 (step S3).

[0067] <Build process> FIG. 6 is a flowchart showing an example of the build process (S2) shown in FIG.

[0068] With reference to FIG. 6, the builder 254 builds the source code 271 edited by the edit process (S1). In the build process, the analysis unit 212 analyzes the source code 271 and converts it into a data structure suitable for building (step S21). As this data structure, for example, an abstract syntax tree (AST) is used. Specifically, the analysis unit 212 first analyzes the source code 271 while scanning it as a lexical analysis process, classifies the source code 271 into tokens including identifiers such as variables based on the analysis result, and generates a token string including the classified tokens. Next, the analysis unit 212 analyzes the generated token string as a syntactic analysis process, and generates an AST based on the analysis result. Furthermore, the analysis unit 212 determines a data type or a type of an expression including instruction codes based on the AST as a semantic analysis process so that the source code 271 conforms to the description specification of the program language.

[0069] The variable declaration generating unit 215 generates a variable definition list 272, which is a variable declaration that defines variables referenced by command elements included in the source code 271. Specifically, the variable declaration generating unit 215 first extracts variables referenced by command elements included in the source code 271 (step S22). Next, the variable declaration generating unit 215 infers the data types of the extracted variables (step S23). The variable declaration generating unit 215 generates the variable definition list 272 by defining each variable using the inferred data type (step S24).

[0070] <Variable declaration generation process> The process of inferring the data type of a variable (S23 in FIG. 6) and the process of generating the variable definition list 272 (S24 in FIG. 6) in the variable declaration generating unit 215 will be described below with reference to FIG. 7 to FIG.

[0071] Fig. 7 shows a conceptual diagram for explaining a first example of source code 271. Fig. 7 shows a ladder circuit described by a ladder program, which is an example of a control program, and a variable definition list 272 generated based on the ladder circuit.

[0072] 7, a ladder program is expressed by a ladder circuit 420 in which a logic circuit using circuit elements and connection lines is drawn in a ladder shape between an input bus 421 and an output bus 422. The circuit elements correspond to one embodiment of a "command element."

[0073] In the example of Fig. 7, the ladder circuit 420 includes a contact 425 that is turned on / off according to the value of the variable a, and a coil 426 that outputs the on / off result as a variable b. The ladder circuit 420 is described by connecting circuit elements such as the contact 425 and the coil 426 with each other by a connection line 423. For example, the variable b is further used as a variable for opening and closing a contact of another ladder circuit (not shown). Alternatively, the variable a is an output value of a coil of another ladder circuit (not shown). By such a hierarchical combination of ladder circuits, it is possible to describe a process for the control device 200 to control the external device 300.

[0074] The variable declaration generating unit 215 extracts variables referenced by circuit elements (command elements) included in the ladder circuit 420. In the first example shown in Fig. 7, a variable a referenced by a contact 425 and a variable b referenced by a coil 426 are extracted.

[0075] The variable declaration generating unit 215 infers the data type of each of the extracted variables a and b. The data type of a variable can be inferred based on the content of the process executed by the circuit element that references the variable. In the example of Fig. 7, since the contact 425 that receives the variable a as input is turned on / off according to the value of the variable a, the data type of the variable a can be inferred to be "BOOL". Since the coil 426 that outputs the variable b outputs an on / off result, the data type of the variable b can be inferred to be "BOOL".

[0076] Based on the result of the inference, the variable declaration generating unit 215 generates a variable definition list 272 in which the variable name and data type are declared for each of the variables a and b.

[0077] Fig. 8 shows a conceptual diagram illustrating a second example of source code 271. Like Fig. 7, Fig. 8 shows an example of a ladder circuit and a variable definition list 272 generated based on the ladder circuit.

[0078] In the example of FIG. 8, the ladder circuit 420 includes a contact 425 that is turned on / off according to the value of variable a, a coil 426 that outputs the on / off result as variable b, and a function 427. A function is a basic component called a POU (Program Organization Unit) that constitutes the control program 210. A function is an element that always outputs the same value for the same input. The function 427 executes a process defined in the function 427 based on the value of the variable associated with the input section. The execution result is reflected in the variable associated with the output of the function 427.

[0079] The variable declaration generating unit 215 extracts variables referenced by circuit elements (command elements) included in the ladder circuit 420. In the second example shown in Fig. 8, a variable a referenced by a contact 425, a variable b referenced by a coil 426, and variables a and c referenced by a function 427 are extracted.

[0080] The variable declaration generation unit 215 infers the data type of each of the extracted variables a, b, and c. The data type of each of variables a and b can be inferred to be "BOOL" by the method shown in Fig. 7. The data type of variable c can be inferred based on the processing content defined in function 427.

[0081] 8, the function 427 is a command element that defines a "MOVE" function, which is a data transfer command. The "MOVE" function is defined to execute a process of transferring the value of a variable (input argument) accepted by the input section (In) to a variable (output argument) associated with the output section (Out).

[0082] Since the data type of the input argument of the "MOVE" function is "ANY", variables of any data type can be input to the input section (In). In other words, the "MOVE" function alone cannot infer the data type of the variable input to the input section (In). However, in the example of FIG. 8, since the variable a, which is the input argument, is also referenced by another circuit element (node ​​425), the data type of variable a can be inferred based on the inference results obtained from the other circuit element.

[0083] In the "MOVE" function, the data types of the variables are usually the same between the input and output arguments. Therefore, if the data type of the input argument variable a is inferred to be "BOOL", it can be inferred that the data type of the output argument variable c is also "BOOL".

[0084] Based on the result of the inference, the variable declaration generating unit 215 generates a variable definition list 272 in which the variable name and data type are declared for each of the variables a and b.

[0085] Contrary to the example in Figure 8, in the "MOVE" function, even if the data type of the variable that is the output argument is inferred, the data type of the variable that is the input argument can also be inferred. However, if the data type of one of the input and output arguments cannot be inferred, the data type of the other variable cannot be inferred either.

[0086] Fig. 9 shows a conceptual diagram illustrating a third example of source code 271. Like Fig. 7, Fig. 9 shows an example of a ladder circuit and a variable definition list 272 generated based on the ladder circuit.

[0087] 9, the ladder circuit 420 includes a function 428. The variable declaration generating unit 215 extracts variables d and e referenced by the function 428, and infers the data types of the extracted variables d and e.

[0088] 9, function 428 is a command element that defines the "INT_TO_BCD_BYTE" function, which is a data type conversion command. In the symbol "INT_TO_BCD_BYTE" of function 428, the left side of "TO" defines the data type of the variable that is the input argument, and the right side of "TO" defines the data type of the variable that is the output argument. In other words, the "INT_TO_BCD_BYTE" function defines a command to convert integer type (INT) data into byte type (BYTE) BCD (binary coded decimal notation) data.

[0089] Therefore, the variable declaration generation unit 215 can infer that the data type of the variable d, which is an input argument, is “INT,” and that the data type of the variable e, which is an output argument, is “BYTE.” Based on the inference result, the variable declaration generation unit 215 generates a variable definition list 272 that declares the variable name and data type for each of the variables d and e.

[0090] Fig. 10 shows a conceptual diagram illustrating a fourth example of the source code 271. Like Fig. 7, Fig. 10 shows an example of a ladder circuit and a variable definition list 272 generated based on the ladder circuit.

[0091] 10, the ladder circuit 420 includes a function 429. The variable declaration generating unit 215 extracts the variables "DINT#30", f, and g referenced by the function 429, and infers the data types of the extracted variables "DINT#30", f, and g.

[0092] In the example of Fig. 10, function 429 is a command element that specifies an execution command for an arithmetic operation (multiplication "*" in Fig. 10). Function 429 has two input parts (In1, In2) and one output part (Out), and is specified to multiply the two input arguments and output an output argument that is the multiplication result.

[0093] In arithmetic operations, it is common not to mix the data types of variables for multiple input arguments. Also, the data types of the variables for the multiple input arguments and the output arguments that are the results of these operations are the same. Therefore, in an arithmetic operation function, if the data type of the variable for any one of the multiple input arguments and output arguments is known (or can be inferred), the data types of the variables for the remaining arguments can be inferred.

[0094] In the example of Fig. 10, the variable "DINT#30" input to the first input section (In1) is a variable of type "DINT" (double precision integer). Therefore, the variable declaration generation section 215 can infer that the variable f input to the second input section (In2) is also a variable of type "DINT". The variable declaration generation section 215 can further infer that the variable g output from the output section (Out) is also a variable of type "DINT".

[0095] Based on the result of the inference, the variable declaration generating unit 215 generates a variable definition list 272 in which the variable name and data type are declared for each of the variables f and g.

[0096] 6, when variable definition list 272 is generated based on the inference result of the data type of the variable, variable declaration generating unit 215 judges whether variable definition list 272 is complete or not (S25). In step S25, variable declaration generating unit 215 judges whether data types have been declared for all of the multiple variables described in source code 271. If data types have been declared for all of the variables, the judgment in S25 is YES.

[0097] On the other hand, if the data type is not declared for some of the multiple variables described in source code 271, a NO judgment is made in S25. For example, as described in Fig. 8, if the data type of one of the input and output arguments of the "MOVE" function cannot be inferred, the data type of the other variable cannot be inferred either. In such a case, the variable definition list 272 includes a variable whose data type is not declared, and therefore a NO judgment is made in S25.

[0098] If the data types have not been declared for all of the multiple variables described in the source code 271 (NO in S25), the variable declaration generating unit 215 presents the variable definition list 272 generated in step S24 to the user via the display unit 118 (S26). As described below, the variable declaration generating unit 215 completes the variable definition list 272 in accordance with the user's operation by interacting with the user using the GUI module 258.

[0099] <User interaction> Fig. 11 is a diagram showing an example of the display of the variable definition list 272 on the display unit 118. In the example of Fig. 11, the variable definition list 272 is displayed in a table format that shows at least the variable name and data type for each variable. Note that the variable definition list 272 may be displayed in another format.

[0100] In the variable definition list 272, the data type inferred in the process of step S23 in Fig. 6 is entered for each of the multiple variables described in the source code 271. However, for variables for which the data type could not be inferred, the data type entry column is left blank. Note that instead of leaving the corresponding entry column blank, the corresponding entry column may be displayed in a more noticeable manner than other entry columns.

[0101] 11, the data type of variable h cannot be inferred, so the data type entry field for variable h is blank. In this case, the GUI module 258 uses the display unit 118 to notify the user that the data type of variable h is unknown, and prompts the user to input the data type of variable f. The GUI module 258 displays a message 500 on the display unit 118, for example, "The data type of variable h is unknown. Please input the data type" (S27 in FIG. 6).

[0102] With the message 500 displayed on the display unit 118, the GUI module 258 goes into a standby state for a predetermined time to receive a user input in response to the message (S28). If the GUI module 258 receives a user input within the predetermined time (YES in S29), the variable declaration generating unit 215 updates the variable definition list 272 by rewriting the variable definition list 272 according to the user input (S30). For example, if a user input is made to specify a data type of the variable h in a blank space in the variable definition list 272 of FIG. 11, the variable definition list 272 is updated to include the specified data type of the variable h.

[0103] After updating the variable definition list 272 according to the user input, the process returns to step S25, where the variable declaration generating unit 215 determines whether or not the variable definition list 272 is complete. As described above, the variable declaration generating unit 215 determines whether or not data types have been declared for all of the multiple variables described in the source code 271. If data types have been declared for all of the variables, the determination in S25 is YES.

[0104] When it is determined that the variable definition list 272 is complete (YES in S25), the variable declaration generating section 215 stores the variable definition list 272 in the data storage section 270 (S31).

[0105] The execution code generation unit 216 generates the execution code 273 based on the source code 271 and the variable definition list 272 stored in the data storage unit 270 (S32). In S32, the execution code generation unit 216 converts the source code 271 into the execution code 273 based on the information on the data type of the expression obtained by the semantic analysis in the analysis unit 212 and the variable definition list 272. The execution code generation unit 216 stores the generated execution code 273 in the data storage unit 270. Then, the process returns to FIG. 5.

[0106] As described above, in this embodiment, in the build process (S2) of source code 271 written according to a user operation, for variables referenced by command elements included in source code 271, variable definition list 272 is generated which defines the variables. As a result, only variables used in source code 271 are declared in the generated variable definition list 272. That is, variables not used in source code 271 are not declared in variable definition list 272. As a result, it is possible to prevent variables not referenced by command elements included in source code 271 (hereinafter also referred to as "unused variables") from being generated in variable definition list 272.

[0107] Here, assume that in the edit process (S1), some command elements in the source code 271 are deleted in accordance with a user operation. In this case, a variable (for example, denoted as "variable A") referenced by the command element may become an unused variable in the source code 271. On the other hand, if the variable A is declared in the definition list 272, when a source program made up of the source code 271 and the variable definition list 272 is built, an area for storing the variable A (unused variable) is secured in the memory area of ​​the control device 200.

[0108] According to this embodiment, in the above case, the variable definition list 272 generated when the source code 271 is built is updated to remove the unused variable A. This makes it possible to prevent variables that have become unnecessary due to editing of the source code 271 from accumulating in the variable definition list 272.

[0109] For variables used in the source code 271 whose data types cannot be inferred, the variable definition list 272 can be completed by requesting user input using the GUI module 258. Therefore, the control device 200 can secure a memory area according to the data type for each of all variables declared in the variable definition list 272.

[0110] <Modification> In the above-described embodiment, the GUI module 258 is configured to accept user input regarding the data type of a variable that cannot be inferred from among the variables referenced by command elements included in the source code 271. However, the GUI module 258 can be further configured to accept user input regarding variables other than the variables referenced by the command elements.

[0111] According to the above configuration, it is possible to declare variables that are not referenced by command elements in the source code 271 but are used in the external device 300 (control target) when the control device 200 executes the control program 210. Therefore, the control device 200 can secure a memory area for storing the variables.

[0112] Such variables may include variables accessed from the external device 300 via the networks NW1 and NW2. For example, in the device 300A connected to the control device 200 via the network NW2, variables to be read periodically by periodic communication of the network are defined during execution of the control program 210. The device 300A accesses the variables by periodic communication and acquires the values ​​of the variables from the control device 200. The values ​​of the variables are used in the device 301A for monitoring state quantities, etc.

[0113] In addition, in the device 300B connected to the control device 200 by the network NW1, a data link setting is created that specifies a correspondence (link) between the variables read from the control device 200 and the variables in the device 300B. The device 300B accesses the variables of the control device 200 in accordance with the data link setting and acquires the values ​​of the variables. The acquired variable values ​​can be used in the equipment 301B in the same manner as described above.

[0114] <Additional Notes> The above-described embodiment and the modified examples include the following technical ideas.

[0115] [Configuration 1] A development support device (100) for supporting development of a control program (210) for a control device (200) that controls a control target (300), comprising: an editor (252) for generating and editing a source code (271) of the control program in accordance with a user operation; a builder (254) for generating execution code (273) of the control program from the source code and a variable declaration (272) defining variables referenced by command elements included in the source code; The builder includes a variable declaration generation unit (215) that extracts variables referenced by command elements included in the source code and generates the variable declarations by inferring data types of the extracted variables.

[0116] [Configuration 2] An interface (258) for interacting with the user, The development support device according to configuration 1, wherein the variable declaration generation unit (215) notifies the user via the interface of a first variable for which a data type cannot be inferred, and updates the variable declaration according to user input regarding the data type of the first variable via the interface.

[0117] [Configuration 3] 3. The development support device according to configuration 2, wherein the variable declaration generating unit (215) further adds a second variable to the variable declaration in response to a user input for the second variable via the interface (258).

[0118] [Configuration 4] 4. The development support device according to configuration 3, wherein the second variables include variables used by the control target (300) during execution of the control program (210).

[0119] [Configuration 5] 5. The development support device according to any one of configurations 1 to 4, wherein the variable declaration generating unit (215) infers a data type of a variable referenced by the command element based on the processing content of the command element.

[0120] [Configuration 6] A development support method for supporting development of a control program (210) for a control device (200) that controls a controlled object (300), comprising: generating and editing a source code (271) of the control program according to a user operation; generating an execution code (273) of the control program from the source code and a variable declaration (272) that defines variables referenced by command elements included in the source code; The step of generating the execution code includes: extracting variables referenced by instruction elements included in the source code; generating the variable declarations by inferring data types of the extracted variables.

[0121] [Configuration 7] A development support program for supporting development of a control program (210) for a control device (200) that controls a controlled object (300), comprising: The development support program is installed on a computer. generating and editing a source code (271) of the control program according to a user operation; generating an execution code (273) of the control program from the source code and a variable declaration (272) that defines variables referenced by command elements included in the source code; The step of generating the execution code includes: extracting variables referenced by instruction elements included in the source code; generating the variable declaration by inferring a data type of the extracted variable.

[0122] The embodiments disclosed herein should be considered to be illustrative and not restrictive in all respects. The scope of the present invention is defined by the claims, not the above description, and is intended to include all modifications within the meaning and scope of the claims. [Explanation of symbols]

[0123] 10 FA system, 50 development support program, 60 various data programs, 100 development support device, 102 processor, 104 main memory, 111 communication interface, 114 I / O interface, 115 operation unit, 117 display interface, 118 display unit, 120 storage device, 200 control device, 210 control program, 212 analysis unit, 215 variable declaration generation unit, 216 execution code generation unit, 250 programming application, 252 editor, 254 builder, 256 debugger, 257 configurator, 258 GUI module, 260 simulator, 270, 299 data storage unit, 271 source code, 272 variable definition list, 273 execution code, 293 configuration information, 280 network setting application, 300 external device, 300A-300C device, 301A-301C Equipment, 420 ladder circuit, 421 input busbar, 422 output busbar, 423 connecting wire, 425 contact, 426 coil, 427~429 functions, a~i variables, NW1,NW2 network.

Claims

1. A development support device for supporting development of a control program for a control device that controls a control target, an editor for generating and editing a source code of the control program in accordance with a user operation; a builder that generates an execution code of the control program from the source code and a variable declaration that defines a variable to be referenced by an instruction element included in the source code; The builder includes a variable declaration generation unit that extracts the variables referenced by the command elements included in the source code and generates the variable declarations by inferring the data types of the extracted variables.

2. Further comprising an interface for interacting with a user, 2. The development support device according to claim 1, wherein the variable declaration generation unit notifies the user via the interface of a first variable for which a data type cannot be inferred, and updates the variable declaration in accordance with user input regarding the data type of the first variable via the interface.

3. 3. The development support device according to claim 2, wherein the variable declaration generating section further adds a second variable to the variable declaration in response to a user input for the second variable via the interface.

4. 4. The development support device according to claim 3, wherein the second variables include variables used by the control target during execution of the control program.

5. 5. The development support device according to claim 1, wherein the variable declaration generating section infers a data type of a variable referenced by the command element based on a process content of the command element.

6. A development support method for supporting development of a control program for a control device that controls a control target, comprising: generating and editing a source code of the control program according to a user operation; generating an execution code of the control program from the source code and a variable declaration that defines a variable to be referenced by an instruction element included in the source code; The step of generating the execution code includes: extracting the variables referenced by the instruction elements included in the source code; generating the variable declarations by inferring data types of the extracted variables.

7. A development support program for supporting development of a control program for a control device that controls a control target, The development support program is installed on a computer. generating and editing a source code of the control program according to a user operation; generating an execution code for the control program from the source code and a variable declaration that defines a variable to be referenced by an instruction element included in the source code; The step of generating the execution code includes: extracting the variables referenced by the instruction elements included in the source code; generating the variable declaration by inferring a data type of the extracted variable.

Citation Information

Patent Citations

  • Program conversion device

    JP1992317133A

  • Type inferring device

    JP1993040631A

  • Editor for automatically forming data part

    JP1993143310A

  • Deduction of Operand Types in the Intermediate Language

    JP2003501742A

  • Device for supporting program development, and method for displaying variable name list

    JP2005352612A