WO2015136960A1 - コントローラ - Google Patents

コントローラ Download PDF

Info

Publication number
WO2015136960A1
WO2015136960A1 PCT/JP2015/050798 JP2015050798W WO2015136960A1 WO 2015136960 A1 WO2015136960 A1 WO 2015136960A1 JP 2015050798 W JP2015050798 W JP 2015050798W WO 2015136960 A1 WO2015136960 A1 WO 2015136960A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
priority
program
instruction
cycle
Prior art date
Application number
PCT/JP2015/050798
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 EP15761349.8A priority Critical patent/EP3101496A4/en
Priority to US15/123,061 priority patent/US10139799B2/en
Priority to CN201580011829.4A priority patent/CN106062648A/zh
Publication of WO2015136960A1 publication Critical patent/WO2015136960A1/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
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • 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/10Plc systems
    • G05B2219/13Plc programming
    • G05B2219/13086Priority interrupt

Definitions

  • the present invention relates to a control system including a control device that executes a user program periodically or in an event, and an information processing device of the control system.
  • Control system mainly composed of a control device (controller) such as a programmable controller (hereinafter also referred to as “PLC”).
  • controller such as a programmable controller
  • PLC programmable controller
  • the PLC is, for example, a CPU (Central Processing Unit) unit that includes a microprocessor that executes user programs, and an IO (Input Output) unit that is responsible for signal input from external switches and sensors and signal output to external relays and actuators. It is composed of a plurality of units.
  • the PLC performs a control operation while exchanging data via the PLC system bus and / or the field network for each user program execution cycle between these units.
  • the PLC CPU unit executes programs such as user programs and system programs in accordance with task assignments.
  • the CPU unit executes an I / O refresh for inputting / outputting data to / from a slave device or an I / O unit, executing a user program, and receiving a user program command.
  • I / O refresh for inputting / outputting data to / from a slave device or an I / O unit, executing a user program, and receiving a user program command.
  • Tasks include a fixed-cycle task that is periodically executed by the PLC, and an event task that is executed only once when a predetermined condition is satisfied.
  • Each task has a priority to be executed and a task cycle.
  • the CPU unit executes each program according to the priority of the task.
  • Patent Document 1 An example of a PLC that operates according to task assignment is, for example, Japanese Patent No. 4894961 (Patent Document 1).
  • Patent Document 1 Japanese Patent Application Laid-Open No. H10-228707 considers that the execution time of the control program may be sporadically increased, and the control data output and input communication cycle performed by the PLC CPU unit is set as the maximum execution time of the control program. It describes a CPU unit of a PLC that can have a shorter fixed time.
  • Patent Document 1 when a program with a high priority for task execution and a program with a low priority exist, a program with a high priority is executed within a certain cycle time, and after this execution is completed, It is described that the execution of a low priority program is started.
  • the program to be prioritized and the cycle time of the program may differ depending on the situation where the controller is used.
  • the cycle time and priority required for a program may differ between when the controller is started up and when communication with a higher system is required and when high-speed processing is required.
  • an object of the present invention is to provide a technique that can change the execution conditions for executing a program even when the program is running in the controller, thereby improving the convenience for the user. With the goal.
  • a controller for controlling a target device.
  • the controller includes a storage unit for storing a plurality of programs including a user program, task information indicating task execution conditions, and a control unit that periodically executes the program according to the execution conditions indicated in the task information. Prepare.
  • the controller controls the target device by the control unit periodically executing the user program.
  • the user program can include a setting instruction for changing the task execution condition.
  • the control unit updates the task information in the storage unit by executing a setting command included in the user program, and executes the program according to the updated task execution conditions.
  • the execution condition indicated in the task information includes a priority for executing the task
  • the control unit periodically executes the program according to the priority of the task, and the priority of the task is included in the setting instruction.
  • a command to change the task priority is executed, and the control unit updates the task information by changing the task priority for the command by executing the command to change the task priority included in the user program. It is good.
  • the execution condition indicated in the task information includes a period for executing the task
  • the setting instruction includes an instruction for changing the period for executing the task
  • the control unit is included in the user program.
  • the task information may be updated by executing a command for changing the task cycle to change the task cycle for the command.
  • the execution condition indicated in the task information includes a priority for executing the task and a cycle for executing the task
  • the control unit executes the program periodically according to the priority and the cycle of the task, and sets
  • the instruction for use includes at least one of an instruction for changing the priority of the task and an instruction for changing the cycle of the task
  • the control unit changes the priority of the task included in the user program.
  • the task information may be updated by changing at least one of the priority and the period of the task related to the instruction by executing the instruction and the instruction that changes the cycle of the task.
  • ⁇ A. System configuration> First, the system configuration of the control system according to the present embodiment will be described.
  • a programmable controller (PLC) that controls a control target such as a machine or equipment will be described as a typical example of a control device.
  • 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 schematic diagram showing a system configuration of a control system 1 according to the present embodiment.
  • control system 1 includes a PLC 100, a support device 300 connected to PLC 100, and a database device 400 that receives access from PLC 100.
  • the PLC 100 executes a user program as will be described later periodically or in an event manner.
  • An access instruction can be included in the user program, and the PLC 100 can access the database apparatus 400 according to the access. That is, the PLC 100 and the database device 400 are configured to exchange data with each other via the network 112 such as Ethernet (registered trademark).
  • the network 112 such as Ethernet (registered trademark).
  • the support device 300 is a typical example of an information processing device that can be connected to the PLC 100.
  • the support device 300 is connected to the PLC 100 via the connection cable 114 and provides functions such as setting various parameters, programming, monitoring, and debugging with the PLC 100.
  • the PLC 100 and the support device 300 are configured to be communicable according to the USB (Universal Serial Bus) standard.
  • USB Universal Serial Bus
  • the PLC 100 includes a CPU unit 104 that executes control calculation and one or more IO (Input / Output) units 106. These units are configured to exchange data with each other via the PLC system bus 108. These units are supplied with power of an appropriate voltage by the power supply unit 102.
  • IO Input / Output
  • the PLC 100 exchanges data with various field devices via the IO unit 106 (connected via the PLC system bus 108) and / or via the field bus 110.
  • These field devices include an actuator for performing some processing on the control target, a sensor for acquiring various information from the control target, and the like.
  • FIG. 1 includes a servo motor driver 30 that drives the detection switch 10, the relay 20, and the motor 32 as an example of such a field device.
  • the PLC 100 is also connected to the remote IO terminal 200 via the field bus 110.
  • the remote IO terminal 200 basically performs processing related to general input / output processing in the same manner as the IO unit 106. More specifically, the remote IO terminal 200 includes a communication coupler 202 for performing processing related to data transmission via the field bus 110 and one or more IO units 204. These units are configured to exchange data with each other via the remote IO terminal bus 208.
  • FIG. 2 is a schematic diagram showing a hardware configuration showing a main part of PLC 100 according to the present embodiment.
  • FIG. 3 is a schematic diagram showing a software configuration of PLC 100 according to the present embodiment.
  • the hardware configuration of the CPU unit 104 of the PLC 100 will be described with reference to FIG.
  • the CPU unit 104 includes a processor 120, a chip set 122, a system clock 124, a main memory 126, a nonvolatile memory 128, a USB connector 130, a PLC system bus controller 140, a field bus controller 150, and higher-level communication.
  • a controller 160 and a memory card interface 170 are included.
  • the chip set 122 and other components are coupled via various buses.
  • the processor 120 and the chip set 122 are typically configured according to a general-purpose computer architecture. That is, the processor 120 interprets and executes the instruction codes sequentially supplied from the chip set 122 according to the internal clock.
  • the chip set 122 exchanges internal data with various connected components and generates instruction codes necessary for the processor 120.
  • the system clock 124 generates a system clock having a predetermined period and provides it to the processor 120.
  • the chip set 122 has a function of caching data obtained as a result of execution of arithmetic processing by the processor 120.
  • the CPU unit 104 has a main memory 126 and a nonvolatile memory 128 as storage means.
  • the main memory 126 is a volatile storage area, holds various programs to be executed by the processor 120, and is also used as a working memory when executing the various programs.
  • the nonvolatile memory 128 holds an OS (Operating System), a system program, a user program, data definition information, log information, and the like in a nonvolatile manner.
  • OS Operating System
  • the USB connector 130 is an interface for connecting the support device 300 and the CPU unit 104. Typically, an executable program or the like transferred from the support device 300 is taken into the CPU unit 104 via the USB connector 130.
  • the CPU unit 104 includes a PLC system bus controller 140, a field bus controller 150, and a host communication controller 160 as communication means. These communication circuits transmit and receive data.
  • the PLC system bus controller 140 controls data exchange via the PLC system bus 108. More specifically, the PLC system bus controller 140 includes a buffer memory 142, a PLC system bus control circuit 144, and a DMA (Dynamic Memory Access) control circuit 146. The PLC system bus controller 140 is connected to the PLC system bus 108 via the PLC system bus connector 148.
  • DMA Dynamic Memory Access
  • the fieldbus controller 150 includes a buffer memory 152, a fieldbus control circuit 154, and a DMA control circuit 156.
  • the field bus controller 150 is connected to the field bus 110 via the field bus connector 158.
  • the upper communication controller 160 includes a buffer memory 162, an upper communication control circuit 164, and a DMA control circuit 166.
  • the host communication controller 160 is connected to the network 112 via the host communication connector 168.
  • the memory card interface 170 connects a memory card 172 detachable to the CPU unit 104 and the processor 120.
  • FIG. 3 is a schematic diagram showing a software configuration executed by the CPU unit 104 according to the embodiment of the present invention.
  • the software executed by CPU unit 104 has three layers: real-time OS 200, system program 210, and user program 236.
  • the real-time OS 200 is designed according to the computer architecture of the CPU unit 104, and provides a basic execution environment for the processor 120 to execute the system program 210 and the user program 236.
  • This real-time OS is typically provided by a PLC manufacturer or a specialized software company.
  • the system program 210 is a software group for providing functions as the PLC 100.
  • the system program 210 includes a scheduler program 212, an output processing program 214, an input processing program 216, a sequence command operation program 232, a motion operation program 234, and other system programs 220.
  • the output processing program 214 and the input processing program 216 are executed continuously (integrally), so these programs may be collectively referred to as an IO processing program 218.
  • the user program 236 is created according to the control purpose of the user. That is, the program is arbitrarily designed according to the line (process) to be controlled using the control system 1.
  • the user program 236 realizes a control purpose for the user in cooperation with the sequence command calculation program 232 and the motion calculation program 234. That is, the user program 236 implements programmed operations by using instructions, functions, function modules, and the like provided by the sequence instruction calculation program 232 and the motion calculation program 234. Therefore, the user program 236, the sequence command calculation program 232, and the motion calculation program 234 may be collectively referred to as the control program 230.
  • the processor 120 of the CPU unit 104 executes the system program 210 and the user program 236 stored in the storage unit.
  • the user program 236 is created according to a control purpose (for example, a target line or process) by the user.
  • the user program 236 is typically in an object program format that can be executed by the processor 120 of the CPU unit 104.
  • the user program 236 is generated by compiling a source program described in a ladder language or the like in the support device 300 or the like. Then, the generated user program 236 in the object program format is transferred from the support device 300 to the CPU unit 104 via the connection cable 10 and stored in the nonvolatile memory 128 or the like.
  • the scheduler program 212 controls the process start in each execution cycle and the process resumption after the process interruption for the output process program 214, the input process program 216, and the control program 230. More specifically, the scheduler program 212 controls task execution. The task sequentially executes assigned programs (IO processing program 218, control program 230, etc.).
  • the scheduler program 212 manages the execution order of processing by these programs in accordance with the setting of task execution conditions such as task priority setting and task cycle setting. Setting of execution conditions for each task is managed by a task execution condition management table 242 described later.
  • an instruction (setting instruction) for changing an execution condition such as a task execution priority or a task execution cycle is provided. 236.
  • the CPU unit 104 changes the priority of each task, the cycle of each task, and the like by executing a command included in the user program 236 for changing the execution condition of each task.
  • the control system 1 can change the priority of the task from the user program.
  • the output processing program 214 rearranges the output data generated by the execution of the user program 236 (control program 230) into a format suitable for transferring to the PLC system bus controller 140 and / or the fieldbus controller 150.
  • the output processing program 214 issues such an instruction.
  • the input processing program 216 rearranges the input data received by the PLC system bus controller 140 and / or the field bus controller 150 into a format suitable for use by the control program 230.
  • the sequence command calculation program 232 is a program that is called when a certain sequence command used in the user program 236 is executed and executed to realize the content of the command.
  • the motion calculation program 234 is a program that is executed in accordance with instructions from the user program 236 and calculates a command value to be output to a motor driver such as the servo motor driver 30 or the pulse motor driver.
  • Other system programs 220 collectively represent a group of programs for realizing various functions of the PLC 100 other than the programs individually shown in FIG.
  • Other system programs 220 include a DB access processing program 192.
  • the DB access processing program 192 includes an instruction code group for realizing processing necessary for accessing the database device 400 as the user program 236 is executed.
  • the DB access processing program 192 includes an execution code corresponding to an instruction that can be specified in the user program 236.
  • the format of the information for specifying the period of the motion control cycle includes a time value indicating the period of the motion control cycle and information for identifying one of a plurality of options prepared in advance relating to the period of the motion control cycle (number Or a character) etc. can be adopted.
  • the real-time OS 200 provides an environment for switching and executing a plurality of programs over time.
  • an output preparation interrupt (P) as an event (interrupt) for outputting (transmitting) output data generated by program execution of the CPU unit 104 to another unit or another device.
  • the field network transmission interrupt (X) is initialized.
  • the real time OS 200 switches the execution target in the processor 120 from the program being executed at the time of the interrupt generation to the scheduler program 212.
  • the real-time OS 200 executes the programs included in the other system programs 210 when the scheduler program 212 and the program that controls the execution of the scheduler program 212 are not executed.
  • Such programs include, for example, those related to communication processing between the CPU unit 104 and the support device 300 via the connection cable 10 (USB), the CPU unit 104, and higher-level devices (such as the database device 400). Related to the communication processing.
  • FIG. 4 is a diagram showing the task execution condition management table 242.
  • the task execution condition management table 242 indicates conditions for the CPU unit 104 to execute each task, and indicates, for example, the priority for executing each task and the cycle of each task.
  • Each record of the task execution condition management table 242 includes a task name 244, an execution priority 246, and a task cycle 248.
  • the task name 244 indicates the name of each task.
  • the execution priority 246 indicates a setting value for the priority of each task.
  • the priority setting values include, for example, the highest priority “high”, the second highest priority “medium”, and the lowest priority “low”.
  • the priority setting value is not limited to three levels, and may be set to more levels.
  • the task cycle 248 indicates a cycle for executing each task.
  • the period of the task with the highest priority “high” may be used as a reference, and the tasks with other priorities may be integer multiples of the period of the task with high priority.
  • FIG. 5 is a diagram showing an example of the execution order of each task.
  • the CPU unit 104 has a fixed period task with a priority setting “high” and a period “T1”, and a fixed priority setting with a priority “medium” and a period “T2”.
  • the periodic task is executed according to the task execution condition.
  • the periodic task with the priority “high” is the task with the highest priority in the CPU unit 104.
  • the medium-priority task has a lower priority than the high-priority task Therefore, the task is temporarily interrupted, and the periodic task having the high priority is executed. After completion of the periodic task with the priority “high”, the execution of the periodic task with the medium priority is resumed.
  • the period T2 of the fixed-period task having the medium priority is an integer multiple of the period T1 of the fixed-period task having the high priority.
  • the scheduler program is expressed as “SC”
  • the output / input processing program as “OI”
  • the user program 236 as “UPRG”
  • the motion calculation program 234 as “MC”.
  • different reference numerals 701 to 707 are given to identify each OI and each MC.
  • the processor 120 is in a state where at least the output / input processing program (the output processing program 214 and the input processing program 216), the user program 236, and the motion calculation program 234 can be executed.
  • the real-time OS 200 holds processes (or threads) related to the respective programs in an executable state
  • the scheduler program 212 uses the real-time OS 200 and hardware resources (such as the system clock 124).
  • each program is executed at an appropriate timing and in an appropriate order.
  • the start / interruption / end of execution of each program is controlled by the scheduler program 212.
  • the user program 236 can include an instruction for changing task execution conditions (setting of task priority, setting of a cycle for executing a task).
  • the CPU unit 104 of the PLC 100 executes the instruction for changing the task execution condition included in the user program 236, thereby setting the priority of each task shown in the task execution condition management table 242 and the task. Either or both of the cycle settings to be performed can be changed.
  • the scheduler program 212 controls the program execution order for each cycle according to the priority of each task and the cycle of each task shown in the task execution condition management table 242. For example, the scheduler program 212 acquires the priority of each task and the period of each task by referring to the task execution condition management table 242 when a certain condition such as completion of a certain process is satisfied, and the priority of the acquired task
  • the execution order of each program is managed according to the task cycle setting.
  • FIG. 6 is a diagram illustrating an example of an instruction for changing a task execution condition.
  • FIG. 6 shows an example of a screen on which the user edits the task execution condition change command 320 on the display 310 of the support apparatus 300.
  • the user can set a task name “TaskName”, a task cycle “TaskInterval”, and a task execution priority “TaskPriority” by an instruction “ChangeTaskProperties” for changing the task execution condition. it can.
  • the task execution condition change instruction 320 can be described in a function block format, for example.
  • the task execution condition change instruction 320 is executed by the CPU unit 104 of the PLC 100 to update either the task priority or task execution cycle or both of the designated task execution condition management table 242. .
  • FIG. 7 is a diagram showing the execution order of each task when the CPU unit 104 executes a command included in the user program and changes the priority of the task.
  • FIG. 7A shows the execution order of each task when the priority of the task “B” is “medium”.
  • FIG. 7B shows the execution order of each task when the priority of the task “B” is “low”.
  • an instruction (function block) included in the user program is “FB”.
  • the instruction 801 and the instruction 803 are instructions for changing task execution conditions.
  • the PLC 100 can be changed by changing the task priority between when each device produces a product and when the PLC 100 receives a recipe that is a production parameter from the server.
  • Each process can be efficiently operated.
  • the process of the control system 1 is switched from a process for producing a product to a process for receiving a recipe.
  • the communication processing by the PLC 100 is efficiently performed, and the recipe data reception processing can be speeded up.
  • the process of the control system 1 is switched from the process of receiving a recipe to the process of producing a product.
  • the priority of the task “B” so that the priority is equal to or higher than that of the task “communication processing task”
  • the production of the product can be made efficient.
  • FIG. 8 is a diagram showing the execution order of each task when the CPU unit 104 executes a command included in the user program to change the task cycle.
  • FIG. 8A shows the execution order of each task when the cycle of the task “A” and the cycle of the task “communication processing task” are both the cycle “T1”.
  • FIG. 8B shows the execution order of each task when the cycle of the task “A” and the cycle of the task “communication processing task” are both the cycle “T2”.
  • An instruction 805 and an instruction 807 are instructions for changing task execution conditions.
  • the CPU unit 104 executes the program according to the cycle of each task.
  • the CPU unit 104 first executes the process of the task “A” in the period “T1”, and executes the task “communication process task” within the remaining time after the process of the task “A” is completed.
  • the CPU unit 104 executes the user program 804 and executes the instruction 805 included in the user program 804, the cycle of the task “A” and the cycle of the task “communication processing task” are changed from the cycle “T1” to the cycle “ To "T2". Thereafter, each task is executed as shown in FIG.
  • the period of each task is longer in FIG. 8B.
  • the task “communication processing task” is executed for a longer period of time compared to the state of FIG. Therefore, in the state of FIG. 8B, the period during which the CPU unit 104 communicates with an external device (for example, the database device 400) is longer than that in the state of FIG.
  • the processing time of the task “communication processing task” can be adjusted by adjusting the period of the task for controlling each device (in the example of FIG. 8, task “A” or the like).
  • the task cycle may be set shorter with priority given to the control processing of the device.
  • the task cycle may be set longer.
  • the task cycle can be changed from the user program, so that the task cycle can be finely adjusted at the time of starting up the device or during the adjustment. Work such as adjustment can be carried out efficiently.
  • FIG. 9 is a diagram showing the execution order of each task when the CPU unit 104 executes instructions included in the user program to change the task priority and the task cycle.
  • FIG. 9A shows the priority “high” and the cycle “T1” for the task “A”, the priority “medium” and the cycle “T2” for the task “B”, and the task “communication processing task”. The execution order of each task when the priority is “low” and the period is “T2” is shown.
  • FIG. 9B shows the priority “high” and the cycle “T1” for the task “A”, the priority “low” and the cycle “T3” for the task “B”, and the task “communication processing task”. The execution order of each task when the priority is “low” and the period is “T3” is shown.
  • An instruction 809 and an instruction 811 are instructions for changing task execution conditions.
  • the priority of the task “B” is changed from the priority “medium” to the priority. It is changed to “low”, and the period of the task “B” is changed from the period “T2” to the period “T3”. Also, by executing the instruction 809 included in the user program, the priority of the task “communication processing task” is changed from the priority “low” to the priority “medium”, and the cycle of the task “communication processing task” Is changed from the cycle “T2” to the cycle “T3”. Thereafter, each task is executed as shown in FIG.
  • the control system normally presets program priorities and cycles, and executes each program according to the settings.
  • the program to be prioritized and the program cycle may differ depending on the situation. For example, when the control device transmits / receives data to / from a higher-level device (database device, server, etc.) connected via a network, or when each device is started up, high-speed operation such as during product production
  • the program that you want to prioritize and the cycle time of the program may differ depending on the demand. According to the control system 1 described in the present embodiment, even when the control program 230 is in operation, the priority for executing the program and the cycle time for operating the control device can be changed. Can be made more efficient.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • General Engineering & Computer Science (AREA)
  • Programmable Controllers (AREA)

