WO2020008867A1 - 制御装置および制御方法 - Google Patents

制御装置および制御方法 Download PDF

Info

Publication number
WO2020008867A1
WO2020008867A1 PCT/JP2019/024144 JP2019024144W WO2020008867A1 WO 2020008867 A1 WO2020008867 A1 WO 2020008867A1 JP 2019024144 W JP2019024144 W JP 2019024144W WO 2020008867 A1 WO2020008867 A1 WO 2020008867A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
shared
variable
shared variable
management unit
Prior art date
Application number
PCT/JP2019/024144
Other languages
English (en)
French (fr)
Inventor
航 荒井
Original Assignee
オムロン株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by オムロン株式会社 filed Critical オムロン株式会社
Priority to EP19831238.1A priority Critical patent/EP3819762A4/en
Priority to US16/973,781 priority patent/US11157297B2/en
Priority to CN201980038865.8A priority patent/CN112272821A/zh
Publication of WO2020008867A1 publication Critical patent/WO2020008867A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/056Programming the PLC
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking
    • G06F8/437Type checking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/54Link editing before load time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Definitions

  • the present invention relates to a control device for preventing unintended overwriting of data shared between user programs, and a control method using the control device.
  • Patent Document 1 the following control device is known (see Patent Document 1). That is, when there are a plurality of user programs, data exchange between them is performed via the data storage unit. When exchanging data between programs, a variable name is given to the data, and each user program writes and reads data from the data storage unit using the variable name as a key.
  • none of the above techniques are techniques for preventing unintended overwriting of data due to collision of variable names when a plurality of programs exist.
  • One object of one embodiment of the present invention is to prevent unintended overwriting of data when variable names collide and there are a plurality of programs that define shared variables.
  • a control device includes a program management unit that executes a first user program and a second user program, and a program management unit that executes the first user program and the second user program.
  • a data storage unit that stores data of a shared variable that can be referred to from a storage unit; and a shared variable symbol table that stores an address of the shared variable in the data storage unit. Acquiring an identifier, generating a shared variable name including the variable name of the shared variable defined in the first user program and the identifier, and associating the shared variable name with the address of the shared variable. In addition, it is recorded in the shared variable symbol table.
  • a control method is a method for executing a first user program and a second user program, the method comprising: acquiring an identifier of the first user program; (2) generating a shared variable name including a variable name of the shared variable defined in the first user program that can be referred to from the first user program and the identifier, and associating the shared variable name with the address of the shared variable;
  • the data of the shared variable is recorded in a shared variable symbol table, and the data of the shared variable is stored in an area corresponding to the address in the data storage unit.
  • FIG. 2 is a diagram illustrating details of a shared variable symbol table in FIG. 1.
  • 9 is a flowchart of steps executed by the program management unit of Configuration Example 2 of the program management unit.
  • 9 is a flowchart of steps executed by a program management unit of a configuration example 2 of a program A.
  • 9 is a flowchart of steps executed by the program management unit of Configuration Example 3 of the program management unit.
  • 5 is a flowchart showing each step in the control method according to the first embodiment of the present invention.
  • FIG. 1 is a block diagram schematically illustrating an example of a configuration of a control device according to the present embodiment.
  • the control device 1 according to the present embodiment is a device for preventing, when there are a plurality of user programs that define a shared variable, unintended overwriting of data due to collision of variable names.
  • control device 1 includes a program management unit 11, an auxiliary storage device 12, and a memory 13.
  • the program management unit 11 includes a program A management unit 11a and a program B management unit 11b.
  • the program management unit 11 executes a first user program (hereinafter, referred to as a program A) and a second user program (hereinafter, referred to as a program B).
  • the auxiliary storage device 12 stores the program A and the program B.
  • the memory 13 temporarily stores the program A and the program B.
  • the memory 13 includes a data storage unit 13a and a shared variable symbol table 13b.
  • the data storage unit 13a stores data of shared variables that can be referred to by both the program A and the program B.
  • the shared variable symbol table 13b stores addresses of the shared variables in the data storage unit 13a.
  • the program A management unit 11a generates, for a shared variable defined by the program A, a shared variable name including the variable name of the shared variable and the identifier of the program A.
  • the program A management unit 11a manages the shared variable name and the address in association with the shared variable symbol table. When accessing (reading / writing) the shared variable from the program B, access is performed using the shared variable name.
  • control device of the present embodiment when there are a plurality of programs that define a shared variable, it is possible to prevent the variable names from colliding and accidentally overwriting data.
  • FIG. 1 is a block diagram schematically illustrating an example of a configuration of a control device according to the present embodiment.
  • the control device 1 includes a program management unit 11, an auxiliary storage device 12, and a memory 13.
  • the control device 1 controls the operation of various devices such as a PLC (programmable logic controller).
  • PLC programmable logic controller
  • the program management unit 11 includes a program A management unit 11a and a program B management unit 11b.
  • the program management unit 11 executes the program A and the program B.
  • a configuration in which the program A is executed by the program A management unit 11a and the program B is executed by the program B management unit 11b is exemplified, but this does not limit the present embodiment.
  • the auxiliary storage device 12 stores the program A and the program B. Normally, the program A and the program B are stored in the auxiliary storage device 12.
  • the auxiliary storage device 12 is, for example, a non-volatile memory or a hard disk, but is not limited thereto. By providing the auxiliary storage device 12, data loss can be reliably prevented.
  • the memory 13 temporarily stores the program A and the program B.
  • the memory 13 is, for example, a volatile memory, but is not limited to this.
  • the memory 13 includes a data storage unit 13a and a shared variable symbol table 13b.
  • the data storage unit 13a stores data of shared variables that can be referred to by both the program A and the program B.
  • the shared variable symbol table 13b stores addresses of the shared variables in the data storage unit 13a.
  • a shared variable here refers to a variable that can be referenced from a plurality of user programs.
  • the shared variable symbol table 13b stores storage locations (addresses) of the shared variables stored in the data storage unit 13a.
  • FIG. 2 is a diagram illustrating details of the shared variable symbol table 13b of FIG.
  • the program management unit 11 loads the program A from the auxiliary storage device 12 and stores the program A in the memory 13 upon receiving an instruction to execute the program A from the user.
  • the program A is a compiler-type program.
  • the program A stored in the auxiliary storage device 12 is a program compiled into a machine language.
  • Compiled program A includes a symbol table indicating the correspondence between shared variables and addresses of the shared variables.
  • the non-shared variable is a variable that is used only in the program A and can be referred to only by the program A.
  • the address of the non-shared variable is defined.
  • the information on the variable name of the non-shared variable may not be left. However, even after being compiled, the program A includes the information on the variable name of the shared variable and the information on the address.
  • the program management unit 11 acquires the information on the variable name of the shared variable, the information on the address, and the identifier of the program A.
  • the program management unit 11 generates a shared variable name including the variable name of the shared variable defined in the program A and the identifier.
  • the program management unit 11 records the shared variable name and the address of the shared variable in the shared variable symbol table 13b in association with each other. Further, the program management unit 11 writes the data of the shared variable to the address of the data storage unit 13a.
  • the shared variable name generated by the program management unit 11 includes the variable name of the shared variable and the identifier.
  • the program management unit 11 records the shared variable name and the address of the shared variable in the shared variable symbol table 13b in association with each other.
  • the identifier of the user program is a character string or a numerical value unique to the user program.
  • the identifiers of the plurality of user programs are set so as not to overlap each other. For example, a program name of a user program, a path of a directory where the user program is located, a character string arbitrarily set by a user, a UUID (universally unique identifier), or a domain name may be used as the identifier of the user program.
  • the identifier of the program A is “Press”.
  • the variable name of the shared variable defined in the program A is “status”.
  • the variable name “status” is a variable name defined in the source code of the program A.
  • the program management unit 11 generates a shared variable name “Press.status” of the shared variable by combining the identifier “Press” with the original variable name “status”.
  • the shared variable name “Press.status” is a variable name used as a key when referring to the shared variable from another program B.
  • “.” Is added between the identifier and the variable name, but any character or character string may be used instead. Also, there may be no characters between the identifier and the variable name.
  • the order of the identifier and the variable name is also arbitrary.
  • “Cutter.status” illustrated in FIG. 2 is a shared variable name of a shared variable defined in the program B.
  • the identifier of the program B is “Cutter”.
  • the variable name of the shared variable defined in the program B is “status”.
  • the program management unit 11 generates a shared variable name including an identifier and a variable name according to a predetermined rule. Thereby, even if a plurality of shared variables having the same variable name “status” are defined in a plurality of user programs, it is possible to avoid a collision of the shared variable names.
  • the shared variable names include, for example, Press.status and Cutter.status, and the addresses corresponding to these shared variable names are 0X00000000 and 0X00000001, respectively, but this is not a limitation of the present embodiment.
  • FIG. 3 is a flowchart of the steps executed by the program management unit of Configuration Example 2 of the program management unit.
  • the program B management unit 11b upon receiving an instruction to read or write the shared variable from the program B using the shared variable name as a key, the program B management unit 11b corresponds to the shared variable name from the shared variable symbol table 13b. Obtain the address.
  • the program B management unit 11b reads or writes the shared variable in the data storage unit 13a using the address.
  • step S1 the program B management unit 11b receives an instruction from the program B to read or write the shared variable using the shared variable name as a key. Subsequently, in step S2, the program B management unit 11b acquires the address corresponding to the shared variable name from the shared variable symbol table 13b. Finally, in step S3, the program B management unit 11b reads or writes the shared variable in the data storage unit 13a using the address.
  • the program B management unit 11b can read or write the shared variables in the data storage unit 13a that have already been generated by the program A.
  • the configuration example 1 of the program A described above will be described in detail.
  • the program A is, for example, compiled into a machine language.
  • the program A includes the information on the variable name and the information on the address of the shared variable even after being compiled into a machine language.
  • the program A management unit 11a acquires the variable name and the address of the shared variable from the program A.
  • the program A management unit 11a that executes the program A can read or write the shared variable in the data storage unit 13a using the obtained address.
  • the program A includes a program using a ladder language, a C language, or the like, but this does not limit the present embodiment.
  • the ladder language is a programming language suitable for the case where the control device 1 controls the operation of a machine tool or a production device.
  • the program A management unit 11a acquires the symbol table and the identifier of the program A from the program A.
  • the program A management unit 11a assigns the identifier to the variable name of the shared variable to generate a shared variable name.
  • the program A management unit 11a records the shared variable name and the address in the shared variable symbol table 13b in association with each other.
  • the program A management unit 11a executes the program A.
  • the program A management unit 11a receives a data write instruction from the program A using the address as a key.
  • the program A management unit 11a writes data in the memory 13 using the address as a key.
  • the generation of the shared variable name is performed when the program A is loaded.
  • the program A management unit 11a can acquire the variable name and the address of the shared variable from the program A.
  • a production apparatus is controlled by a program A in a ladder language and data processing is performed by a program B in a Java language.
  • the program A obtains data (such as sensing information) on a production line from a production device or a sensor.
  • the program A causes the data storage unit 13a to record the obtained data as a shared variable.
  • the program B reads the shared variables recorded by the program A, and performs statistical processing using, for example, sensing information.
  • a ladder language is a programming language suitable for control
  • a general-purpose programming language such as Java is a programming language suitable for information processing. As described above, it is possible to perform appropriate processing on common data using different programming languages.
  • the existing program A and the program B may be replaced with the program management unit 11 and the program B according to the present embodiment while the existing program A is continuously executed (the production apparatus is continuously operated).
  • the existing control device can be used as the control device of the present embodiment that can avoid collision of shared variable names.
  • FIG. 4 is a flowchart of steps executed by the program A management unit 11a of the configuration example 2 of the program A.
  • the program A is, for example, an interpreter-type program.
  • the program A includes information on the variable name of the shared variable.
  • the program A management unit 11a functions as an interpreter of the program A.
  • step S4 in FIG. 4 when the program A management unit 11a acquires the variable name and the identifier of the shared variable from the program A, the program A management unit 11a generates the shared variable name. Subsequently, in step S5, the program A management unit 11a determines whether a shared variable name is recorded. When the shared variable name is already recorded in the shared variable symbol table 13b (YES in S5), the program A management unit 11a acquires the address of the shared variable (Step S6). On the other hand, if the shared variable name is not recorded in the shared variable symbol table 13b (NO in S5), the program A management unit 11a determines the address to be assigned to the shared variable (Step S7). The program A management unit 11a records the determined address and the shared variable name in the shared variable symbol table 13b in association with each other.
  • examples of the interpreter-type program include a program using a programming language such as Java (registered trademark), JavaScript (registered trademark), and Python.
  • Java registered trademark
  • JavaScript registered trademark
  • Python Python
  • the user program is a Java program
  • the user program stored in the auxiliary storage device 12 is compiled into an intermediate code, and the program A management unit 11a interprets and executes the user program as the intermediate code. Function as a Java virtual machine.
  • the program A management unit 11a acquires the identifier of the program A from the program A. Further, the program A management unit 11a executes the program A. Then, the program A management unit 11a receives a data write instruction using the variable name as a key. Subsequently, the program A management unit 11a adds the identifier of the program A to the variable name of the shared variable to generate a shared variable name. Then, the program A management unit 11a refers to the shared variable symbol table 13b and determines whether or not the shared variable has been defined. If the shared variable is undefined, an address is determined and the address is assigned to the shared variable. The program A management unit 11a records the determined address and the shared variable name in the shared variable symbol table 13b in association with each other.
  • the assigned address is obtained from the shared variable symbol table 13b.
  • the program A management unit 11a writes data in the data storage unit 13a using the address as a key.
  • the program A management unit 11a determines whether or not it is a shared variable at the time of execution. Whether a variable used in the program A is a shared variable or a non-shared variable is defined in the program A. For example, in the program A, whether a variable is a shared variable or a non-shared variable is defined by designating the variable as shared or non-shared.
  • the program A management unit 11a generates a shared variable name when the program A is executed.
  • the program management unit 11 can prevent the shared variables from being duplicated and appropriately manage the shared variables.
  • the program A management unit 11a may provide an API function (application @ program @ interface) for writing to a shared variable.
  • writing to the shared variable “status” may be described as “write (“ status ”,“ OK ”)” using the API function “write”.
  • the program A passes the variable name “status” of the shared variable as a key to the program A management unit 11a.
  • the program A described above includes information on the identifier, and the program A management unit 11a acquires the identifier from the program A.
  • the program A management unit 11a may acquire the identifier from a setting file.
  • a setting file defining the identifier of the program A may be stored in a predetermined directory.
  • FIG. 5 is a flowchart of the steps executed by the program management unit of Configuration Example 3 of the program management unit.
  • the program B is an interpreter-type program.
  • the program A is executed first, and the shared variable names and addresses of the shared variables defined in the program A are recorded in the shared variable symbol table 13b.
  • the program B management unit 11b executes the program B in step S8.
  • the program B management unit 11b creates a non-shared symbol table that records non-shared variables defined in the program B and addresses of the non-shared variables.
  • the non-shared symbol table is created separately for each user program to be executed.
  • step S10 the program B management unit 11b determines whether a variable name is recorded.
  • the program B management unit 11b determines that the variable is a non-shared variable (S10).
  • Step S11 the program B management unit 11b determines that the variable is a shared variable.
  • the program B management unit 11b determines whether the variable is a non-shared variable according to whether the variable name of the variable referred to in the program B is recorded in the non-shared symbol table. Whether the variable is a shared variable can be appropriately determined. For example, even if the shared variable name “Press.status” of the shared variable defined in the program A and the variable name of the non-shared variable referred to in the program B coincide with each other, the non-shared variable of the program B is It is possible to prevent erroneous determination of the shared variable.
  • the program B is a compiler type program.
  • the program A is executed first, and the shared variable names and addresses of the shared variables defined in the program A are recorded in the shared variable symbol table 13b.
  • the program B management unit 11b that executes the program B provides an API function for reading a shared variable.
  • the reference (reading) of the shared variable “Press.status” may be described as “read (“ Press.status ”)” using the API function “read”.
  • the program B passes the shared variable name “Press.status” of the shared variable as a key to the program B management unit 11b via an API function.
  • the program B management unit 11b acquires a corresponding address from the shared variable symbol table.
  • the program B management unit 11b acquires the data of the shared variable from the data storage unit 13a using the address as a key.
  • the program B management unit 11b returns the data of the shared variable to the program B.
  • compiler-type user programs are converted into machine language. Therefore, the variable names specified in the source file have been converted to addresses and do not remain.
  • the shared variable name in the compiled program B remains as a key by using the API that refers to the shared variable.
  • the program A and the program B may be configured in different programming languages. According to the above aspect, the variables can be shared between the program A and the program B which are configured in different programming languages.
  • the program A and the program B may be configured in the same programming language.
  • the identifier may include a path of the program A.
  • the user prescribes a path of a directory in which the program A is to be arranged in the program A.
  • the program A itself executed by the program A management unit 11a may acquire the path of the program A.
  • the identifier may include a file name of the program A. Like the path, the file name may be defined in the program A, or the program A itself executed by the program A management unit 11a may acquire the file name of the program A.
  • the identifier may include a path and a file name of the program A.
  • the identifier may include a character string arbitrarily set by a user, a universally unique identifier (UUID), and / or a domain name.
  • the domain name is a domain name (for example, omron.co.jp or jp.co.omron) owned by the provider (providing company) of the user program.
  • FIG. 6 is a flowchart showing each step in the control method according to the present embodiment.
  • the program A management unit 11a acquires the identifier of the program A.
  • the program A management unit 11a generates a shared variable name that can be referred to by the program B and includes the variable name of the shared variable defined in the program A and the identifier.
  • the program A management unit 11a records the shared variable name and the address of the shared variable in the shared variable symbol table 13b in association with each other.
  • step S16 the program A management unit 11a stores the data of the shared variable in an area of the data storage unit 13a corresponding to the address.
  • control block (particularly, the program management unit 11) of the control device 1 may be realized by a logic circuit (hardware) formed on an integrated circuit (IC chip) or the like, or may be realized by software.
  • the control device 1 includes a computer that executes instructions of a program that is software for realizing each function.
  • This computer includes, for example, one or more processors and a computer-readable recording medium storing the above-described program. Then, in the computer, the object of the present invention is achieved when the processor reads the program from the recording medium and executes the program.
  • the processor for example, a CPU (Central Processing Unit) can be used.
  • the recording medium include a “temporary tangible medium” such as a ROM (Read Only Memory), a tape, a disk, a card, a semiconductor memory, and a programmable logic circuit. Further, a RAM (Random Access Memory) for expanding the program may be further provided.
  • the program may be supplied to the computer via an arbitrary transmission medium (a communication network, a broadcast wave, or the like) capable of transmitting the program.
  • a transmission medium a communication network, a broadcast wave, or the like
  • one embodiment of the present invention can also be realized in the form of a data signal embedded in a carrier wave, in which the program is embodied by electronic transmission.
  • a control device includes a program management unit that executes a first user program and a second user program, and data of a shared variable that can be referred to by both the first user program and the second user program.
  • a data storage unit for storing, and a shared variable symbol table for storing an address of the shared variable in the data storage unit, wherein the program management unit acquires an identifier of the first user program;
  • a variable name of the shared variable defined in the program and a shared variable name including the identifier are generated, and the shared variable name is associated with the address of the shared variable, and the shared variable symbol table is generated. It is characterized by recording.
  • the program management unit of the control device upon receiving an instruction to read or write the shared variable using the shared variable name as a key from the second user program, the address corresponding to the shared variable name from the shared variable symbol table. And reading or writing the shared variable in the data storage unit using the address.
  • the program management unit can read or write the shared variables in the data storage unit that have already been generated by the program A.
  • the first user program is compiled into a machine language, the first user program includes information on the variable name of the shared variable and information on the address, and the program management unit Acquires the variable name and the address of the shared variable from the first user program.
  • the program management unit can acquire the variable name and the address of the shared variable from the first user program.
  • the first user program is an interpreter-type program
  • the first user program includes information on the variable name of the shared variable
  • the program management unit operates as an interpreter of the first user program. Functioning, the program management unit generates the shared variable name when acquiring the variable name of the shared variable from the first user program, and the shared variable name is recorded in the shared variable symbol table. Acquiring the address of the shared variable, and determining the address to be assigned to the shared variable when the shared variable name is not recorded in the shared variable symbol table.
  • the program management unit can prevent duplication of the shared variables and appropriately manage the shared variables.
  • the first user program includes information on the identifier
  • the program management unit acquires the identifier from the first user program.
  • the program management unit acquires the identifier from a setting file.
  • the program management unit when the second user program is executed, the program management unit creates an unshared symbol table in which an unshared variable and an address of the unshared variable are recorded, and is referred to in the second user program. If the variable name of the variable is recorded in the non-shared symbol table, the variable is determined to be a non-shared variable, and the variable name of the variable referred to in the second user program is the non-shared symbol. When not recorded in the table, the variable is determined to be a shared variable.
  • the program management unit determines whether the variable referred to in the second user program is a non-shared variable according to whether or not the variable name of the variable is recorded in the non-shared symbol table. It is possible to suitably determine whether or not there is a shared variable.
  • the first user program and the second user program are configured in different programming languages.
  • the variables can be shared between the first user program and the second user program which are composed of different programming languages.
  • the identifier includes a path of the first user program.
  • the identifier includes a file name of the first user program.
  • a control method is a method for executing a first user program and a second user program, wherein the control method acquires an identifier of the first user program, is capable of being referred to by the second user program, and A shared variable name including the variable name of the shared variable defined in one user program and the identifier is generated, and the shared variable name is associated with the address of the shared variable and recorded in the shared variable symbol table.
  • the data of the shared variable is stored in an area corresponding to the address in the data storage unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Automation & Control Theory (AREA)
  • Devices For Executing Special Programs (AREA)
  • Programmable Controllers (AREA)

