Patent ID: 12259804

DESCRIPTION OF EMBODIMENTS

Hereinafter, an embodiment of the present invention will be described with reference to the drawings. The same or corresponding parts in the drawings are denoted by the same reference signs, and the description thereof will not be repeated.

A. Application Example: Modular Programming

First, an example of a situation to which the present invention is applied will be described. Specifically, modular programming according to the embodiment will be schematically described. As will be described later, the term “modular programming” means that programs and settings are defined as modules and are scheduled to be reused on a module-by-module basis. However, the technical idea of the present invention is not applied only to modular programming but is applicable to a user program including a plurality of programs.

In IEC 61131-3 defined by the International Electrotechnical Commission (IEC), blocks constituting programs and projects are referred to as program organization units (POUs). The POU corresponds to a unit of a group of program elements. In the user program, a calling relationship (hereinafter, the parent-child relationship is also referred to as “parent-child relationship” or “parent-child”) between POUs such as calling another POU from a certain POU can be defined.

By using a POU as a unit of a module, the parent-child relationship between modules can be represented, but a control device or a control system acquires an input signal from an input device via an IO unit and controls an output device in accordance with control calculation based on the acquired input signal. Therefore, the number of IO signals is much larger than that of a general-purpose computer, and a global variable (indicating a value of the IO signal) assigned to the IO unit is accessible from the POU of any layer. Therefore, an IO-program interface (IO-program I/F) that enables each program to access the global variable assigned to the IO unit is prepared.

In addition, in a case where a program structure that allows only a strict calling relationship (that is, the calling relationship is defined only by an input variable and an output variable managed by each POU) is adopted as an interface between the POUs, the reusability of the program decreases, and thus, an interface between modules (inter-program interface (inter-program I/F)) that defines global variables accessible by each POU is prepared.

FIG.1is a schematic diagram illustrating an example of a data structure of a project created in the modular programming according to the embodiment. Referring toFIG.1, a project50includes a user program52, an IO unit definition54, an IO-program I/F56, and an inter-program I/F58as elements.

In general, a global variable indicating an IO signal exchanged by an IO unit is defined in I/O-program I/F56. Typically, a variable set in IO-program I/F56is associated with a specific IO unit. On the other hand, a global variable that can be referred to by each program is defined in inter-program I/F58.

In project50illustrated inFIG.1, modules corresponding to characteristics of a control target are defined. Specifically, project50includes a device module60and process modules62and66. Process module62further includes in-process modules63and64corresponding to respective functions in a process. Each of the modules includes a program element that belongs to each of user program52, IO unit definition54, IO-program I/F56, and inter-program I/F58. That is, each program included in project50, including a variable to be used and an attribute set for the variable, is modularized.

Specifically, device module60includes a device program53for controlling a device included in the control target as user program52, and includes a global variable definition59as inter-program I/F58. Global variable definition59includes definitions of available global variable names and definitions of data types for global variable names (hereinafter, the same applies to other global variables and local variables).

Note that, a “local variable” herein means a variable that can be referred to only in a program that defines the local variable, and a “global variable” means a variable other than the “local variable”. In the following description, “global variable” is a term that encompasses a variable that can be referred to by one or more programs or IO units, and the modifier “global” should not be interpreted in a strict sense.

Process module62includes, as user program52, a program531that coordinates and wholly controls the function of the process and a local variable definition539, and also includes global variable definition59as inter-program I/F58.

In-process module63included in process module62includes, as user program52, a function program532and a function block533called from function program532, and includes global variable definition59as inter-program I/F58. Further, in-process module63includes a global variable definition57as IO-program I/F56and IO unit setting55as IO unit definition54.

Similarly, in-process module64included in process module62includes, as user program52, a function program534and a function block535called from function program534, and includes global variable definition59as inter-program I/F58. Further, in-process module64includes global variable definition57as IO-program I/F56and IO unit setting55as IO unit definition54.

Process module66includes, as user program52, a program536that wholly controls the process, and includes global variable definition59as inter-program I/F58.