Abstract

 PLCなどのコントローラ(104)は、タスクの実行条件を示すタスク実行条件管理テーブル(242)を記憶し、プログラムを、タスクの実行条件に従って周期的に実行する。コントローラ(104)は、タスクの実行条件を変更するための設定用の命令(320)を提供している。ユーザは、サポート装置(300)等により設定用の命令(320)をユーザプログラム(236)に含める。コントローラ(104)は、ユーザプログラム(236)に含まれる、各タスクの優先度、タスクの周期などタスクの実行条件を変更する命令(320)を実行することで、命令にかかるタスクについてタスク実行条件管理テーブル(242)を更新し、更新後のタスクの実行条件に従ってプログラムを実行する。

Description

コントローラ
 本発明は、ユーザプログラムを周期的またはイベント的に実行する制御装置を含む制御システムおよび制御システムの情報処理装置に関する。
 多くの生産現場で使用される機械や設備は、典型的には、プログラマブルコントローラ(Programmable Logic Controller;以下「PLC」とも称す)などの制御装置(コントローラ)を主たる構成とした制御システムによって制御される。
 PLCは、たとえば、ユーザプログラムを実行するマイクロプロセッサを含むCPU(Central Processing Unit)ユニット、外部のスイッチやセンサからの信号入力および外部のリレーやアクチュエータへの信号出力を担当するIO(Input Output)ユニットといった複数のユニットで構成される。それらのユニット間で、ユーザプログラム実行サイクルごとに、PLCシステムバスおよび/またはフィールドネットワークを経由してデータの授受をしながら、PLCは制御動作を実行する。
 PLCのCPUユニットは、タスクの割り当てに従って、ユーザプログラムやシステムプログラムなどのプログラムを実行する。PLCにおいて、タスクで実行される処理としては、例えば、CPUユニットがスレーブ機器やI/Oユニットとデータの入出力を行うI/Oリフレッシュ、ユーザプログラムの実行、ユーザプログラムの指令を受けて実行するモーション制御、データトレース処理その他の処理がある。
 タスクには、PLCが周期的に繰り返し実行する定周期タスク、予め指定された条件が成立したときにPLCが1回だけ実行するイベントタスクなどがある。各タスクには、実行すべき優先度と、タスクの周期とが設定されている。CPUユニットは、タスクの優先度に従って、各プログラムを実行する。
 タスクの割り当てに従って動作するPLCの例として、例えば、特許第4894961号公報(特許文献1)がある。特許文献1には、制御プログラムの実行時間が散発的に長くなりうることを考慮して、PLCのCPUユニットが行う制御データの出力および入力のための通信の周期を、制御プログラムの最大実行時間よりも短い一定時間としうるPLCのCPUユニットについて記載されている。特許文献1には、タスク実行の優先度が高いプログラムと、優先度が低いプログラムとが存在した時に、一定のサイクルタイムの中で、高い優先度のプログラムを実行し、この実行が終了した後に、低い優先度のプログラムの実行を開始することが記載されている。