Abstract

共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止する。制御装置(1)は、プログラム管理部(11)と、データ記憶部(13a)と、共有変数シンボルテーブルと(13b)を備え、プログラム管理部(11)は、第1ユーザプログラムの識別子を取得し、前記第1ユーザプログラムにおいて定義されている共有変数の変数名と、前記識別子とを含む共有変数名を生成し、前記共有変数名と、前記共有変数のアドレスとを対応付けて、共有変数シンボルテーブル(13b)に記録する。

Description

制御装置および制御方法
  本発明は、ユーザプログラム間で共有するデータの意図せずに上書きすることを防止するための制御装置およびこの制御装置による制御方法に関する。
  従来では、以下のようなコントロール制御装置が知られている(特許文献1を参照)。すなわち、ユーザプログラムが複数あるとき、それらの間のデータのやり取りはデータ記憶部を介して行う。プログラム間でデータのやり取りを行うにあたっては、データに変数名を与え、その変数名をキーにして各ユーザプログラムがデータ記憶部からデータの書き込みや読み取りを行う。
  また、従来では、異なるアプリケーションフレームワーク間のデータサービスのためのプラットフレームが知られている(特許文献2を参照)。
  また、従来では、仕様記述もしくは言語記述を処理する言語処理システムにおける入力/出力仕様記述中もしくは入力ソースプログラム/出力オブジェクトプログラム中の名標を管理する言語管理システムの名標管理方式が知られている(特許文献3を参照)。