In-process module67included in process module66includes, as user program52, a function program537and a function block538called from function program537, and includes global variable definition59as inter-program I/F58. Further, in-process module67includes global variable definition57as IO-program I/F56and IO unit setting55as IO unit definition54.

As for global variable definitions57and59, refer toFIG.9and the like described later.

For example, assuming that a specific module (program, variable definition, and IO definition for specific process) included in project50illustrated inFIG.1is reused, not only the program included in user program52but also elements included in IO unit definition54, IO-program I/F56, and inter-program I/F58need to be considered at the time of reuse.

The variable referred to only by the specific program included in user program52exists as the global variable of IO-program I/F56, and the variable cross-referred between a plurality of programs exists as the global variable of inter-program I/F58. However, since there is no information related to such a difference in handling of variables in the definition of variables in IEC 61131-3, there is a possibility that variables cannot be appropriately handled at a design stage of the user program.

Therefore, in the modular programming according to the embodiment, it is possible to set any attribute (or rule) of reference to a variable only by a specific program or reference to a variable among a plurality of programs, and it is possible to evaluate consistency based on the set attribute. Note that an attribute different from the above attributes may be set as a variable.

FIG.2is a diagram for describing handling of variables in the modular programming according to the embodiment. Referring toFIG.2, the global variable belonging to IO-program I/F56is permitted to be referred to only by a specific program, and the global variable belonging to inter-program OF58is permitted to be referred to by a plurality of programs.

In the modular programming according to the embodiment, which attribute each global variable has is set in advance, and whether each global variable matches the set attribute is evaluated.

Furthermore, the global variable belonging to inter-program I/F58can also be required to be referred to by a plurality of target programs. That is, it is also possible to determine as inconsistent when the global variable is not referred to by any of the plurality of target programs.

By setting attributes and consistency evaluation for the variables as described above, it is possible to achieve a new mechanism capable of improving design efficiency and reusability of the user program.

B. Configuration Example of Control System

Next, a description will be made of a configuration example of a control system1in which a user program created by a program development device200according to the embodiment is executed.

FIG.3is a schematic diagram illustrating an overall configuration example of control system1according to the embodiment. Referring toFIG.3, control system1includes one or more control devices100. AlthoughFIG.3illustrates control system1including two control devices100, control system1may include one control device100.

Each of control devices100executes control calculation for controlling the control target and executes abnormality detection processing for detecting any abnormality that may occur in a monitoring target included in the control target. Control device100may be embodied as a kind of computer such as a programmable logic controller (PLC).

Control device100is connected to a field device group10via a field bus2. Control devices100are connected to each other via a local network4. Program development device200may be connected to control device100.

As field bus2, it is preferable to adopt a network that perform constant cycle communication that guarantees arrival time of data. EtherCAT (registered trademark) and the like are known as a network that performs such constant cycle communication.

Control device100collects data (hereinafter, also referred to as an “input value”) acquired by field device group10and transferred to control device100. Field device group10includes a device that collects a state value of a control target or a manufacturing device related to control, a production line, and the like (hereinafter, collectively referred to as “field”) as an input value.

The “state value” is herein a term including a value that can be observed by an arbitrary control target (including the monitoring target), and can include, for example, a physical value that can be measured by an arbitrary sensor, an ON or OFF state of a relay, a switch, or the like, a command value such as a position, a speed, or a torque given by the PLC to a servo driver, a variable value used by the PLC for calculation, or the like.

As a device that collects such a state value, an input relay, various sensors, and the like are assumed. Field device group10further includes a device that exerts some action to the field on the basis of the command value (hereinafter, also referred to as an “output value”) generated by control device100. As a device that exerts some action on such a field, an output relay, a contactor, a servo driver, a servomotor, and other arbitrary actuators are assumed. Field device group10exchanges data including an input value and an output value with control device100via field bus2.

In the configuration example illustrated inFIG.3, field device group10includes a remote input/output (IO) device12, a relay group14, an image sensor18, a camera20, a servo driver22, and a servomotor24.

Remote IO device12includes a communication unit that performs communication via field bus2and an input/output unit (hereinafter, also referred to as an “IO unit”) that collects an input value and outputs an output value. An input value and an output value are exchanged between control device100and field via such an IO unit.FIG.3illustrates an example in which a digital signal is exchanged as an input value and an output value via relay group14.