特許第4894961号公報
 しかし、コントローラが使用される状況に応じて、優先したいプログラムやプログラムのサイクルタイム等が異なることがある。例えば、コントローラの立ち上げ時や上位のシステムとの通信時と、高速な処理が求められる場合とではプログラムに求められるサイクルタイムや優先度が異なることがある。
 そこで、本発明の目的は、コントローラにおいて、プログラムが動作している場合であっても、プログラムを実行するための実行条件を変更可能とし、これによりユーザの利便性を向上させる技術を提供することを目的とする。
 本発明のある局面に係るコントローラは、対象機器を制御するためのものである。コントローラは、ユーザプログラムを含む複数のプログラムと、タスクの実行条件を示すタスク情報とを記憶するための記憶部と、プログラムを、タスク情報に示される実行条件に従って周期的に実行する制御部とを備える。コントローラは、制御部がユーザプログラムを周期的に実行することで対象機器を制御する。ユーザプログラムには、タスクの実行条件を変更するための設定用の命令を含めることが可能である。制御部は、ユーザプログラムに含まれる設定用の命令を実行することにより、記憶部のタスク情報を更新し、更新後のタスクの実行条件に従ってプログラムを実行する。
 好ましくは、タスク情報に示される実行条件には、タスクを実行する優先度が含まれ、制御部は、タスクの優先度に従ってプログラムを周期的に実行し、設定用の命令には、タスクの優先度を変更する命令が含まれ、制御部は、ユーザプログラムに含まれる、タスクの優先度を変更する命令を実行することにより、命令にかかるタスクの優先度を変更してタスク情報を更新することとしてもよい。
 好ましくは、タスク情報に示される実行条件には、タスクを実行する周期が含まれ、設定用の命令には、タスクを実行する周期を変更する命令が含まれ、制御部は、ユーザプログラムに含まれる、タスクの周期を変更する命令を実行することにより、命令にかかるタスクの周期を変更してタスク情報を更新する、こととしてもよい。
 好ましくは、タスク情報に示される実行条件には、タスクを実行する優先度と、タスクを実行する周期が含まれ、制御部は、タスクの優先度および周期に従ってプログラムを周期的に実行し、設定用の命令には、タスクの優先度を変更する命令と、タスクの周期を変更する命令との少なくともいずれか一方が含まれ、制御部は、ユーザプログラムに含まれる、タスクの優先度を変更する命令とタスクの周期を変更する命令とを実行することにより、命令にかかるタスクの優先度または周期の少なくともいずれかを変更してタスク情報を更新する、こととしてもよい。
 本発明によれば、ユーザプログラムから各プログラムを実行する優先度やプログラムによりコントローラを動作させる周期を変更することができ、コントローラの動作を効率化することができる。
