Program development device and computer program product
By setting and analyzing the variable attributes in the user program in the program development device, the problem of low user program design efficiency and reusability in control devices such as PLC is solved, efficient matching management of variables is realized, and the user program is improved. Adaptability and reusability.
Patent Information
- Application Number
- CN202080067892.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2019-10-03
- Filing Date
- 2020-03-03
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-03-03
AI Technical Summary
The existing technology is difficult to improve the design efficiency and reusability of user programs in control devices such as PLCs. Especially when processing the use restriction information of public variables, there is a lack of effective methods to improve the adaptability and reusability of programs.
Provides a program development device, including a setting unit and an evaluation unit, which performs attribute setting and matching analysis on variables used in programs in a calling relationship to ensure that the use of variables conforms to preset attributes, thereby improving the quality of user programs. Design efficiency and reusability.
Through presetting and matching evaluation, it is possible to create highly reusable user programs, prevent variables from being incorrectly or incompletely referenced, and improve program design efficiency and adaptability.
Smart Images

Figure CN114556242B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a program development apparatus and a computer program product comprising a program for implementing the program development apparatus. Background Technology
[0002] With the increasing functionality of control devices such as PLCs (Programmable Logic Controllers), which form the basis of FA (Factory Automation), application programs, known as user programs, have also become more large-scale. As programs become more large-scale, there is a need to improve their design efficiency and reusability.
[0003] The user program executed by the control device contains commands that reference the signals (IO signals) exchanged between the field device group and the reference IO signals. Therefore, when reusing the program, it is necessary to appropriately modify the commands used to reference the IO signals.
[0004] For example, Japanese Patent Application Publication No. 4-205355 (Patent Document 1) does not target control devices, but discloses the following technology: by analyzing and storing variable usage restriction information for common variables in the source program, and by checking the use of variables in the source program while referring to the stored restriction information, erroneous use of common variables can be discovered at the source program stage.
[0005] Existing technical documents
[0006] Patent documents
[0007] Patent Document 1: Japanese Patent Application Publication No. 4-205355 Summary of the Invention
[0008] The problem that the invention aims to solve
[0009] The technology disclosed in the aforementioned patent document 1 only focuses on common variables used in the source program, and cannot achieve the purpose of improving the design efficiency and reusability of the program in control devices such as PLCs.
[0010] One object of the present invention is to provide a new structure that can improve the design efficiency and reusability of user programs executed by a control device.
[0011] Methods for solving problems
[0012] According to one embodiment of the present invention, a program development apparatus is provided for providing a development environment for a user program executed by a control device. The program development apparatus includes a setting unit that, for each of one or more variables used in a user program comprising a first program and a second program in a calling relationship, accepts the setting of an attribute related to a reference from the program. The set attribute includes a first attribute referenced by either the first program or the second program, and a second attribute referenced by both the first program and the second program. The program development apparatus includes an evaluation unit that analyzes the user program and, for each of the one or more variables, evaluates the matching degree based on the set attribute related to the reference from the program.
[0013] Based on this structure, the attributes of variables referenced by the first and second programs in a calling relationship can be pre-defined, ensuring that the usage is appropriate for these defined attributes. This enables the creation of highly reusable user programs.
[0014] The evaluation unit's assessment of matching can also include whether the variable with the first attribute has been referenced by a program different from the program used as the reference source. This structure prevents variables identified as being referenced by a specific program from being referenced by other programs.
[0015] The evaluation of matching in the evaluation unit can also include whether the variable with the second attribute is referenced by both the first and second programs. This structure prevents variables identified as being referenced by multiple programs from being referenced by only a subset of programs.
[0016] The program development apparatus may also include a result notification unit, which notifies the evaluation unit of the matching evaluation result. Based on this structure, the user can refer to the matching evaluation result and appropriately modify the user program, etc.
[0017] The results display unit can also show variables that are evaluated as not meeting the matching criteria in a way that differs from other variables. Based on this structure, variables that do not meet the matching criteria can be identified at a glance.
[0018] The result suggestion unit can also indicate which category of input and output a variable is used in the user program. Based on this structure, it is possible to determine whether a variable is used appropriately for each usage category.
[0019] A variable with a first attribute can also correspond to a specific I / O unit. Based on this structure, it is possible to set variables that are appropriate for the values referenced by the I / O unit.
[0020] The setting unit can also handle the setting of the program used for each of one or more variables. According to this structure, the appropriate attributes can be set simply by setting the program used, without needing to be aware of the differences in attributes.
[0021] The first and second programs can also be modularized by including the variables used and the properties set for those variables. This structure facilitates reuse by allowing for modularization.
[0022] According to another embodiment of the present invention, a program is provided for implementing a program development apparatus, the program development apparatus being used to provide a development environment for a user program executed by a control device. The program causes a computer to perform the following steps: for each of one or more variables used in a user program comprising a first program and a second program in a calling relationship, accepting the setting of an attribute related to a reference from the program. The set attribute includes a first attribute referenced by either the first program or the second program, and a second attribute referenced by both the first program and the second program. The program causes the computer to perform the following steps: analyzing the user program, for each of the one or more variables, evaluating the matching based on the set attribute related to the reference from the program.
[0023] Based on this structure, the attributes of variables referenced by the first and second programs in a calling relationship can be pre-defined, ensuring that the usage is appropriate for these defined attributes. This enables the creation of highly reusable user programs.
[0024] The effects of the invention
[0025] According to the present invention, a new structure can be realized that improves the design efficiency and reusability of user programs executed by the control device. Attached Figure Description
[0026] Figure 1 This is a schematic diagram illustrating an example of the data structure of a project created in the modular programming of this embodiment.
[0027] Figure 2 This is a diagram used to illustrate variable handling in modular programming of this embodiment.
[0028] Figure 3 This is a schematic diagram illustrating an example of the overall structure of the control system in this embodiment.
[0029] Figure 4 This is a block diagram illustrating an example of the hardware structure of the control device constituting the control system of this embodiment.
[0030] Figure 5 This is a block diagram illustrating an example of the hardware structure of a program development device for a control system according to this embodiment.
[0031] Figure 6 is a flowchart showing the overall processing steps of the modular programming of the present embodiment.
[0032] Figure 7 is a diagram showing an example of a project created according to the modular programming of the present embodiment.
[0033] Figure 8 is shown in Figure 7 is a diagram showing an example of the number of errors included in the project shown.
[0034] Figure 9 is a diagram showing an example of the definition of global variables used in the modular programming of the present embodiment.
[0035] Figure 10 is a flowchart showing the processing steps of the matching evaluation in the modular programming of the present embodiment.
[0036] Figure 11 is shown by Figure 10 is a diagram showing an example of the usage status of each module variable generated by the processing of the matching evaluation shown.
[0037] Figure 12 is a diagram showing an example of the definition of object global variables generated in the modular programming of the present embodiment.
[0038] Figure 13 is a schematic diagram showing an example of the result of the matching evaluation provided by the program development device of the present embodiment.
[0039] Figure 14 is a schematic diagram showing another example of the result of the matching evaluation provided by the program development device of the present embodiment.
[0040] Figure 15 is a diagram showing an example of the interface between modules in the modular programming of the modified example of the present embodiment. Detailed Implementation Modes
[0041] The embodiments of the present invention will be described in detail with reference to the accompanying drawings. In addition, the same or corresponding parts in the drawings are denoted by the same reference numerals and will not be described repeatedly.
[0042] <A. Application Example: Modular Programming>
[0043] First, an example of a scenario in which the present invention is applied will be described. Specifically, the modular programming of this embodiment will be briefly described. Furthermore, as will be explained later, the term "modular programming" is used to define programs and settings as modules, intended for reuse on a module-by-module basis. However, the technical concept of the present invention is not only applicable to modular programming, but also to user programs that contain multiple programs.
[0044] In IEC 61131-3, as defined by the International Electrotechnical Commission (IEC), the blocks that constitute a program or project are called POUs (Program Organization Units). A POU is equivalent to a unit of collection of program elements. Within a user program, it is possible to define the calling relationship between POUs, such as calling one POU from another (hereinafter also referred to as "parent-child relationship" or "parent-child relationship," etc.).
[0045] By using I / O units (POUs) as the unit of modules, parent-child relationships between modules can be represented. Control devices or control systems obtain input signals from input devices via I / O units and control output devices according to control operations based on the obtained input signals. Therefore, the number of I / O signals is far greater than in a general-purpose computer. Furthermore, global variables (representing the values of I / O signals) allocated to I / O units can be accessed from any level of I / O units. Therefore, an I / O-program interface (I / O-program I / F) is prepared that allows each program to access the global variables allocated to I / O units.
[0046] In addition, regarding the interface between POUs, when adopting a program structure that only allows strict calling relationships (i.e., the calling relationship is only specified through the input and output variables managed by each POU), the reusability of the program is reduced. Therefore, we will prepare to specify the interface between modules (inter-module interface (inter-module I / F)) that can be accessed by each POU.
[0047] Figure 1 This is a schematic diagram illustrating an example of the data structure of a project created in the modular programming of this implementation. (Refer to...) Figure 1 Project 50 includes user program 52, IO unit definition 54, IO-program I / F 56, and inter-program I / F 58 as elements.
[0048] Typically, global variables representing the I / O signals exchanged by I / O units are defined in I / O-Program I / F 56. Typically, the variables set in I / O-Program I / F 56 correspond to specific I / O units. On the other hand, global variables that can be referenced by each program are defined in Inter-Program I / F 58.
[0049] exist Figure 1 Item 50, as shown, defines modules corresponding to the characteristics of the controlled object. More specifically, item 50 includes device module 60, process modules 62 and 66. Process module 62 further includes intra-process modules 63 and 64 corresponding to the functions within the process. Each module contains program elements belonging to user program 52, IO unit definition 54, IO-program I / F 56, and inter-program I / F 58, respectively. That is, each program included in item 50 is modularized by including the variables used and the attributes set for those variables.
[0050] More specifically, the device module 60 includes a device program 53 as a user program 52 for controlling the devices contained in the controlled object, and includes global variable definitions 59 as an inter-program I / F 58. The global variable definitions 59 include definitions of usable global variable names and definitions of the data types of each global variable name (the same applies to other global variables and local variables below).
[0051] Furthermore, in this specification, "local variable" refers to a variable that can only be referenced within the program in which it is defined, and "global variable" refers to a variable outside of "local variables". In the following description, "global variable" is a term that includes variables that can be referenced by one or more programs or I / O units, and the modifier "global" should not be interpreted in a strict sense.
[0052] The process module 62 includes a program 531 that coordinates and controls the functions of the process as a whole, as well as local variable definitions 539 as user programs 52, and global variable definitions 59 as inter-program I / F 58.
[0053] The process module 62 includes an intra-process module 63 containing a function program 532 and function blocks 533 called by the function program 532 as a user program 52, and also includes a global variable definition 59 as an inter-program I / F 58. Furthermore, the intra-process module 63 includes a global variable definition 57 as an I / O-program I / F 56, and an I / O unit setting 55 as an I / O unit definition 54.
[0054] Similarly, the process module 62 includes an intra-process module 64 containing a function program 534 and a function block 535 called by the function program 534 as a user program 52, and a global variable definition 59 as an inter-program I / F 58. Furthermore, the intra-process module 64 contains a global variable definition 57 as an I / O-program I / F 56, and an I / O unit setting 55 as an I / O unit definition 54.
[0055] The process module 66 includes a program 536 for overall process control as a user program 52, and includes global variable definitions 59 as inter-program I / F 58.
[0056] The process module 66 includes an intra-process module 67 containing a function program 537 and a function block 538 called by the function program 537 as a user program 52, and a global variable definition 59 as an inter-program I / F 58. Furthermore, the intra-process module 67 contains a global variable definition 57 as an I / O-program I / F 56, and an I / O unit setting 55 as an I / O unit definition 54.
[0057] Additionally, please refer to the following sections regarding global variable definitions 57 and 59. Figure 9 wait.
[0058] For example, if we envision reuse Figure 1 The specific modules (programs, variable definitions, and IO definitions for specific processes) contained in item 50 shown must be considered not only in the user program 52, but also in the elements contained in IO unit definition 54, IO-program I / F 56, and inter-program I / F 58 during reuse.
[0059] Only variables referenced by a specific program within user program 52 exist as global variables in IO-program I / F 56, while variables referenced between multiple programs exist as global variables in inter-program I / F 58. However, the variable definitions in IEC 61131-3 do not contain such information regarding differences in variable handling, which may prevent proper handling during the user program design phase.
[0060] Therefore, in the modular programming of this embodiment, it is possible to set specific program references for variables, as well as arbitrary attributes (or rules) among multiple program references, and to evaluate the matching based on the set attributes. Furthermore, attributes different from these can also be set as variables.
[0061] Figure 2 This is a diagram illustrating variable handling in the modular programming of this embodiment. (Refer to...) Figure 2 Global variables belonging to I / F 56 (IO-Program I / F) can only be referenced by a specific program, while global variables belonging to I / F 58 (Inter-Program I / F) can be referenced by multiple programs.
[0062] In the modular programming of this implementation, each global variable is pre-defined as having a specific attribute, and its match with that attribute is evaluated.
[0063] Also, it is possible to request that global variables belonging to the inter-program I / F 58 be referred to by multiple programs that are objects. That is, it is also possible to determine that a situation where it is not referred to by any of the multiple programs that are not objects is a mismatch.
[0064] By performing such attribute setting and matching evaluation for variables, a new structure that can improve the design efficiency and reusability of user programs can be achieved.
[0065] <B. Example of control system structure>
[0066] Next, an example of the structure of the control system 1 that executes the user program created by the program development device 200 of the present embodiment will be described.
[0067] Figure 3 It is a schematic diagram showing an overall structure example of the control system 1 of the present embodiment. Refer to Figure 3 , the control system 1 includes one or more control devices 100. In addition, in Figure 3 an example of the control system 1 including two control devices 100 is illustrated, but it may also be a structure composed of one control device 100.
[0068] The control devices 100 respectively execute control operations for controlling the control object, and execute anomaly detection processing for detecting a certain anomaly that may occur in the monitoring object included in the control object. The control device 100 may be embodied as a computer such as a PLC (programmable logic controller).
[0069] The control device 100 is connected to the field device group 10 via the field bus 2. Furthermore, the control devices 100 are connected to each other via the local network 4. Sometimes the program development device 200 is also connected to the control device 100.
[0070] As the field bus 2, a network that guarantees the arrival time of data and performs constant cycle communication is preferably used. As a network that performs such constant cycle communication, EtherCAT (registered trademark) etc. are known.
[0071] The control device 100 collects the data (hereinafter, also referred to as "input value") obtained by the field device group 10 and transmitted to the control device 100. The field device group 10 includes devices that collect the state values of the control object or manufacturing devices or production lines related to control (hereinafter, also collectively referred to as "field") as input values.
[0072] In this specification, "status value" is a term that includes values that can be observed in any controlled object (including monitored objects). For example, it may include physical values that can be measured by any sensor, the on / off state of relays or switches, position, speed, torque, and other command values given by the PLC to the servo drive, and variable values used by the PLC in calculations.
[0073] As a device for collecting such state values, input relays, various sensors, etc., are conceivable. The field device group 10 also includes a device that applies some action to the field based on command values (hereinafter also referred to as "output values") generated by the control device 100. As such a device for applying some action to the field, output relays, contactors, servo drives, servo motors, and other arbitrary actuators are conceivable. These field device groups 10 exchange data containing input and output values with the control device 100 via the fieldbus 2.
[0074] exist Figure 3 In the illustrated structural example, the field device group 10 includes a remote I / O (Input / Output) device 12, a relay group 14, an image sensor 18 and a camera 20, a servo driver 22 and a servo motor 24.
[0075] The remote I / O device 12 includes a communication unit that communicates via the fieldbus 2, and an input / output unit (hereinafter also referred to as "I / O unit") for collecting input values and outputting output values. Input values and output values are exchanged between the control device 100 and the field via such I / O unit. Figure 3 An example is shown of exchanging digital signals as input and output values via relay group 14.
[0076] The I / O unit can also be directly connected to the fieldbus. Figure 3 An example is shown where I / O unit 16 is directly connected to fieldbus 2.
[0077] The image sensor 18 performs image measurement processing such as pattern matching on the image data captured by the camera 20, and sends the processing results to the control device 100.
[0078] The servo driver 22 drives the servo motor 24 according to the output value (e.g., position command) from the control device 100.
[0079] The program development device 200 provides a development environment for user programs executed by the control device 100. The user operates the program development device 200 to create a user program executed by the control device 100. Specifically, the program development device 200 provides a development environment for user programs executed by the control device 100 (program creation and editing tools, parser, compiler, etc.), a function for determining setting parameters (configuration) of the control device 100 and various devices connected to the control device 100, a function for sending the created user program to the control device 100, a function for online correcting / changing the user program executed on the control device 100, and so on.
[0080] The program development device 200 of the present embodiment can not only improve the reusability within a user program executed by a single control device 100, but also improve the reusability between user programs executed by multiple control devices 100 respectively.
[0081] <C. Example of hardware structure>
[0082] Next, an example of the hardware structure of the control device 100 and the program development device 200 that constitute the control system 1 of the present embodiment will be described.
[0083] (c1. Example of hardware structure of the control device)
[0084] Figure 4 is a block diagram showing an example of the hardware structure of the control device 100 that constitutes the control system 1 of the present embodiment. Referring to Figure 4 , the control device 100 includes a processor 102 such as a CPU (Central Processing Unit) or an MPU (Micro-Processing Unit), a chipset 104, a main storage device 106, a secondary storage device 108, a local network controller 110, a USB (Universal Serial Bus) controller 112, a memory card interface 114, a field bus controller 120, an internal bus controller 122, and IO units ...
[0085] The processor 102 reads various programs stored in the secondary storage device 108, expands and executes them in the main storage device 106, thereby implementing control corresponding to the control object and various processes as described later. The chipset 104 controls each component together with the processor 102, thereby implementing the processing of the control device 100 as a whole.
[0086] In the secondary storage device 108, in addition to a system program not shown, an executable user program 126 (equivalent to a control program) created in the program development device 200 is also stored.
[0087] The local network controller 110 controls data exchange with other devices via the local network 4. The USB controller 112 controls data exchange with the program development device 200 via a USB connection.
[0088] The memory card interface 114 is configured to be able to load and unload the memory card 116, write data to the memory card 116, and read various data (user programs, trace data, etc.) from the memory card 116.
[0089] Fieldbus controller 120 controls data exchange with other devices via fieldbus 2. Internal bus controller 122 is the interface for exchanging data with I / O units 124-1, 124-2, ... mounted on control device 100.
[0090] exist Figure 4 The diagram illustrates a structural example of providing the required functionality by executing program code via processor 102. However, some or all of these provided functions can also be implemented using dedicated hardware circuitry (e.g., ASIC (Application Specific Integrated Circuit) or FPGA (Field-Programmable Gate Array)). Alternatively, the main part of the control device 100 can be implemented using hardware following a general architecture (e.g., an industrial personal computer based on a general-purpose personal computer).
[0091] (c2: Example of hardware structure of program development device 200)
[0092] Figure 5 This is a block diagram illustrating an example of the hardware structure of the program development apparatus 200 that constitutes the control system 1 according to this embodiment. As an example, the program development apparatus 200 may also be implemented by executing programs using hardware that follows a general architecture (e.g., a general-purpose personal computer).
[0093] Reference Figure 5 The program development device 200 includes a processor 202 such as a CPU or MPU, a driver 204, a main storage device 206, a secondary storage device 208, a USB controller 212, a local network controller 214, an input unit 216, and a display unit 218. These components are connected via a bus 220.
[0094] The processor 202 reads various programs stored in the secondary storage device 208, unfolds and executes them in the main storage device 206, thereby realizing the various processes described later.
[0095] The secondary storage device 208 is constituted by, for example, an HDD (Hard Disk Drive) or an SSD (Solid State Drive). A development tool 250 for implementing various functions described later is stored in the secondary storage device 208. An OS and other necessary system programs may also be stored in the secondary storage device 208.
[0096] The drive 204 can write data to the storage medium 205 and read various data (user programs and various data) from the storage medium 205. The storage medium 205 includes, for example, a storage medium 205 that non-temporarily stores a computer-readable program (e.g., an optical storage medium such as a DVD (Digital Versatile Disc)).
[0097] The development tool 250 and the like executed by the program development device 200 can be installed via a computer-readable storage medium 205 or can be installed in the form of being downloaded from a server device on a network. In addition, the functions provided by the program development device 200 of the present embodiment may sometimes be implemented in the form of using a part of the modules provided by the OS.
[0098] The USB controller 212 controls data exchange with the control device 100 via a USB connection. The local network controller 214 controls data exchange with other devices via an arbitrary network.
[0099] The input unit 216 is constituted by a keyboard, a mouse, etc., and accepts user operations. The display unit 218 is constituted by a display, various indicators, etc., and outputs the processing results from the processor 202. A printer may also be connected to the program development device 200.
[0100] In Figure 5 FIG., a structural example of providing the required functions by executing program code by the processor 202 is shown, but a part or all of these provided functions may also be installed using a dedicated hardware circuit (e.g., an ASIC or an FPGA).
[0101] <D. Design and Compatibility Evaluation of User Programming>
[0102] Next, a design example and compatibility evaluation of a user program for modular programming according to the present embodiment will be described.
[0103] (d1: Overall Processing Steps)
[0104] Figure 6 is a flowchart showing the overall processing steps of the modular programming of the present embodiment. Refer to Figure 6The user application development device 200 defines predetermined variables to be used in the user application to be created (step S2). Then, the user application development device 200 creates the user application (step S4).
[0105] Before the user program is created (No in step S6), the processing of steps S2 and S4 is repeated.
[0106] When the user program is created (Yes in step S6), the user performs a matching evaluation on the created user program (step S8). If the matching is not satisfied (No in step S10), the user reconsiders the user program and the definition of the variables (step S12). Then, the user performs the following steps again.
[0107] If the matching condition is met ("Yes" in step S10), the user builds the created user program and transmits it to the control device 100 (step S14). Then, the user program creation process is complete.
[0108] (d2: Design example of Project 50)
[0109] Figure 7 This is a diagram illustrating an example of a project 50 created according to the modular programming of this implementation method. Figure 7 Project 50 shown contains two modules in a calling relationship (parent module 70 and child module 80). Parent module 70 contains a command to receive an input signal from input unit A and start child module 80. Child module 80 contains a command that, after receiving the start command from parent module 70 and performing processing, outputs the processing result to an output unit. Thus, the user program contains multiple programs in a calling relationship.
[0110] In the inter-module I / F 58, two variables, “Child_REQ” and “Child_ACK”, are specified that can be referenced by both parent module 70 and child module 80. These variables are used for handover between modules 72 and 82 so that parent module 70 can start and stop child module 80.
[0111] In addition, the parent module 70's IO-Program I / F 56 specifies a variable "InA_Bit00" representing the input signal of input unit A, and the sub-module 80's IO-Program I / F 56 specifies a variable "InB_Bit00" representing the input signal of input unit B and a variable "Out_Bit00" representing the output signal of output unit B.
[0112] Figure 8 It means in Figure 7The diagram shown in Project 50 contains several examples of errors. Figure 8 In item 50 shown, assuming it should have been created Figure 7 The item shown is 50, but it contains the following two errors.
[0113] In parent module 70, command 71, which references the variable “Child_ACK”, should be included in the program, but this is omitted. As a result, the variable “Child_ACK” specified in inter-program I / F 58 is not referenced ((1) not referenced).
[0114] Furthermore, the variable “InA_Bit00” of input unit A as specified in IO-Program I / F 56 should only be referenced by the parent module 70, but includes the command 81 which is referenced by the child module 80. As a result, the variable “InA_Bit00” as specified in IO-Program I / F 56 is referenced by a module different from the original module ((2) from an external reference).
[0115] so, Figure 8 The item 50 shown cannot comply with the rules regarding IO-procedural I / F 56 and inter-procedural I / F 58.
[0116] The modular programming of this implementation allows for evaluation of the compatibility of this rule with respect to IO-program I / F 56 and inter-program I / F 58.
[0117] By setting such attributes for variables and evaluating their matching, new structures can be achieved that improve the design efficiency and reusability of user programs.
[0118] (d3: Global variable definition 90)
[0119] Figure 9 This is a diagram illustrating an example of global variable definition 90 used in modular programming in this implementation. Figure 9 The global variable definition shown in 90 can also be accessed via... Figure 6 The step S2 shown is created by the user's defined operation. That is, the program development device 200 performs processing to accept the setting of attributes related to references from the program for each variable used in a user program that includes multiple programs (parent module 70 and child module 80) in a calling relationship.
[0120] Reference Figure 9The global variable definition 90 includes: a variable definition section 93, which includes a variable name 91 specifying the variable name of each global variable and a data type 92 defining the corresponding data type; an I / O unit allocation definition section 94, which indicates the correspondence between each global variable and an I / O unit; and a reference module section 96, which specifies the reference target module. The global variable definition 90 may also include a comment section 95 storing comments (arbitrary) about each global variable.
[0121] Thus, in global variable definition 90, the program used (referenced) is set for each variable. In global variable definition 90, based on the setting of such reference source program (i.e., the presence and number of modules specified in reference module section 96 associated with each global variable), it is determined whether each global variable belongs to IO-program I / F56 or inter-program I / F58.
[0122] like Figure 9 As shown, the program development apparatus 200 accepts the setting of attributes (or rules) related to references from programs for each of one or more variables used in a user program that includes multiple programs in a calling relationship. Variables belonging to IO-Program I / F 56 have the attribute of being referenced by any program. In addition, variables belonging to Inter-Program I / F 58 have the attribute of being referenced by any program among the multiple associated programs.
[0123] (d4: Match evaluation)
[0124] The program development device 200 analyzes the user program and evaluates the matching of each variable contained in the user program based on the set attributes related to the reference from the program (which one it belongs to in IO-program I / F 56 and inter-program I / F 58). As an example of such a matching evaluation of the user program based on global variable definition 90, the processing of the variable usage by each module is explained.
[0125] Figure 10 This is a flowchart illustrating the matching evaluation process in the modular programming of this embodiment. Figure 10 The steps shown are typically implemented by the processor 202 of the program development device 200 executing the development tool 250. That is, the development tool 250 is a program for implementing the program development device 200, which provides a development environment for user programs executed by the control device 100. Furthermore, the program development device 200 performs the following processing, which involves parsing and analyzing the user program and evaluating the matching of various variables based on set attributes related to references from the program.
[0126] Reference Figure 10 Program Development Device 200 Reference Figure 9 The global variable definition 90 shown extracts the module name of the analysis object (step S100). The program development device 200 sets the program with the extracted arbitrary module name as the search object (step S102). The program development device 200 reads one line of the program set as the search object (step S104) and determines whether a certain variable is used (step S106). If a certain variable is used ("yes" in step S106), the variable name, usage location, input / output category, purpose, etc. of the used variable are extracted (step S108). The extracted information is used as the variable usage status of each module (see below). Figure 11 The output is then processed. Additionally, if no variables are used ("No" in step S106), the processing in step S108 is skipped.
[0127] The program development device 200 determines whether the last line of the program to be searched has been reached (step S110). If the last line of the program to be searched has not been reached ("No" in step S110), the program development device 200 reads the next line of the program set as the search target (step S112) and executes the processing from step S106 onwards again.
[0128] If the last line of the program to be searched is reached ("Yes" in step S110), the program development device 200 determines whether the search process has been completed for all programs with extracted module names (step S114). If there are programs among the programs with extracted module names that have not completed the search process ("No" in step S114), the program development device 200 sets the programs that have not completed the search process as new search targets (step S116). Then, the program development device 200 executes the process from step S102 onwards again.
[0129] If the retrieval process has been completed for all programs with the extracted module names (Yes in step S114), the program development device 200 executes the processing from step S120 onwards.
[0130] Figure 11 It means through Figure 10 The graph shows an example of the usage of 350 variables for each module generated from the matching evaluation process. (See also...) Figure 11 Each module variable usage 350 contains a list of global variables used by the program contained in the object module.
[0131] More specifically, each module variable usage status 350 includes the module name 351 indicating that the corresponding variable is used, the variable name of the variable used 352, the location of the corresponding variable's use 353, the type of input / output of the corresponding variable 354, the purpose of the corresponding variable 355, and a flag indicating that the variable is used outside the module where it is defined 356.
[0132] The usage location 353 uses the corresponding program step number, etc., to determine the usage location of the variable. The input / output category 354 indicates whether the corresponding variable is used as a contact (input variable) or as a coil (output variable).
[0133] In addition, Figure 10 In step S108, there are cases where the same variable is extracted multiple times from the same program. However, these multiple extractions of the same variable are merged, and in each module variable usage status 350, the same variable will not be registered repeatedly for the same program. Alternatively, it can be deleted in... Figure 10 The variables extracted in step S108 that do not have a corresponding module name.
[0134] Reference Figure 11 The usage status of each module variable shown is 350, execution. Figure 10 The processing from step S120 onwards is shown. Refer again... Figure 10 The program development device 200 deleted 90 global variable definitions. Figure 9 For variables in the included variables that are not specified to have a corresponding reference target module (reference module section 96), generate an object global variable definition 90A consisting only of variables that are the objects of matching evaluation (step S120).
[0135] Figure 12 This diagram illustrates an example of object global variable definition 90A generated in the modular programming of this implementation. (Refer to...) Figure 12 The object global variable definition 90A only includes global variables corresponding to the referenced module. In the object global variable definition 90A, a flag can be set for each module that references each global variable to evaluate whether it is used (reference module section 97).
[0136] Next, the processing is performed on... Figure 11 The usage status of each module variable shown is 350 and Figure 12 The global variable definitions of the objects shown in 90A are compared to evaluate consistency and differences.
[0137] More specifically, the program development device 200 reads the usage status of each module's variables 350 ( Figure 11The initial entry in the object global variable definition 90A (step S122) is used as the keyword to search for entries with the same variable name 91 (step S124). Then, among the retrieved entries in the object global variable definition 90A, a flag indicating that the module name is the same as the module name 351 of the read entry is set. Figure 12 (Referencing module 97) (Step S126).
[0138] Next, the program development device 200 determines whether the read module name 351 is included in the reference module section 97 in the entry of the object global variable definition 90A corresponding to the variable name 352 of the read entry (step S128). If the read module name 351 is not included in the reference module section 97 ("No" in step S128), the program development device 200 sets a flag indicating that the read entry is used in a module outside the definition. Figure 11 (Step S130) If the read module name 351 is included in the reference module section 97 ("Yes" in step S128), the program development device 200 skips the processing of step S130.
[0139] That is, in steps S128 and S130, regarding the variable of interest, if the reference module section 97 of the object global variable definition 90A contains the module name 351 of each module variable usage status 350, it is determined that the variable of interest is used appropriately. On the other hand, if the reference module section 97 of the object global variable definition 90A does not contain the module name 351 of each module variable usage status 350, it is determined that the variable of interest is used incorrectly (used in an undefined module). Thus, as a matching evaluation, it includes the following judgment: whether the variable belonging to IO-program I / F 56 has been referenced by a program different from the program that is the reference source.
[0140] The program development device 200 determines whether the processing has been completed up to the last entry of each module variable usage status 350 (step S132). If the processing has not been completed up to the last entry of each module variable usage status 350 ("No" in step S132), the program development device 200 reads each module variable usage status 350 ( Figure 11 The next entry in the sequence (step S134) is executed again, and the following processing steps are performed again.
[0141] If the processing has been completed up to the last entry of the variable usage status 350 for each module (marked as "Yes" in step S132), the program development device 200 extracts variables that are not marked in the reference module section 97 of the object global variable definition 90A as unused variables (step S136), and displays the matching evaluation result based on the variable usage status 350 for each module and the object global variable definition 90A (step S138). Thus, the matching evaluation includes the following judgment: whether the variables belonging to the inter-program I / F 58 are associated with the program has been referenced.
[0142] Then, the matching evaluation process ends. Additionally, based on the results of the matching evaluation, the user program can be modified to make certain adjustments.
[0143] (d5: Example of matching evaluation results)
[0144] The program development device 200 has the function of displaying the results of the matching evaluation as described above.
[0145] Figure 13 This is a schematic diagram illustrating an example of the matching evaluation results provided by the program development apparatus 200 of this embodiment. (Refer to...) Figure 13 The results show that the usage status of each module variable is 350 (screen 300). Figure 11 Based on this, the matching evaluation results of the variable usage are shown for each module.
[0146] The results display screen 300 includes a list of used variables 310, representing variables that have been properly used, and a list of unused variables 320, representing variables that have not been used.
[0147] The variable list 310 includes the module name representing the object module 311, the variable name representing the object variable 312, the data type representing the data type of the object variable 313, the IO unit allocation representing the correspondence between the object variable and the IO unit 314, comments about the object variable 315 (arbitrary), the purpose of the object variable 316, and the evaluation result representing the result of the matching evaluation of the object 317.
[0148] In evaluation result 317, regarding variables used in modules other than the module defined as the usage destination (variables marked in usage outside the definition of each module variable usage 350 in usage 356), an error message 318 is displayed as "usage not in the module definition".
[0149] Similarly, the list of unused variables 320 includes the module name 321 representing the object module, the variable name 322 representing the object variable, the data type 323 representing the data type of the object variable, the I / O unit allocation 324 representing the correspondence between the object variable and the I / O unit, comments about the object variable 325 (arbitrary), the purpose of the object variable 326, and the evaluation result 327 representing the result of the matching evaluation for the object. Furthermore, since the object variables are unused, it is impossible to set valid values for the I / O unit allocation 324 and the purpose 326.
[0150] In evaluation result 327, for variables that are not used in the defined module (variables whose flags are not set in the reference module section 97 of object global variable definition 90A), an error message 328 such as "not used in the defined module" is displayed.
[0151] By Figure 13 The matching evaluation results shown are presented to the user, allowing them to easily identify variables that do not match the pre-defined rules.
[0152] Figure 14 This is a schematic diagram illustrating another example of the matching evaluation result provided by the program development apparatus 200 of this embodiment. (Refer to...) Figure 14 The result shows that screen 330 is defined as 90A using a global variable of the object. Figure 12 Based on this, the matching evaluation results of usage status are shown for each variable.
[0153] The results show that screen 330 contains the global variable definition 90A (for objects). Figure 12 A list of the variables used is provided in section 340.
[0154] The variable list 340 includes the variable name representing the object variable 341, the data type representing the data type of the object variable 342, the IO unit allocation representing the correspondence between the object variable and the IO unit 343, comments about the object variable 344 (arbitrary), the usage status of each module representing the usage status of the object variable in the module 345, and the evaluation result representing the result of the matching evaluation of the object 348.
[0155] Each module usage status 345 includes a definition 346 indicating whether or not a usage is defined in each module, and a usage 347 indicating whether or not it is actually used in each module. In the definition 346, an evaluation mark is displayed when the usage of an object variable is defined in the corresponding module. In addition, in the usage 347, information indicating how the object variable in the corresponding module is used is displayed. When the corresponding variable is used as a contact (input variable), it is displayed as [R], and when the corresponding variable is used as a coil (output variable), it is displayed as [W]. That is, the program development device 200 notifies the user which category (input / output) of input and output each variable is used in the user program.
[0156] In each module usage status 345, the situation of not matching the predetermined rules regarding variable usage is displayed in a coordinated manner with a different display method from others. In Figure 14 the example shown, the variables "InA_Bit00" and "Child_ACK" are shown not to match the usage-related rules.
[0157] In the evaluation result 348, the details of the non-matching with the rules are displayed. In Figure 14 the example shown, error messages such as "Usage not in module definition" and "Access to unit in multiple modules" are displayed corresponding to the variable "InA_Bit00". In addition, an error message "Not used in the defined module" is displayed corresponding to the variable "Child_ACK".
[0158] In this way, the program development device 200 displays the variables evaluated as not meeting the matching in the matching evaluation in a different manner from other variables.
[0159] By presenting the user with an example of the result of the matching evaluation as Figure 14 shown, the variables that do not match the predetermined variable-related rules can be grasped at a glance.
[0160] <E. Variant example>
[0161] In the above description, the IO-program I / F 56 that defines the global variables referred to for access from each program to the IO unit, and the inter-program I / F 58 that defines the global variables that can be accessed between programs have been described. The inter-program I / F 58 only stipulates that the global variables can be referred to between programs (modules), but the call relationship (parent-child relationship) between programs (modules) can also be considered, and the attributes (or rules) of the global variables that can be referred to between programs (modules) can be further set.
[0162] Figure 15 It is a diagram showing an example of the interface between modules in modular programming, which is a variant example of the present embodiment. Refer to Figure 15 In (A), the parent-child relationship of calling two child modules 80A and 80B (Child) from the parent module 70 (Parent) is set. Regarding such three modules, there can be three types of inter-module interfaces: the relationship between the parent module 70 and the child module 80A, the relationship between the parent module 70 and the child module 80B, and the relationship between the child module 80A and the child module 80B.
[0163] The information of such parent-child relationships between modules can also be used to evaluate whether there is a matching of variables that serve as inter-module interfaces outside the parent-child relationship.
[0164] For example, as shown in (B), IF_Parent_Child1 can be defined as the inter-module interface between the parent module 70 and the child module 80A, IF_Parent_Child2 can be defined as the inter-module interface between the parent module 70 and the child module 80B, and IF_Child1_Child2 can be defined as the inter-module interface between the child module 80A and the child module 80B. Figure 15 That is, by referring to the parent-child relationship between modules, the definition of variables belonging to the inter-module interface such as IF_Child1_Child2 can be carried out, and thus the matching of variable references between child modules can be evaluated. Moreover, variables that do not match the attributes (or rules) of such variables can be notified to the user.
[0165] In addition, regarding whether to define a relationship other than the parent-child relationship between modules (that is, the interface between child modules), it can also depend on the rules of the user's module design. In this case, regarding whether to define a relationship other than the parent-child relationship between modules, the user can make an arbitrary choice (that is, switch between valid / invalid).
[0166] <F. Supplementary Note>
[0167] <F. Supplementary Note>
[0168] The above-described embodiment contains the following technical ideas.
[0169] [Structure 1]
[0170] A program development device (200) for providing a development environment for a user program to be executed by a control device (100), wherein
[0171] The program development device (200) has a setting unit (90; S2), and the setting unit (90; S2) accepts the setting of attributes related to references from the program for each of one or more variables used in a user program including a first program and a second program in a call relationship.
[0172] The set attribute includes a first attribute (56) referenced by either the first program or the second program, and a second attribute (58) referenced by both the first program and the second program.
[0173] The program development apparatus (200) has an evaluation unit (S100-S138) that analyzes the user program and evaluates the matching of each of the one or more variables based on the set attributes related to the reference from the program.
[0174] [Structure 2]
[0175] In the program development apparatus described in Structure 1,
[0176] The evaluation unit's assessment of matching includes: whether the variable with the first attribute was referenced by a program different from the program used as the reference source.
[0177] [Structure 3]
[0178] In the program development apparatus described in Structure 1 or 2,
[0179] The evaluation unit's assessment of matching includes whether the variable with the second attribute has been referenced by both the first and second programs.
[0180] [Structure 4]
[0181] In any of the program development devices described in structures 1 to 3,
[0182] The program development device also has a result prompting unit (300; 330), which prompts the evaluation unit for the evaluation result of the matching.
[0183] [Structure 5]
[0184] In the program development apparatus described in Structure 4,
[0185] The result prompting unit will display variables that are evaluated by the evaluation unit as not meeting the matching criteria in a way that differs from other variables.
[0186] [Structure 6]
[0187] In the program development apparatus described in structure 4 or 5,
[0188] The result prompting unit indicates which category of input and output the one or more variables are used in the user program.
[0189] [Structure 7]
[0190] In the program development device according to any one of Structures 1 to 6,
[0191] A variable having the first attribute is set to correspond to a specific IO unit.
[0192] [Structure 8]
[0193] In the program development device according to any one of Structures 1 to 5, <00>
[0194] The setting unit accepts settings of the program to be used for each of the one or more variables.
[0195] [Structure 9]
[0196] In the program development device according to any one of Structures 1 to 8,
[0197] The first program and the second program are modularized to include the variables to be used and the attributes set for the variables.
[0205] This enables high-quality modular programming, thereby improving the design efficiency and reusability of user programs executed by the control device 100.
[0206] The embodiments disclosed herein should be considered illustrative rather than restrictive in all respects. The scope of the invention is defined by the claims, not by the foregoing description, and is intended to include all modifications equivalent to and within the scope of the claims.
[0207] Label Explanation
[0208] 1: Control system; 2: Fieldbus; 4: Local network; 10: Field device group; 12: Remote I / O device; 14: Relay group; 16, 124: I / O unit; 18: Image sensor; 20: Camera; 22: Servo driver; 24: Servo motor; 50: Project; 52, 126: User program; 53: Device program; 54, 346: Definition; 55: I / O unit setting; 56: I / O-program I / F; 57, 59, 90: Global variable definition; 58: Inter-program I / F; 60: Device module; 62, 66: Process module; 63, 64, 67: In-process modules; 70: Parent module; 71, 81: Commands; 72, 82: Handover; 80, 80A, 80B: Sub-modules; 90A: Object global variable definition; 91, 312, 322, 341, 352: Variable names; 92, 313, 323, 342: Data types; 93: Variable definition section; 94: Allocation definition section; 95: Comment section; 96, 97: Reference module section; 100: Control device; 102, 202: Processor; 104: Chipset; 106, 206: Main storage device; 108, 2 08: Secondary storage device; 110, 214: Local network controller; 112, 212: USB controller; 114: Memory card interface; 116: Memory card; 120: Fieldbus controller; 122: Internal bus controller; 200: Program development device; 204: Driver; 205: Storage medium; 216: Input unit; 218: Display unit; 220: Bus; 250: Development tool; 300, 330: Result display screen; 310, 340: List of used variables; 311, 321, 351: Module name; 314, 324 343: Allocation; 315, 325, 344: Comments; 316, 326, 355: Purpose; 317, 327, 348: Evaluation Results; 318, 328: Error Messages; 320: List of Unused Variables; 345: Usage Status of Each Module; 347: Usage; 350: Variable Usage Status of Each Module; 353: Location of Use; 354: Category; 356: Use Outside Definition; 531, 536: Program; 532, 534, 537: Functional Program; 533, 535, 538: Function Block; 539: Local Variable Definition.
Claims
1. A program development device for providing a development environment for a user program executed by a control device, wherein: The program development device includes a setting unit that receives a setting of an attribute related to a reference from a program for each of one or more variables used in a user program including a first program and a second program in a calling relationship. The set attributes include a first attribute that is referred to by either the first program or the second program, and a second attribute that is referred to by both the first program and the second program. The program development device includes an evaluation unit that analyzes the user program and evaluates the compatibility of each of the one or more variables based on a set attribute related to a reference from the program. The evaluation of the matching by the evaluation unit includes: whether the variable to which the first attribute is set is referenced by a program different from the program serving as a reference source; and Whether the variable to which the second attribute is set is referenced by both the first program and the second program.
2. The program development device according to claim 1, wherein: The program development device further includes a result presenting unit for presenting a result of the evaluation of the compatibility by the evaluation unit.
3. The program development device according to claim 2, wherein: The result presenting unit displays the variable evaluated by the evaluating unit as not satisfying the matching in a manner different from other variables.
4. The program development device according to claim 2, wherein: The result presentation unit presents the one or more variables as either input or output in the user program.
5. The program development device according to any one of claims 1 to 4, wherein: The variable to which the first attribute is set corresponds to a specific IO unit.
6. The program development device according to any one of claims 1 to 4, wherein: The setting unit receives setting of a program to be used for each of the one or more variables.
7. The program development device according to any one of claims 1 to 4, wherein: The first program and the second program are modularized including variables used and attributes set for the variables, respectively.
8. A computer program product comprising a program for implementing a program development device for providing a development environment for a user program executed by a control device, wherein: The program causes a computer to execute the following steps: accepting setting of attributes related to reference from a program for each of one or more variables used in a user program including a first program and a second program in a calling relationship, The set attributes include a first attribute that is referred to by either the first program or the second program, and a second attribute that is referred to by both the first program and the second program. The program causes the computer to execute the following evaluation steps: analyzing the user program, evaluating the compatibility of each of the one or more variables based on the attributes set and related to the reference from the program, The evaluation step comprises: a step of determining whether the variable to which the first attribute is set is referenced by a program different from a program serving as a reference source; and A step of determining whether the variable to which the second attribute is set is referenced by both the first program and the second program.