The IO unit may be directly connected to the field bus.FIG.3illustrates an example in which an IO unit16is directly connected to field bus2.

Image sensor18performs image measurement processing such as pattern matching on an image data captured by camera20, and transmits a processing result to control device100.

Servo driver22drives servomotor24in accordance with an output value (for example, a position command or the like) from control device100.

Program development device200provides a development environment of a user program executed by control device100. A user operates program development device200to create the user program to be executed by control device100. Specifically, program development device200provides the development environment (program creation and editing tool, parser, compiler, and the like) of the user program executed by control device100, a function of determining setting parameters (configurations) of control device100and various devices connected to control device100, a function of transmitting the created user program to control device100, a function of correcting and modifying online the user program executed on control device100, and the like.

Program development device200according to the embodiment can not only enhance the reusability in the user program executed by one control device100, but also enhance the reusability between the user programs executed by the plurality of control devices100.

C. Hardware Configuration Example

Next, a description will be made of a hardware configuration example of control device100and program development device200constituting control system1according to the embodiment.

c1: Hardware Configuration Example of Control Device100

FIG.4is a block diagram illustrating a hardware configuration example of control device100constituting control system1according to the embodiment. Referring toFIG.4, control device100includes a processor102such as a central processing unit (CPU) or a micro-processing unit (MPU), a chipset104, a primary storage106, a secondary storage device108, a local network controller110, a universal serial bus (USB) controller112, a memory card interface114, a field bus controller120, an internal bus controller122, and IO units124-1,124-2, and the like.

Processor102reads various programs stored in secondary storage device108, develops the programs in primary storage106, and executes the programs to implement control according to the control target and various processing as described later. Chipset104controls each component with processor102, and thus provides the processing of control device100as a whole.

Secondary storage device108stores an executable user program126(corresponding to a control program) created by program development device200in addition to a system program (not illustrated).

Local network controller110controls data exchange with other devices via local network4. USB controller112controls data exchange with program development device200via USB connection.

A memory card116is attachable to and detachable from memory card interface114, and memory card interface114can write data to memory card116or read various data such as the user program and trace data from memory card116.

Field bus controller120controls data exchange with other devices via field bus2. Internal bus controller122is an interface that exchanges data with IO units124-1,124-2, and the like mounted on control device100.

AlthoughFIG.4illustrates the configuration example in which necessary functions are provided by processor102executing a program code, some or all of these provided functions may be implemented by using a dedicated hardware circuit (for example, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or the like). Alternatively, a main part of control device100may be implemented by using hardware according to a general-purpose architecture (for example, an industrial personal computer based on a general-purpose personal computer).

c2: Hardware Configuration Example of Program Development Device200

FIG.5is a block diagram illustrating a hardware configuration example of program development device200constituting control system1according to the embodiment. For example, program development device200may be implemented by executing a program using hardware according to a general-purpose architecture (for example, a general-purpose personal computer).

Referring toFIG.5, program development device200includes a processor202such as a CPU or an MPU, a drive204, a primary storage206, a secondary storage device208, a USB controller212, a local network controller214, an input unit216, and a display unit218. These components are connected via a bus220.

Processor202reads various programs stored in secondary storage device208, develops the programs in primary storage206, and executes the programs to implement various processing as described later.

Secondary storage device208includes, for example, a hard disk drive (HDD), a solid state drive (SSD), or the like. Secondary storage device208stores a development tool250for achieving various functions as described later. Secondary storage device208may store an OS and other necessary system programs.

Drive204can write data to a storage medium205and read various data (user program and various data) from storage medium205. Storage medium205includes, for example, storage medium205(for example, an optical storage medium such as a digital versatile disc (DVD)) that non-transiently stores a computer-readable program.

Development tool250executed by program development device200may be installed via computer-readable storage medium205, or may be installed by being downloaded from a server device or the like on a network. In some cases, a function provided by program development device200according to the embodiment is implemented by using a part of modules provided by the OS.

USB controller212controls data exchange with control device100via USB connection. Local network controller214controls data exchange with other devices via an arbitrary network.