本実施の形態に係る制御システム1のシステム構成を示す模式図である。 本実施の形態に係るPLC100の主要部を示すハードウェア構成を示す模式図である。 本実施の形態に係るPLC100のソフトウェア構成を示す模式図である。 タスク実行条件管理テーブル242を示す図である。 各タスクの実行順序の一例を示した図である。 タスクの実行条件を変更するための命令の例を示す図である。 CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの優先度を変更する場合の各タスクの実行順序を示す図である。 CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの周期を変更する場合の各タスクの実行順序を示す図である。 CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの優先度およびタスクの周期を変更する場合の各タスクの実行順序を示す図である。
 本発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰り返さない。
 <A.システム構成>
 まず、本実施の形態に係る制御システムのシステム構成について説明する。本実施の形態においては、機械や設備などの制御対象を制御するプログラマブルコントローラ(PLC)を制御装置の典型例として説明を行う。但し、本発明に係る制御装置は、PLCに限られることなく、各種の制御装置へ適用可能である。
 図1は、本実施の形態に係る制御システム1のシステム構成を示す模式図である。図1を参照して、制御システム1は、PLC100と、PLC100に接続されるサポート装置300と、PLC100からのアクセスを受けるデータベース装置400とを含む。PLC100は、後述するようなユーザプログラムを周期的またはイベント的に実行する。このユーザプログラムにアクセス命令を含めることができ、PLC100は、このアクセスに従って、データベース装置400にアクセスすることができる。すなわち、PLC100およびデータベース装置400は、イーサネット(登録商標)などのネットワーク112を介して、データを互いに遣り取りできるように構成される。
 サポート装置300は、PLC100に接続可能な情報処理装置の典型例である。サポート装置300は、接続ケーブル114を介してPLC100に接続され、PLC100との間で各種パラメータの設定、プログラミング、モニタ、デバッグなどの機能を提供する。PLC100とサポート装置300との間は、典型的には、USB(Universal Serial Bus)規格に従って通信可能に構成される。
 PLC100は、制御演算を実行するCPUユニット104と、1つ以上のIO(Input/Output)ユニット106とを含む。これらのユニットは、PLCシステムバス108を介して、データを互いに遣り取りできるように構成される。また、これらのユニットには、電源ユニット102によって適切な電圧の電源が供給される。
 制御システム1において、PLC100は、(PLCシステムバス108を介して接続される)IOユニット106を介して、および/または、フィールドバス110を介して、各種のフィールド機器との間でデータを遣り取りする。これらのフィールド機器は、制御対象に対して何らかの処理を行うためのアクチュエータや、制御対象から各種情報を取得するためのセンサなどを含む。図1には、このようなフィールド機器の一例として、検出スイッチ10、リレー20およびモータ32を駆動するサーボモータドライバ30を含む。また、PLC100は、フィールドバス110を介してリモートIOターミナル200も接続されている。リモートIOターミナル200は、基本的には、IOユニット106と同様に、一般的な入出力処理に関する処理を行う。より具体的には、リモートIOターミナル200は、フィールドバス110でのデータ伝送に係る処理を行うための通信カプラ202と、1つ以上のIOユニット204とを含む。これらのユニットは、リモートIOターミナルバス208を介して、データを互いに遣り取りできるように構成される。
 <B.PLC100の構成>
 次に、本実施の形態に係るPLC100の構成について説明する。図2は、本実施の形態に係るPLC100の主要部を示すハードウェア構成を示す模式図である。図3は、本実施の形態に係るPLC100のソフトウェア構成を示す模式図である。
 図2を参照して、PLC100のCPUユニット104のハードウェア構成について説明する。CPUユニット104は、プロセッサ120と、チップセット122と、システムクロック124と、主メモリ126と、不揮発性メモリ128と、USBコネクタ130と、PLCシステムバスコントローラ140と、フィールドバスコントローラ150と、上位通信コントローラ160と、メモリカードインターフェイス170とを含む。チップセット122と他のコンポーネントとの間は、各種のバスを介してそれぞれ結合されている。
 プロセッサ120およびチップセット122は、典型的には、汎用的なコンピュータアーキテクチャに準じて構成される。すなわち、プロセッサ120は、チップセット122から内部クロックに従って順次供給される命令コードを解釈して実行する。チップセット122は、接続されている各種コンポーネントとの間で内部的なデータを遣り取りするとともに、プロセッサ120に必要な命令コードを生成する。システムクロック124は、予め定められた周期のシステムクロックを発生してプロセッサ120に提供する。チップセット122は、プロセッサ120での演算処理の実行の結果得られたデータなどをキャッシュする機能を有する。
 CPUユニット104は、記憶手段として、主メモリ126および不揮発性メモリ128を有する。主メモリ126は、揮発性の記憶領域であり、プロセッサ120で実行されるべき各種プログラムを保持するとともに、各種プログラムの実行時の作業用メモリとしても使用される。不揮発性メモリ128は、OS(Operating System)、システムプログラム、ユーザプログラム、データ定義情報、ログ情報などを不揮発的に保持する。
 USBコネクタ130は、サポート装置300とCPUユニット104とを接続するためのインターフェイスである。典型的には、サポート装置300から転送される実行可能なプログラムなどは、USBコネクタ130を介してCPUユニット104に取込まれる。
 CPUユニット104は、通信手段として、PLCシステムバスコントローラ140、フィールドバスコントローラ150、および上位通信コントローラ160を有する。これらの通信回路は、データの送信および受信を行う。
 PLCシステムバスコントローラ140は、PLCシステムバス108を介したデータの遣り取りを制御する。より具体的には、PLCシステムバスコントローラ140は、バッファメモリ142と、PLCシステムバス制御回路144と、DMA(Dynamic Memory Access)制御回路146とを含む。PLCシステムバスコントローラ140は、PLCシステムバスコネクタ148を介してPLCシステムバス108と接続される。
 フィールドバスコントローラ150は、バッファメモリ152と、フィールドバス制御回路154と、DMA制御回路156とを含む。フィールドバスコントローラ150は、フィールドバスコネクタ158を介してフィールドバス110と接続される。上位通信コントローラ160は、バッファメモリ162と、上位通信制御回路164と、DMA制御回路166とを含む。上位通信コントローラ160は、上位通信コネクタ168を介してネットワーク112と接続される。
 メモリカードインターフェイス170は、CPUユニット104に対して着脱可能なメモリカード172とプロセッサ120とを接続する。
 <C.CPUユニットのソフトウェア構成>
 次に、図3を参照して、本実施の形態に係る各種機能を提供するためのソフトウェア群について説明する。これらのソフトウェアに含まれる命令コードは、適切なタイミングで読み出され、CPUユニット104のプロセッサ120によって実行される。
 図3は、本発明の実施の形態に係るCPUユニット104で実行されるソフトウェア構成を示す模式図である。図3を参照して、CPUユニット104で実行されるソフトウェアとしては、リアルタイムOS200と、システムプログラム210と、ユーザプログラム236との3階層になっている。
 リアルタイムOS200は、CPUユニット104のコンピュータアーキテクチャに応じて設計されており、プロセッサ120がシステムプログラム210およびユーザプログラム236を実行するための基本的な実行環境を提供する。このリアルタイムOSは、典型的には、PLCのメーカーあるいは専門のソフトウェア会社などによって提供される。
 システムプログラム210は、PLC100としての機能を提供するためのソフトウェア群である。具体的には、システムプログラム210は、スケジューラプログラム212と、出力処理プログラム214と、入力処理プログラム216と、シーケンス命令演算プログラム232と、モーション演算プログラム234と、その他のシステムプログラム220とを含む。なお、一般には出力処理プログラム214および入力処理プログラム216は、連続的(一体として)に実行されるので、これらのプログラムを、IO処理プログラム218と総称する場合もある。
 ユーザプログラム236は、ユーザにおける制御目的に応じて作成される。すなわち、制御システム1を用いて制御する対象のライン(プロセス)などに応じて、任意に設計されるプログラムである。
 後述するように、ユーザプログラム236は、シーケンス命令演算プログラム232およびモーション演算プログラム234と協働して、ユーザにおける制御目的を実現する。すなわち、ユーザプログラム236は、シーケンス命令演算プログラム232およびモーション演算プログラム234によって提供される命令、関数、機能モジュールなどを利用することで、プログラムされた動作を実現する。そのため、ユーザプログラム236、シーケンス命令演算プログラム232、およびモーション演算プログラム234を、制御プログラム230と総称する場合もある。
 このように、CPUユニット104のプロセッサ120は、記憶手段に格納されたシステムプログラム210およびユーザプログラム236を実行する。
 以下、各プログラムについてより詳細に説明する。
 ユーザプログラム236は、上述したように、ユーザにおける制御目的(たとえば、対象のラインやプロセス)に応じて作成される。ユーザプログラム236は、典型的には、CPUユニット104のプロセッサ120で実行可能なオブジェクトプログラム形式になっている。このユーザプログラム236は、サポート装置300などにおいて、ラダー言語などによって記述されたソースプログラムがコンパイルされることで生成される。そして、生成されたオブジェクトプログラム形式のユーザプログラム236は、サポート装置300から接続ケーブル10を介してCPUユニット104へ転送され、不揮発性メモリ128などに格納される。
 スケジューラプログラム212は、出力処理プログラム214、入力処理プログラム216、および制御プログラム230について、各実行サイクルでの処理開始および処理中断後の処理再開を制御する。より具体的には、スケジューラプログラム212は、タスクの実行を制御する。タスクは、割り付けられたプログラム(IO処理プログラム218、制御プログラム230など)を順次実行する。
 スケジューラプログラム212は、タスクの優先度の設定、タスクの周期の設定などのタスクの実行条件の設定に従って、これらプログラムによる処理の実行順序などを管理する。各タスクの実行条件の設定は、後述するタスク実行条件管理テーブル242により管理されている。本実施形態の制御システム1では、各タスクについて、タスクの実行優先度やタスク実行の周期などの実行条件を変更するための命令(設定用の命令)が提供されており、この命令をユーザプログラム236に含めることができる。CPUユニット104は、ユーザプログラム236に含まれる、各タスクの実行条件を変更するための命令を実行することで、各タスクの優先度、各タスクの周期などを変更する。このように、制御システム1は、タスクの優先度を、ユーザプログラムから変更することができる。
 出力処理プログラム214は、ユーザプログラム236(制御プログラム230)の実行によって生成された出力データを、PLCシステムバスコントローラ140および/またはフィールドバスコントローラ150へ転送するのに適した形式に再配置する。PLCシステムバスコントローラ140またはフィールドバスコントローラ150が、プロセッサ120からの、送信を実行するための指示を必要とする場合は、出力処理プログラム214がそのような指示を発行する。
 入力処理プログラム216は、PLCシステムバスコントローラ140および/またはフィールドバスコントローラ150によって受信された入力データを、制御プログラム230が使用するのに適した形式に再配置する。
 シーケンス命令演算プログラム232は、ユーザプログラム236で使用されるある種のシーケンス命令が実行されるときに呼び出されて、その命令の内容を実現するために実行されるプログラムである。
 モーション演算プログラム234は、ユーザプログラム236による指示に従って実行され、サーボモータドライバ30やパルスモータドライバといったモータドライバに対して出力する指令値を算出するプログラムである。
 その他のシステムプログラム220は、図3に個別に示したプログラム以外の、PLC100の各種機能を実現するためのプログラム群をまとめて示したものである。その他のシステムプログラム220は、DBアクセス処理プログラム192を含む。DBアクセス処理プログラム192は、ユーザプログラム236の実行に伴って、データベース装置400へアクセスするために必要な処理を実現するための命令コード群を含む。DBアクセス処理プログラム192は、ユーザプログラム236において指定可能な命令に対応する実行コードを含む。
 モーション制御サイクルの周期を指定する情報の形式としては、モーション制御サイクルの周期を示す時間の値や、モーション制御サイクルの周期に関する予め用意された複数の選択肢のうちから1つを特定する情報(番号または文字)などを採用することができる。
 リアルタイムOS200は、複数のプログラムを時間の経過に従い切り換えて実行するための環境を提供する。本実施の形態に係るPLC100においては、CPUユニット104のプログラム実行によって生成された出力データを他のユニットまたは他の装置へ出力(送信)するためのイベント(割り込み)として、出力準備割り込み(P)およびフィールドネットワーク送信割り込み(X)が初期設定される。リアルタイムOS200は、出力準備割り込み(P)またはフィールドネットワーク送信割り込み(X)が発生すると、プロセッサ120での実行対象を、割り込み発生時点で実行中のプログラムからスケジューラプログラム212に切り換える。
 なお、リアルタイムOS200は、スケジューラプログラム212およびスケジューラプログラム212がその実行を制御するプログラムが何ら実行されていない場合に、その他のシステムプログラム210に含まれているプログラムを実行する。このようなプログラムとしては、たとえば、CPUユニット104とサポート装置300との間の接続ケーブル10(USB)などを介した通信処理に関するもの、CPUユニット104と、上位の装置(データベース装置400など)との通信処理に関するものなどが含まれる。
 <D.データ構造>
 図4を参照して、CPUユニット104が使用するデータについて説明する。
 図4は、タスク実行条件管理テーブル242を示す図である。図4に示すように、タスク実行条件管理テーブル242は、各タスクをCPUユニット104が実行するための条件を示し、例えば、各タスクを実行する優先度と、各タスクの周期とを示す。タスク実行条件管理テーブル242の各レコードは、タスク名244と、実行優先度246と、タスク周期248とを含む。
 タスク名244は、各タスクの名称を示す。
 実行優先度246は、各タスクの優先度の設定値を示す。優先度の設定値は、例えば、最も高い優先度である優先度「高」、次に優先度が高い優先度「中」、最も優先度が低い優先度「低」がある。この他に、優先度の設定値は3段階に限らず、さらに多くの段階に設定可能であるとしてもよい。
 タスク周期248は、各タスクを実行する周期を示す。例えば、最も優先度が高い優先度「高」のタスクの周期を基準とし、他の優先度のタスクは、優先度「高」のタスクの周期の整数倍であるとしてもよい。
 図5は、各タスクの実行順序の一例を示した図である。図5を参照して、CPUユニット104は、優先度の設定が優先度「高」、周期「T1」の定周期タスクと、優先度の設定が優先度「中」、周期「T2」の定周期タスクとを、タスクの実行条件に従って実行する。優先度「高」の定周期タスクは、CPUユニット104の中で最高優先度のタスクである。
 優先度「中」の定周期タスク実行中に高優先度定周期タスクが実行可能になった場合、優先度「中」の定周期タスクは、優先度「高」のタスクよりも優先度が低いため一旦中断され、優先度「高」の定周期タスクが実行される。優先度「高」の定周期タスクの完了後、優先度「中」の定周期タスクの実行が再開される。なお、優先度「中」の定周期タスクの周期T2は、優先度「高」の定周期タスクの周期T1の整数倍である。図5は、T2=2T1(周期T2が周期T1の2倍の周期)の場合を表している。
 図5においては、スケジューラプログラムを「SC」と、出力・入力処理プログラムを「OI」と、ユーザプログラム236を「UPRG」と、モーション演算プログラム234を「MC」と表記している。また、図5では、説明の便宜上、各OI、各MCを識別するために、それぞれに異なる参照符合701~707を付している。
 PLC100の実行中においては、プロセッサ120が、少なくとも、出力・入力処理プログラム(出力処理プログラム214および入力処理プログラム216)と、ユーザプログラム236と、モーション演算プログラム234とが実行可能な状態になっている。厳密に言えば、リアルタイムOS200がそれぞれのプログラムに係るプロセス(または、スレッド)を実行可能な状態に保持しており、スケジューラプログラム212がリアルタイムOS200およびハードウェアリソース(システムクロック124など)を利用することで、各プログラムが適切なタイミングかつ適切な順序で実行される。このように、それぞれのプログラムに係る実行の開始/中断/終了などは、スケジューラプログラム212によって制御される。
 <E.タスクの実行条件を変更するための命令>
 図6を参照して、ユーザプログラム236に含めることができる、タスクの実行条件を変更するための命令について説明する。実施の形態1のPLC100において、ユーザプログラム236には、タスクの実行条件(タスクの優先度の設定、タスクを実行する周期の設定)を変更するための命令を含めることができる。PLC100のCPUユニット104は、ユーザプログラム236に含まれる、タスクの実行条件を変更するための命令を実行することにより、タスク実行条件管理テーブル242に示される各タスクの優先度の設定と、タスクを実行する周期の設定のいずれかまたは両方を変更することができる。
 スケジューラプログラム212は、タスク実行条件管理テーブル242に示される各タスクの優先度および各タスクの周期に従って、プログラムの実行順序を各サイクルについて制御する。例えば、スケジューラプログラム212は、ある処理の完了など何らかの条件が成立することにより、タスク実行条件管理テーブル242を参照して各タスクの優先度および各タスクの周期を取得し、取得したタスクの優先度およびタスクの周期の設定に従って、各プログラムの実行順序を管理する。
 図6は、タスクの実行条件を変更するための命令の例を示す図である。図6では、サポート装置300のディスプレイ310において、ユーザがタスク実行条件変更命令320を編集している画面の例を示している。図6に示すように、タスクの実行条件を変更するための命令「ChangeTaskProperties」により、ユーザは、タスク名称「TaskName」、タスク周期「TaskInterval」、タスクの実行優先度「TaskPriority」を設定することができる。タスク実行条件変更命令320は、例えば、ファンクションブロック形式で記述することができる。タスク実行条件変更命令320は、PLC100のCPUユニット104によって実行されることにより、指定されたタスクの優先度またはタスクの実行周期のいずれかまたは両方を変更してタスク実行条件管理テーブル242を更新する。
 <F.動作>
 次に、CPUユニット104がユーザプログラム236に含まれる命令を実行することで、各タスクの優先度を変更する場合の動作の例を説明する。
 <F1.ユーザプログラムからのタスク優先度の変更>
 図7は、CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの優先度を変更する場合の各タスクの実行順序を示す図である。図7(A)は、タスク「B」の優先度が優先度「中」の場合の各タスクの実行順序を示す。図7(B)は、タスク「B」の優先度が優先度「低」の場合の各タスクの実行順序を示す。なお、図7(A)および図7(B)において、ユーザプログラムに含まれる命令(ファンクションブロック)を「FB」とする。命令801と命令803とは、タスクの実行条件を変更するための命令である。
 図7(A)に示すように、CPUユニット104が、ユーザプログラム800を実行し、このユーザプログラム800に含まれる命令801を実行すると、タスク「B」の優先度が優先度「中」から優先度「低」へ変更される。以降、図7(B)に示すように各タスクが実行される。図7(B)において、CPUユニット104が、ユーザプログラム802を実行し、このユーザプログラム802に含まれる命令803を実行すると、タスク「B」の優先度が優先度「低」から優先度「中」へ変更される。
 例えば、制御システム1において、各装置が製品を生産している場合と、生産用のパラメータであるレシピをPLC100がサーバから受信している場合とで、タスクの優先度を変更することで、PLC100の各処理を効率的に動作させることができる。具体的には、例えば、制御システム1の処理を、製品の生産をするための処理からレシピを受信する処理へと切り替えるとする。この時、タスク「B」の優先度を、タスク「通信処理タスク」よりも低くすることで、PLC100による通信処理が効率的に行われ、レシピデータの受信処理を高速化することができる。また、制御システム1の処理を、レシピを受信する処理から製品の生産をするための処理へと切り替えるとする。この時、タスク「B」の優先度を変更してタスク「通信処理タスク」と同等またはそれ以上の優先度とすることで、製品の生産を効率的にすることができる。
 <F2.ユーザプログラムからのタスク周期の変更>
 図8は、CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの周期を変更する場合の各タスクの実行順序を示す図である。図8(A)は、タスク「A」の周期と、タスク「通信処理タスク」の周期とが、ともに周期「T1」である場合の各タスクの実行順序を示す。図8(B)は、タスク「A」の周期と、タスク「通信処理タスク」の周期とが、ともに周期「T2」である場合の各タスクの実行順序を示す。なお、図8において、タスク「A」の優先度は、タスク「通信処理タスク」の優先度よりも高いものとする。命令805と命令807とは、タスクの実行条件を変更するための命令である。
 図8(A)に示すように、CPUユニット104は、各タスクの周期に従ってプログラムを実行する。CPUユニット104は、周期「T1」の期間において、まずタスク「A」の処理を実行し、タスク「A」の処理が終了した残りの時間内にタスク「通信処理タスク」を実行する。CPUユニット104が、ユーザプログラム804を実行し、このユーザプログラム804に含まれる命令805を実行すると、タスク「A」の周期とタスク「通信処理タスク」の周期とが、周期「T1」から周期「T2」へと変更される。以降、図8(B)に示すように各タスクが実行される。
 図8(A)と図8(B)とを比較すると、図8(B)の方が、各タスクの周期が長くなっている。そのため、図8(B)の状態では、タスク「通信処理タスク」が、図8(A)の状態と比較して、より長い期間実行されている。そのため、図8(B)の状態において、CPUユニット104が外部の機器(例えば、データベース装置400など)と通信している期間は、図8(A)の状態よりも長くなる。
 図8(B)において、CPUユニット104が、ユーザプログラム806を実行し、このユーザプログラム806に含まれる命令807を実行すると、タスク「A」の周期とタスク「通信処理タスク」の周期とが、周期「T2」から周期「T1」へと変更される。
 例えば、制御システム1において、装置の立ち上げ時や装置を調整する局面など、状況に応じて各装置の制御処理と通信処理とのバランスを調整したいことがある。ここで、各装置を制御するためのタスク(図8の例では、タスク「A」など)の周期を調整することで、タスク「通信処理タスク」の処理の時間を調整することができる。
 例えば、制御システム1の設計時には、装置の制御処理を優先してタスクの周期を短く設定することがある。一方、通信処理にある程度の余裕が必要である場合に、タスクの周期を長く設定することがある。図8に示す例のように、ユーザプログラムからタスク周期の変更を可能とすることで、装置の立ち上げ時や調整の局面などにおいて、タスク周期を微調整することができ、これらの立ち上げ、調整などの作業を効率よく進めることができる。
 <F3.ユーザプログラムからのタスク優先度およびタスク周期の変更>
 図9は、CPUユニット104がユーザプログラムに含まれる命令を実行してタスクの優先度およびタスクの周期を変更する場合の各タスクの実行順序を示す図である。図9(A)は、タスク「A」について優先度「高」、周期「T1」であり、タスク「B」について優先度「中」、周期「T2」であり、タスク「通信処理タスク」について優先度「低」、周期「T2」である場合の各タスクの実行順序を示す。図9(B)は、タスク「A」について優先度「高」、周期「T1」であり、タスク「B」について優先度「低」、周期「T3」であり、タスク「通信処理タスク」について優先度「低」、周期「T3」である場合の各タスクの実行順序を示す。命令809と命令811とは、タスクの実行条件を変更するための命令である。
 図9(A)に示すように、CPUユニット104が、ユーザプログラム808を実行し、このユーザプログラムに含まれる命令809を実行すると、タスク「B」の優先度が優先度「中」から優先度「低」へと変更され、タスク「B」の周期が周期「T2」から周期「T3」へと変更される。また、ユーザプログラムに含まれる命令809が実行されることにより、タスク「通信処理タスク」の優先度が優先度「低」から優先度「中」へと変更され、タスク「通信処理タスク」の周期が周期「T2」から周期「T3」へと変更される。以降、図9(B)に示すように各タスクが実行される。
 図9(A)と図9(B)とを比較すると、図9(B)の方が、タスク「B」およびタスク「通信処理タスク」の周期が長くなり、タスク「通信処理タスク」の優先度がタスク「B」よりも高くなっている。
 図9(B)において、CPUユニット104が、ユーザプログラム810を実行し、このユーザプログラム810に含まれる命令811を実行すると、タスク「B」の優先度が優先度「低」から優先度「中」へ変更され、周期「T3」から周期「T2」へと変更される。またタスク「通信処理タスク」の優先度が優先度「中」から優先度「低」へと変更され、周期が周期「T3」から周期「T2」へと変更される。
 図7と比較して、優先度を下げるタスクが周期的に動作する場合は、そのタスクの優先度を下げると共に、タスクの周期を長くする。これにより、優先度を下げたタスクが、タスク周期を超過させず動作させることができる。
 <G.効果>
 制御システムは、通常、プログラムの優先度や周期を予め設定し、設定に従って各プログラムを実行する。これらのシステムにおいて、状況によって優先させたいプログラムやプログラムの周期が異なることがある。例えば、制御装置が、ネットワークを介して接続される上位の装置(データベース装置、サーバなど)に対してデータを送受信する場合や各装置を立ち上げる場合等と、製品の生産時など高速な動作が求められる場合とで、優先させたいプログラムやプログラムのサイクルタイムが異なることがある。本実施形態で説明した制御システム1によると、制御プログラム230が動作中である場合にも、プログラムを実行する優先度や制御装置を動作させるサイクルタイムを変更することができ、制御システム1の動作を効率化することができる。
 今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は、上記した説明ではなく、請求の範囲によって示され、請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。
 1 制御システム、10 検出スイッチ、20 リレー、30 サーボモータドライバ、32 モータ、100 PLC、102 電源ユニット、104 CPUユニット、106 IOユニット、108 PLCシステムバス、110 フィールドバス、112 ネットワーク、114 接続ケーブル、120 プロセッサ、122 チップセット、124 システムクロック、126 主メモリ、128 不揮発性メモリ、130 USBコネクタ、140 PLCシステムバスコントローラ、142,152,162 バッファメモリ、144 PLCシステムバス制御回路、146,156,166 DMA制御回路、148 PLCシステムバスコネクタ、150 フィールドバスコントローラ、154 フィールドバス制御回路、158 フィールドバスコネクタ、160 上位通信コントローラ、164 上位通信制御回路、168 上位通信コネクタ、170 メモリカードインターフェイス、172 メモリカード、192 DBアクセス処理プログラム、194 入出力処理プログラム、196 インターフェイス処理プログラム、200 リアルタイムOS、212 スケジューラ、214 出力処理プログラム、216 入力処理プログラム、218 IO処理プログラム、220 その他のシステムプログラム、230 制御プログラム、232 シーケンス命令演算プログラム、234 モーション演算プログラム、236 ユーザプログラム、242 タスク実行条件管理テーブル、300 サポート装置、310 ディスプレイ、400 データベース装置。

