WO2013191275A1 - 制御装置 - Google Patents

制御装置 Download PDF

Info

Publication number
WO2013191275A1
WO2013191275A1 PCT/JP2013/067088 JP2013067088W WO2013191275A1 WO 2013191275 A1 WO2013191275 A1 WO 2013191275A1 JP 2013067088 W JP2013067088 W JP 2013067088W WO 2013191275 A1 WO2013191275 A1 WO 2013191275A1
Authority
WO
WIPO (PCT)
Prior art keywords
name
sql statement
user program
definition information
program
Prior art date
Legal status (The legal status 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 status listed.)
Ceased
Application number
PCT/JP2013/067088
Other languages
English (en)
French (fr)
Inventor
弘太郎 岡村
西山 佳秀
岡 実
太田 政則
勝 中崎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to US14/405,980 priority Critical patent/US10061809B2/en
Priority to CN201380032494.5A priority patent/CN104395845B/zh
Priority to EP13807001.6A priority patent/EP2866108A4/en
Priority to JP2014521521A priority patent/JP6065008B2/ja
Publication of WO2013191275A1 publication Critical patent/WO2013191275A1/ja
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Program-control systems
    • G05B19/02Program-control systems electric
    • G05B19/04Program 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 OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Program-control systems
    • G05B19/02Program-control systems electric
    • G05B19/418Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS] or computer integrated manufacturing [CIM]
    • G05B19/4185Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS] or computer integrated manufacturing [CIM] characterised by the network communication
    • G05B19/4186Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS] or computer integrated manufacturing [CIM] characterised by the network communication by protocol, e.g. MAP, TOP
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/31From computer integrated manufacturing till monitoring
    • G05B2219/31369Translation, conversion of protocol between two layers, networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Definitions

  • the present invention relates to a control device such as a programmable logic controller (PLC), and more particularly to a technique for facilitating access to a database system.
  • PLC programmable logic controller
  • a control device such as a PLC is used for controlling an automatic machine such as a factory and has a plurality of input / output functions, for example, sequentially reading values output from a sensor or the like and holding data.
  • Patent Document 1 discloses a data collection device that can transmit I / O data of a PLC to a host computer in real time.
  • an object of the present invention is to provide a technique for facilitating programming including access to a database for engineers in control programming of a control device such as a PLC.
  • a control apparatus capable of accessing a database system includes a user program including a structure type variable, a storage unit for storing definition information indicating the definition of the structure type included in the user program, and the definition information And generating a SQL statement when accessing the database system by executing the user program based on the read definition information, and executing the SQL statement by transmitting the generated SQL statement to the database system And an execution unit.
  • the generation unit extracts the structure tag name and the member name indicated in the definition of the definition information corresponding to the user program to be executed, and the extracted structure tag name and the member name in the database according to a predetermined conversion rule.
  • An SQL statement may be generated by determining the table name and field name for accessing the system.
  • the generation unit generates an SQL statement that does not include a value in which a table name and a field name for accessing the database system are specified based on the definition information, and the execution unit includes an SQL statement that does not include a value. May be transmitted to the database system in advance, the value of the member of the structure type variable is extracted by an instruction of the user program, and the extracted value may be transmitted to the database system to execute the SQL statement.
  • the storage unit stores mapping information indicating a conversion rule between a structure tag name and a member name defined in the definition information, and a table name and a field name for accessing the database system.
  • the generation unit may generate the SQL statement based on the structure tag name and member name indicated in the definition information and the conversion rule indicated in the mapping information.
  • the generation unit generates an SQL statement that does not include a value based on the table name and the field name indicated in the mapping information, and the execution unit transmits the SQL statement that does not include a value to the database system in advance, and the user
  • the SQL statement may be executed by extracting a member value of a structure type variable in accordance with a program instruction and transmitting the extracted value to the database system.
  • the storage unit is configured to store mapping information indicating a conversion rule between a structure tag name and a member name defined in the definition information and a table name and a field name for accessing the database system.
  • the user program includes a command for generating the mapping information based on the definition information, and the generation unit executes the command for generating the mapping information included in the user program.
  • the mapping information may be generated based on the structure tag name and the member name indicated in the definition information, and the SQL statement may be generated based on the conversion rule indicated in the generated mapping information.
  • the engineer who performs control programming of the control device performs programming including access to the database using the structure type data structure without being aware of the SQL statement for database operation. Can be easier to program.
  • FIG. 5 is a functional block diagram showing a configuration of PLC 30 in a second embodiment. It is a figure which shows the example of the mapping information. 10 is a flowchart showing an operation of a DB access processing program 35 in the second embodiment.
  • Embodiment 1> ⁇ 1.1 Configuration of Embodiment 1>
  • PLC programmable controller
  • the control device according to the present invention is not limited to the PLC, and can be applied to various control devices.
  • FIG. 1 is a diagram showing a configuration of the entire PLC system in the present embodiment.
  • the PLC system includes a PC (Personal Computer) 10, a DB (Database) server 20, a PLC 30, and a switching hub 40.
  • the PC 10 is an information processing apparatus for a user to create a user program that is operated by the PLC 30.
  • the DB server 20 is a server that functions as a DBMS (database management system) in order to manage a database.
  • DBMS database management system
  • the user program is created by the PLC 30 user.
  • the user can create a program (source program) including an instruction to access the database by operating the PC 10.
  • the PC 10 converts the source program into a format that can be executed by the PLC 30, and transmits the converted user program to the PLC 30.
  • the PLC 30 executes the user program and can access the DB server 20 in accordance with an access command included in the user program.
  • the PLC 30 is connected to the switching hub 40 and is connected to the PC 10 and the DB server 20 via the switching hub 40.
  • the PLC 30 accepts sensor output and the like from the outside, and accumulates data.
  • the PLC 30 transmits the accumulated data to the DB server 20 by processing of a DB access processing program 35 described later.
  • FIG. 1 an example in which the PLC system includes a plurality of PLCs 30 is illustrated, and the main configurations of the PLCs 30 are the same.
  • the switching hub 40 is connected to a plurality of devices such as the PC 10 and transfers data transmitted / received between the devices.
  • FIG. 2 is a block diagram illustrating functions of the PC 10.
  • the PC 10 is a computer system (information processing apparatus) including an MCU (Micro Control Unit), a ROM (Read Only Memory), a RAM (Random Access Memory), and the like. As shown in FIG. 2, the PC 10 exhibits the function of the programming tool 12.
  • the programming tool 12 is a program that causes the PC 10 to exhibit a function for a user to create a user program for operating the PLC 30.
  • the programming tool 12 includes functions of a data type definition unit 14 and a programming function 16.
  • the user program created by the user using the programming tool 12 is transmitted to the PLC 30 and executed by the PLC 30.
  • the user program includes structure type variables.
  • the data type definition unit 14 is software for defining a structure type.
  • a structure type is composed of a structure tag name and one or more member names.
  • the data type definition unit 14 defines structure tag names, member names of these structures, and their data types. For example, in order to indicate each index used in production management at a factory or the like, the data type definition unit 14 sets the structure tag name to “ProductionTable”, and each member of the structure indicates the name of the product to be produced.
  • the data type definition unit 14 defines the structure type in this way, and generates definition information 32 indicating the definition content.
  • the programming function 16 is software for supporting user program creation. The PC 10 exhibits the functions of the data type definition unit 14 and the programming function 16 by executing these software on the PC 10.
  • FIG. 3 is a block diagram showing functions of the DB server 20.
  • the DB server 20 is a computer system including a large-capacity storage device.
  • the DB server 20 exhibits the function of the DBMS 22 that manages reading and writing to the database.
  • the DBMS 22 includes a DB 24 that functions as a database.
  • the DB 24 holds a plurality of database tables 26.
  • FIG. 4 is a block diagram showing functions of the PLC 30.
  • the PLC 30 is a computer system and periodically executes a user program.
  • the PLC 30 reads and writes information in the memory area in the PLC 30 and sequentially executes instructions indicated in the user program.
  • the PLC 30 has an input / output function, receives data from outside the PLC 30 such as sensor output, and accumulates the data.
  • the PLC 30 transmits the accumulated data to the DB server 20.
  • each function of the PLC 30 includes an OS 31, a system program 33, a user program 38, and definition information 32.
  • the OS 31 is designed according to the computer architecture of the PLC 30 and provides a basic execution environment for a microprocessor (not shown) to execute the system program 33 and the user program 38.
  • the system program 33 is a software group for providing basic functions as the PLC 30, operates on the OS 31, and exhibits functions such as control of a ladder program.
  • the system program 33 includes a sequence command program 34, a DB access processing program 35, an input / output processing program 36, and a scheduler 37.
  • the sequence instruction program 34 sequentially executes instructions of the user program 38 while reading / writing information in the memory area in the PLC 30.
  • the DB access processing program 35 is called when the sequence command program 34 executes the user program 38, and executes processing for the user program 38 to access the DB server 20, for example, processing such as generation of an SQL statement. .
  • the input / output processing program 36 controls data input to and output from the PLC 30 by a plurality of input / output functions provided in the PLC 30. Each input / output function is assigned to a memory address. Data held in the memory corresponding to each input / output function is periodically exchanged with data outside the PLC 30 at a time.
  • the scheduler 37 controls the execution of the sequence instruction program 34, the DB access processing program 35, and the input / output processing program 36.
  • the user program 38 is created on the PC 10 by the user and held in the memory of the PLC 30. As shown in FIG. 4, the user program 38 and the sequence command program 34 constitute a control program 39. That is, the sequence command program 34 reads the user program 38 and executes the commands in order, thereby causing the PLC 30 to execute a control operation desired by the user.
  • the definition information 32 is information indicating the definition of a structure type variable included in the user program 38, and defines a structure tag name, each member name included in the structure, and their data types.
  • FIG. 5 is a diagram showing the database table 26. As described above, the database table 26 is managed by the DBMS 22 of the DB server 20.
  • the database table 26 includes a table name 51 indicating the name of the table and table fields (Name 52, LotNo 53, SuccessCount 54, FailedCount 55,).
  • the table name 51 is “Production Table”, and information about products is stored in the table.
  • Name 52 indicates the name of the product.
  • LotNo 53 indicates the lot number of the product.
  • SuccessCount 54 indicates the number of product manufacturing successes, and FailedCount 55 indicates the number of product manufacturing failures.
  • the outline of the operation in the first embodiment is as follows.
  • the user creates a user program to be executed by the PLC 30 in the PC 10.
  • the user creates a user program including a structure type variable.
  • the PLC 30 receives the user program and the definition information 32 from the PC 10 and stores them.
  • the sequence instruction program 34 sequentially executes the instructions of the user program 38, and extracts the value of each member of the structure type variable from the memory by executing the instructions of the user program 38.
  • the sequence instruction program 34 passes processing to the DB access processing program 35 in response to an instruction for calling the DB access processing program 35.
  • the DB access processing program 35 analyzes the definition shown in the definition information 32 of the user program 38, and the data of the structure type variable extracted by the execution of the data included in the user program 38 or the instruction of the user program 38.
  • An SQL statement for accessing the DB server 20 is generated using the value of each member.
  • the DB access processing program 35 executes the SQL statement by transmitting the generated SQL statement to the DB server 20 (the DB server 20 executes the SQL statement).
  • the data type definition unit 14 of the programming tool 12 uses the structure tag name and member name and the data type of each member as the table name and field name of the database table 26 held in the DB server 20.
  • the structure tag name corresponds to the table name
  • the member name corresponds to the field name.
  • the DB access processing program 35 can create an SQL statement using the structure tag name included in the definition information 32 as the table name as it is.
  • the structure tag name defining the structure may be associated with the table name of the database table 26.
  • FIG. 6 is a flowchart showing a process in which the DB access processing program 35 creates and executes an SQL statement.
  • step S70 the DB access processing program 35 reads the definition information 32.
  • step S72 the DB access processing program 35 extracts a member name with reference to the structure definition indicated in the definition information 32, and uses the extracted member name as a field name for operating the DB 24.
  • step S74 the DB access processing program 35 extracts the structure tag name of the structure definition shown in the definition information 32, and uses the extracted structure tag name as the table name for operating the DB 24.
  • step S76 the DB access processing program 35 reads the value of each member of the structure extracted by the execution of the user program 38.
  • step S78 the DB access processing program 35 associates the field name acquired in step S72 with the value read in step S76, and generates an SQL statement using the table name acquired in step S74. To do.
  • step S80 the DB access processing program 35 operates the DB 24 of the DB server 20 by transmitting the generated SQL statement to the DB server 20.
  • a user who creates a user program for controlling the PLC 30 can access the DBMS 22 without writing a SQL statement for operating the database. For example, even a user who is unfamiliar with database operation can create a user program for accessing the database without learning the SQL concept for database operation.
  • FIG. 7 is a diagram illustrating an example of a user program.
  • the user performs programming using a structure-type data structure.
  • the variable name of the structure type variable is “ProductionTable”.
  • the value of each member is extracted by executing the user program 71 of FIG.
  • the value of the member “Name” is “Product1”
  • the value of the member “LotNo” is “100”
  • the value of the member “SuccessCount” is “49”
  • the value of the member “FailedCount” is “ 1 ”is extracted from the memory of the PLC 30, and the SQL statement shown in FIG. 8 is created and transmitted from the PLC 30 to the DB server 20.
  • the database is updated.
  • NJtoDBFunc refers to a library (a library for accessing the DBMS 22 by the DB access processing program 35) prepared in advance in the sequence instruction program 34, and the PLC 30 accesses the DBMS 22 by the DB access processing program 35.
  • Instructions to do “DBHandle” indicates a handle when the PLC 30 connects to the DBMS 22. The handle is set at the initial stage of connection to the DBMS 22 by the user program 38.
  • “Variable” indicates a variable name of a structure type variable whose value is to be passed from the PLC 30 to the DB server 20 in this program (“ProductionTable” in the example of FIG. 7).
  • “Done” and “Error” are output instructions, and indicate a state in which the instruction is completed.
  • FIG. 8 is a diagram illustrating an example of an SQL sentence.
  • FIG. 8 corresponds to the user program 71 of FIG.
  • step S72 and step S74 the table name and field name to be accessed by the PLC 30 are extracted from each database table 26 held by the DB server 20.
  • step S76 the DB access processing program 35 analyzes the lexical of each command of the user program 71 and reads the database value from the memory. As shown in the SQL statement 81 of FIG. 8, the SQL statement for updating the value of each field in the table name “ProductionTable” is generated by the DB access processing program 35.
  • FIG. 8 shows the case where data is added to the database
  • the program 35 operates the database by generating these SQL statements and sending them to the DB server 20.
  • languages that manipulate data such as Insert and Select, DML (Data Manipulation Language), DDL (Data Definition Language), and the like can also be used.
  • the DB access processing program 35 uses the structure tag name included in the definition information 32 as a table name for accessing the DBMS 22 as it is, and the member name included in the definition information 32 as It was described as a field name.
  • the DB access processing program 35 may convert the structure tag name and the member name included in the definition information 32 into a table name and a field name for accessing the DBMS 22 based on a predetermined conversion rule.
  • the predetermined conversion rule is, for example, a rule for converting a structure tag name or a member name of a structure into a character string that allows access to the DBMS 22. For example, (i) a part of a structure tag name or member name is omitted to obtain a table name or field name. (Ii) In DBMS 22, a character string prohibited from being used as a table name and field name is When included in the structure tag name or member name of the definition information 32, these character strings are deleted or corrected and used as a table name or the like.
  • the DB access processing program 35 has been described as generating an SQL sentence including the value read in step S76 as shown in FIG. Not limited to this, the DB access processing program 35 first generates an SQL statement that does not include a value, transmits it to the DBMS 22 in advance, and then transmits the value to the DBMS 22 each time a value acquired periodically is acquired. Thus, the DBMS 22 may be operated.
  • the DB access processing program 35 determines the field name and table name for operating the DB 24 by the processes up to step S70, step S72, and step S74, and determines the determined field name and table.
  • An SQL statement that does not include a value is generated using the name.
  • the item “VALUE” is blank (for example, VALUE (?,?,?,?))
  • the DB access processing program 35 transmits an SQL sentence that does not include a value to the DBMS 22 in advance. Subsequently, the DB access processing program 35 transmits the value of the SQL sentence to the DBMS 22 based on the processing result of the user program 38.
  • the value “('Product1”, 100, 49, 1) ” is transmitted from the PLC 30 to the DBMS 22 by the processing of the DB access processing program 35.
  • the SQL statement is executed when the PLC 30 transmits the SQL statement not including the value and the value to the DBMS 22 by the processing of the DB access processing program 35.
  • the PLC 30 uses the structure tag name and member name indicated in the definition information 32 as they are as the table name and field name based on the user program 38 and the definition information 32, or a predetermined conversion rule. It is assumed that the table name and field name are converted based on the above.
  • mapping information indicating a conversion rule between the structure tag name and member name indicated in the definition information 32 and the table name and field name for the DB access processing program 35 to access the DBMS 22. 41 is held by the PLC 30.
  • the DB access processing program 35 generates an SQL statement based on the mapping information 41 corresponding to the structure tag name.
  • FIG. 9 is a functional block diagram showing the configuration of PLC 30 in the second embodiment. The difference from the first embodiment is that the PLC 30 holds the mapping information 41.
  • FIG. 10 is a diagram illustrating an example of the mapping information 41. As shown in FIG. 10, the mapping information 41 associates structure tag names with table names for accessing the DBMS 22. The mapping information 41 associates each member name of the structure with each field name.
  • the mapping information 41 is, for example, created in advance by the administrator of the DB server 20 and held by the PLC 30, or the table information and field information of the database table 26 are acquired by the PC 10 and defined by the data type definition unit 14.
  • the administrator or the like may create a conversion rule for structure tag names and member names by the PC 10.
  • FIG. 11 is a flowchart showing the operation of the DB access processing program 35 in the second embodiment.
  • the PLC 30 receives the user program and the definition information 32 from the PC 10 and stores them.
  • the sequence instruction program 34 sequentially executes the instructions of the user program 38, and extracts the value of each member of the structure type variable from the memory by executing the instructions of the user program 38.
  • the sequence instruction program 34 passes processing to the DB access processing program 35 in response to an instruction for calling the DB access processing program 35.
  • step S110 the DB access processing program 35 reads the definition information 32 of the user program 38.
  • step S112 the DB access processing program 35 reads the structure tag name of the definition information 32 and the table name and field name corresponding to each member from the mapping information 41.
  • step S114 the DB access processing program 35 reads the value of each member of the structure extracted by the execution of the user program 38.
  • step S118 the DB access processing program 35 generates an SQL statement for accessing the DB server 20 using the table name and field name read in step S112 and the value read in step S114.
  • step S120 the DB access processing program 35 executes the SQL statement by transmitting the generated SQL statement to the DB server 20.
  • the mapping information 41 indicates the conversion rule between the definition information 32 and the table name and field name for accessing the DBMS 22, for example, characters that cannot be used as the table name and field name Even when the column is included in the structure tag name or member name
  • the DB access processing program 35 can generate the SQL statement by referring to the mapping information 41. Further, in the DBMS 22, the DB access processing program 35 refers to the mapping information 41 even when the naming rule of the table name and the field name is difficult for the user (for example, the character string that the table name is difficult for humans to remember).
  • the user can create the user program 38 using an easily understandable character string as the structure tag name or member name. It is also effective when the user wants to freely set a structure tag name or a member name, and the user can perform programming even if the user is not familiar with the SQL concept.
  • the mapping information 41 has been described as being created in advance by the administrator of the DB server 20 and held by the PLC 30, for example.
  • the user program 38 may include an instruction that the PLC 30 should generate the mapping information 41.
  • the PC 10 includes a user program including a conversion rule between a structure data definition (structure tag name, member name, etc.) indicated in the definition information 32 and a table name and field name for the PLC 30 to access the DBMS 22. 38 is generated.
  • This user program 38 includes an instruction for the PLC 30 to generate the mapping information 41.
  • the sequence instruction program 34 executes the user program 38, generates the mapping information 41 according to the instruction to generate the conversion rule and mapping information 41 included in the user program 38, and generates the generated mapping information 41. Is stored in memory.
  • the DB access processing program 35 generates an SQL statement by referring to the mapping information 41 held in the memory based on the structure type variable included in the user program 38 in the processing after the mapping information 41 is generated. This speeds up the process in which the PLC 30 generates the SQL statement.
  • the PC 10 generates the definition information 32 and the user program in response to a user input operation, and transmits the generated definition information 32 and the user program to the PLC 30 from the PC 10 respectively.
  • the user program may include the definition information 32.
  • the PC 10 generates a user program including the definition information 32 and transmits the generated user program to the PLC 30.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Computational Linguistics (AREA)
  • Programmable Controllers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

 データベース操作のためのSQLの記述をしなくとも、データベースへの操作を含むプログラミングを可能とする技術を提供する。DBMS(22)へアクセス可能なPLC(30)は、構造体型の変数を含むユーザプログラム(38)および構造体型の定義を示す定義情報(32)を記憶する。シーケンス命令プログラム(34)は、ユーザプログラム(38)の命令を順次、実行し、DBMS(22)へアクセスするためにDBアクセス処理プログラム(35)を呼び出す。DBアクセス処理プログラム(35)は、定義情報(32)を読み出して、読み出した定義情報(32)に基づいて、ユーザプログラム(38)の実行によるDBMS(22)へのアクセス時のSQL文を生成する。DBアクセス処理プログラム(35)は、生成されたSQL文をDBサーバ(20)へ送信することにより、SQL文を実行する。

Description

制御装置
 本発明は、プログラマブルロジックコントローラ(PLC:Programmable Logic Controller)などの制御装置に関し、特に、データベースシステムへのアクセスを容易にするための技術に関する。
 PLCなどの制御装置は、工場などの自動機械の制御などに用いられ、複数の入出力機能を有して、例えば、センサ等から出力される値を逐次、読みこんでデータを保持する。
 また、近年、制御装置は、データベースシステムと接続して、制御装置で保持しているデータを、データベースシステムに蓄積する。これにより、データベースに接続する情報処理装置同士でのデータの共有を容易にしたり、各種データを収集して、データの集計や解析などを容易にしたりすることができる。例えば、特開2007-80286号公報(下記の特許文献1)は、PLCが持つI/Oデータをリアルタイムで上位コンピュータに伝達することができるデータ収集装置を開示する。
特開2007-80286号公報
 PLC等の制御装置の制御プログラミングを行う技術者は、構造体など、制御プログラミングで用いられるデータ構造には習熟している場合が多い。一方、データベースの操作については、SQL文の記述などが必要となり、技術者にとって煩わしく、また、データベースの操作に習熟していない場合もある。通常、データベース運用のノウハウは、データベースを含む上位のコンピュータシステムのエンジニアの方が習熟している。
 そこで、本発明は、PLC等の制御装置の制御プログラミングにおいて、技術者にとって、データベースへのアクセスを含むプログラミングを容易にする技術を提供することを目的とする。
 一実施形態に従う、データベースシステムへアクセス可能な制御装置は、構造体型の変数を含むユーザプログラム、および、ユーザプログラムに含まれる構造体型の定義を示す定義情報を記憶するための記憶部と、定義情報を読み出して、読み出した定義情報に基づいて、ユーザプログラムの実行によるデータベースシステムへのアクセス時のSQL文を生成する生成部と、生成されるSQL文をデータベースシステムへ送信することによりSQL文を実行する実行部とを含む。
 好ましくは、生成部は、実行されるユーザプログラムに対応する定義情報の定義に示される構造体タグ名およびメンバ名を抽出し、抽出した構造体タグ名およびメンバ名を、所定の変換規則に従ってデータベースシステムへアクセスするためのテーブル名およびフィールド名として決定することでSQL文を生成することとしてもよい。
 好ましくは、生成部は、定義情報に基づいて、データベースシステムへアクセスするためのテーブル名およびフィールド名が特定された、値を含まないSQL文を生成し、実行部は、値を含まないSQL文を予めデータベースシステムへ送信し、ユーザプログラムの命令により構造体型の変数のメンバの値を抽出し、抽出された値をデータベースシステムへ送信することにより、SQL文を実行することとしてもよい。
 好ましくは、記憶部は、定義情報に示される、構造体タグ名およびメンバ名の定義と、データベースシステムへアクセスするためのテーブル名およびフィールド名との変換規則を示すマッピング情報を記憶しており、生成部は、定義情報に示される構造体タグ名およびメンバ名と、マッピング情報に示される変換規則とに基づいて、SQL文を生成することとしてもよい。
 好ましくは、生成部は、マッピング情報に示されるテーブル名およびフィールド名に基づいて、値を含まないSQL文を生成し、実行部は、値を含まないSQL文を予めデータベースシステムへ送信し、ユーザプログラムの命令により構造体型の変数のメンバの値を抽出し、抽出された値をデータベースシステムへ送信することにより、SQL文を実行することとしてもよい。
 好ましくは、記憶部は、定義情報に示される、構造体タグ名およびメンバ名の定義と、データベースシステムへアクセスするためのテーブル名およびフィールド名との変換規則を示すマッピング情報を記憶するように構成され、ユーザプログラムは、定義情報に基づきマッピング情報を生成すべき旨の命令を含み、生成部は、ユーザプログラムに含まれる、マッピング情報を生成すべき旨の命令を実行することで、定義情報に基づいてマッピング情報を生成し、定義情報に示される構造体タグ名およびメンバ名と、生成されるマッピング情報に示される変換規則とに基づいて、SQL文を生成することとしてもよい。
 上記の一実施形態によると、制御装置の制御プログラミングを行う技術者は、データベース操作のためのSQL文を意識せずとも、構造体型のデータ構造を用いて、データベースへのアクセスを含むプログラミングをすることができ、プログラミングが容易になる。
 この発明の上記および他の目的、特徴、局面および利点は、添付の図面と関連して理解されるこの発明に関する次の詳細な説明から明らかとなるであろう。
本実施形態におけるPLCシステム全体の構成を示す図である。 PC10の機能を示すブロック図である。 DBサーバ20の機能を示すブロック図である。DBサーバ20は、大容量の記憶装置などを備えるコンピュータシステムである。 PLC30の機能を示すブロック図である。 データベーステーブル26を示す図である。 DBアクセス処理プログラム35が、SQL文を作成し実行する処理を示すフローチャートである。 ユーザプログラムの一例を示す図である。 SQL文の例を示す図である。 実施の形態2におけるPLC30の構成を示す機能ブロック図である。 マッピング情報41の例を示す図である。 実施の形態2におけるDBアクセス処理プログラム35の動作を示すフローチャートである。
 以下、図面を参照しつつ、本発明の実施の形態について説明する。以下の説明では、同一の部品には同一の符号を付してある。それらの名称および機能も同じである。したがって、それらについての詳細な説明は繰り返さない。
 <1 実施の形態1>
 <1.1 実施の形態1の構成>
 まず、本実施の形態に係る制御システムのシステム構成について説明する。本実施の形態においては、機械や設備などの制御対象を制御するプログラマブルコントローラ(PLC)を制御装置の典型例として説明を行う。ただし、本発明に係る制御装置は、PLCに限られることなく、各種の制御装置へ適用可能である。
 図1は、本実施形態におけるPLCシステム全体の構成を示す図である。
 まず概要を説明する。図1に示すように、PLCシステムは、PC(Personal Computer)10と、DB(Database)サーバ20と、PLC30と、スイッチングハブ40とを含む。PC10は、PLC30で動作させるユーザプログラムをユーザが作成するための情報処理装置である。DBサーバ20は、データベースを管理するため、DBMS(database management system)として機能するサーバである。
 ユーザプログラムは、PLC30の利用者によって作成される。ユーザは、例えばPC10を操作することにより、データベースへのアクセス命令を含むプログラム(ソースプログラム)を作成することができる。PC10は、ソースプログラムを、PLC30において実行可能な形式に変換し、変換されたユーザプログラムをPLC30へ送信する。PLC30は、ユーザプログラムを実行し、ユーザプログラムに含まれるアクセス命令に従って、DBサーバ20にアクセスすることができる。
 PLC30は、スイッチングハブ40と接続されており、スイッチングハブ40を経由してPC10およびDBサーバ20と接続される。PLC30は、センサ出力などを外部から受け付けており、データを蓄積する。PLC30は、蓄積されたデータを、後述するDBアクセス処理プログラム35の処理により、DBサーバ20へ送信する。図1に示す例では、PLCシステムが複数のPLC30を含む例を示しており、PLC30それぞれの主要な構成は同一である。スイッチングハブ40は、PC10など複数の機器と接続され、各機器間で送受信されるデータを転送する。
 次に、各機器の構成の詳細について説明する。
 <1.2 各機器の構成の詳細>
 図2は、PC10の機能を示すブロック図である。
 PC10は、MCU(Micro Control Unit)、ROM(Read Only Memory)、RAM(Random Access Memory)等を備えるコンピュータシステム(情報処理装置)である。図2に示すように、PC10は、プログラミングツール12の機能を発揮する。プログラミングツール12は、PLC30を動作させるためのユーザプログラムをユーザが作成するための機能をPC10に発揮させるプログラムである。プログラミングツール12は、データ型定義部14と、プログラミング機能16との機能を含む。ユーザがプログラミングツール12により作成したユーザプログラムは、PLC30へ送信され、PLC30で実行される。
 ユーザプログラムは、構造体型の変数を含む。データ型定義部14は、構造体型を定義するためのソフトウェアである。構造体型は、構造体タグ名や1つ以上のメンバ名で構成される。データ型定義部14は、構造体タグ名や、これら構造体のメンバ名やそのデータ型を定義する。データ型定義部14は、例えば、工場等の生産管理において用いられる各指標を示すために、構造体タグ名を「ProductionTable」とし、この構造体の各メンバを、生産される製品の名称を示す「Name」(データ型はString)、製品のロット番号を管理するための「LotNo」(データ型はInteger)、製品の製造の成功数を示す「SuccessCount」(データ型はInteger)、製品の製造の失敗数を示す「FailedCount」(データ型はInteger)とする構造体型を定義する。データ型定義部14は、このように構造体型を定義して、その定義内容を示す定義情報32を生成する。プログラミング機能16は、ユーザによるプログラム作成を支援するためのソフトウェアである。PC10は、これらソフトウェアをPC10において実行することにより、データ型定義部14およびプログラミング機能16の機能を発揮する。
 図3は、DBサーバ20の機能を示すブロック図である。DBサーバ20は、大容量の記憶装置などを備えるコンピュータシステムである。
 DBサーバ20は、データベースへの読み出しおよび書き込みを管理するDBMS22の機能を発揮する。DBMS22は、データベースとして機能するDB24を含む。DB24は、複数のデータベーステーブル26を保持する。
 図4は、PLC30の機能を示すブロック図である。PLC30は、コンピュータシステムであり、ユーザプログラムを周期的に実行する。PLC30は、PLC30内のメモリ領域の情報を読み書きして、ユーザプログラムに示される命令を順に実行する。PLC30は、入出力機能を備えており、センサ出力などPLC30の外部からデータを受け付けて、データを蓄積する。PLC30は、蓄積されたデータをDBサーバ20へ送信する。
 図4に示すように、PLC30の各機能は、OS31と、システムプログラム33と、ユーザプログラム38および定義情報32とにより構成される。OS31は、PLC30のコンピュータアーキテクチャに応じて設計されており、マイクロプロセッサ(図示しない)がシステムプログラム33およびユーザプログラム38を実行するための基本的な実行環境を提供する。
 システムプログラム33は、PLC30としての基本的な機能を提供するためのソフトウェア群であり、OS31上で動作し、ラダープログラムの制御などの機能を発揮する。システムプログラム33は、シーケンス命令プログラム34と、DBアクセス処理プログラム35と、入出力処理プログラム36と、スケジューラ37とを含んでいる。シーケンス命令プログラム34は、PLC30内のメモリ領域の情報を読み書きしながら、ユーザプログラム38の命令を順に実行する。DBアクセス処理プログラム35は、シーケンス命令プログラム34がユーザプログラム38を実行することに伴って呼び出され、ユーザプログラム38がDBサーバ20へアクセスするための処理、例えばSQL文の生成などの処理を実行する。
 入出力処理プログラム36は、PLC30が備える複数の入出力機能によるPLC30へのデータ入力およびPLC30からのデータ出力を制御する。各入出力機能は、それぞれメモリのアドレスと割りつけられている。各入出力機能に対応するメモリに保持されるデータは、PLC30の外部のデータと一括して周期的に交換される。スケジューラ37は、シーケンス命令プログラム34と、DBアクセス処理プログラム35と、入出力処理プログラム36との実行を制御する。
 ユーザプログラム38は、ユーザによってPC10上で作成され、PLC30のメモリに保持されている。図4に示すように、ユーザプログラム38とシーケンス命令プログラム34とが制御プログラム39を構成する。すなわち、シーケンス命令プログラム34がユーザプログラム38を読み出して、命令を順に実行することで、PLC30にユーザ所望の制御動作を実行させる。
 定義情報32は、ユーザプログラム38に含まれる構造体型の変数の定義を示す情報であり、構造体タグ名、構造体に含まれる各メンバ名や、これらのデータ型が定義される。
 <2 データ>
 次に、本実施形態で用いるデータについて、説明する。
 図5は、データベーステーブル26を示す図である。データベーステーブル26は、上述のとおり、DBサーバ20のDBMS22で管理されている。
 データベーステーブル26は、テーブルの名称を示すテーブル名称51と、テーブルのフィールド(Name52、LotNo53、SuccessCount54、FailedCount55、・・)とにより構成される。図5の例では、テーブル名称51に示されるように、テーブルの名称は「Production Table」であり、製品に関する情報をテーブルに格納している。Name52は、製品の名称を示す。LotNo53は、製品のロット番号を示す。SuccessCount54は、製品製造の成功数を示し、FailedCount55は、製品製造の失敗数を示す。
 <3 動作>
 次に、本実施形態におけるPC10、PLC30の動作について、図面を用いて詳しく説明する。
 実施の形態1における動作の概要は、以下のとおりである。
 ユーザは、PC10において、PLC30で実行させるユーザプログラムを作成する。ユーザは、DBサーバ20へアクセスするため、構造体型の変数を含むユーザプログラムを作成する。
 PLC30は、PC10から、ユーザプログラム、および、定義情報32を受信して記憶する。シーケンス命令プログラム34は、ユーザプログラム38の命令を順に実行し、ユーザプログラム38の命令の実行により、構造体型の変数の、各メンバの値をメモリから抽出する。シーケンス命令プログラム34は、DBアクセス処理プログラム35を呼び出す命令に応じて、DBアクセス処理プログラム35に処理を渡す。DBアクセス処理プログラム35は、ユーザプログラム38の定義情報32に示される定義などを解析し、ユーザプログラム38に含まれるデータや、ユーザプログラム38の命令の実行により抽出された、構造体型の変数の、各メンバの値を用いて、DBサーバ20へアクセスするためのSQL文を生成する。DBアクセス処理プログラム35は、生成されるSQL文をDBサーバ20へ送信することで、SQL文を実行する(DBサーバ20にSQL文を実行させる)。
 なお、本実施形態では、プログラミングツール12のデータ型定義部14は、構造体タグ名およびメンバ名と、各メンバのデータ型を、DBサーバ20に保持されるデータベーステーブル26のテーブル名およびフィールド名と対応づけて定義している。すなわち、構造体タグ名とテーブル名とが対応し、メンバ名とフィールド名とが対応している。このような定義が、ユーザプログラム38の定義情報32に含まれる。そのため、DBアクセス処理プログラム35は、定義情報32に含まれる構造体タグ名をそのままテーブル名として使用してSQL文を作成することができる。メンバ名とフィールド名についても同様である。なお、構造体を定義する構造体タグ名を、データベーステーブル26のテーブル名と対応づけることとしてもよい。
 図6は、DBアクセス処理プログラム35が、SQL文を作成し実行する処理を示すフローチャートである。
 ステップS70において、DBアクセス処理プログラム35は、定義情報32を読み出す。
 ステップS72において、DBアクセス処理プログラム35は、定義情報32に示される構造体の定義を参照してメンバ名を抽出し、抽出したメンバ名をDB24を操作するためのフィールド名とする。
 ステップS74において、DBアクセス処理プログラム35は、定義情報32に示される構造体の定義の構造体タグ名を抽出し、抽出した構造体タグ名をDB24を操作するためのテーブル名とする。
 ステップS76において、DBアクセス処理プログラム35は、ユーザプログラム38の実行により抽出された、構造体の各メンバの値を読み出す。
 ステップS78において、DBアクセス処理プログラム35は、ステップS72で取得されたフィールド名と、ステップS76で読み出された値とを対応づけて、ステップS74で取得されたテーブル名を用いてSQL文を生成する。
 ステップS80において、DBアクセス処理プログラム35は、生成されたSQL文をDBサーバ20へ送信することにより、DBサーバ20のDB24を操作する。
 これにより、PLC30を制御するためのユーザプログラムを作成するユーザにとっては、データベースを操作するためのSQL文の記述をしなくとも、DBMS22へアクセスすることができる。例えば、データベース操作に不慣れなユーザであっても、データベース操作のためのSQLの概念などを習得しなくとも、データベースへアクセスするユーザプログラムを作成することができる。
 以下、ユーザプログラムの例や、SQL文の例について、具体的に説明する。
 プログラミングツール12により作成されるユーザプログラムの例について、説明する。図7は、ユーザプログラムの一例を示す図である。
 図7のユーザプログラム71に示されるように、ユーザは、構造体型のデータ構造を用いて、プログラミングを実施する。ユーザプログラム71の例は、構造体型の変数の変数名が「ProductionTable」である。なお、図7のユーザプログラム71が実行されることにより、各メンバの値が抽出される。例えば、DBアクセス処理プログラム35は、メンバ「Name」の値が「Product1」、メンバ「LotNo」の値が「100」、メンバ「SuccessCount」の値が「49」、メンバ「FailedCount」の値が「1」とPLC30のメモリから抽出し、図8に示すSQL文を作成してPLC30からDBサーバ20へ送信する。これにより、データベースが更新される。
 ここで、「NJtoDBFunc」は、シーケンス命令プログラム34に予め用意されたライブラリ(DBアクセス処理プログラム35によりDBMS22へアクセスするためのライブラリ)をPLC30が呼び出して、PLC30がDBアクセス処理プログラム35によりDBMS22へアクセスするための命令を示す。「DBHandle」は、PLC30がDBMS22に接続する際のハンドルを示す。ハンドルは、ユーザプログラム38によるDBMS22への接続の初期段階で設定される。「Variable」は、このプログラムにおいて、PLC30からDBサーバ20へと値を渡す対象となる構造体型の変数の変数名(図7の例では、「ProductionTable」)を示す。「Done」「Error」は、出力用の命令であり、命令が完了した状態を示す。
 ステップS78において生成されるSQL文の例について、具体的に説明する。図8は、SQL文の例を示す図である。なお、図8は、図7のユーザプログラム71と対応している。
 なお、ステップS72、ステップS74において、DBサーバ20が保持する各データベーステーブル26のうち、PLC30がアクセスする対象となるテーブル名およびフィールド名が抽出されている。ステップS76において、DBアクセス処理プログラム35は、ユーザプログラム71の各命令の字句を解析し、メモリからデータベースの値を読み出す。図8のSQL文81に示されるように、テーブル名「ProductionTable」において、各フィールドの値を更新するためのSQL文がDBアクセス処理プログラム35により生成される。
 なお、この図8の例では、データベースへのデータの追加をする場合を示しているが、SQL文は、データベースへの書き込み、読みこみ、また、データベースそのものを作成するものもあり、DBアクセス処理プログラム35は、これらSQL文を生成してDBサーバ20へ送信することにより、データベースを操作する。SQL文の例としては、Insert、Selectなどデータを操作する言語、DML(Data Manipulation Language)、DDL(Data Definition Language)なども利用できる。
 <4 変形例>
 (実施例1の変形例1)
 なお、上記実施例1の説明では、DBアクセス処理プログラム35は、定義情報32に含まれる構造体タグ名を、そのままDBMS22へアクセスするためのテーブル名とし、定義情報32に含まれるメンバ名を、フィールド名とするものとして説明した。
 DBアクセス処理プログラム35は、所定の変換規則に基づいて、定義情報32に含まれる構造体タグ名およびメンバ名を、DBMS22へアクセスするためのテーブル名およびフィールド名に変換するものとしてもよい。ここで、所定の変換規則とは、例えば、構造体の構造体タグ名やメンバ名を、DBMS22へのアクセスを可能とする文字列に変換するための規則である。例えば、(i)構造体タグ名またはメンバ名の一部の文字列を省略してテーブル名またはフィールド名とする、(ii)DBMS22において、テーブル名およびフィールド名としての使用を禁止する文字列が定義情報32の構造体タグ名またはメンバ名に含まれる場合に、これら文字列を削除または修正してテーブル名等として使用する等である。
 (実施例1の変形例2)
 上記実施例1の説明では、DBアクセス処理プログラム35は、図8に示されるような、ステップS76で読み出された値を含むSQL文を生成するものとして説明した。これに限らず、DBアクセス処理プログラム35は、まず値を含まないSQL文を生成し、予めDBMS22へ送信し、続いて、周期的に取得される値を取得する都度、DBMS22へ値を送信することによりDBMS22を操作するものとしてもよい。
 例えば、DBアクセス処理プログラム35は、図6の例において、ステップS70、ステップS72、ステップS74までの処理により、DB24を操作するためのフィールド名とテーブル名とを決定し、決定したフィールド名およびテーブル名を用いて、値を含まないSQL文を生成する。値を含まないSQL文は、図8の例では、「VALUE」の項目が空欄(例えば、VALUE(?, ?, ?, ?))になる。DBアクセス処理プログラム35は、値を含まないSQL文をDBMS22へ予め送信する。続いて、DBアクセス処理プログラム35は、SQL文の値を、ユーザプログラム38の処理結果に基づいて、DBMS22へ送信する。例えば、図7および8の例では、値「('Product1', 100, 49, 1)」がDBアクセス処理プログラム35の処理によってPLC30からDBMS22へ送信される。このように、値を含まないSQL文と、値とをDBアクセス処理プログラム35の処理によってPLC30がDBMS22へ送信することにより、SQL文が実行される。
 <5 実施の形態2>
 次に、別の実施の形態について説明する。実施の形態1では、PLC30が、ユーザプログラム38および定義情報32に基づいて、定義情報32に示される構造体タグ名およびメンバ名を、そのままテーブル名およびフィールド名とする、または、所定の変換規則に基づいてテーブル名およびフィールド名に変換するものとして説明している。
 これに対し、実施の形態2では、定義情報32に示される構造体タグ名およびメンバ名と、DBアクセス処理プログラム35がDBMS22へアクセスするためのテーブル名およびフィールド名との変換規則を示すマッピング情報41を、PLC30が保持している。DBアクセス処理プログラム35は、構造体タグ名に対応するマッピング情報41に基づいて、SQL文を生成する。
 以下、具体的に説明する。図9は、実施の形態2におけるPLC30の構成を示す機能ブロック図である。実施の形態1との相違点は、PLC30がマッピング情報41を保持している点である。
 図10は、マッピング情報41の例を示す図である。図10に示すように、マッピング情報41は、構造体タグ名と、DBMS22へアクセスするためのテーブル名とを対応づけている。また、マッピング情報41は、構造体の各メンバ名と、各フィールド名とを対応づけている。
 マッピング情報41は、例えば、予めDBサーバ20の管理者等により作成されてPLC30が保持するか、データベーステーブル26のテーブル情報およびフィールド情報をPC10が取得して、データ型定義部14により定義される構造体タグ名やメンバ名との変換規則を管理者等がPC10により作成することとしてもよい。
 <6 実施の形態2の動作>
 図11は、実施の形態2におけるDBアクセス処理プログラム35の動作を示すフローチャートである。
 実施の形態1と同様に、PLC30は、PC10からユーザプログラム、および、定義情報32を受信して記憶する。シーケンス命令プログラム34は、ユーザプログラム38の命令を順に実行し、ユーザプログラム38の命令の実行により、構造体型の変数の、各メンバの値をメモリから抽出する。シーケンス命令プログラム34は、DBアクセス処理プログラム35を呼び出す命令に応じて、DBアクセス処理プログラム35に処理を渡す。
 以下、具体的に説明する。
 ステップS110において、DBアクセス処理プログラム35は、ユーザプログラム38の定義情報32を読み出す。
 ステップS112において、DBアクセス処理プログラム35は、定義情報32の構造体タグ名と、各メンバとに対応するテーブル名、フィールド名とをマッピング情報41から読み出す。
 ステップS114において、DBアクセス処理プログラム35は、ユーザプログラム38の実行により抽出された、構造体の各メンバの値を読み出す。
 ステップS118において、DBアクセス処理プログラム35は、ステップS112で読み出したテーブル名、フィールド名と、ステップS114で読み出した値を用いて、DBサーバ20へアクセスするためのSQL文を生成する。
 ステップS120において、DBアクセス処理プログラム35は、生成されるSQL文をDBサーバ20へ送信することでSQL文を実行する。
 上記実施の形態2によると、定義情報32と、DBMS22へアクセスするためのテーブル名およびフィールド名との変換規則を、マッピング情報41により示しているため、例えば、テーブル名およびフィールド名として使用できない文字列が構造体タグ名やメンバ名に含まれている場合にも、DBアクセス処理プログラム35は、マッピング情報41を参照することによりSQL文を生成することができる。また、DBMS22において、テーブル名およびフィールド名の命名規則が、ユーザにとって扱いにくい場合(例えば、テーブル名が人間にとって覚えにくい文字列など)であっても、DBアクセス処理プログラム35がマッピング情報41を参照してSQL文を生成するため、ユーザは、理解しやすい文字列を構造体タグ名やメンバ名に用いてユーザプログラム38を作成することができる。また、ユーザが自由に構造体タグ名やメンバ名を設定したい場合にも有効であり、ユーザは、SQLの概念に習熟していなくとも、プログラミングをすることができる。
 実施の形態2において、マッピング情報41は、例えば、予めDBサーバ20の管理者等により作成されてPLC30が保持するものと説明した。この他に、ユーザプログラム38に、PLC30がマッピング情報41を生成すべき旨の命令を含めることとしてもよい。例えば、PC10は、定義情報32に示される構造体のデータの定義(構造体タグ名、メンバ名など)と、PLC30がDBMS22へアクセスするためのテーブル名およびフィールド名との変換規則を含むユーザプログラム38を生成する。このユーザプログラム38は、PLC30がマッピング情報41を生成すべき命令を含む。
 PLC30は、シーケンス命令プログラム34がユーザプログラム38を実行し、ユーザプログラム38に含まれる、上記の変換規則およびマッピング情報41を生成すべき命令に応じてマッピング情報41を生成し、生成したマッピング情報41をメモリに保持する。DBアクセス処理プログラム35は、マッピング情報41を生成した以降の処理で、ユーザプログラム38に含まれる構造体型の変数に基づいて、メモリに保持されるマッピング情報41を参照してSQL文を生成する。これにより、PLC30がSQL文を生成する処理が高速化する。
 また、上記実施の形態の説明では、ユーザの入力操作に応じてPC10が定義情報32とユーザプログラムとを生成し、生成された定義情報32とユーザプログラムとをそれぞれPC10からPLC30へ送信するものとして説明してきた。この他に、ユーザプログラムが定義情報32を含むものとしてもよい。PC10は、定義情報32を含むユーザプログラムを生成し、生成されたユーザプログラムをPLC30へ送信する。
 このように各実施形態について説明してきたが、これら実施形態を組み合わせてもよいことはいうまでもない。以上、本発明者によってなされた発明を実施の形態に基づき具体的に説明したが、本発明は前記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。
 今回開示された実施の形態はすべての点で例示であって制限的なものでないと考えられるべきである。この発明の範囲は上記した説明ではなくて請求の範囲によって示され、請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。
 10 PC、12 プログラミングツール、14 データ型定義部、16 プログラミング機能、20 DBサーバ、22 DBMS、24 DB、26 データベーステーブル、30 PLC、31 OS、32 定義情報、33 システムプログラム、34 シーケンス命令プログラム、35 DBアクセス処理プログラム、36 入出力処理プログラム、37 スケジューラ、38 ユーザプログラム、39 制御プログラム、40 スイッチングハブ、41 マッピング情報、51 テーブル名称、52 Name、53 LotNo、54 SuccessCount、55 FailedCount、71 ユーザプログラム、81 SQL文。

Claims (6)

  1.  データベースシステムへアクセス可能な制御装置であって、
     構造体型の変数を含むユーザプログラム、および、前記ユーザプログラムに含まれる前記構造体型の定義を示す定義情報を記憶するための記憶部と、
     前記定義情報を読み出して、読み出した当該定義情報に基づいて、前記ユーザプログラムの実行による前記データベースシステムへのアクセス時のSQL文を生成する生成部と、
     生成されるSQL文を前記データベースシステムへ送信することにより前記SQL文を実行する実行部とを含む、制御装置。
  2.  前記生成部は、
     前記実行されるユーザプログラムに対応する前記定義情報の定義に示される構造体タグ名およびメンバ名を抽出し、抽出した構造体タグ名およびメンバ名を、所定の変換規則に従って前記データベースシステムへアクセスするためのテーブル名およびフィールド名として決定することで前記SQL文を生成する、請求項1に記載の制御装置。
  3.  前記生成部は、
     前記定義情報に基づいて、前記データベースシステムへアクセスするためのテーブル名およびフィールド名が特定された、値を含まないSQL文を生成し、
     前記実行部は、前記値を含まないSQL文を予め前記データベースシステムへ送信し、前記ユーザプログラムの命令により前記構造体型の変数のメンバの値を抽出し、抽出された値を前記データベースシステムへ送信することにより、前記SQL文を実行する、請求項1に記載の制御装置。
  4.  前記記憶部は、前記定義情報に示される、構造体タグ名およびメンバ名の定義と、前記データベースシステムへアクセスするためのテーブル名およびフィールド名との変換規則を示すマッピング情報を記憶しており、
     前記生成部は、前記定義情報に示される構造体タグ名およびメンバ名と、前記マッピング情報に示される変換規則とに基づいて、前記SQL文を生成する、請求項1に記載の制御装置。
  5.  前記生成部は、
     前記マッピング情報に示されるテーブル名およびフィールド名に基づいて、値を含まないSQL文を生成し、
     前記実行部は、前記値を含まないSQL文を予め前記データベースシステムへ送信し、前記ユーザプログラムの命令により前記構造体型の変数のメンバの値を抽出し、抽出された値を前記データベースシステムへ送信することにより、前記SQL文を実行する、請求項4に記載の制御装置。
  6.  前記記憶部は、前記定義情報に示される、構造体タグ名およびメンバ名の定義と、前記データベースシステムへアクセスするためのテーブル名およびフィールド名との変換規則を示すマッピング情報を記憶するように構成され、
     前記ユーザプログラムは、前記定義情報に基づき前記マッピング情報を生成すべき旨の命令を含み、
     前記生成部は、
     前記ユーザプログラムに含まれる、前記マッピング情報を生成すべき旨の命令を実行することで、前記定義情報に基づいて前記マッピング情報を生成し、
     前記定義情報に示される構造体タグ名およびメンバ名と、前記生成される前記マッピング情報に示される前記変換規則とに基づいて、前記SQL文を生成する、請求項1に記載の制御装置。
PCT/JP2013/067088 2012-06-22 2013-06-21 制御装置 Ceased WO2013191275A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
US14/405,980 US10061809B2 (en) 2012-06-22 2013-06-21 Control device
CN201380032494.5A CN104395845B (zh) 2012-06-22 2013-06-21 控制装置
EP13807001.6A EP2866108A4 (en) 2012-06-22 2013-06-21 CONTROL DEVICE
JP2014521521A JP6065008B2 (ja) 2012-06-22 2013-06-21 制御装置

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2012-141378 2012-06-22
JP2012141378 2012-06-22

Publications (1)

Publication Number Publication Date
WO2013191275A1 true WO2013191275A1 (ja) 2013-12-27

Family

ID=49768866

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2013/067088 Ceased WO2013191275A1 (ja) 2012-06-22 2013-06-21 制御装置

Country Status (5)

Country Link
US (1) US10061809B2 (ja)
EP (1) EP2866108A4 (ja)
JP (1) JP6065008B2 (ja)
CN (1) CN104395845B (ja)
WO (1) WO2013191275A1 (ja)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015162794A1 (ja) * 2014-04-25 2015-10-29 三菱電機株式会社 情報連携支援装置、情報連携支援プログラム
KR20160083284A (ko) * 2014-12-30 2016-07-12 주식회사 포스코아이씨티 이기종 데이터베이스를 지원하는 제어기 관리 스테이션 및 이를 포함하는 제어 시스템
EP3076309A1 (en) 2015-03-31 2016-10-05 Omron Corporation Programmable logic controller, data collection apparatus, database access method, and database access program
WO2018193503A1 (ja) * 2017-04-17 2018-10-25 三菱電機株式会社 プログラム作成装置
WO2019176486A1 (ja) * 2018-03-15 2019-09-19 オムロン株式会社 制御システム、コントローラ、および制御方法
JP2019159996A (ja) * 2018-03-15 2019-09-19 オムロン株式会社 コントローラ、制御方法、および制御プログラム
JP2020144753A (ja) * 2019-03-08 2020-09-10 オムロン株式会社 制御システム、情報処理装置、および情報処理プログラム

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3118696B1 (en) * 2015-04-06 2020-07-22 Mitsubishi Electric Corporation Programmable controller system
US10169351B2 (en) * 2015-08-19 2019-01-01 International Business Machines Corporation Merging directory information from a user directory to a common directory
US11409760B2 (en) 2017-08-31 2022-08-09 Aveva Software, Llc Data array of objects indexing
CN109885532A (zh) * 2019-02-11 2019-06-14 中国银行股份有限公司 一种交易数据标准化方法和装置
CN112015831A (zh) * 2020-09-09 2020-12-01 深圳市绿联科技有限公司 基于c语言对关系型数据库进行操作的方法、装置及设备
CN116975031A (zh) * 2023-07-06 2023-10-31 上海金仕达卫宁软件科技有限公司 基于数据指标体系快速建立数据质量监测规则标准的方法

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001034513A (ja) * 1999-07-19 2001-02-09 Hitachi Ltd データ変換方法および装置並びにデータ変換プログラムを格納した記憶媒体
JP2002023812A (ja) * 2000-07-05 2002-01-25 Mitsubishi Materials Corp 自動制御システムおよび自動制御方法
JP2002099561A (ja) * 2000-09-21 2002-04-05 Toshiba Corp データ変換方法およびデータ変換システム並びに記憶媒体
JP2002149652A (ja) * 2000-11-07 2002-05-24 Hitachi Ltd データベース検索処理方法及びその実施装置並びにその処理プログラムを記録した記録媒体
JP2003091530A (ja) * 2001-09-17 2003-03-28 Toshiba Corp 構造化データ変換方法、構造化データ変換プログラム、構造化データ変換装置
JP2004302849A (ja) * 2003-03-31 2004-10-28 Mitsubishi Electric Corp Faコントローラ
JP2007080286A (ja) 2006-11-13 2007-03-29 Omron Corp データ収集装置
JP2008083872A (ja) * 2006-09-26 2008-04-10 Fuji Electric Fa Components & Systems Co Ltd シーケンスプログラム変換装置、プログラマブルコントローラのプログラミング装置、および、プログラマブルコントローラ
JP2012108642A (ja) * 2010-11-16 2012-06-07 Fuji Electric Co Ltd データ収集システム、データ収集システムの異常要因判定方法

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6735594B1 (en) * 2000-06-23 2004-05-11 International Business Machines Corporation Transparent parameter marker support for a relational database over a network
US7467018B1 (en) * 2002-11-18 2008-12-16 Rockwell Automation Technologies, Inc. Embedded database systems and methods in an industrial controller environment
US20060026193A1 (en) * 2004-08-02 2006-02-02 Rockwell Software, Inc. Dynamic schema for unified plant model
JP2006164090A (ja) * 2004-12-10 2006-06-22 Hitachi Ltd データベース操作プログラムの自動生成装置
US7565351B1 (en) * 2005-03-14 2009-07-21 Rockwell Automation Technologies, Inc. Automation device data interface
US8065666B2 (en) * 2006-06-02 2011-11-22 Rockwell Automation Technologies, Inc. Change management methodologies for industrial automation and information systems
DE102006046643A1 (de) 2006-09-29 2008-04-03 Phoenix Contact Gmbh & Co. Kg Speicherprogrammierbare Steuereinrichtung mit integriertem Datenbanktreiber
CN100456237C (zh) * 2007-01-31 2009-01-28 华为技术有限公司 数据库访问方法和装置
US7853336B2 (en) * 2007-02-27 2010-12-14 Rockwell Automation Technologies, Inc. Dynamic versioning utilizing multiple controller engine instances to limit complications
CN101714087A (zh) * 2009-12-15 2010-05-26 四川长虹电器股份有限公司 C语言结构体至关系数据库表的映射系统及映射方法
JP6201298B2 (ja) 2012-11-14 2017-09-27 オムロン株式会社 コントローラおよびプログラム

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001034513A (ja) * 1999-07-19 2001-02-09 Hitachi Ltd データ変換方法および装置並びにデータ変換プログラムを格納した記憶媒体
JP2002023812A (ja) * 2000-07-05 2002-01-25 Mitsubishi Materials Corp 自動制御システムおよび自動制御方法
JP2002099561A (ja) * 2000-09-21 2002-04-05 Toshiba Corp データ変換方法およびデータ変換システム並びに記憶媒体
JP2002149652A (ja) * 2000-11-07 2002-05-24 Hitachi Ltd データベース検索処理方法及びその実施装置並びにその処理プログラムを記録した記録媒体
JP2003091530A (ja) * 2001-09-17 2003-03-28 Toshiba Corp 構造化データ変換方法、構造化データ変換プログラム、構造化データ変換装置
JP2004302849A (ja) * 2003-03-31 2004-10-28 Mitsubishi Electric Corp Faコントローラ
JP2008083872A (ja) * 2006-09-26 2008-04-10 Fuji Electric Fa Components & Systems Co Ltd シーケンスプログラム変換装置、プログラマブルコントローラのプログラミング装置、および、プログラマブルコントローラ
JP2007080286A (ja) 2006-11-13 2007-03-29 Omron Corp データ収集装置
JP2012108642A (ja) * 2010-11-16 2012-06-07 Fuji Electric Co Ltd データ収集システム、データ収集システムの異常要因判定方法

Non-Patent Citations (1)

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

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015162794A1 (ja) * 2014-04-25 2015-10-29 三菱電機株式会社 情報連携支援装置、情報連携支援プログラム
KR20160020569A (ko) * 2014-04-25 2016-02-23 미쓰비시덴키 가부시키가이샤 정보 제휴 지원 장치, 정보 제휴 지원 프로그램
JP5875737B1 (ja) * 2014-04-25 2016-03-02 三菱電機株式会社 情報連携支援装置、情報連携支援プログラム
CN105393181A (zh) * 2014-04-25 2016-03-09 三菱电机株式会社 信息协同辅助装置、信息协同辅助程序
KR101665300B1 (ko) 2014-04-25 2016-10-11 미쓰비시덴키 가부시키가이샤 정보 제휴 지원 장치 및 정보 제휴 지원 프로그램이 기록된 기록매체
CN105393181B (zh) * 2014-04-25 2017-06-09 三菱电机株式会社 信息协同辅助装置、信息协同辅助程序
US9841754B2 (en) 2014-04-25 2017-12-12 Mitsubishi Electric Corporation Information-linkage supporting apparatus and information-linkage supporting program
KR20160083284A (ko) * 2014-12-30 2016-07-12 주식회사 포스코아이씨티 이기종 데이터베이스를 지원하는 제어기 관리 스테이션 및 이를 포함하는 제어 시스템
KR101704145B1 (ko) 2014-12-30 2017-02-08 주식회사 포스코아이씨티 이기종 데이터베이스를 지원하는 제어기 관리 스테이션 및 이를 포함하는 제어 시스템
EP3076309A1 (en) 2015-03-31 2016-10-05 Omron Corporation Programmable logic controller, data collection apparatus, database access method, and database access program
JP2016194808A (ja) * 2015-03-31 2016-11-17 オムロン株式会社 プログラマブルロジックコントローラ、データ収集装置、データベースアクセス方法およびデータベースアクセスプログラム
CN109478051A (zh) * 2017-04-17 2019-03-15 三菱电机株式会社 程序创建装置
WO2018193503A1 (ja) * 2017-04-17 2018-10-25 三菱電機株式会社 プログラム作成装置
US11281650B2 (en) 2018-03-15 2022-03-22 Omron Corporation Control system, controller, and control method
JP2019159996A (ja) * 2018-03-15 2019-09-19 オムロン株式会社 コントローラ、制御方法、および制御プログラム
WO2019176487A1 (ja) * 2018-03-15 2019-09-19 オムロン株式会社 コントローラ、制御方法、および制御プログラム
JP2019159995A (ja) * 2018-03-15 2019-09-19 オムロン株式会社 制御システム、コントローラ、および制御方法
WO2019176486A1 (ja) * 2018-03-15 2019-09-19 オムロン株式会社 制御システム、コントローラ、および制御方法
US11334550B2 (en) 2018-03-15 2022-05-17 Omron Corporation Controller, control method, and control program for SQL statement generation in a factory automation database
JP2020144753A (ja) * 2019-03-08 2020-09-10 オムロン株式会社 制御システム、情報処理装置、および情報処理プログラム
WO2020184061A1 (ja) * 2019-03-08 2020-09-17 オムロン株式会社 制御システム、情報処理装置、および情報処理プログラム
CN113518981A (zh) * 2019-03-08 2021-10-19 欧姆龙株式会社 控制系统、信息处理装置以及信息处理程序
JP7014199B2 (ja) 2019-03-08 2022-02-01 オムロン株式会社 制御システム、情報処理装置、および情報処理プログラム
US12298731B2 (en) 2019-03-08 2025-05-13 Omron Corporation Control system, information processing apparatus, and information processing program
US12372937B2 (en) 2019-03-08 2025-07-29 Omron Corporation Control system, information processing apparatus, and information processing program

Also Published As

Publication number Publication date
CN104395845A (zh) 2015-03-04
EP2866108A1 (en) 2015-04-29
JP6065008B2 (ja) 2017-01-25
EP2866108A4 (en) 2015-11-04
JPWO2013191275A1 (ja) 2016-05-26
US20150254305A1 (en) 2015-09-10
US10061809B2 (en) 2018-08-28
CN104395845B (zh) 2017-07-25

Similar Documents

Publication Publication Date Title
JP6065008B2 (ja) 制御装置
EP3853680B1 (en) A gateway and method for transforming a description of an industrial process equipment into a data information model
US10209695B2 (en) Method and a system for replacing and commissioning of a field device
CN107179753B (zh) 来自控制器程序文件的自动化控制系统点配置
US11385613B2 (en) Process image within controllers enabling visibility and accessibility of real world objects
CN1764877B (zh) 启动应用的方法
US8032232B2 (en) Natively retaining project documentation in a controller
CN108351636A (zh) 工程设计工具、系统及模块
EP3042254A1 (en) Systems and methods for virtualizing a programmable logic controller
CN112363694B (zh) Fmu文件及求解器运行环境与工业软件的集成方法
CN112363695A (zh) Pmml文件及其运行时环境与工业软件的集成方法
WO2022073981A1 (en) Data extraction in industrial automation systems
JP6370503B1 (ja) プログラム作成装置
Weigand et al. Creating virtual knowledge graphs from software-internal data
CN115562629A (zh) 一种rpa流程表示方法、系统、装置及存储介质
JP2022125962A (ja) プロセス制御システム用の実装可能なシーケンシャルファンクションチャートコードを生成するための方法、システム、およびコンピュータプログラム製品
US20120011157A1 (en) Method and system for inferencing taxonomy topic concept objects using a metamodel instance model
Xiao et al. MetaFactory: A cloud-based framework to configure and generate dynamic data structures from the STEP-NC knowledge graph
Schachinger et al. Model-driven integration of building automation systems into Web service gateways
Runde et al. EDDL and semantic web—From field device integration (FDI) to Future Device Management (FDM)
Listl et al. Utilizing ISA-95 in an industrial knowledge graph for material flow simulation-semantic model extensions and efficient data integration
JP7793401B2 (ja) プロトコルドライバ作成装置
WO2025120802A1 (ja) Scadaウェブhmiシステム
EP4099106A1 (en) Validation logic for opc ua connected devices
JP2026042243A (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: 13807001

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2013807001

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2014521521

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 14405980

Country of ref document: US