Input unit216includes a keyboard, a mouse, and the like, and receives a user operation. Display unit218includes a display, various indicators, and the like, and outputs processing results and the like from processor202. A printer may be connected to program development device200.

AlthoughFIG.5illustrates the configuration example in which necessary functions are provided by processor202executing the program code, some or all of these provided functions may be implemented by using a dedicated hardware circuit (for example, ASIC or FPGA).

D. Design and Consistency Evaluation of User Programming

Next, a description will be made of a design example and consistency evaluation of the user program according to the modular programming of the embodiment.

d1: Overall Processing Procedure

FIG.6is a flowchart illustrating an overall processing procedure of the modular programming according to the embodiment. Referring toFIG.6, the user operates program development device200to define a variable to be used in the user program to be created (step S2). Then, the user operates program development device200to create the user program (step S4).

The processing of steps S2and S4is repeatedly executed until the creation of the user program is completed (NO in step S6).

When the creation of the user program is completed (YES in step S6), the user executes consistency evaluation for the created user program (step S8). When the consistency is not satisfied (NO in step S10), the user reviews the definitions of the user program and the variable (step S12). Then, the user executes the processing of step S8and subsequent steps again.

When the consistency is satisfied (YES in step S10), the user builds the created user program and transfers the user program to control device100(step S14). Then, the processing of creating the user program is completed.

d2: Design Example of Project50

FIG.7is a diagram illustrating an example of project50created in the modular programming according to the embodiment. Project50illustrated inFIG.7includes two modules (a parent module70(parent) and a child module80(child)) having a calling relationship (parent-child relationship). Parent module70includes an instruction to receive an input signal from an input unit A and activate child module80. Child module80includes an instruction to receive an activation instruction from parent module70, execute processing, and then output a processing result to an output unit. As described above, the user program includes a plurality of programs having a calling relationship.

Two variables “Child_REQ” and “Child_ACK” that can be referred to by both parent module70and child module80are defined in inter-program I/F58. These variables are used in transfers72and82for activation and termination from parent module70to child module80.

Further, a variable “InA_Bit00” indicating the input signal of input unit A is defined in IO-program I/F56of parent module70, and a variable “InB_Bit00” indicating an input signal of an input unit B and a variable “Out_Bit00” indicating an output signal of the output unit are defined in IO-program I/F56of child module80.

FIG.8is a diagram illustrating an example in which some errors are included in project50illustrated inFIG.7. In project50illustrated inFIG.8, project50illustrated inFIG.7should be originally created, but it is assumed that the following two errors are included.

In parent module70, an instruction71referring to variable “Child_ACK” should be included in the program, but is not described. As a result, variable “Child_ACK” defined in inter-program I/F58is not referred to ((1) no reference).

Variable “InA_Bit00” of input unit A defined in IO-program I/F56should be referred to only by parent module70, but includes an instruction81referred to by child module80. As a result, variable “InA_Bit00” defined in IO-program I/F56is referred to by a module different from the original module ((2) reference from outside of definition).

As described above, project50illustrated inFIG.8fails to comply with rules for IO-program I/F56and inter-program I/F58.

The modular programming according to the embodiment can evaluate consistency with the rules for IO-program I/F56and inter-program IF58.

By setting attributes and consistency evaluation for the variables as described above, it is possible to achieve a new mechanism capable of improving design efficiency and reusability of the user program.

d3: Global Variable Definition90

FIG.9is a diagram illustrating an example of a global variable definition90used in the modular programming according to the embodiment. Global variable definition90illustrated inFIG.9may be created by a definition operation by the user illustrated in step S2inFIG.6. That is, program development device200executes processing of receiving setting of an attribute related to reference from a program for each of the variables used in the user program including the plurality of programs having a calling relationship (parent module70and child module80).

Referring toFIG.9, global variable definition90includes a variable definition section93including a variable name91designating a variable name of each global variable and a data type92defining a corresponding data type, an IO unit assignment definition section94indicating a correspondence between each global variable and IO unit, and a reference module section96defining a module of a reference destination. Global variable definition90may further include a comment section95that stores a (arbitrary) comment for each global variable.