Claims (4)

  1.  対象機器を制御するためのコントローラであって、
     ユーザプログラムを含む複数のプログラムと、タスクの実行条件を示すタスク情報とを記憶するための記憶部と、
     前記プログラムを、前記タスク情報に示される実行条件に従って周期的に実行する制御部とを備え、
     前記コントローラは、前記制御部が前記ユーザプログラムを周期的に実行することで前記対象機器を制御し、
     前記ユーザプログラムには、前記タスクの実行条件を変更するための設定用の命令を含めることが可能であり、
     前記制御部は、前記ユーザプログラムに含まれる前記設定用の命令を実行することにより、前記記憶部の前記タスク情報を更新し、更新後の前記タスクの実行条件に従って前記プログラムを実行する、コントローラ。
  2.  前記タスク情報に示される前記実行条件には、前記タスクを実行する優先度が含まれ、
     前記制御部は、タスクの優先度に従って前記プログラムを周期的に実行し、
     前記設定用の命令には、前記タスクの優先度を変更する命令が含まれ、
     前記制御部は、前記ユーザプログラムに含まれる、前記タスクの優先度を変更する命令を実行することにより、前記命令にかかるタスクの優先度を変更して前記タスク情報を更新する、請求項1に記載のコントローラ。
  3.  前記タスク情報に示される前記実行条件には、前記タスクを実行する周期が含まれ、
     前記設定用の命令には、前記タスクを実行する周期を変更する命令が含まれ、
     前記制御部は、前記ユーザプログラムに含まれる、前記タスクの周期を変更する命令を実行することにより、前記命令にかかるタスクの周期を変更して前記タスク情報を更新する、請求項1に記載のコントローラ。
  4.  前記タスク情報に示される前記実行条件には、前記タスクを実行する優先度と、前記タスクを実行する周期が含まれ、
     前記制御部は、タスクの優先度および周期に従って前記プログラムを周期的に実行し、
     前記設定用の命令には、前記タスクの優先度を変更する命令と、前記タスクの周期を変更する命令との少なくともいずれか一方が含まれ、
     前記制御部は、前記ユーザプログラムに含まれる、前記タスクの優先度を変更する命令と前記タスクの周期を変更する命令とを実行することにより、前記命令にかかるタスクの優先度または周期の少なくともいずれかを変更して前記タスク情報を更新する、請求項1に記載のコントローラ。