日本国公開特許公報「特開2000-132208号公報」 日本国公開特許公報「特開2006-244488号公報」 日本国公開特許公報「特開平4-260134号公報」
  しかしながら、上記の何れの技術も、プログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きしてしまうことを防止する技術ではない。
  本発明の一態様は、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することを目的とする。
  上記の課題を解決するために、本発明の一態様に係る制御装置は、第1ユーザプログラムおよび第2ユーザプログラムを実行するプログラム管理部と、前記第1ユーザプログラムおよび前記第2ユーザプログラムの両方から参照可能な共有変数のデータを記憶するデータ記憶部と、前記データ記憶部での前記共有変数のアドレスを記憶する共有変数シンボルテーブルとを備え、前記プログラム管理部は、前記第1ユーザプログラムの識別子を取得し、前記第1ユーザプログラムにおいて定義されている前記共有変数の変数名と、前記識別子とを含む共有変数名を生成し、前記共有変数名と、前記共有変数の前記アドレスとを対応付けて、前記共有変数シンボルテーブルに記録することを特徴とする。
  上記の課題を解決するために、本発明の一態様に係る制御方法は、第1ユーザプログラムおよび第2ユーザプログラムを実行する方法であって、前記第1ユーザプログラムの識別子を取得し、前記第2ユーザプログラムから参照可能かつ前記第1ユーザプログラムにおいて定義されている共有変数の変数名と、前記識別子とを含む共有変数名を生成し、前記共有変数名と、前記共有変数のアドレスとを対応付けて、共有変数シンボルテーブルに記録し、前記共有変数のデータを、データ記憶部における前記アドレスに対応する領域に記憶させることを特徴とする。
  本発明の一態様によれば、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