As described above, in global variable definition90, a program to be used (referred to) is set for each variable. In global variable definition90, whether each global variable belongs to IO-program I/F56or inter-program I/F58is determined in accordance with the setting of a reference source program (that is, the presence or absence of modules and the number of modules defined in reference module section96in association with each global variable).

Referring toFIG.9, program development device200executes processing of receiving setting of an attribute related to reference from a program for each of one or more variables used in the user program including the plurality of programs having a calling relationship. The variable belonging to IO-program I/F56has an attribute of being referred to by any one of the programs. The variable belonging to inter-program I/F58has an attribute of being referred to by all of the plurality of related programs.

d4: Consistency Evaluation

Program development device200analyzes the user program and evaluates consistency based on the set attribute (attribute to either IO-program I/F56or inter-program I/F58) related to reference from the program for each variable included in the user program. As an example of the consistency evaluation of the user program based on global variable definition90, processing of analyzing a variable use status for each module will be described.

FIG.10is a flowchart illustrating a processing procedure of the consistency evaluation in the modular programming according to the embodiment. Typically, each step illustrated inFIG.10is implemented by processor202of program development device200executing development tool250. That is, development tool250is a program for providing program development device200for providing the development environment of the user program executed by control device100. Then, program development device200analyzes the user program and executes processing as described below for evaluating consistency based on the set attribute related to reference from the program for each of the variables.

Referring toFIG.10, program development device200extracts a module name to be analyzed with reference to global variable definition90illustrated inFIG.9(step S100). Program development device200sets a program having any extracted module name as a search target (step S102). Program development device200reads one line of the program set as the search target (step S104), and determines whether any variable is used (step S106). When any variable is used (YES in step S106), a variable name, a use location, an input/output type, an application, and the like of the variable being used are extracted (step S108). Each piece of extracted information is output as a per-module variable use status (seeFIG.11described later). When no variable is used (NO in step S106), the processing in step S108is skipped.

Program development device200determines whether the last line of the program as the search target has been reached (step S110). When the last line of the program as the search target has not been reached (NO in step S110), program development device200reads the next one line of the program set as the search target (step S112), and executes the processing of step S106and subsequent steps again.

When the last line of the program as the search target has been reached (YES in step S110), program development device200determines whether search processing has been completed for all the programs having the extracted module name (step S114). When there is a program for which the search processing is not completed among the programs having the extracted module name (NO in step S114), program development device200sets, as a new search target, the program for which the search processing is not completed (step S116). Then, program development device200executes the processing of step S102and subsequent steps again.

When the search processing has been completed for all the programs having the extracted module name (YES in step S114), program development device200executes the processing of step S120and subsequent steps.

FIG.11is a diagram illustrating an example of a per-module variable use status350generated by the processing of the consistency evaluation illustrated inFIG.10. Referring toFIG.11, per-module variable use status350includes a list of global variables used in the program included in a target module.

Specifically, per-module variable use status350includes a module name351indicating a module in which the corresponding variable is used, a variable name352of the variable being used, a use location353of the corresponding variable, an input/output type354of the corresponding variable, an application355of the corresponding variable, and a non-definition use356that stores a flag indicating that the corresponding variable is used in a module other than the defined module.

In use location353, the use location of the corresponding variable is specified using a step number of the corresponding program or the like. Input/output type354indicates whether a corresponding variable is used as a contact (input variable) or a corresponding variable is used as a coil (output variable).

Note that, in step S108inFIG.10, the same variable may be extracted from the same program a plurality of times. However, the same variable extracted a plurality of times is merged, and the same variable is not redundantly registered in per-module variable use status350for the same program. Among the variables extracted in step S108inFIG.10, variables having no corresponding module name may be deleted.

Processing of step S120and subsequent steps illustrated inFIG.10is executed with reference to per-module variable use status350as illustrated inFIG.11. Referring toFIG.10again, program development device200deletes the variables included in global variable definition90(FIG.9) for which a module of a corresponding reference destination (reference module section96) is not defined, and generates a target global variable definition90A including only the variables to be subjected to the consistency evaluation (step S120).