PCT/JP2015/050798 2014-03-13 2015-01-14 コントローラ WO2015136960A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP15761349.8A EP3101496A4 (en) 2014-03-13 2015-01-14 Controller
US15/123,061 US10139799B2 (en) 2014-03-13 2015-01-14 Controller to modify an execution condition during program execution
CN201580011829.4A CN106062648A (zh) 2014-03-13 2015-01-14 控制器

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2014-049974 2014-03-13
JP2014049974A JP6626240B2 (ja) 2014-03-13 2014-03-13 コントローラ

Publications (1)

Publication Number Publication Date
WO2015136960A1 true WO2015136960A1 (ja) 2015-09-17

Family

ID=54071414

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2015/050798 WO2015136960A1 (ja) 2014-03-13 2015-01-14 コントローラ

Country Status (5)

Country Link
US (1) US10139799B2 (ja)
EP (1) EP3101496A4 (ja)
JP (1) JP6626240B2 (ja)
CN (1) CN106062648A (ja)
WO (1) WO2015136960A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018055507A1 (en) * 2016-09-20 2018-03-29 Ramon Chips Ltd. Scheduling of tasks in a multiprocessor device

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102079499B1 (ko) * 2015-10-20 2020-02-21 엘에스산전 주식회사 Plc 위치 결정 시스템의 축별 제어주기 독립 할당 방법
JP6356726B2 (ja) 2016-05-19 2018-07-11 ファナック株式会社 ラダープログラム解析装置
JP7085305B2 (ja) * 2016-11-24 2022-06-16 株式会社日立産機システム コントロールシステム及びコントロール方法
JP6919404B2 (ja) * 2017-08-10 2021-08-18 オムロン株式会社 制御装置
JP6950385B2 (ja) * 2017-09-12 2021-10-13 オムロン株式会社 制御装置および制御方法
US20190384637A1 (en) * 2017-09-26 2019-12-19 Mitsubishi Electric Corporation Controller
JP6806019B2 (ja) 2017-09-26 2020-12-23 オムロン株式会社 制御装置
JP6969455B2 (ja) 2018-03-13 2021-11-24 オムロン株式会社 制御装置、制御システム、制御方法、および、制御プログラム
JP7277292B2 (ja) * 2019-07-08 2023-05-18 ファナック株式会社 Plc装置

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06259115A (ja) * 1993-03-04 1994-09-16 Matsushita Electric Ind Co Ltd プログラマブルコントローラ
JPH0962317A (ja) * 1995-08-25 1997-03-07 Omron Corp プログラマブル制御装置および方法
JPH09251389A (ja) * 1996-03-14 1997-09-22 Omron Corp データ処理装置
JPH1074105A (ja) * 1996-08-29 1998-03-17 Toyo Electric Mfg Co Ltd プログラマブルコントローラ
JPH10133889A (ja) * 1996-10-28 1998-05-22 Omron Corp コントローラの制御周期設定方法および装置
JP2000132207A (ja) * 1998-10-27 2000-05-12 Hitachi Ltd サイクルタイム設定方式
JP2003181900A (ja) * 2001-12-20 2003-07-02 Omron Corp コントローラ並びにモーション制御装置
JP2004151762A (ja) * 2002-10-28 2004-05-27 Toshiba Corp プログラマブルコントローラ
JP2004272781A (ja) * 2003-03-11 2004-09-30 Nissan Motor Co Ltd 制御周期の動的設定装置および制御周期の動的設定方法

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3363234A (en) * 1962-08-24 1968-01-09 Sperry Rand Corp Data processing system
US6263487B1 (en) * 1996-01-17 2001-07-17 Siemens Ag Programmable controller
JPH11338447A (ja) * 1998-05-22 1999-12-10 Matsushita Electric Ind Co Ltd 情報処理装置
JP2001265412A (ja) * 2000-03-15 2001-09-28 Omron Corp プログラマブルコントローラ
DE10326542B4 (de) * 2003-06-12 2016-12-08 Siemens Aktiengesellschaft Betriebsverfahren und Steuerungsprogramm für eine Zentraleinheit eines Automatisierungssystems sowie Zentraleinheit eines Automatisierungssystems und Automatisierungssystem selbst
US7568198B2 (en) * 2006-01-10 2009-07-28 National Instruments Corporation Control of tasks in a programmable logic controller
JP4762204B2 (ja) * 2007-07-04 2011-08-31 三菱電機株式会社 プログラム開発支援装置
CN101560741B (zh) * 2009-05-25 2011-10-12 浙江华章科技有限公司 用于造纸机传动控制系统的流程控制方法
US8624570B2 (en) * 2009-10-15 2014-01-07 Continental Automotive Systems, Inc. Digitally controlling a power converter
JP5136695B2 (ja) * 2011-01-31 2013-02-06 トヨタ自動車株式会社 安全制御装置および安全制御方法
JP4894961B1 (ja) 2011-03-15 2012-03-14 オムロン株式会社 Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体
JP4877423B1 (ja) * 2011-03-15 2012-02-15 オムロン株式会社 Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体
US8504176B2 (en) 2011-03-15 2013-08-06 Omron Corporation CPU unit of PLC, system program for PLC, and recording medium storing system program for PLC
JP4752984B1 (ja) * 2011-03-15 2011-08-17 オムロン株式会社 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
JP4957853B1 (ja) * 2011-03-15 2012-06-20 オムロン株式会社 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
CN103399798A (zh) * 2013-07-29 2013-11-20 深圳市汇川控制技术有限公司 Plc的多任务控制方法和装置

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06259115A (ja) * 1993-03-04 1994-09-16 Matsushita Electric Ind Co Ltd プログラマブルコントローラ
JPH0962317A (ja) * 1995-08-25 1997-03-07 Omron Corp プログラマブル制御装置および方法
JPH09251389A (ja) * 1996-03-14 1997-09-22 Omron Corp データ処理装置
JPH1074105A (ja) * 1996-08-29 1998-03-17 Toyo Electric Mfg Co Ltd プログラマブルコントローラ
JPH10133889A (ja) * 1996-10-28 1998-05-22 Omron Corp コントローラの制御周期設定方法および装置
JP2000132207A (ja) * 1998-10-27 2000-05-12 Hitachi Ltd サイクルタイム設定方式
JP2003181900A (ja) * 2001-12-20 2003-07-02 Omron Corp コントローラ並びにモーション制御装置
JP2004151762A (ja) * 2002-10-28 2004-05-27 Toshiba Corp プログラマブルコントローラ
JP2004272781A (ja) * 2003-03-11 2004-09-30 Nissan Motor Co Ltd 制御周期の動的設定装置および制御周期の動的設定方法