本発明に係る制御装置の構成の一例を模式的に示すブロック図である。 図1の共有変数シンボルテーブルの詳細を例示する図である。 プログラム管理部の構成例2のプログラム管理部が実行する工程のフロチャートである。 プログラムAの構成例2のプログラム管理部が実行する工程のフロチャートである。 プログラム管理部の構成例3のプログラム管理部が実行する工程のフロチャートである。 本発明の実施形態1に係る制御方法における各工程を示すフロチャートである。
  §1 適用例
 図1を用いて、本実施形態に係る制御装置の適用場面の一例について説明する。図1は、本実施形態に係る制御装置の構成の一例を模式的に示すブロック図である。本実施形態に係る制御装置1は、共有変数を定義するユーザプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止するための装置である。
  図1に示すように、制御装置1は、プログラム管理部11と、補助記憶装置12と、メモリ13とを備える。
  プログラム管理部11は、プログラムA管理部11aと、プログラムB管理部11bとを含む。本実施形態では、プログラム管理部11により第1ユーザプログラム(以下プログラムAと称する)および第2ユーザプログラム(以下プログラムBと称する)を実行する。
  補助記憶装置12は、プログラムAおよびプログラムBを格納する。メモリ13は、プログラムAおよびプログラムBを一時的に記憶する。メモリ13は、データ記憶部13aと、共有変数シンボルテーブル13bとを備える。データ記憶部13aは、プログラムAおよびプログラムBの両方から参照可能な共有変数のデータを記憶している。共有変数シンボルテーブル13bは、データ記憶部13aでの前記共有変数のアドレスを記憶している。
  プログラムA管理部11aは、プログラムAで定義される共有変数に対して、該共有変数の変数名とプログラムAの識別子とを含む共有変数名を生成する。プログラムA管理部11aは、共有変数名とアドレスとを対応付けて共有変数シンボルテーブルで管理する。プログラムBから該共有変数にアクセス(読み込み/書き込み)する場合、上記共有変数名を用いてアクセスする。
  本実施形態に係る制御装置によれば、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
  §2 構成例
 (制御装置1の概略構成)
 図1~図2を用いて、制御装置1の概略構成の一例について説明する。図1は、本実施形態に係る制御装置の構成の一例を模式的に示すブロック図である。図1に示すように、制御装置1は、プログラム管理部11と、補助記憶装置12と、メモリ13とを備える。制御装置1は、たとえばPLC(プログラマブルロジックコントローラ)等の各種の機器の動作を制御するものが挙げられる。
  図1に例示したように、プログラム管理部11は、プログラムA管理部11aと、プログラムB管理部11bとを含む。本実施形態では、プログラム管理部11によりプログラムAおよびプログラムBを実行する。具体的には、プログラムA管理部11aによりプログラムAを実行し、プログラムB管理部11bによりプログラムBを実行する構成を例示するが、これは本実施形態を限定するものではない。
  また、プログラムAおよびプログラムBに詳細について後述する。
  補助記憶装置12は、プログラムAおよびプログラムBを格納するためのものである。通常、プログラムAおよびプログラムBは補助記憶装置12に格納されている。補助記憶装置12は、例えば、不揮発性のメモリ、またはハードディスク等であるが、これに限らない。補助記憶装置12を備えることにより、データ消失を確実に防止することができる。
  メモリ13は、プログラムAおよびプログラムBを一時的に記憶する。メモリ13は、例えば揮発性のメモリ等であるが、これに限らない。メモリ13は、データ記憶部13aと、共有変数シンボルテーブル13bとを備える。データ記憶部13aは、プログラムAおよびプログラムBの両方から参照可能な共有変数のデータを記憶している。共有変数シンボルテーブル13bは、データ記憶部13aでの前記共有変数のアドレスを記憶している。
  ここでいう共有変数とは、複数のユーザプログラムから参照可能な変数のことを指す。共有変数シンボルテーブル13bは、前記データ記憶部13aに記憶されている前記共有変数の記憶場所(アドレス)を記憶している。
  (プログラム管理部の構成例1)
 図2は、図1の共有変数シンボルテーブル13bの詳細を例示する図である。プログラム管理部の構成例1として、本実施形態では、プログラム管理部11は、ユーザからプログラムAを実行する指示を受けると、補助記憶装置12からプログラムAをロードし、メモリ13にプログラムAを記憶させる。ここでは、例えばプログラムAはコンパイラ型のプログラムであるとする。補助記憶装置12に格納されたプログラムAは、機械語にコンパイルされたプログラムである。コンパイルされたプログラムAは、共有変数と該共有変数のアドレスとの対応関係を示すシンボルテーブルを含む。非共有変数は、プログラムAの中だけで使用され、プログラムAのみが参照可能な変数である。コンパイルされたプログラムAにおいて、非共有変数のアドレスが規定されている。コンパイルされたプログラムAにおいて、非共有変数の変数名の情報は残っていなくてもよい。ただし、プログラムAは、コンパイルされた後でも、共有変数の変数名の情報とアドレスの情報とを含む。
  プログラム管理部11は、共有変数の変数名の情報、アドレスの情報、および、プログラムAの識別子を取得する。プログラム管理部11は、プログラムAにおいて定義されている前記共有変数の変数名と、前記識別子とを含む共有変数名を生成する。プログラム管理部11は、前記共有変数名と、前記共有変数の前記アドレスとを対応付けて、共有変数シンボルテーブル13bに記録する。また、プログラム管理部11は、データ記憶部13aの前記アドレスに、前記共有変数のデータを書き込む。
  換言すると、プログラム管理部11により生成される共有変数名は、前記共有変数の変数名と、前記識別子とを含む。プログラム管理部11は、前記共有変数名と、前記共有変数の前記アドレスとを対応付けて、共有変数シンボルテーブル13bに記録する。
  ユーザプログラムの識別子は、該ユーザプログラムに固有の文字列または数値である。複数のユーザプログラムの識別子は、互いに重複しないように設定される。例えば、ユーザプログラムのプログラム名、ユーザプログラムの配置先ディレクトリのパス、ユーザが任意に設定する文字列、UUID(universally unique identifier)、またはドメイン名を、該ユーザプログラムの識別子としてもよい。
  図2の例示では、プログラムAの識別子が「Press」である。プログラムAで定義されている共有変数の変数名は「status」である。変数名「status」は、プログラムAのソースコードで定義された変数名である。プログラム管理部11は、識別子「Press」と元々の変数名「status」を組み合わせることで、該共有変数の共有変数名「Press.status」を生成する。共有変数名「Press.status」は、他のプログラムBから該共有変数を参照するときにキーとして使用される変数名である。ここでは、識別子と変数名との間に「.」を加えているが、代わりに任意の文字または文字列を用いてもよい。また、識別子と変数名との間の文字はなくてもよい。識別子と変数名との順番も任意である。例えば、図2に例示する「Cutter.status」は、プログラムBで定義される共有変数の、共有変数名である。プログラムBの識別子が「Cutter」である。プログラムBで定義されている共有変数の変数名は「status」である。プログラム管理部11は、所定の規則に沿って識別子と変数名とを含む共有変数名を生成する。これにより、複数のユーザプログラムにおいて、変数名「status」が同じ複数の共有変数が定義されていても、共有変数名の衝突を回避することができる。共有変数名はたとえばPress.status、Cutter.statusを挙げ、これらの共有変数名に対応するアドレスはそれぞれ0X00000000、0X00000001を挙げたが、これは本実施形態を限定するものではない。
  上記の態様によれば、共有変数を定義するユーザプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
  (プログラム管理部の構成例2)
 図3は、プログラム管理部の構成例2のプログラム管理部が実行する工程のフロチャートである。図3に示すように、プログラムB管理部11bは、プログラムBから前記共有変数名をキーとして前記共有変数を読み込みまたは書き込みする命令を受けると、共有変数シンボルテーブル13bから前記共有変数名に対応する前記アドレスを取得する。プログラムB管理部11bは、前記アドレスを用いてデータ記憶部13aの前記共有変数を読み込みまたは書き込みする。
  詳細に、ステップS1において、プログラムB管理部11bは、前記プログラムBから前記共有変数名をキーとして前記共有変数を読み込みまたは書き込みする命令を受ける。続いて、ステップS2において、プログラムB管理部11bは、共有変数シンボルテーブル13bから前記共有変数名に対応する前記アドレスを取得する。最後に、ステップS3において、プログラムB管理部11bは、前記アドレスを用いて前記データ記憶部13aの前記共有変数を読み込みまたは書き込みする。
  上記の態様によれば、プログラムB管理部11bは、プログラムAによって既に生成されていたデータ記憶部13aの前記共有変数を読み込みまたは書き込みすることができる。
  (プログラムAの構成例1)
 上述したプログラムAの構成例1について詳細に説明する。プログラムAは、たとえば機械語にコンパイルされたものである。プログラムAは、機械語にコンパイルされた後でも、前記共有変数の前記変数名の情報と前記アドレスの情報とを含む。プログラムA管理部11aは、前記プログラムAから、前記共有変数の前記変数名と前記アドレスとを取得する。プログラムAを実行するプログラムA管理部11aは、取得された前記アドレスを用いて、データ記憶部13aの前記共有変数を読み込みまたは書き込みすることができる。
  ここで、プログラムAはラダー言語またはC言語等を用いたプログラムが挙げられるが、これは本実施形態を限定するものではない。ラダー言語は、制御装置1が工作機械または生産装置等の動作制御を行う場合に適したプログラミング言語である。
  具体的には、プログラムA管理部11aは、プログラムAからシンボルテーブルとプログラムAの識別子を取得する。プログラムA管理部11aは、共有変数の変数名に前記識別子を付与して共有変数名を生成する。そして、プログラムA管理部11aは、共有変数シンボルテーブル13bに共有変数名とアドレスとを対応付けて記録する。続いて、プログラムA管理部11aは、プログラムAを実行する。そして、プログラムA管理部11aは、前記プログラムAから前記アドレスをキーにしてデータ書き込み指示を受ける。最後に、プログラムA管理部11aは、メモリ13に前記アドレスをキーにしてデータ書き込みする。ここで、共有変数名の生成は前記プログラムAのロード時に行う。
  上記の態様によれば、プログラムA管理部11aは、プログラムAから、前記共有変数の前記変数名と前記アドレスとを取得することができる。
  例えば、生産装置をラダー言語であるプログラムAで制御し、Java言語であるプログラムBでデータ処理を行う場合について説明する。プログラムAは、生産装置またはセンサから、生産ラインに関するデータ(センシング情報等)を得る。プログラムAは、得られたデータを、共有変数としてデータ記憶部13aに記録させる。プログラムBは、プログラムAが記録した共有変数を読み出し、例えばセンシング情報等を用いて統計処理を行う。ラダー言語は制御に適したプログラミング言語であり、Java等の汎用プログラミング言語は、情報処理に適したプログラミング言語である。このように、異なるプログラミング言語を用いて、共通のデータに対してそれぞれ適した処理を行うことができる。
  また、既存のプログラムAを実行し続けたまま(生産装置を稼働させ続けたまま)、既存のプログラム管理部およびプログラムBを本実施形態のプログラム管理部11およびプログラムBに入れ替えてもよい。これにより、既存の制御装置を共有変数名の衝突を回避できる本実施形態の制御装置にすることができる。
  (プログラムAの構成例2)
 図4は、プログラムAの構成例2のプログラムA管理部11aが実行する工程のフロチャートである。例えば、プログラムAは、たとえばインタプリタ型プログラムである。プログラムAは、前記共有変数の前記変数名の情報を含む。プログラムA管理部11aは、前記プログラムAのインタプリタとして機能する。
  図4におけるステップS4において、プログラムA管理部11aは、前記プログラムAから前記共有変数の前記変数名と識別子とを取得すると、前記共有変数名を生成する。続いて、ステップS5において、プログラムA管理部11aは、共有変数名が記録されているか否かを判定する。プログラムA管理部11aは、共有変数シンボルテーブル13bに前記共有変数名が既に記録されている場合(S5でYES)、前記共有変数の前記アドレスを取得する(ステップS6)。一方、プログラムA管理部11aは、共有変数シンボルテーブル13bに前記共有変数名が記録されていない場合(S5でNO)、前記共有変数に割り当てる前記アドレスを決定する(ステップS7)。プログラムA管理部11aは、決定した前記アドレスと前記共有変数名とを対応付けて共有変数シンボルテーブル13bに記録する。
  また、インタプリタ型のプログラムとしては、例えば、Java(登録商標)、JavaScript(登録商標)、Pythonなどのプログラミング言語を用いたプログラムが挙げられる。例えば、ユーザプログラムがJavaプログラムである場合、補助記憶装置12に格納されたユーザプログラムは中間コードにコンパイルされたものであり、プログラムA管理部11aは、中間コードであるユーザプログラムを解釈して実行するJava仮想マシンとして機能する。
  具体的には、プログラムA管理部11aは、プログラムAから前記プログラムAの識別子を取得する。また、プログラムA管理部11aは、前記プログラムAを実行する。そして、プログラムA管理部11aは、変数名をキーにしてデータ書き込み指示を受ける。続いて、プログラムA管理部11aは、共有変数の変数名に前記プログラムAの前記識別子を付加して共有変数名を生成する。そして、プログラムA管理部11aは、共有変数シンボルテーブル13bを参照して、該共有変数が定義済みであるか否かを判定する。該共有変数が未定義である場合、アドレスを決定し、共有変数に前記アドレスを割り当てる。プログラムA管理部11aは、決定した前記アドレスと前記共有変数名とを対応付けて共有変数シンボルテーブル13bに記録する。一方、該共有変数が定義済みである場合、割り当て済みの前記アドレスを共有変数シンボルテーブル13bから取得する。最後に、プログラムA管理部11aは、データ記憶部13aに前記アドレスをキーにしてデータ書き込みする。ここで、プログラムA管理部11aは、共有変数であるか否かの判断を実行時に行う。プログラムAにおいて使用される変数が共有変数であるか非共有変数であるかは、プログラムAにおいて定義されている。例えば、プログラムAにおいて、変数に対して共有または非共有を指定することにより、変数が共有変数であるか非共有変数であるかを定義する。また、プログラムA管理部11aは、プログラムAの実行時に共有変数名を生成する。
  上記の態様によれば、プログラム管理部11は、共有変数の重複を防ぎ、共有変数を適切に管理することができる。
  例えば、プログラムAのソースコードにおいて、共有変数「status」への書き込みは、一般的な方法で「status="OK"」と記述されてもよい。これは共有変数「status」に値「OK」を書き込むことを意味する。ここで「=」は値の代入を意味する演算子である。または、プログラムA管理部11aは、共有変数に書き込むためのAPI関数(application program interface)を提供してもよい。例えば、プログラムAのソースコードにおいて、共有変数「status」への書き込みは、API関数「write」を用いて「write("status","OK")」と記述されてもよい。いずれも、プログラムAは、キーとして共有変数の変数名「status」をプログラムA管理部11aに渡す。
  (識別子の取得例1)
 上述したプログラムAは、前記識別子の情報を含み、プログラムA管理部11aは、前記プログラムAから、前記識別子を取得する。
  (識別子の取得例2)
 例えば、プログラムA管理部11aは、設定ファイルから、前記識別子を取得してもよい。プログラムAの識別子を規定する設定ファイルを、所定のディレクトリに格納していてもよい。
  (プログラム管理部の構成例3)
 図5は、プログラム管理部の構成例3のプログラム管理部が実行する工程のフロチャートである。ここでは、プログラムBはインタプリタ型のプログラムである。プログラムAは先に実行され、プログラムAで定義された共有変数の共有変数名およびアドレスは、共有変数シンボルテーブル13bに記録されている。図5に示すように、ステップS8において、プログラムB管理部11bは、プログラムBを実行する。続いて、ステップS9において、プログラムB管理部11bは、プログラムBにおいて定義されている非共有変数と前記非共有変数のアドレスとを記録した非共有シンボルテーブルを作成する。非共有シンボルテーブルは、実行されるユーザプログラム毎に分けて作成される。例えば、プログラムBにおいて変数が非共有変数として定義されたとき、該変数名および割り当てたアドレスを非共有シンボルテーブルに記録する。プログラムB管理部11bは、非共有シンボルテーブルを記憶している。続いて、ステップS10において、プログラムB管理部11bは、変数名が記録されているか否かを判定する。プログラムB管理部11bは、プログラムBにおいて参照(読み込み)される変数の変数名が前記非共有シンボルテーブルに記録されている場合(S10でYES)、該変数は非共有変数であると判断する(ステップS11)。一方、プログラムB管理部11bは、プログラムBにおいて参照(読み込み)される前記変数の変数名が前記非共有シンボルテーブルに記録されていない場合(S10でNO)、該変数は共有変数であると判断する(ステップS12)。
  上記の態様によれば、プログラムB管理部11bは、プログラムBにおいて参照される変数の変数名が前記非共有シンボルテーブルに記録されているか否かに応じて、該変数が非共有変数であるか共有変数であるかを好適に判断することができる。例えば、プログラムAで定義された共有変数の共有変数名「Press.status」と、プログラムBで参照された非共有変数の変数名とが偶然一致している場合でも、プログラムBの非共有変数を誤って前記共有変数だと判断することを防ぐことができる。
  (プログラム管理部の構成例4)
 プログラム管理部11の構成例4について、詳細に説明する。ここでは、プログラムBはコンパイラ型のプログラムである。プログラムAは先に実行され、プログラムAで定義された共有変数の共有変数名およびアドレスは、共有変数シンボルテーブル13bに記録されている。プログラムBを実行するプログラムB管理部11bは、共有変数を読み込むためのAPI関数を提供する。例えば、プログラムBのソースコードにおいて、共有変数「Press.status」の参照(読み込み)は、API関数「read」を用いて「read("Press.status")」と記述されてもよい。プログラムBは、キーとして共有変数の共有変数名「Press.status」をAPI関数を介してプログラムB管理部11bに渡す。プログラムB管理部11bは、共有変数シンボルテーブルから対応するアドレスを取得する。プログラムB管理部11bは、アドレスをキーにしてデータ記憶部13aから共有変数のデータを取得する。プログラムB管理部11bは、共有変数のデータをプログラムBに返す。
  通常、コンパイラ型のユーザプログラムは、機械語に変換されている。そのため、ソースファイルで規定した変数名は、アドレスに変換されており、残っていない。上記の態様によれば、共有変数を参照するAPIを用いることで、コンパイルされたプログラムBの中の共有変数名はキーとして残る。
  制御装置1では、前記プログラムAと、前記プログラムBとは、互いに異なるプログラミング言語で構成されたものであってもよい。上記の態様によれば、互いに異なるプログラミング言語で構成されたプログラムAとプログラムBとの間で、変数を共有することができる。
  例えば、プログラムAと、プログラムBとは、同じプログラミング言語で構成されたものであってもよい。
  (識別子の構成例1)
 前記識別子は、前記プログラムAのパスを含んでもよい。例えば、ユーザは、プログラムAを作成する際に、プログラムAを配置する予定であるディレクトリのパスをプログラムA内で規定しておく。または、プログラムA管理部11aによって実行されたプログラムA自身が、プログラムAのパスを取得してもよい。
  (識別子の構成例2)
 前記識別子は、前記プログラムAのファイル名を含んでもよい。パスと同様に、ファイル名はプログラムA内で規定されていてもよいし、プログラムA管理部11aによって実行されたプログラムA自身が、プログラムAのファイル名を取得してもよい。
  前記識別子は、前記プログラムAのパスおよびファイル名を含んでもよい。上述したように、前記識別子は、ユーザが任意に設定する文字列、UUID(universally unique identifier)、および/またはドメイン名を含んでもよい。ここでのドメイン名とは、ユーザプログラムの提供者(提供会社)が所有するドメイン名(例えば、omron.co.jpまたはjp.co.omron)である。
  (制御方法)
 図6は、本実施形態に係る制御方法における各工程を示すフロチャートである。図6に示すように、ステップS13において、プログラムA管理部11aは、前記プログラムAの識別子を取得する。続いて、ステップS14において、プログラムA管理部11aは、前記プログラムBから参照可能かつ前記プログラムAにおいて定義されている共有変数の変数名と、前記識別子とを含む共有変数名を生成する。続いて、ステップS15において、プログラムA管理部11aは、前記共有変数名と、前記共有変数のアドレスとを対応付けて、共有変数シンボルテーブル13bに記録する。続いて、ステップS16において、プログラムA管理部11aは、前記共有変数のデータを、データ記憶部13aにおける前記アドレスに対応する領域に記憶させる。
  上記の態様によれば、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
  〔ソフトウェアによる実現例〕
 制御装置1の制御ブロック(特にプログラム管理部11)は、集積回路(ICチップ)等に形成された論理回路(ハードウェア)によって実現してもよいし、ソフトウェアによって実現してもよい。
  後者の場合、制御装置1は、各機能を実現するソフトウェアであるプログラムの命令を実行するコンピュータを備えている。このコンピュータは、例えば1つ以上のプロセッサを備えていると共に、上記プログラムを記憶したコンピュータ読み取り可能な記録媒体を備えている。そして、上記コンピュータにおいて、上記プロセッサが上記プログラムを上記記録媒体から読み取って実行することにより、本発明の目的が達成される。上記プロセッサとしては、例えばCPU(Central Processing Unit)を用いることができる。上記記録媒体としては、「一時的でない有形の媒体」、例えば、ROM(Read Only Memory)等の他、テープ、ディスク、カード、半導体メモリ、プログラマブルな論理回路などを用いることができる。また、上記プログラムを展開するRAM(Random Access Memory)などをさらに備えていてもよい。また、上記プログラムは、該プログラムを伝送可能な任意の伝送媒体(通信ネットワークや放送波等)を介して上記コンピュータに供給されてもよい。なお、本発明の一態様は、上記プログラムが電子的な伝送によって具現化された、搬送波に埋め込まれたデータ信号の形態でも実現され得る。
 〔まとめ〕
  本発明の一態様に係る制御装置は、第1ユーザプログラムおよび第2ユーザプログラムを実行するプログラム管理部と、前記第1ユーザプログラムおよび前記第2ユーザプログラムの両方から参照可能な共有変数のデータを記憶するデータ記憶部と、前記データ記憶部での前記共有変数のアドレスを記憶する共有変数シンボルテーブルとを備え、前記プログラム管理部は、前記第1ユーザプログラムの識別子を取得し、前記第1ユーザプログラムにおいて定義されている前記共有変数の変数名と、前記識別子とを含む共有変数名を生成し、前記共有変数名と、前記共有変数の前記アドレスとを対応付けて、前記共有変数シンボルテーブルに記録することを特徴とする。
  上記の態様によれば、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
  制御装置の前記プログラム管理部は、前記第2ユーザプログラムから前記共有変数名をキーとして前記共有変数を読み込みまたは書き込みする命令を受けると、前記共有変数シンボルテーブルから前記共有変数名に対応する前記アドレスを取得し、前記アドレスを用いて前記データ記憶部の前記共有変数を読み込みまたは書き込みすることを特徴とする。
  上記の態様によれば、前記プログラム管理部は、プログラムAによって既に生成されていた前記データ記憶部の前記共有変数を読み込みまたは書き込みすることができる。
  制御装置では、前記第1ユーザプログラムは、機械語にコンパイルされたものであり、前記第1ユーザプログラムは、前記共有変数の前記変数名の情報と前記アドレスの情報とを含み、前記プログラム管理部は、前記第1ユーザプログラムから、前記共有変数の前記変数名と前記アドレスとを取得することを特徴とする。
  上記の態様によれば、前記プログラム管理部は、前記第1ユーザプログラムから、前記共有変数の前記変数名と前記アドレスとを取得することができる。
  制御装置では、前記第1ユーザプログラムは、インタプリタ型プログラムであり、前記第1ユーザプログラムは、前記共有変数の前記変数名の情報を含み、前記プログラム管理部は、前記第1ユーザプログラムのインタプリタとして機能し、前記プログラム管理部は、前記第1ユーザプログラムから前記共有変数の前記変数名を取得すると、前記共有変数名を生成し、前記共有変数シンボルテーブルに前記共有変数名が記録されている場合、前記共有変数の前記アドレスを取得し、前記共有変数シンボルテーブルに前記共有変数名が記録されていない場合、前記共有変数に割り当てる前記アドレスを決定することを特徴とする。
  上記の態様によれば、前記プログラム管理部は、共有変数の重複を防ぎ、共有変数を適切に管理することができる。
  制御装置では、前記第1ユーザプログラムは、前記識別子の情報を含み、前記プログラム管理部は、前記第1ユーザプログラムから、前記識別子を取得することを特徴とする。
  制御装置では、前記プログラム管理部は、設定ファイルから、前記識別子を取得することを特徴とする。
  制御装置では、前記プログラム管理部は、前記第2ユーザプログラムを実行すると、非共有変数と前記非共有変数のアドレスとを記録した非共有シンボルテーブルを作成し、前記第2ユーザプログラムにおいて参照されている変数の変数名が前記非共有シンボルテーブルに記録されている場合、該変数は非共有変数であると判断し、前記第2ユーザプログラムにおいて参照されている前記変数の変数名が前記非共有シンボルテーブルに記録されていない場合、該変数は共有変数であると判断することを特徴とする。
  上記の態様によれば、前記プログラム管理部は、前記第2ユーザプログラムにおいて参照される変数の変数名が前記非共有シンボルテーブルに記録されているか否かに応じて、該変数が非共有変数であるか共有変数であるかを好適に判断することができる。
  制御装置では、前記第1ユーザプログラムと、前記第2ユーザプログラムとは、互いに異なるプログラミング言語で構成されたものであることを特徴とする。
  上記の態様によれば、互いに異なるプログラミング言語で構成された第1ユーザプログラムと第2ユーザプログラムとの間で、変数を共有することができる。
  制御装置では、前記識別子は、前記第1ユーザプログラムのパスを含むことを特徴とする。
  制御装置では、前記識別子は、前記第1ユーザプログラムのファイル名を含むことを特徴とする。
  本発明の一態様に係る制御方法は、第1ユーザプログラムおよび第2ユーザプログラムを実行する方法であって、前記第1ユーザプログラムの識別子を取得し、前記第2ユーザプログラムから参照可能かつ前記第1ユーザプログラムにおいて定義されている共有変数の変数名と、前記識別子とを含む共有変数名を生成し、前記共有変数名と、前記共有変数のアドレスとを対応付けて、共有変数シンボルテーブルに記録し、前記共有変数のデータを、データ記憶部における前記アドレスに対応する領域に記憶させることを特徴とする。
  上記の態様によれば、共有変数を定義するプログラムが複数存在する場合、変数名が衝突し意図せずにデータを上書きすることを防止することができる。
  本発明は上述した各実施形態に限定されるものではなく、請求項に示した範囲で種々の変更が可能であり、異なる実施形態にそれぞれ開示された技術的手段を適宜組み合わせて得られる実施形態についても本発明の技術的範囲に含まれる。
  1 制御装置
 11 プログラム管理部
 11a プログラムA管理部
 11b プログラムB管理部
 12 補助記憶装置
 13 メモリ
 13a データ記憶部
 13b 共有変数シンボルテーブル