FIG.12is a diagram illustrating an example of target global variable definition90A generated in the modular programming according to the embodiment. Referring toFIG.12, target global variable definition90A includes only the global variable associated with the reference module. In target global variable definition90A, a flag for evaluating the presence or absence of use can be set for each module that refers to each global variable (reference module section97).

Next, processing is executed in which per-module variable use status350illustrated inFIG.11is compared with target global variable definition90A illustrated inFIG.12and coincidence and difference are evaluated.

Specifically, program development device200reads the first entry in per-module variable use status350(FIG.11) (step S122), and searches for an entry having same variable name91included in target global variable definition90A using variable name352of the read entry as a key (step S124). Then, in the searched entry of target global variable definition90A, a flag (reference module section97inFIG.12) indicating that the same module name as module name351of the read entry is used is set (step S126).

Subsequently, program development device200determines whether read module name351is included in reference module section97in the entry of target global variable definition90A corresponding to variable name352of the read entry (step S128). When read module name351is not included in reference module section97(NO in step S128), program development device200sets a flag (non-definition use356inFIG.11) indicating that the variation is used in a module outside of definition for the read entry (step S130). On the other hand, when read module name351is included in reference module section97(YES in step S128), program development device200skips the processing of step S130.

That is, in steps S128and S130, when module name351of per-module variable use status350is included in reference module section97of target global variable definition90A for the variable of interest, it is determined that the variable of interest is appropriately used. On the other hand, when module name351of per-module variable use status350is not included in reference module section97of target global variable definition90A, it is determined that the variable of interest is incorrectly used (used in an undefined module). As described above, the consistency evaluation includes determination as to whether the variable belonging to IO-program I/F56is referred by a program different from the reference source program.

Program development device200determines whether the processing has been completed up to the last entry of per-module variable use status350(step S132). When the processing has not been completed up to the last entry of per-module variable use state350(NO in step S132), program development device200reads the next entry of per-module variable use status350(FIG.11) (step S134), and executes the processing of step S124and subsequent steps again.

When the processing has been completed up to the last entry of per-module variable use status350(YES in step S132), program development device200extracts a variable for which a flag has not been set in reference module section97of target global variable definition90A as a variable that has not been used (step S136), and displays a result of the consistency evaluation on the basis of per-module variable use status350and target global variable definition90A (step S138). As described above, the consistency evaluation includes determination as to whether the variable belonging to inter-program I/F58is referred to by all of the associated programs.

Then, the processing of the consistency evaluation ends. Note that processing for correcting the user program in any manner may be executed on the basis of the result of the consistency evaluation.

d5: Example of Result of Consistency Evaluation

Program development device200has a function of presenting the result of the consistency evaluation as described above.

FIG.13is a schematic diagram illustrating an example of a result of the consistency evaluation provided by program development device200according to the embodiment. Referring toFIG.13, a result display screen300indicates the result of the consistency evaluation of the variable use status for each module based on per-module variable use status350(FIG.11).

Result display screen300includes a used variable list310indicating appropriately used variables and an unused variable list320indicating unused variables.

Used variable list310includes a module name311indicating the target module, a variable name312indicating the target variable, a data type313indicating the data type of the target variable, IO unit assignment314indicating the correspondence between the target variable and the IO unit, a comment315(optional) on the target variable, an application316of the target variable, and an evaluation result317indicating the result of the consistency evaluation on the target.

In evaluation result317, an error message318such as “use not in module definition” is displayed in association with a variable used in a module other than a module defined as a use destination (variable for which a flag is set in non-definition use356of per-module variable use status350).

Similarly, unused variable list320includes a module name321indicating the target module, a variable name322indicating the target variable, a data type323indicating the data type of the target variable, IO unit assignment324indicating the correspondence between the target variable and the IO unit, a comment325(optional) on the target variable, an application326of the target variable, and an evaluation result327indicating the result of the consistency evaluation on the target. Since the target variable is unused, a valid value cannot be set for IO unit assignment324and application326.

In evaluation result327, an error message328such as “not used in defined module” is displayed in association with the variable not used in the defined module (variable for which a flag of reference module section97of target global variable definition90A is not set).

