Abstract:
A sequence program editing apparatus that automatically performs editing of function block instances in a sequence program when a definition of a function block is modified. When a function block definition defining the number of parameters or attributes of parameters is modified, the sequence program is searched to find a function block instance using the function block of which definition is modified. The found function block instance is altered so that the number of parameters or attributes of parameters conform with the modified definition of the function block.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to a sequence program editing apparatus capable of investigating statuses of function block instances used in a sequence program when a definition of a function block is modified, and -particularly to a sequence program editing apparatus capable of automatically checking conformity of the function block instance with the modified definition of the function block and re-assigning arguments of input and output parameters. 
         [0003]    2. Description of Related Art 
         [0004]    There is known a technique of creating and using function blocks by object-orientated programming languages. However, it has been hardly possible to automatically editing a function block instance when a definition of a function block is modified (see JP 2001-51704A). 
       SUMMARY OF THE INVENTION 
       [0005]    The present invention provides a sequence program editing apparatus in which efficiency of an editing operation of a sequence program is improved when modifying a definition of a function block. 
         [0006]    A sequence program editing apparatus of the present invention edits a sequence program including function blocks. The sequence program editing apparatus comprises: inputting means that allows an operator to input data for modifying a definition of a function block in the sequence program; searching means that searches the sequence program to find a function block instance using the function block of which definition is modified; and altering means that alters the found function block instance so that the number of parameters or attributes of parameters conform with the modified definition of the function block. 
         [0007]    The altering means may discriminate parameters unchanged by the modification of definition of the function block and reassign attributes of the unchanged parameters to the altered function block instance. 
         [0008]    The sequence program editing apparatus may further comprise display means that displays a position of a parameter changed or added by the modification of definition of the function block or a position of an attribute of the changed or added parameter in the altered function block instance distinctively from unchanged parameters. 
         [0009]    The searching means and the altering means may be automatically operated when the definition of the function block is modified. 
         [0010]    According to the present invention, when a function block of which definition has been modified is designated, the sequence program is automatically searched to find a function block instance using the function block, the found function block instance is deleted and the modified definition of the function block is re-instanced to save manual re-input of data by an operator. An operator is only required to input data of the parameters of which the number or variable types are changed and thus attributes of the parameters can not be reassigned, to thus perform editing of the sequence program efficiently. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0011]      FIG. 1  is a block diagram of a sequence program editing apparatus according to an embodiment of the present invention; 
           [0012]      FIG. 2  is a schematic view of a frame on a display device showing components of a function block; 
           [0013]      FIG. 3  is a schematic view showing a function block; 
           [0014]      FIG. 4  is a schematic view showing a function block instance; 
           [0015]      FIG. 5  is a schematic view of a function block defining and editing frame in which an input parameter of a symbol name New and a data type BYTE is added; 
           [0016]      FIG. 6  is a schematic diagram showing an example of searching the sequence program to find a function block instance using the function block of which definition is modified; 
           [0017]      FIG. 7  is a diagram showing examples of tables for determining conformity before and after modification; 
           [0018]      FIG. 8  is a diagram showing an example of storing arguments of an input part and an output part of the found function block instance; 
           [0019]      FIG. 9  is a diagram showing an example of deleting the found function block instance; 
           [0020]      FIG. 10  is a diagram showing an example of re-instancing of the modified function block definition; 
           [0021]      FIG. 11  is a diagram showing an example of re-assigning of arguments of the input part and the output part for the parameters of which data types, symbol names and variable types are not changed or added; 
           [0022]      FIG. 12  is a diagram showing an example of displaying a position of the changed or added parameter or an attribute thereof distinctively; 
           [0023]      FIG. 13  is a flowchart showing the re-instancing process; and 
           [0024]      FIG. 14  is a continuation of flowchart of  FIG. 13 . 
       
    
    
     DETAILED DESCRIPTION 
       [0025]      FIG. 1  shows a sequence program editing apparatus  1  according to an embodiment of the present embodiment. A processor (CPU)  2  is connected to a ROM  3 , a RAM  4 , a hard disc  5 , a keyboard interface  6 , a display interface  7  and a communication interface  8  through a bus BS. The processor  2  controls the sequence program editing deice  1  according to a system program stored in the ROM  3 . A program for editing a sequence program according to the present invention is stored in the ROM  3 . The RAM  4  is used for temporary storage of data, and sequence programs are stored in the hard disc  5 . A keyboard  9  is connected to the keyboard interface  6 , and a display  10  such as a CRT and a LCD is connected to the display interface  7 . The communication interface  8  is connected to a programmable controller  11  which controls I/O devices  12 . 
         [0026]      FIG. 2  shows a flame on the display  10  in which components for definition of a function block are displayed. A reference numeral  13  denotes a name of a function block to be defined. A reference numeral  14  denotes information such as parameters and internal variables to be used in the definition. In  FIG. 2 , a function block FB comprises variables of input parameters In 1  and In 2 , an input/output parameter InOut and output parameters Out 1  and Out 2 . A reference numeral  15  denotes a sequence program. The function flock FB is shown by a ladder diagram as the sequence program  15 . “BOO1” indicates a bit data type and “SINT/DINT” indicates an integer data type. 
         [0027]      FIG. 3  shows a diagram of the function block having input parameters and output parameters created based on the ladder diagram as shown in  FIG. 2 . 
         [0028]      FIG. 4  shows a diagram of a sequence program including a function block instance using the function block definition. A reference numeral  16  denotes an input part, a reference numeral  17  denotes a function block instance name “FB — 001”, and a reference numeral  18  denotes an output part. “R9091.1” and “D0100” denote PC (programmable controller) addresses, and the former is of a bit type having a decimal point and the latter is of a byte type. 
         [0029]    The sequence program is executed from the left-hand to the right-hand and from the upper portion to the lower portion as follows; 
         [0030]    (1) Transferring of arguments of the input part to the input parameters: 
         [0031]    Contents of R9091.1 are transferred to the input parameter In 1 , Contents of D0100 are transferred to the input parameter In 2 , and Contents of R0100.0 are transferred to the input/output parameter InOut 
         [0032]    (2) Processing in FB — 0001 
         [0033]    (3) Transferring of contents of the output parameters to arguments of the output part: 
         [0034]    Contents of the output parameter Out 1  are transferred to D0200, 
         [0035]    Contents of the output parameter Out 2  are transferred to R0300.0, and 
         [0036]    Contents of the input/output parameter InOut are transferred to R0300.1. 
         [0037]      FIG. 5  shows an example of a function block definition/editing frame on the display  10  in which a new parameter is added. An input parameter  19  having the arranging order “3”, the symbol name “New” and the data type “BYTE” is newly added to definition of the function block FB. 
         [0038]      FIG. 6  shows an example of a sequence program searched to find a function block instance in the re-instancing process. A block surrounded by the dotted line shows a found function block instance  20 . When the definition of the function block is modified, the name of the function block whose definition is modified is notified from the function block definition editing process to the re-instancing process. The re-instancing process receives the definition name of the function block and searches the sequence program to find a function block instance using the function block definition. 
         [0039]      FIG. 7  shows tables A, B and C created when a function block instance having the function block whose definition has been modified is found. These tables are stored in the RAM  4  shown in  FIG. 1 . The table A is prepared as a parameter list before the modification of definition based on the found function block instance. The table B is prepared as a list of parameters after the modification of definition based on the modified definition of the function block. The table C is prepared by checking conformity of data in the table A and the table B, and determining arguments of the input part and the output part for which parameters have not changed after the modification of the definition of the function block to be re-assignable. Thus, arguments of the input parameter of the symbol name “New” and variable type “BYTE” which has been added in the modification of definition are determined to be not re-assignable. 
         [0040]    Using the tables A, B, C as shown in  FIG. 7 , the procedure of re-instancing of the function block definition will be described. 
         [0041]      FIG. 8  shows storing of arguments of the input part and the output part of the function block instance before the modification.  FIG. 9  shows deletion of the function block instance using the function block definition before the modification, prior to the re-instancing of the function block definition.  FIG. 10  shows re-instancing of the function block definition.  FIG. 11  shows reassigning of arguments of the input part and the output part corresponding to the parameters whose data types, symbol names and variation types before and after the modification are the same.  FIG. 12  shows a frame on the display  10  in which a position of a parameter  21  or an attribute of the parameter  21  changed or added by the modification of definition is displayed with a different color or displayed to blink distinctively from the unchanged parameters or attributes.thereof. 
         [0042]      FIGS. 13 and 14  are flowcharts showing the re-instancing process to be performed by the CPU  2  in  FIG. 1  when the function block definition is modified. When the re-instancing process is started, the CPU receives a notification of a name of the modified function block definition (Step S 1 ). A search position is set to a head of the whole ladder program (Step S 2 ). A command is obtained from the search position (Step S 3 ). It is determined whether or not it is an function block instance using the function block definition to be found (Step S 4 ). If it is determined NO, the procedure proceeds to Step S 14 . If it is determined YES, a list of parameters before the modification of the function block definition is created from the found function block instance (Step S 5 ). A list of parameters after the modification is created from the modified function block definition (Step S 6 ). The arguments of the found function block instance are stored (Step S 7 ). The found function block instance is deleted (Step S 8 ). The modified function block definition is re-instanced (Step S 9 ). Then, the procedure proceeds to Step S 10 . 
         [0043]    It is determined whether or not a data type, a symbol name and a variable type of each of the parameters has been changed or added after the modification of definition (Step S 10 ). The arguments for the parameters of which data types, symbol names and variable types have not been changed or added are reassigned in an editing buffer (Step S  11 ). It is determined whether or not the function block instance with the reassigned arguments cause an error net (Step S 12 ). If it is determined YES, an input of necessary data is required to an operator (Step S 13 ). If it is determined NO in Step S 12 , it is determined whether the obtained command is a last one or not (Step S 14 ). If it is determined that the command is the last one, the procedure is terminated. If it is determined that the command is not the last one, the search position is advanced by one and the procedure returns to Step 3. 
         [0044]    The determination of an error net at Step S 12  is performed as follows; 
         [0045]    In Step  11 , the arguments for the parameters of which data types, symbol names and variable types are not changed or added after the modification of the function block definition are reassigned in the editing buffer. Thus, according to the table C in  FIG. 7 , the argument for the input parameter “New” newly added by the modification of the definition remains undefined. Therefore, it is determined that the sequence program includes an error net as lack of information since the input parameter can not be omitted. The error net is displayed by red color or thick lines so as to prompt the operator to input necessary information.