Claims (11)

  1.  第1ユーザプログラムおよび第2ユーザプログラムを実行するプログラム管理部と、
     前記第1ユーザプログラムおよび前記第2ユーザプログラムの両方から参照可能な共有変数のデータを記憶するデータ記憶部と、
     前記データ記憶部での前記共有変数のアドレスを記憶する共有変数シンボルテーブルとを備え、
     前記プログラム管理部は、
      前記第1ユーザプログラムの識別子を取得し、
      前記第1ユーザプログラムにおいて定義されている前記共有変数の変数名と、前記識別子とを含む共有変数名を生成し、
      前記共有変数名と、前記共有変数の前記アドレスとを対応付けて、前記共有変数シンボルテーブルに記録することを特徴とする制御装置。
  2.  前記プログラム管理部は、
      前記第2ユーザプログラムから前記共有変数名をキーとして前記共有変数を読み込みまたは書き込みする命令を受けると、前記共有変数シンボルテーブルから前記共有変数名に対応する前記アドレスを取得し、
      前記アドレスを用いて前記データ記憶部の前記共有変数を読み込みまたは書き込みすることを特徴とする請求項1に記載の制御装置。
  3.  前記第1ユーザプログラムは、機械語にコンパイルされたものであり、
     前記第1ユーザプログラムは、前記共有変数の前記変数名の情報と前記アドレスの情報とを含み、
     前記プログラム管理部は、前記第1ユーザプログラムから、前記共有変数の前記変数名と前記アドレスとを取得することを特徴とする請求項1または2に記載の制御装置。
  4.  前記第1ユーザプログラムは、インタプリタ型プログラムであり、
     前記第1ユーザプログラムは、前記共有変数の前記変数名の情報を含み、
     前記プログラム管理部は、前記第1ユーザプログラムのインタプリタとして機能し、
     前記プログラム管理部は、前記第1ユーザプログラムから前記共有変数の前記変数名を取得すると、
      前記共有変数名を生成し、
      前記共有変数シンボルテーブルに前記共有変数名が記録されている場合、前記共有変数の前記アドレスを取得し、
      前記共有変数シンボルテーブルに前記共有変数名が記録されていない場合、前記共有変数に割り当てる前記アドレスを決定することを特徴とする請求項1または2に記載の制御装置。
  5.  前記第1ユーザプログラムは、前記識別子の情報を含み、
     前記プログラム管理部は、前記第1ユーザプログラムから、前記識別子を取得することを特徴とする請求項3または4に記載の制御装置。
  6.  前記プログラム管理部は、設定ファイルから、前記識別子を取得することを特徴とする請求項3または4に記載の制御装置。
  7.  前記プログラム管理部は、前記第2ユーザプログラムを実行すると、
      非共有変数と前記非共有変数のアドレスとを記録した非共有シンボルテーブルを作成し、
      前記第2ユーザプログラムにおいて参照されている変数の変数名が前記非共有シンボルテーブルに記録されている場合、該変数は非共有変数であると判断し、
      前記第2ユーザプログラムにおいて参照されている前記変数の変数名が前記非共有シンボルテーブルに記録されていない場合、該変数は共有変数であると判断することを特徴とする請求項1から6のいずれか一項に記載の制御装置。
  8.  前記第1ユーザプログラムと、前記第2ユーザプログラムとは、互いに異なるプログラミング言語で構成されたものであることを特徴とする請求項1から7のいずれか一項に記載の制御装置。
  9.  前記識別子は、前記第1ユーザプログラムのパスを含むことを特徴とする請求項1から4のいずれか一項に記載の制御装置。
  10.  前記識別子は、前記第1ユーザプログラムのファイル名を含むことを特徴とする請求項1から4のいずれか一項に記載の制御装置。
  11.  第1ユーザプログラムおよび第2ユーザプログラムを実行する方法であって、
     前記第1ユーザプログラムの識別子を取得し、
     前記第2ユーザプログラムから参照可能かつ前記第1ユーザプログラムにおいて定義されている共有変数の変数名と、前記識別子とを含む共有変数名を生成し、
     前記共有変数名と、前記共有変数のアドレスとを対応付けて、共有変数シンボルテーブルに記録し、
     前記共有変数のデータを、データ記憶部における前記アドレスに対応する領域に記憶させることを特徴とする制御方法。
PCT/JP2019/024144 2018-07-03 2019-06-18 制御装置および制御方法 WO2020008867A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP19831238.1A EP3819762A4 (en) 2018-07-03 2019-06-18 CONTROL DEVICE AND CONTROL METHOD
US16/973,781 US11157297B2 (en) 2018-07-03 2019-06-18 Control device and control method for preventing unintentional overwriting of data
CN201980038865.8A CN112272821A (zh) 2018-07-03 2019-06-18 控制装置以及控制方法

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2018126934A JP6950634B2 (ja) 2018-07-03 2018-07-03 制御装置および制御方法
JP2018-126934 2018-07-03

Publications (1)

Publication Number Publication Date
WO2020008867A1 true WO2020008867A1 (ja) 2020-01-09

Family

ID=69060077

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/024144 WO2020008867A1 (ja) 2018-07-03 2019-06-18 制御装置および制御方法

Country Status (5)

Country Link
US (1) US11157297B2 (ja)
EP (1) EP3819762A4 (ja)
JP (1) JP6950634B2 (ja)
CN (1) CN112272821A (ja)
WO (1) WO2020008867A1 (ja)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7322604B2 (ja) * 2019-09-04 2023-08-08 オムロン株式会社 プログラム開発装置、プロジェクト作成方法およびプログラム開発装置を実現するためのプログラム

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04260134A (ja) 1991-02-15 1992-09-16 Nec Corp 言語処理システムの名標管理方式
JP2000132208A (ja) 1998-10-28 2000-05-12 Omron Corp コントロール制御装置
JP2001109632A (ja) * 1999-10-13 2001-04-20 Nec Ic Microcomput Syst Ltd プログラム翻訳システム及びプログラム翻訳方法
JP2001282864A (ja) * 2000-03-29 2001-10-12 Matsushita Electric Ind Co Ltd 機能ブロック修正方法
JP2006099639A (ja) * 2004-09-30 2006-04-13 Denso Wave Inc プログラム作成装置,制御装置及びコンピュータプログラム
JP2006244488A (ja) 2005-02-28 2006-09-14 Microsoft Corp 異なるアプリケーションフレームワーク間のデータサービスのためのプラットフォーム
WO2018198439A1 (ja) * 2017-04-27 2018-11-01 株式会社日立産機システム 産業用コントローラ及び産業用コントローラにおけるデータ共有方法

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3602857B2 (ja) * 1991-04-23 2004-12-15 株式会社日立製作所 多機種対応型情報処理システム、および、方法
JP4446373B2 (ja) * 2003-03-19 2010-04-07 パナソニック株式会社 プロセッサ、データ共有装置
US7870545B2 (en) * 2005-12-16 2011-01-11 Intel Corporation Protecting shared variables in a software transactional memory system
US20080005727A1 (en) * 2006-06-30 2008-01-03 Robert Paul Morris Methods, systems, and computer program products for enabling cross language access to an addressable entity
US8495601B2 (en) * 2010-06-09 2013-07-23 Lear Corporation Shared memory architecture
JP5846581B2 (ja) * 2012-04-25 2016-01-20 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation コードを投機的に最適化するための方法、並びにそのコンピュータ及びコンピュータ・プログラム
US9268623B2 (en) * 2012-12-18 2016-02-23 International Business Machines Corporation Analyzing update conditions for shared variable directory information in a parallel computer
US9513910B2 (en) * 2012-12-18 2016-12-06 International Business Machines Corporation Requesting shared variable directory (SVD) information from a plurality of threads in a parallel computer
JP6292096B2 (ja) * 2014-04-24 2018-03-14 富士電機株式会社 プログラマブルコントローラシステム、その支援装置
CN104461706B (zh) * 2014-11-24 2019-03-26 上海华为技术有限公司 一种将共享全局变量共享的方法和多处理装置
JP2016186697A (ja) * 2015-03-27 2016-10-27 日本電気株式会社 関数間変数共有方法及び機構
CN106484379B (zh) * 2015-08-28 2019-11-29 华为技术有限公司 一种应用的处理方法及装置
JP6705266B2 (ja) * 2016-04-07 2020-06-03 オムロン株式会社 制御装置、制御方法およびプログラム
CN110023909B (zh) * 2016-11-29 2023-05-05 三菱电机株式会社 控制装置以及程序更新方法
JP2019144762A (ja) * 2018-02-19 2019-08-29 株式会社東芝 プログラマブルコントローラ

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04260134A (ja) 1991-02-15 1992-09-16 Nec Corp 言語処理システムの名標管理方式
JP2000132208A (ja) 1998-10-28 2000-05-12 Omron Corp コントロール制御装置
JP2001109632A (ja) * 1999-10-13 2001-04-20 Nec Ic Microcomput Syst Ltd プログラム翻訳システム及びプログラム翻訳方法
JP2001282864A (ja) * 2000-03-29 2001-10-12 Matsushita Electric Ind Co Ltd 機能ブロック修正方法
JP2006099639A (ja) * 2004-09-30 2006-04-13 Denso Wave Inc プログラム作成装置,制御装置及びコンピュータプログラム
JP2006244488A (ja) 2005-02-28 2006-09-14 Microsoft Corp 異なるアプリケーションフレームワーク間のデータサービスのためのプラットフォーム
WO2018198439A1 (ja) * 2017-04-27 2018-11-01 株式会社日立産機システム 産業用コントローラ及び産業用コントローラにおけるデータ共有方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3819762A4

Also Published As

Publication number Publication date
US20210255881A1 (en) 2021-08-19
EP3819762A1 (en) 2021-05-12
JP2020008941A (ja) 2020-01-16
EP3819762A4 (en) 2022-03-09
JP6950634B2 (ja) 2021-10-13
US11157297B2 (en) 2021-10-26
CN112272821A (zh) 2021-01-26

Similar Documents

Publication Publication Date Title
CN107644286B (zh) 工作流处理方法及装置
US9582418B2 (en) Confirming the sensitivity of a data object in a managed object heap
US20110231532A1 (en) Network management apparatus, network management method and network management program
CN108614702B (zh) 字节码优化方法及装置
CN106250104A (zh) 一种针对服务器的远程操作系统、方法及装置
CN103218227B (zh) 一种安卓设备内置硬盘上兼容多种文件系统的方法及装置
US8418122B2 (en) Incorporating functionality from an object file into an existing binary file
CN110309630B (zh) 一种Java代码加密方法及装置
WO2020008867A1 (ja) 制御装置および制御方法
US20110010754A1 (en) Access control system, access control method, and recording medium
CN112965760A (zh) 修改根目录的方法、装置、电子设备和可读存储介质
CN111858020B (zh) 用户资源限制方法、装置及计算机存储介质
JP7047700B2 (ja) 制御システム、制御装置、端末装置、及びプログラム
US8271439B2 (en) Efficient synchronised updates to a data record in a data store
US7962894B2 (en) System and method for identifying non-supported features in a multiple code editor environment
JP6950635B2 (ja) コンパイル装置およびコンパイル方法
JP5675925B2 (ja) 設計モデルのオブジェクトデータの一時的分離方法
JP2007133632A (ja) セキュリティポリシー設定方法及びプログラム
JP6623731B2 (ja) 情報処理装置、情報処理方法、及び、プログラム
JP2016062311A (ja) 更新装置及び情報処理方法
CN112749159A (zh) 表单生成方法、装置、电子设备及存储介质
CN117112047B (zh) 一种usb设备的管控方法、设备及存储介质
CN111192096B (zh) 多联电子发票管理方法、装置、可读介质及电子设备
CN109460640A (zh) 一种Java程序保护方法、装置、设备及可读存储介质
JP7059165B2 (ja) プログラム生成装置、及びプログラム生成方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19831238

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2019831238

Country of ref document: EP

Effective date: 20210203