By presenting an example of a result the consistency evaluation as illustrated inFIG.13to the user, it is possible to easily identify a variable that does not conform to a rule for a predetermined variable.

FIG.14is a schematic diagram illustrating another example of the result of the consistency evaluation provided by program development device200according to the embodiment. Referring toFIG.14, result display screen330shows a result the consistency evaluation of the use status for each variable based on target global variable definition90A (FIG.12).

Result display screen330includes a used variable list340corresponding to target global variable definition90A (FIG.12).

Used variable list340includes a variable name341indicating the target variable, a data type342indicating the data type of the target variable, IO unit assignment343indicating the correspondence between the target variable and the IO unit, a comment344(optional) on the target variable, a per-module use state345indicating a use state of the target variable in the module, and an evaluation result348indicating the result of the consistency evaluation on the target.

Per-module use state345includes a definition346indicating the presence or absence of a definition of use in each module and a use347indicating whether the variable is actually used in each module. In definition346, an evaluation mark is displayed when use of the target variable is defined in the corresponding module. Furthermore, in use347, information indicating in what configuration the target variable in the corresponding module is used is displayed. [R] is displayed when the corresponding variable is used as a contact (input variable), and [W] is displayed when the corresponding variable is used as a coil (output variable). That is, program development device200presents which type (input/output) of input and output each variable is used in the user program.

In per-module use state345, a variable that does not conform to a predetermined rule for the use of variables is coordinately displayed in a display mode different from the other variables. The example illustrated inFIG.14shows that variables “InA_Bit00” and “Child_ACK” do not conform to the rule for use.

In evaluation result348, details that do not conform to the rule are displayed. In the example illustrated inFIG.14, error messages such as “use not in module definition” and “access to units in a plurality of modules” are displayed in association with variable “InA_Bit00”. Further, an error message such as “not used in defined module” is displayed in association with variable “Child_ACK”.

As described above, program development device200displays the variable evaluated as not satisfying the consistency in the consistency evaluation in a mode different from other variables.

By presenting an example of a result the consistency evaluation as illustrated inFIG.14to the user, it is possible to easily identify a variable that does not conform to a rule for a predetermined variable.

E. Modification

The above description has been given focusing on IO-program I/F56that defines the global variable referred to for the access from each program to the IO unit and inter-program I/F58that defines the global variable accessible between the programs. Inter-program I/F58only defines that the global variable can be referred between programs (modules), but may further set an attribute (or rule) of the global variable that can be referred between programs (modules) in consideration of the calling relationship (parent-child relationship) between the programs (modules).

FIG.15is a diagram illustrating an example of an inter-module interface in a modular programming according to a modification of the embodiment. Referring toFIG.15(A), it is assumed that a parent-child relationship calling two child modules80A and80B (child) from parent module70(parent) is set. For such three modules, there may be three types of inter-module interfaces, which are a relationship between parent module70and child module80A, a relationship between parent module70and child module80B, and a relationship between child module80A and child module80B.

By using such information on the parent-child relationship between modules, consistency may be evaluated as to whether there is a variable as an inter-module interface other than the parent-child relationship.

For example, as illustrated inFIG.15(B), IF_Parent_Child1 can be defined as an inter-module interface between parent module70and child module80A, IF_Parent_Child2 can be defined as an inter-module interface between parent module70and child module80B, and IF_Child1_Child2 can be defined as an inter-module interface between child module80A and child module80B.

That is, by enabling definition of the variable belonging to the interface between child modules called IF_Child1_Child2 with reference to the parent-child relationship between modules, consistency of reference of variable between the child modules can be evaluated. Then, it is possible to notify the user of such a variable that does not match the attribute (or rule) of the variable.

Whether to define a relationship other than the parent-child relationship between modules (that is, the interface between the child modules) may depend on a rule of module design of the user. In this case, the user may arbitrarily select (that is, switch between valid and invalid) whether to define a relationship other than the parent-child relationship between the modules.

F. Appendix

The above embodiment includes the following technical ideas.

Configuration 1

A program development device (200) configured to provide a development environment of a user program executed by a control device (100), the program development device including:a setting means (90; S2) configured to receive setting of an attribute 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 that have a calling relationship, the attribute to be set including a first attribute (56) referred to by any one of the first program and the second program and a second attribute (58) referred to by both the first program and the second program; andan evaluation means (S100to S138) configured to analyze the user program and evaluate, for each of the one or plurality of variables, consistency based on the attribute having been set and related to reference from the program.

Configuration 2

The program development device according to Configuration 1, wherein evaluation of consistency by the evaluation means includes whether a variable in which the first attribute is set is referred to by a program different from a reference source program.

Configuration 3

The program development device according to Configuration 1 or 2, wherein the evaluation of consistency by the evaluation means includes whether a variable in which the second attribute is set is referred to by both the first program and the second program.

Configuration 4

The program development device according to any one of Configurations 1 to 3, further including a result presentation means (300;330) configured to present an evaluation result of consistency by the evaluation means.

Configuration 5

The program development device according to Configuration 4, wherein the result presentation means displays the variable evaluated as not satisfying consistency by the evaluation means in a mode different from other variables.

Configuration 6

The program development device according to Configuration 4 or 5, wherein the result presentation means presents which type of input or output each of the one or plurality of variables is used in the user program.

Configuration 7

The program development device according to any one of Configurations 1 to 6, wherein the variable in which the first attribute is set is associated with a specific IO unit.

Configuration 8

The program development device according to any one of Configurations 1 to 5, wherein the setting means receives setting of a program to be used for each of the one or plurality of variables.

Configuration 9

The program development device according to any one of Configurations 1 to 8, wherein each of the first program and the second program, including a variable to be used and the attribute set for the variable, is modularized.

Configuration 10

A program (250) configured to provide a program development device (200) providing a development environment of a user program executed by a control device (100), the program causing a computer to perform:receiving setting of an attribute 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 that have a calling relationship (S2), the attribute to be set including a first attribute (56) referred to by any one of the first program and the second program and a second attribute (58) referred to by both the first program and the second program; andanalyzing the user program and evaluating, for each of the one or plurality of variables, consistency based on the attribute having been set and related to reference from the program (S100to S138).

G. Advantages

In the modular programming according to the embodiment, whether the variable used in the user program belongs to I/O-program I/F56(referred to by any one of the programs) or the variable belongs to inter-program I/F58(referred to by any of the plurality of related programs) can be clearly defined. Thus, whether the use mode is adapted to the defined rule can be evaluated, and a part of the use mode not adapted can be easily corrected.

As a result, high-quality modular programming can be realized, and the design efficiency and reusability of the user program executed by control device100can be improved.

It should be understood that the embodiment disclosed herein is illustrative in all respects and not restrictive. The scope of the present invention is defined not by the above description but by the claims, and is intended to include meanings equivalent to the claims and all modifications within the scope.

REFERENCE SIGNS LIST

1: control system,2: field bus,4: local network,10: field device group,12: remote IO device,14: relay group,16,124: IO unit,18: image sensor,20: camera,22: servo driver,24: servomotor,50: project,52,126: user program,53: device program,54,346: definition,55: IO unit setting,56: IO-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 module,70: parent module,71,81: instruction,72,82: transfer,80,80A,80B: child module,90A: target global variable definition,91,312,322,341,352: variable name,92,313,323,342: data type,93: variable definition section,94: assignment definition section,95: comment section,96,97: reference module section,100: control device,102,202: processor,104: chipset,106,206: primary storage,108,208: secondary storage,110,214: local network controller,112,212: USB controller,114: memory card interface,116: memory card,120: field bus controller,122: internal bus controller,200: program development device,204: drive,205: storage medium,216: input unit,218: display unit,220: bus,250: development tool,300,330: result display screen,310,340: used variable list,311,321,351: module name,314,324,343: assignment,315,325,344: comment,316,326,355: application,317,327,348: evaluation result,318,328: error message,320: unused variable list,345: per-module use state,347: use,350: per-module variable use status,353: use location,354: type,356: non-definition use,531,536: program,532,534,537: function program,533,535,538: function block,539: local variable definition.