Non-Patent Citations (1)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018055507A1 (en) * 2016-09-20 2018-03-29 Ramon Chips Ltd. Scheduling of tasks in a multiprocessor device
US11023277B2 (en) 2016-09-20 2021-06-01 Ramon Chips Ltd. Scheduling of tasks in a multiprocessor device

Also Published As

Publication number Publication date
US10139799B2 (en) 2018-11-27
JP6626240B2 (ja) 2019-12-25
JP2015176191A (ja) 2015-10-05
EP3101496A1 (en) 2016-12-07
US20170075334A1 (en) 2017-03-16
EP3101496A4 (en) 2017-04-12
CN106062648A (zh) 2016-10-26

Similar Documents

Publication Publication Date Title
WO2015136960A1 (ja) コントローラ
CN109557890B (zh) 控制装置
US9618922B2 (en) CPU of PLC, system program for PLC, and recording medium storing system program for PLC
JP4807475B1 (ja) 演算ユニット、出力制御方法、およびプログラム
JP6946909B2 (ja) 制御システムおよび制御装置
US10274936B2 (en) Control apparatus
JP6409557B2 (ja) 制御装置、コントローラ・システム、出力制御方法、およびプログラム
JP7000686B2 (ja) 制御装置
US20110238188A1 (en) Engineering tool
US10877803B2 (en) Control apparatus, control method and non-transitory storage medium
US11855907B2 (en) Robot control system and control method
KR101212781B1 (ko) 로봇 통합용접제어 시스템
CN109709904B (zh) 从机装置、主机装置以及工业用网络系统
JP6135247B2 (ja) 情報処理装置および情報処理プログラム
US9557727B2 (en) Program creation device and programmable logic controller
JP5752087B2 (ja) 制御装置、データ出力制御ユニット、データ入力制御ユニット、および制御ユニット
JP2011062798A (ja) ロボット制御装置およびロボット制御方法
CN113874797A (zh) 控制装置
WO2022049885A1 (ja) 制御装置
JP2012194955A (ja) 支援装置、表示制御方法、およびプログラム
JP2009223648A (ja) 階層化されたソフトウエアによる汎用ネットワークを用いたモーションシステム
US10768597B2 (en) Method and controller for flexible process control
JP2009187255A (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: 15761349

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2015761349

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 15123061

Country of ref document: US

Ref document number: 2015761349

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE