WO2012124133A1 - Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体 - Google Patents

Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体 Download PDF

Info

Publication number
WO2012124133A1
WO2012124133A1 PCT/JP2011/056769 JP2011056769W WO2012124133A1 WO 2012124133 A1 WO2012124133 A1 WO 2012124133A1 JP 2011056769 W JP2011056769 W JP 2011056769W WO 2012124133 A1 WO2012124133 A1 WO 2012124133A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
control
execution
cycle
plc
Prior art date
Application number
PCT/JP2011/056769
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 EP11861122.7A priority Critical patent/EP2687927B1/en
Priority to CN201180068885.3A priority patent/CN103403633B/zh
Publication of WO2012124133A1 publication Critical patent/WO2012124133A1/ja
Priority to US14/017,929 priority patent/US9618922B2/en

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/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0426Programming the control sequence
    • 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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
    • 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
    • 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/15Plc structure of the system
    • G05B2219/15079Multitasking, real time multitasking
    • 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/15Plc structure of the system
    • G05B2219/15126Calculate duration of cycle
    • 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/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25419Scheduling

Definitions

  • the present invention relates to scheduling of control operations including output processing, input processing, arithmetic processing, and the like in a PLC (also referred to as a programmable logic controller or programmable controller) used to control operations of machines and equipment.
  • a PLC also referred to as a programmable logic controller or 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 executes a control operation while exchanging data between these units via the PLC system bus and / or the field network every execution cycle of the control program.
  • Patent Document 1 Japanese Patent Application Laid-Open No. 2000-105604 discloses a scan time (execution) in which a cycle of output refresh (output processing), input refresh (input processing), and sequence program execution (arithmetic processing) is executed in a PLC.
  • a technique for making the cycle period) constant is disclosed.
  • the principle of this technology is that a constant scan setting time that is longer than the time required for one-round execution is set, and after one round of execution is made each time, the one-round execution in that cycle is started. After waiting for the elapsed time to reach the constant scan set time, the next cycle is started.
  • the remote IO terminal that communicates with the CPU unit via the field network acquires the input data from the outside immediately before the scheduled time for transmitting the input data to the CPU unit. Precise, time-controlled planned operation is possible. As a result, the CPU unit can perform arithmetic processing using the newest available input data. Therefore, coupled with the shortening of the cycle of the control cycle, it is possible to shorten the response time from the acquisition of the input data to the output of the output data as a result of calculation using the input data.
  • the occurrence of communication abnormality can be quickly determined by detecting that communication has not been performed at the scheduled time in any unit of the PLC. .
  • the CPU unit When the CPU unit directly communicates with a control target device such as a servo motor driver outside the PLC via the field network, it is advantageous because the communication cycle of the control data by the field network can be made constant. Since it has become possible to shorten the cycle of the PLC execution cycle so that it can be used as the servo motor control cycle, the PLC CPU unit can provide instructions to the servo motor driver without providing a dedicated motion controller. It has become possible to control the motor by generating and outputting a value for each execution cycle. In such a case, the CPU unit outputs an output signal at a constant cycle in order to control the motor with high accuracy. It is important to be able to send
  • the technical scope of the CPU unit of the PLC according to the present invention is not limited to the function of a conventional CPU unit that performs control solely by executing a sequence program, but the function of the PLC CPU unit has been expanded to include the function of a motion controller. Including things.
  • the time required to execute a control program (such as a sequence program and a motion operation program) can be different each time the control program is repeatedly executed. Looking at this distribution of execution times, the execution times tend to be relatively short for most of the number of executions and have little variation, while relatively long execution times tend to be for a small number of execution times.
  • the execution time has such a distribution because the control program may include a process that is executed only when a specific condition is satisfied. In a cycle in which such a condition is satisfied, more processing is performed than in other cycles, so that the execution time becomes longer.
  • the execution time becomes long there is a case where initial processing is performed for a large number of axes in a cycle in which a motion command activation condition such as a motion function block used in a sequence program (user program) is established. It is done.
  • This initial processing includes processing for calculating a motion command value in each subsequent cycle including a cycle in which a motion command activation condition is satisfied.
  • the cycle of the execution cycle is set to be longer than the maximum execution time of the control program, the execution of the control program is completed in a shorter time in most cycles. It is not possible to realize a short execution cycle period adapted to a short execution time.
  • the present invention sets the communication cycle for the control data output and input performed by the PLC CPU unit to be longer than the maximum execution time of the control program.
  • An object of the present invention is to provide a PLC CPU unit that can be used for a short period of time.
  • a PLC CPU unit for controlling a controlled object.
  • the CPU unit of the PLC includes a microprocessor, storage means, a communication circuit for transmitting output data and receiving input data, and means for setting a cycle of a control cycle.
  • the CPU unit of the PLC is configured to control the controlled object by repeating transmission of output data, reception of input data, and execution of a first control program that generates output data using the input data.
  • the storage means is used to store a first control program and a scheduler program that controls execution of the first control program.
  • the microprocessor executes the scheduler program and the first control program stored in the storage means.
  • the communication circuit transmits output data and receives input data for each control cycle.
  • the scheduler program causes the microprocessor to execute the first control program after the output data is transmitted and the input data is received by the communication circuit in the control cycle after the control cycle in which the execution of the first control program is completed. And an instruction for causing the microprocessor to execute an unexecuted portion of the first control program in a control cycle subsequent to a control cycle in which execution of the first control program has not been completed.
  • the PLC CPU unit performs a control cycle for outputting and inputting control data.
  • the period of communication performed in synchronization with the first control program can be set to a certain time shorter than the maximum value of the time required to complete the execution of the first control program.
  • the first control program includes a motion calculation program that calculates a command value output to the motor driver each time it is executed.
  • the motion calculation program is a time required for subsequent execution by executing initial processing necessary for starting calculation of a command value in the first execution started by the user program created according to the control purpose of the user. Requires a longer execution time.
  • the execution period of the motion calculation program is not exceeded, but in the motion start cycle, the execution period is exceeded.
  • the first control program further includes a user program.
  • the storage means is further used for storing a second control program in which an execution cycle having a cycle of an integer multiple of 2 or more of the cycle of the control cycle is set.
  • the scheduler program includes instructions that cause the microprocessor to execute the second control program according to the execution cycle in a period after the end of the first control program in the control cycle.
  • the processing amount of the first control program is reduced by processing, as the second control program, a process that has no effect even if the execution cycle period becomes longer than the control cycle period. can do.
  • the cycle of the control cycle can be further shortened.
  • the frequency at which the execution of the first control program does not end within one control cycle can be reduced.
  • the frequency at which execution of the first control program does not end within the number of control cycles exceeding the assumption can be reduced.
  • the storage means is further used for storing a second control program in which an execution cycle having a cycle of an integer multiple of 2 or more of the cycle of the control cycle is set.
  • the scheduler program includes instructions that cause the microprocessor to execute the second control program according to the execution cycle in a period after the end of the first control program in the control cycle.
  • the first control program includes a motion calculation program
  • the second control program includes a user program.
  • the storage means further includes a setting content for specifying a limit number of control cycles for which one execution of the first control program continues, and a control for limiting the number of executions of the first control program to one limit. It is used for storing an abnormality processing program to be executed when it does not end within a cycle.
  • the scheduler program is used when the number of control cycles in which the first control program continues to execute once reaches the limit number and the execution of the first control program is not completed within the control cycle.
  • an instruction for causing the microprocessor to execute the abnormal processing program without executing the unexecuted portion of the first control program is included.
  • the communication circuit is configured to start transmission of output data and reception of input data under the control of the microprocessor.
  • the scheduler program further includes an instruction for causing the communication circuit to start communication for each control cycle.
  • the scheduler program further sets the communication circuit in the unexecuted portion of the first control program in the next control cycle.
  • An instruction for causing the microprocessor to execute processing for starting communication and then causing the microprocessor to execute an unexecuted portion of the first control program is included.
  • the CPU unit of the PLC further includes a timer circuit that generates a signal at the cycle of the control cycle.
  • the communication circuit is configured to start transmission of output data and reception of input data using a signal generated by the timer circuit as a trigger.
  • the processing amount in the scheduler program can be reduced. Therefore, in the control cycle for executing the unexecuted portion of the processing content included in the first control program, the scheduler program has more time to execute the unexecuted portion of the processing content included in the control program. You can assign more. As a result, it is possible to increase the possibility of ending execution of an unexecuted portion of the processing contents included in the first control program within the control cycle.
  • the microprocessor includes first and second cores.
  • the first core executes a scheduler program
  • the second core executes a first control program.
  • the scheduler program does not interrupt the execution of the first control program, thereby removing the unexecuted portion of the first control program from the microprocessor. Contains instructions to be executed.
  • a system program for PLC includes a microprocessor, storage means, and a communication circuit that transmits output data and receives input data, and repeats transmission of output data and reception of input data by the communication circuit for each control cycle.
  • the microprocessor stores the data in the storage means Executed.
  • the PLC system program includes a scheduler program for controlling the execution of the first control program and a program for setting the cycle of the control cycle.
  • the scheduler program causes the microprocessor to execute the first control program after the output data is transmitted and the input data is received by the communication circuit in the control cycle after the control cycle in which the execution of the first control program is completed. And an instruction for causing the microprocessor to execute an unexecuted portion of the first control program in a control cycle subsequent to a control cycle in which execution of the first control program has not been completed.
  • the PLC system program includes a motion calculation program that calculates a command value output to the motor driver each time it is executed.
  • the motion calculation program is a part or all of the first control program.
  • the motion calculation program is a time required for subsequent execution by executing initial processing necessary for starting calculation of a command value in the first execution started by the user program created according to the control purpose of the user. Requires a longer execution time.
  • a recording medium storing a PLC system program.
  • the PLC system program includes a microprocessor, storage means, and a communication circuit that transmits output data and receives input data, and repeats transmission of output data and reception of input data by the communication circuit for each control cycle.
  • the microprocessor stores the data in the storage means Executed.
  • the PLC system program includes a scheduler program for controlling the execution of the first control program and a program for setting the cycle of the control cycle.
  • the scheduler program causes the microprocessor to execute the first control program after the output data is transmitted and the input data is received by the communication circuit in the control cycle after the control cycle in which the execution of the first control program is completed. And an instruction for causing the microprocessor to execute an unexecuted portion of the first control program in a control cycle subsequent to a control cycle in which execution of the first control program has not been completed.
  • the PLC system program includes a motion calculation program that calculates a command value output to the motor driver each time it is executed.
  • the motion calculation program is a part or all of the first control program.
  • the motion calculation program is a time required for subsequent execution by executing initial processing necessary for starting calculation of a command value in the first execution started by the user program created according to the control purpose of the user. Requires a longer execution time.
  • instructions in this specification means not only individual instructions appearing in a program source list for realizing a certain function, but also a set of such individual instructions and functions. For example, in English, it should be written in plural form like instructions.
  • the PLC user communicates in synchronization with the control cycle for the output and input of control data by the PLC CPU unit. Can be set to a fixed time shorter than the maximum execution time of the first control program.
  • the PLC according to the present embodiment controls a control target such as a machine or equipment.
  • a control target such as a machine or equipment.
  • FIG. 1 is a schematic diagram showing a schematic configuration of a PLC system according to an embodiment of the present invention.
  • PLC system SYS includes PLC 1, servo motor driver 3 and remote IO terminal 5 connected to PLC 1 via field network 2, detection switch 6 and relay 7 which are field devices.
  • the PLC support device 8 is connected to the PLC 1 via the connection cable 10 or the like.
  • the PLC 1 includes a CPU unit 13 that executes main arithmetic processing, one or more IO units 14, and a special unit 15. These units are configured to exchange data with each other via the PLC system bus 11. These units are supplied with power of an appropriate voltage by the power supply unit 12. Since each unit configured as the PLC 1 is provided by a PLC manufacturer, the PLC system bus 11 is generally developed and used independently for each PLC manufacturer. On the other hand, as will be described later, for the field network 2, the standards and the like are often disclosed so that products from different manufacturers can be connected.
  • the IO unit 14 is a unit related to general input / output processing, and controls input / output of binarized data such as on / off. In other words, the IO unit 14 collects information indicating whether a sensor such as the detection switch 6 is detecting a certain object (on) or not detecting any object (off). . In addition, the IO unit 14 outputs either an activation command (ON) or an inactivation command (OFF) to an output destination such as the relay 7 or the actuator.
  • the special unit 15 has functions not supported by the IO unit 14 such as analog data input / output, temperature control, and communication using a specific communication method.
  • the field network 2 transmits various data exchanged with the CPU unit 13.
  • various types of industrial Ethernet registered trademark
  • industrial Ethernet registered trademark
  • industrial Ethernet for example, EtherCAT (registered trademark), Profinet IRT, MECHATROLINK (registered trademark) -III, Powerlink, SERCOS (registered trademark) -III, and CIP Motion are known. Any of them may be adopted.
  • a field network other than industrial Ethernet may be used. For example, if the motion control is not performed, DeviceNet, CompoNet / IP (registered trademark), or the like may be used.
  • the PLC system SYS typically exemplifies a configuration in the case where EtherCAT (registered trademark), which is an industrial Ethernet (registered trademark), is employed as the field network 2 in the present embodiment.
  • FIG. 1 illustrates the PLC system SYS having both the PLC system bus 11 and the field network 2, but a system configuration in which only one of them is mounted may be employed. For example, all units may be connected by the field network 2. Alternatively, the servo motor driver 3 may be directly connected to the PLC system bus 11 without using the field network 2. Further, a communication unit of the field network 2 may be connected to the PLC system bus 11 and communication may be performed between the CPU unit 13 and a device connected to the field network 2 via the communication unit.
  • the CPU unit 13 directly controls the control target without passing through the IO unit 14, the servo motor driver 3, or the like by providing the CPU unit 13 with the function of the IO unit 14 or the function of the servo motor driver 3. It may be configured.
  • the servo motor driver 3 is connected to the CPU unit 13 via the field network 2 and drives the servo motor 4 according to a command value from the CPU unit 13. More specifically, the servo motor driver 3 receives command values such as a position command value, a speed command value, and a torque command value from the PLC 1 at a constant cycle.
  • the servo motor driver 3 receives a position and speed (typically from the difference between the current position and the previous position) from a detector such as a position sensor (rotary encoder) or torque sensor connected to the shaft of the servo motor 4. (Calculated), an actual measurement value related to the operation of the servo motor 4 such as torque is acquired.
  • the servo motor driver 3 sets a command value from the CPU unit 13 as a target value, and performs feedback control using the actually measured value as a feedback value. That is, the servo motor driver 3 adjusts the current for driving the servo motor 4 so that the actual measurement value approaches the target value.
  • the servo motor driver 3 may be referred to as a servo motor amplifier.
  • FIG. 1 shows a system example in which the servo motor 4 and the servo motor driver 3 are combined, but other configurations, for example, a system in which a pulse motor and a pulse motor driver are combined may be employed.
  • a remote IO terminal 5 is further connected to the field network 2 of the PLC system SYS shown in FIG.
  • the remote IO terminal 5 basically performs processing related to general input / output processing in the same manner as the IO unit 14. More specifically, the remote IO terminal 5 includes a communication coupler 52 for performing processing related to data transmission in the field network 2 and one or more IO units 53. These units are configured to exchange data with each other via the remote IO terminal bus 51.
  • FIG. 2 is a schematic diagram showing a hardware configuration of the CPU unit 13 according to the embodiment of the present invention.
  • the CPU unit 13 includes a microprocessor 100, a chip set 102, a main memory 104, a nonvolatile memory 106, a system timer 108, a PLC system bus controller 120, a field network controller 140, USB connector 110.
  • the chip set 102 and other components are coupled via various buses.
  • the microprocessor 100 and the chipset 102 are typically configured according to a general-purpose computer architecture. That is, the microprocessor 100 interprets and executes the instruction codes sequentially supplied from the chip set 102 according to the internal clock.
  • the chip set 102 exchanges internal data with various connected components and generates instruction codes necessary for the microprocessor 100. Further, the chip set 102 has a function of caching data obtained as a result of execution of arithmetic processing in the microprocessor 100.
  • the CPU unit 13 includes a main memory 104 and a nonvolatile memory 106 as storage means.
  • the main memory 104 is a volatile storage area (RAM) and holds various programs to be executed by the microprocessor 100 after the CPU unit 13 is powered on.
  • the main memory 104 is also used as a working memory when the microprocessor 100 executes various programs.
  • a main memory 104 a device such as DRAM (Dynamic Random Access Memory) or SRAM (Static Random Access Memory) is used.
  • the non-volatile memory 106 holds data such as a real-time OS (Operating System), a PLC 1 system program, a user program, a motion calculation program, and system setting parameters in a non-volatile manner. These programs and data are copied to the main memory 104 so that the microprocessor 100 can access them as necessary.
  • a nonvolatile memory 106 a semiconductor memory such as a flash memory can be used.
  • a magnetic recording medium such as a hard disk drive or an optical recording medium such as a DVD-RAM (Digital Versatile Disk Random Access Memory) can be used.
  • the system timer 108 generates an interrupt signal at regular intervals and provides it to the microprocessor 100. Typically, it is configured to generate an interrupt signal at a plurality of different periods depending on the hardware specifications, but interrupts at an arbitrary period depending on the OS (Operating System), BIOS (Basic Input Output System), etc. It can also be set to generate a signal. Using the interrupt signal generated by the system timer 108, a control operation for each control cycle as described later is realized.
  • the CPU unit 13 includes a PLC system bus controller 120 and a field network controller 140 as communication circuits. These communication circuits transmit output data and receive input data.
  • the transmission of output data and the reception of input data by the communication circuit are performed by using the part responsible for these functions as a communication partner.
  • the PLC system bus controller 120 controls data exchange via the PLC system bus 11. More specifically, the PLC system bus controller 120 includes a DMA (Dynamic Memory Access) control circuit 122, a PLC system bus control circuit 124, and a buffer memory 126. The PLC system bus controller 120 is internally connected to the PLC system bus 11 via the PLC system bus connector 130.
  • DMA Dynamic Memory Access
  • the buffer memory 126 is a transmission buffer for data output to other units via the PLC system bus 11 (hereinafter also referred to as “output data”), and is input from other units via the PLC system bus 11. It functions as a data reception buffer (hereinafter also referred to as “input data”).
  • the output data created by the arithmetic processing by the microprocessor 100 is stored in the main memory 104 originally. Output data to be transferred to a specific unit is read from the main memory 104 and temporarily held in the buffer memory 126. Input data transferred from other units is temporarily stored in the buffer memory 126 and then transferred to the main memory 104.
  • the DMA control circuit 122 transfers output data from the main memory 104 to the buffer memory 126 and transfers input data from the buffer memory 126 to the main memory 104.
  • the PLC system bus control circuit 124 performs processing for transmitting output data of the buffer memory 126 and processing for receiving input data and storing it in the buffer memory 126 with other units connected to the PLC system bus 11. .
  • the PLC system bus control circuit 124 provides functions of a physical layer and a data link layer in the PLC system bus 11.
  • the field network controller 140 controls data exchange through the field network 2. That is, the field network controller 140 controls transmission of output data and reception of input data according to the standard of the field network 2 to be used. As described above, since the field network 2 conforming to the EtherCAT (registered trademark) standard is adopted in the present embodiment, the field network controller 140 including hardware for performing normal Ethernet (registered trademark) communication is used. It is done. In the EtherCAT (registered trademark) standard, a general Ethernet (registered trademark) controller that realizes a communication protocol according to the normal Ethernet (registered trademark) standard can be used.
  • the buffer memory 146 is a transmission buffer for data output to other devices via the field network 2 (this data is also referred to as “output data” hereinafter), and other devices via the field network 2. Or the like (hereinafter, this data is also referred to as “input data”).
  • this data is also referred to as “input data”.
  • the output data created by the arithmetic processing by the microprocessor 100 is stored in the main memory 104 originally.
  • Output data to be transferred to a specific device is read from the main memory 104 and temporarily held in the buffer memory 146.
  • Input data transferred from another device is temporarily stored in the buffer memory 146 and then transferred to the main memory 104.
  • the DMA control circuit 142 transfers output data from the main memory 104 to the buffer memory 146 and transfers input data from the buffer memory 146 to the main memory 104.
  • the field network control circuit 144 performs processing for transmitting output data of the buffer memory 146 and processing for receiving input data and storing it in the buffer memory 146 with other devices connected to the field network 2.
  • the field network control circuit 144 provides physical layer and data link layer functions in the field network 2.
  • the USB connector 110 is an interface for connecting the PLC support device 8 and the CPU unit 13. Typically, a program that can be executed by the microprocessor 100 of the CPU unit 13 and transferred from the PLC support device 8 is taken into the PLC 1 via the USB connector 110.
  • FIG. 3 is a schematic diagram showing a software configuration executed by the CPU unit 13 according to the embodiment of the present invention.
  • the software executed by the CPU unit 13 has three layers of a real-time OS 200, a system program 210, and a user program 236.
  • the real-time OS 200 is designed according to the computer architecture of the CPU unit 13, and provides a basic execution environment for the microprocessor 100 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 a function as the PLC 1.
  • 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. In other words, the program is arbitrarily designed according to the line (process) to be controlled using the PLC system SYS.
  • 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 microprocessor 100 of the CPU unit 13 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 the form of an object program that can be executed by the microprocessor 100 of the CPU unit 13.
  • the user program 236 is generated by compiling a source program described in a ladder language or the like in the PLC support device 8 or the like. Then, the generated user program 236 in the object program format is transferred from the PLC support device 8 to the CPU unit 13 via the connection cable 10 and stored in the nonvolatile memory 106 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 the execution of the user program 236 and the motion calculation program 234.
  • the CPU unit 13 employs a constant execution cycle (control cycle) suitable for the motion calculation program 234 as a common cycle for the entire process. For this reason, it is difficult to complete all the processes in one control cycle. Therefore, depending on the priority of the process to be executed, the process to be executed in each control cycle and the control cycles And processing that may be executed.
  • the scheduler program 212 manages the execution order of these divided processes. More specifically, the scheduler program 212 executes a program having a higher priority first in each control cycle period.
  • 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 120 and / or the field network controller 140.
  • 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 120 and / or the field network controller 140 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 executed in accordance with an instruction from the user program 236, and is calculated every time a command value output to a motor driver such as the servo motor driver 3 or the pulse motor driver is executed.
  • Other system programs 220 collectively show a group of programs for realizing various functions of the PLC 1 other than the programs individually shown in FIG.
  • the other system program 220 includes a program 222 for setting the cycle of the control cycle.
  • the cycle of the control cycle can be appropriately set according to the control purpose.
  • the user inputs information specifying the cycle of the control cycle to the PLC support device 8.
  • the input information is transferred from the PLC support device 8 to the CPU unit 13.
  • the program 222 for setting the cycle of the control cycle stores the information from the PLC support device 8 in the nonvolatile memory 106, and generates an interrupt signal at the cycle of the control cycle designated by the system timer 108.
  • Timer 108 is set.
  • the program 222 for setting the cycle of the control cycle is executed, whereby information specifying the cycle of the control cycle is read from the nonvolatile memory 106, and the system is read according to the read information.
  • a timer 108 is set.
  • information specifying the cycle of the control cycle
  • information (number or character) specifying one of a value of time indicating the cycle of the control cycle and a plurality of options prepared in advance relating to the cycle of the control cycle Etc.
  • cycle of the control cycle As means for setting the cycle of the control cycle, means for communicating with the PLC support device 8 used for acquiring information specifying the cycle of the control cycle, cycle of the control cycle This corresponds to an element used to arbitrarily set the cycle of the control cycle, such as the configuration of the system timer 108 that can arbitrarily set the cycle of the interrupt signal that defines the control cycle and the program 222 that sets the control cycle. .
  • an input device such as an operation switch for receiving an input for specifying the cycle of the control cycle may be provided in the CPU unit 13 itself.
  • the real-time OS 200 provides an environment for switching and executing a plurality of programs over time.
  • an output preparation interrupt (P) is used as an event (interrupt) for outputting (transmitting) output data generated by program execution of the CPU unit 13 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 microprocessor 100 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 at all.
  • a program includes, for example, a program related to communication processing between the CPU unit 13 and the PLC support device 8 via the connection cable 10 (USB).
  • control program 230 and the scheduler program 212 are stored in the main memory 104 and the nonvolatile memory 106 that are storage means.
  • FIG. 4 is a schematic diagram showing an area configuration of the main memory 104 of the CPU unit 13 according to the embodiment of the present invention.
  • main memory 104 includes various program areas 1041, control program work area 1042, PLC system bus transmission buffer 1043, PLC system bus reception buffer 1044, and field network transmission buffer 1045.
  • Field network receive buffer 1046 is formed.
  • the various program areas 1041 temporarily store codes for executing various programs.
  • control program work area 1042 output data created by the execution of the control program 230 is temporarily stored.
  • the PLC system bus transmission buffer 1043 and the PLC system bus reception buffer 1044 temporarily store data transmitted and received via the PLC system bus 11, respectively.
  • the field network transmission buffer 1045 and the field network reception buffer 1046 temporarily store data transmitted and received via the field network 2, respectively.
  • the target output data is transmitted from the control program work area 1042 to the PLC system bus. Copy to buffer 1043.
  • the output processing program 214 collects output data groups directed to the same unit in the PLC system bus transmission buffer 1043 so that a plurality of output data to be transmitted to the same unit can be transmitted at once. Rearrange the output data as follows.
  • the output processing program 214 copies the target output data from the work area 1042 of the control program to the field network transmission buffer 1045 when any output data needs to be transmitted via the field network 2. . At this time, the output processing program 214 rearranges the output data in a format that can be transmitted as a serial frame in the field network transmission buffer 1045.
  • the input processing program 216 is input data received by the PLC system bus controller 120 and stored in the PLC system bus reception buffer 1044 and / or received by the field network controller 140 and stored in the field network reception buffer 1046.
  • the input data is copied to the work area 1042 of the control program.
  • the input processing program 216 rearranges the input data in a format suitable for use by the control program 230 in the work area 1042 of the control program.
  • the DMA control circuit 122 of the PLC system bus controller 120 transfers the output data stored in the PLC system bus transmission buffer 1043 to the buffer memory 146 of the PLC system bus controller 120 and the input data stored in the buffer memory 146. Is transferred to the PLC system bus reception buffer 1044.
  • the DMA control circuit 142 of the field network controller 140 transfers the output data stored in the field network transmission buffer 1045 to the buffer memory 146 of the field network controller 140, and inputs the input data stored in the buffer memory 146 to the field network. Transfer to receive buffer 1046.
  • the control program work area 1042, the PLC system bus transmission buffer 1043, the PLC system bus reception buffer 1044, the field network transmission buffer 1045, and the field network reception buffer 1046 are configured so that each access can be controlled independently of each other. Yes. Therefore, for example, the following operations (1) to (3) can be executed in parallel.
  • FIG. 5 is a sequence diagram showing the overall processing operation according to Embodiment 1 of the present invention.
  • priority is given to the output processing program 214, the input processing program 216, and the control program 230 (first control program).
  • the priorities given to these programs are, for example, in the order of the output processing program 214, the input processing program 216, and the control program 230 from the highest.
  • the CPU unit 13 of the PLC 1 repeats transmission of output data (output processing program 214), reception of input data (input processing program 216), and execution of a control program 230 that generates output data using the input data.
  • the microprocessor 100 executes the scheduler program 212 and the control program 230 stored in the storage means, and the communication circuit (the PLC system bus controller 120 and / or the field network controller 140) controls according to the execution result.
  • Output data is transmitted and input data is received every cycle.
  • the scheduler program 212 causes the microprocessor 100 to execute the programs / threads in descending order in each control cycle.
  • “performing the microprocessor 100 to execute” is also simply expressed as “execute”.
  • the scheduler program 212 is not limited to being an object instance itself, but may be a program (process) that is incorporated into various other object instances (for example, the output processing program 214) and operates. For example, it may be a program that operates by being called in another object instance.
  • P and X shown in FIG. 5 indicate interrupt signals generated at regular intervals from the system timer 108 (FIG. 2). Specifically, “P” indicates an output preparation interrupt, and “X” indicates a field network transmission interrupt. In FIG. 5, the numbers “P” and “X” indicating interrupts are added to the numbers indicating the control cycle numbers.
  • the target output data is sent from the control program work area 1042 (FIG. 4) to the PLC system bus transmission buffer 1043. Copy to. Further, when it is necessary to transmit any output data via the field network 2, the output processing program 214 copies the target output data from the control program work area 1042 to the field network transmission buffer 1045.
  • the output processing program 214 instructs the PLC system bus controller 120 to execute transmission (reference A).
  • the output processing program 214 stops executing once the output data copy is completed.
  • the scheduler program 212 resumes the execution of the output processing program 214 in response to the field network transmission interrupt (X-1).
  • the output processing program 214 instructs the field network controller 140 to execute transmission (reference B). Then, the output processing program 214 ends its execution.
  • the scheduler program 212 next executes the input processing program 216 according to the priority.
  • the input processing program 216 waits until it receives a reception completion notification (symbol C) from the PLC system bus controller 120 or a reception completion notification (symbol D) from the field network controller 140.
  • a reception completion notification (symbol C) from the PLC system bus controller 120 is generated first, and then a reception completion notification (symbol D) from the field network controller 140 is generated. As shown, this order of occurrence may be reversed.
  • the input processing program 216 controls the work area of the control program from the PLC system bus reception buffer 1044 or the field network reception buffer 1046 corresponding to which reception completion notification.
  • the input data is copied to 1042.
  • the input processing program 216 terminates execution when copying of input data is completed.
  • the scheduler program 212 next executes the control program 230 according to the priority.
  • the control program 230 performs processing using the input data stored in the work area 1042 of the control program, and stores output data as a processing result in the work area 1042 of the control program.
  • the microprocessor 100 uses the control of the real-time OS to make other system programs 220 (FIG. 2). ).
  • the PLC system bus control circuit 124 transfers the target output data from the buffer memory 126 to the unit that is the destination of each output data. Thereafter, the PLC system bus control circuit 124 transfers input data from each unit on the PLC system bus 11 to the buffer memory 126 of the PLC system bus controller 120.
  • the DMA control circuit 122 of the PLC system bus controller 120 transfers the input data stored in the buffer memory 126 to the PLC system bus reception buffer 1044 of the main memory 104. Thereafter, when the transfer of the input data is completed, the DMA control circuit 122 transmits a reception completion notification (symbol C) to the microprocessor 100.
  • the DMA control circuit 142 of the field network controller 140 transfers the output data stored in the field network transmission buffer 1045 of the main memory 104 to the buffer memory 146 of the field network controller 140 in response to the transmission execution instruction (symbol B). To do.
  • the field network control circuit 144 transfers the output data from the buffer memory 146 to the destination device of each output data. Thereafter, the field network control circuit 144 transfers input data from each device on the field network 2 to the buffer memory 146 of the field network controller 140.
  • the DMA control circuit 142 of the field network controller 140 transfers the input data stored in the buffer memory 146 to the field network reception buffer 1046 of the main memory 104. Thereafter, when the transfer of the input data is completed, the DMA control circuit 142 transmits a reception completion notification (symbol D) to the microprocessor 100.
  • EtherCAT registered trademark
  • output data addressed to each unit and input data from each unit are included in a single frame.
  • the transmitted frame is sequentially transferred via each unit connected in a daisy chain.
  • Each unit other than the CPU unit 13 is set as a slave.
  • the frame returns to the CPU unit 13 via each unit which is a slave again by turning back the full-duplex communication path.
  • Each slave selectively captures the output data addressed to its own slave while passing the outgoing frame through the FIFO (First In First Out) method, and writes the input data generated by its own unit to the appropriate position in the frame. .
  • Each slave passes the return frame without reading the output data and writing the input data.
  • a frame is transmitted to each unit individually, or a single frame is transmitted and received instead of individually receiving a frame from each unit. This corresponds to the transfer of output data from the buffer memory 146 to each unit and the transfer of input data from each unit to the buffer memory 146 by the field network control circuit 144.
  • EtherCAT registered trademark
  • the field network 2 when a frame including output data is transmitted and the frame returns via each unit of the slave, the input data is included in the frame. It will be. Therefore, regarding the execution order, it is natural to execute the input process after the output process. However, depending on the type of the field network 2 to be used, it may be preferable to execute the output process after the input process. As described above, the order of the output process and the input process may be appropriately designed according to the specifications of the field network 2 and the like.
  • the execution of the control program 230 is not completed even when the output preparation interrupt (P-3) in the control cycle 3 occurs. Since the execution cycle of the control program 230 is equal to the cycle of the control cycle, it can be said that the execution cycle of the control program 230 has been exceeded. Execution of the control program 230 executed in the control cycle 2 is interrupted at this time (the execution target is shifted to the scheduler program 212), and the scheduler program 212 executes the output processing program 214 and the input processing program 216 in the control cycle 3. Execute.
  • the scheduler program 212 resumes the execution of the control program 230 that has started execution in the control cycle 2 (execution is interrupted at the start of the control cycle 3), and is included in the control program 230 The unexecuted portion of the processing contents to be executed is executed.
  • the execution of the unexecuted part of the control program 230 ends during the control cycle 3.
  • the scheduler program 212 does not newly start executing the control program in the control cycle 3.
  • the same normal operation as in the control cycle 1 is executed.
  • the output processing program 214 in the control cycle 3 does not copy the output data from the control program work area 1042 to the PLC system bus transmission buffer 1043 and / or the field network transmission buffer 1045, and sends it to the PLC system bus controller 120.
  • the execution of transmission is instructed (reference A).
  • the output processing program 214 of the control cycle 3 sends the field network controller 140 to the field network controller 140 in accordance with the execution restart instruction from the scheduler program 212 in response to the field network transmission interrupt (X).
  • the transmission execution instruction is given (reference B).
  • the input processing program 216 in the control cycle 3 does not copy the input data stored in the PLC system bus reception buffer 1044 and the field network reception buffer 1046 to the work area 1042 of the control program. If this copy operation is executed, the input data is updated when the execution of the control program 230 is resumed in the control cycle 3, that is, during the execution of the single control program 230, which is inconvenient. It is.
  • the input processing program 216 in the control cycle 3 terminates execution upon confirming the reception completion notification (reference C) from the PLC system bus controller 120 and the reception completion notification (D) from the field network controller 140.
  • control program 230 that has started execution in the control cycle 2 does not end in the control cycle 2, and executes a non-executed portion in the control cycle 3 to end a series of executions. If the control program 230 does not complete a series of executions even in the control cycle 3, the execution is interrupted again at the start of the control cycle 4, and then the unexecuted portion is executed in the control cycle 4.
  • the process in the control cycle 4 in this case is the same as the process in the control cycle 3 shown in FIG.
  • the scheduler program 212 outputs the output from the communication circuit (the PLC system bus controller 120 and / or the field network controller 140) to the microprocessor 100 in the control cycle next to the control cycle in which the execution of the control program 230 is completed. It includes an instruction to start execution of the control program 230 after data transmission and input data reception. In addition, the scheduler program 212 includes an instruction that causes the microprocessor 100 to execute an unexecuted portion of the control program 230 in a control cycle subsequent to the control cycle in which the execution of the control program 230 has not ended.
  • the scheduler program 212 sends the control program to the communication circuit (the PLC system bus controller 120 and / or the field network controller 140) in the next control cycle.
  • An instruction for causing the microprocessor 100 to execute an unexecuted part of the control program 230 is executed after the process for starting communication is executed in preference to the unexecuted part of 230.
  • the period of communication performed by the CPU unit 13 of the PLC 1 in synchronization with the control cycle for the output and input of control data is A certain time shorter than the maximum execution time of the control program 230 can be set.
  • the remote IO terminal 5 since the communication cycle of the control data is constant, the remote IO terminal 5 has a precisely time-controlled plan in which the input data is acquired from the outside immediately before the scheduled time for transmitting the input data to the CPU unit 13. Operation becomes possible. As a result, the CPU unit 13 can perform arithmetic processing using the newest available input data. Therefore, coupled with the shortening of the cycle of the control cycle, it is possible to shorten the response time from the acquisition of the input data to the output of the output data as a result of calculation using the input data.
  • the communication cycle of the control data is constant, it is possible to quickly determine the occurrence of a communication abnormality by detecting that communication has not been performed at a scheduled time in any unit of the PLC 1. .
  • the CPU unit 13 according to the present embodiment directly communicates with the servo motor driver outside the PLC 1 via the field network 2, the communication cycle of control data by the field network 2 can be made constant. Therefore, the motor can be controlled with high accuracy.
  • communication circuit (PLC system bus controller 120 and / or field network controller 140) starts transmission of output data and reception of input data under the control of microprocessor 100.
  • the scheduler program 212 includes a command for causing the communication circuit to start communication for each control cycle.
  • FIG. 6 is a sequence diagram showing an overall processing operation according to Embodiment 2 of the present invention. In the following, differences from the sequence shown in FIG. 5 will be mainly described.
  • control program 230 first control program
  • second control program set with a lower priority
  • low priority control program 230-2 the high priority control program 230-1 in the second embodiment is substantially the same as the control program 230 in the above-described first embodiment, and only the way of calling is changed for convenience of explanation.
  • the execution period of the low priority control program 230-2 is set to an integer multiple of 2 or more of the control cycle period. Is done. In the example of FIG. 6, a period corresponding to four control cycles is set as the execution period of the low priority control program 230-2. That is, the execution cycle of the low priority control program 230-2 is four times the cycle of the high priority control program 230-1. Note that the low priority control program 230-2 is also stored in the main memory 104 and the nonvolatile memory 106, which are storage means.
  • control cycles 1 to 4 are one execution cycle of the low priority control program 230-2, and the next execution cycle is the control cycles 5 to 8.
  • the scheduler program 212 executes an unexecuted portion of the processing contents included in the low priority control program 230-2. Then, the low priority control program 230-2 ends within the control cycle 3.
  • the execution cycle of the low priority control program 230-2 that has started execution in the control cycle 1 includes the subsequent control cycle 4, but in the example shown in FIG. 6, the low priority control program 230-2 includes the control cycle. Since the execution has already been completed within 3, the low priority control program 230-2 is not executed within the control cycle 4.
  • the scheduler program 212 starts the execution of the low priority control program 230-2 and starts from the beginning. Execute the process.
  • the low priority control program 230-2 that has started execution in the control cycle 1 is executed using the input data obtained by executing the input processing program 216 in the control cycle 1.
  • the output data obtained as a result of the execution of the low priority control program 230-2 is obtained by executing the output processing program 214 in the control cycle 5 corresponding to the start timing of the execution cycle of the new low priority control program 230-2. Sent.
  • the scheduler program 212 includes an instruction for causing the microprocessor 100 to execute the low priority control program 230-2 according to the execution cycle in a period after the end of the high priority control program 230-1 in the control cycle.
  • FIG. 6 shows an example in which the output process and input process of the low priority control program 230-2 are performed together with the output process and input process of the high priority control program 230-1.
  • the communication for the output and input of the low priority control program 230-2 may be performed at a timing different from the communication timing for the output and input of the high priority control program 230-1. Even in such a case, if attention is paid to the communication for the output and input of the high priority control program 230-1, the communication is performed at a constant cycle.
  • control cycle is executed when the control program with the highest priority can be executed without exceeding the cycle. Corresponds to the cycle.
  • the high-priority control program 230 is executed by including the low-priority control program 230-2 and executing a process that does not affect the execution cycle period longer than the control cycle period.
  • the amount of processing included in -1 can be reduced. Thereby, there is a possibility that the cycle of the control cycle can be further shortened.
  • the frequency at which the execution of the high priority control program 230-1 does not end within one control cycle can be reduced.
  • the frequency at which the execution of the high priority control program 230-1 does not end within an unexpected number of control cycles may be reduced.
  • FIG. 7 is a sequence diagram showing an overall processing operation according to Embodiment 3 of the present invention.
  • the content of the high priority control program 230-1 shown in the sequence according to the second embodiment is set as the motion operation program 234, and the content of the low priority control program 230-2 is set as the user program 236.
  • the sequence instruction calculation program 232 that is necessary for the execution is used. In the following, differences from the sequence shown in FIG. 5 will be mainly described.
  • the motion calculation program 234 is executed in accordance with instructions included in the user program 236, and calculates a command value to be output to the motor driver for each execution.
  • control cycles 1 to 4 are one execution cycle of the user program 236. Assume that the user program 236 gives an instruction to start the motion calculation program 234 in the previous execution cycle.
  • the motion calculation program 234 is activated in response to an instruction from the user program 236.
  • the motion calculation program 234 first executes an initial process called profile data generation.
  • the profile data is data necessary for sequentially calculating command values for the respective axes to be controlled each time the motion calculation program 234 is executed.
  • This profile data is calculated using parameters specified by a motion command in the user program 236. For example, using parameters such as the start position, start speed, target speed, acceleration, jerk (Jerk) specified by the motion command, the end time of acceleration increase from the start time of motion (start time of constant acceleration motion) ), The acceleration reduction start time, the constant speed motion start time, and the like are calculated. Furthermore, the motion calculation program 234 calculates the first command value following the creation of the profile data within the execution cycle at the time of activation.
  • the control cycle 1 corresponds to the first of the (four) control cycles included in one execution cycle of the user program 236, but no surplus time for executing the user program 236 or the like is generated. In the control cycle 1, the user program 236 is not executed.
  • the motion calculation program 234 executes initial processing necessary for starting the calculation of the command value in the first execution started by the user program 236 created according to the control purpose of the user. As a result, a longer execution time than the time required for the subsequent execution is required.
  • the motion operation program 234 stops execution, and in the control cycle 2, the scheduler program 212 executes the output processing program 214 and the input processing program 216. Thereafter, the scheduler program 212 executes an unexecuted portion of the processing contents included in the motion calculation program 234.
  • the scheduler program 212 executes the user program 236.
  • the user program 236 calls and executes the sequence instruction operation program 232 as necessary. In the control cycle 2, the user program 236 is not finished, and the user program 236 interrupts execution in response to the output preparation interrupt (P-3).
  • the sequence shown in FIG. 7 shows an example in which the user program 236 cannot end execution even in the control cycle 3 and ends execution only in the control cycle 4.
  • the output data (including the command value to the motor driver) is not updated in the control cycle 2.
  • the command to the motor driver is not updated.
  • the control program 230 shown in the sequence of FIG. 5 includes the motion calculation program 234 in addition to the user program 236.
  • the control program 230 includes the motion calculation program 234, the execution cycle of the motion calculation program 234 does not exceed in the control cycle after the control cycle (motion start cycle) in which the motion calculation program 234 is started.
  • motion start cycle by setting the control cycle period short enough to cause the execution cycle to be exceeded, motion control that shortens the control cycle period and prevents the cycle from occurring during motion operation is realized. it can.
  • FIG. 8 is a sequence diagram showing the entire processing operation according to Embodiment 4 of the present invention.
  • the abnormality processing program 240 is assumed to be stored in the nonvolatile memory as one program included in the other system program 220 shown in FIG. Then, the abnormality processing program 240 is read into the main memory 104 and can be executed after the PLC 1 is powered on. In the following, differences from the sequence shown in FIG. 5 will be mainly described.
  • This limit number defines the limit number of control cycles in which one execution of the control program 230 continues, that is, a condition for executing the abnormality processing program 240.
  • the limit number data (limit number setting content) may be stored in advance in the nonvolatile memory 106 when the PLC 1 is manufactured, or the user may store the limit number data in the nonvolatile memory 106. .
  • the limit number data can be expressed in a format that specifies the limit number value itself, a format that determines the number of control cycles that execute the unexecuted part of the control program (one less than the limit number), and a preset number related to the limit number. It is sufficient that the PLC can specify the limit number, such as information (number or character) for specifying one of the plurality of options.
  • the sequence shown in FIG. 8 shows a processing example when the limit number is “2”.
  • the control cycle 3 is a control cycle corresponding to the limit number. If the control program 230 that has started execution in the control cycle 2 does not end execution in the control cycle 3, the scheduler program 212 executed in response to the output preparation interrupt (P-4) It is detected that the number of control cycles has reached the limit and that the execution of the control program 230 has not ended. Then, the scheduler program 212 executes the abnormality processing program 240 after executing the output processing program 214. Note that the control program 230 may not be executed after the abnormality processing program 240 is executed.
  • the abnormality processing program 240 typically performs a process for notifying the outside of the PLC 1 of the occurrence of an abnormality that the execution cycle has been exceeded. For example, the abnormality processing program 240 transmits data indicating the occurrence of an abnormality to the operation manager of the PLC 1 via an upper network (not shown) that lights an abnormality notification lamp (not shown) mounted on the PLC 1. Execute the process.
  • the scheduler program 212 executes only the output processing program 214. This state continues until the power supply is reset or there is some release action such that an appropriate abnormality release procedure is performed by the user on the PLC support device 8 connected via USB.
  • the scheduler program 212 has reached the limit of the number of control cycles in which the control program 230 continues to execute once, and the execution of the control program 230 has not ended within the control cycle.
  • the instruction includes causing the microprocessor 100 to execute the abnormality processing program 240 without causing the microprocessor 100 to execute an unexecuted portion of the control program 230 in the next control cycle.
  • the execution of the output processing program 214 is continued and the fixed cycle in the PLC system bus 11 and the field network 2 is performed.
  • a process such as interrupting the execution of the output processing program 214, it is also possible to stop the communication itself at a fixed period by the communication circuit.
  • the abnormality processing program 240 as one special program in the user program 236 instead of being implemented as a program included in the system program 210, the user can freely program the contents of the abnormality processing. You may comprise as follows.
  • the abnormality processing program 240 is executed while the execution of the control program 230 is stopped. Therefore, higher safety can be ensured.
  • FIG. 9 is a sequence diagram showing an overall processing operation according to the fifth embodiment of the present invention. In the following, differences from the sequence shown in FIG. 5 will be mainly described.
  • the sequence shown in FIG. 9 shows a case where the control program 230 that started execution in the control cycle 2 could not end its execution in the control cycle 2.
  • the control program 230 interrupts execution.
  • the scheduler program 212 does not perform the communication processing of the PLC system bus 11 in the control cycle 3, and executes only the communication processing of the field network 2. That is, since the DMA control circuit 122 of the PLC system bus controller 120 is not given a transmission execution instruction (symbol A), the output data stored in the PLC system bus transmission buffer 1043 of the main memory 104 is converted to the PLC system bus controller 120. The process of transferring to the buffer memory 126 is skipped.
  • the scheduler program 212 is a part of the output processing program 214 that prepares output data to be transmitted via the PLC system bus 11. Do not execute processing.
  • the scheduler program 212 executes processing of a part instructing the field network controller 140 to execute transmission in the output processing program 214. The process of preparing the output data transmitted via the field network 2 is executed. That is, the scheduler program 212 executes the output processing program 214 in response to the field network transmission interrupt (X-3).
  • the scheduler program 212 does not execute any program until the field network transmission interrupt (X-3) occurs after the output preparation interrupt (P-3) occurs.
  • the control program may be executed during this period.
  • the control program 230 suspends execution again in response to the field network transmission interrupt (X-3).
  • the scheduler program 212 resumes the execution of the control program 230 in response to the transmission execution instruction (reference B) from the output processing program 214. That is, the scheduler program executes an unexecuted portion of the processing contents included in the control program 230 even before the transmission instruction of the field network 2 in the control cycle. This increases the possibility that the control program 230 can be terminated within the control cycle 3.
  • any communication path PLC system bus 11 or field network 2
  • the operational effects according to the present embodiment in relation to the communication path. Can be maintained.
  • devices connected to the field network 2 are provided by many manufacturers based on published network communication specifications. Since there is a need to maintain compatibility between such devices, the field network 2 generally has a constant communication cycle rather than the PLC system bus 11 although it depends on the specific specifications of the field network 2. There is often a need to maintain.
  • FIG. 10 is a sequence diagram showing an overall processing operation according to Embodiment 6 of the present invention.
  • FIG. 10 shows an example of a form in which a part of the scheduling process of the scheduler program 212 as described above is shared by the system timer 108.
  • the field network controller 140 receives a transmission execution instruction (symbol B in FIG. 5) from the scheduler program 212 and performs a transmission operation.
  • the transmission trigger signal (Y) from the system timer 108 is directly received and a transmission operation is performed.
  • the timing of the transmission trigger signal (Y) is set to be the same as the timing of the field network transmission interrupt (X) in the sequence shown in FIG. That is, the CPU unit 13 further includes a timer circuit that generates a signal at the cycle of the control cycle. Then, the communication circuit (field network controller 140) starts transmission of output data and reception of input data using a signal generated by the timer circuit as a trigger.
  • the scheduler program 212 determines whether or not the execution of the control program 230 has ended. If the execution of the control program 230 has ended, the scheduler program 212 executes the output processing program 214 (control). Cycles 1, 2, 4). On the other hand, if the execution of the control program 230 has not ended, the scheduler program 212 executes an unexecuted portion of the processing contents included in the control program 230 (control cycle 3).
  • FIG. 10 shows an example in which output data transmission and input data reception are performed using only the field network 2 without using the PLC system bus 11 and the units on the PLC system bus 11.
  • the PLC system bus 11 may be used together.
  • system timer 108 may be mounted in the field network controller 140.
  • the start of communication in the communication circuit is triggered by a constant cycle interrupt signal generated by the system timer 108, so that the processing amount in the scheduler program 212 can be reduced. Therefore, in the control cycle in which the unexecuted portion of the processing content included in the control program 230 is executed, the scheduler program 212 has more time to execute the unexecuted portion of the processing content included in the control program. Can be assigned. As a result, it is possible to increase the possibility of ending execution of an unexecuted portion of the processing contents included in the control program 230 within the control cycle.
  • FIG. 11 is a sequence diagram showing an overall processing operation according to the seventh embodiment of the present invention. In the following, differences from the sequence shown in FIG. 5 will be mainly described.
  • the microprocessor 100 that executes the sequence shown in FIG. As an example, it is assumed that the core 1 executes the scheduler program 212, the output processing program 214, and the input processing program 216, and the core 2 executes the control program 230.
  • the scheduler program 212 causes the core 2 to execute the control program 230.
  • the scheduler program 212 causes the core 2 to execute an unexecuted portion of the processing contents included in the control program 230 by not preventing the core 2 from continuing the execution of the control program 230.
  • the scheduler program 212 passes the unexecuted portion of the control program 230 to the microprocessor 100 by not interrupting the execution of the control program 230 in the control cycle following the control cycle in which the execution of the control program 230 has not ended. Contains instructions to be executed.
  • the portion of the system program 210 that governs execution control for continuing execution of the control program 230 (eg, by a transmission preparation interrupt (P)).
  • a transmission preparation interrupt P
  • FIG. 12 is a schematic diagram showing a hardware configuration of the PLC support device 8 used by being connected to the CPU unit according to the embodiment of the present invention.
  • PLC support device 8 is typically formed of a general-purpose computer. From the viewpoint of maintainability, a notebook personal computer with excellent portability is preferable.
  • the PLC support device 8 includes a CPU 81 that executes various programs including an OS, a ROM (Read Only Memory) 82 that stores BIOS and various data, and data necessary for the CPU 81 to execute the programs.
  • a memory RAM 83 that provides a work area for storing the program, and a hard disk (HDD) 84 that stores programs executed by the CPU 81 in a nonvolatile manner.
  • HDD hard disk
  • the PLC support device 8 further includes a keyboard 85 and a mouse 86 that accept operations from the user, and a monitor 87 for presenting information to the user. Furthermore, the PLC support device 8 includes a communication interface (IF) 89 for communicating with the PLC 1 (CPU unit 13) and the like.
  • IF communication interface
  • CD-ROM 9 Compact Disk-Read Only Memory
  • HDD hard disk
  • FIG. 13 is a schematic diagram showing a software configuration of the PLC support device 8 used by being connected to the CPU unit according to the embodiment of the present invention.
  • the PLC support device 8 executes the OS 310 and provides an environment in which various programs included in the PLC support program 320 can be executed.
  • the PLC support program 320 includes an editor program 321, a compiler program 322, a debugger program 323, a simulation sequence instruction calculation program 324, a simulation motion calculation program 325, and a communication program 326.
  • Each program included in the PLC support program 320 is typically distributed in a state stored in the CD-ROM 9 and installed in the PLC support device 8.
  • the editor program 321 provides functions such as input and editing for creating the user program 236. More specifically, the editor program 321 provides a storage function and an editing function for the created source program 330 in addition to a function for the user to operate the keyboard 85 and the mouse 86 to create the source program 330 of the user program 236. To do. The editor program 321 accepts an input of the source program 330 from the outside.
  • the compiler program 322 provides a function of compiling the source program 330 and generating a user program 236 in an object program format that can be executed by the microprocessor 100 of the CPU unit 13.
  • the compiler program 322 provides a function of compiling the source program 330 and generating a user program 340 in an object program format that can be executed by the CPU 81 of the PLC support device 8.
  • the user program 340 is a simulation object program used for simulating the operation of the PLC 1 by the PLC support device 8.
  • the debugger program 323 provides a function for debugging the source program of the user program.
  • the contents of the debugging include operations such as partially executing a range designated by the user in the source program, and tracking temporal changes in variable values during the execution of the source program.
  • the debugger program 323 further provides a function of executing a user program 340 that is an object program for simulation.
  • the sequence instruction calculation program 324 and the simulation motion calculation program 325 included in the PLC support program 320 are used instead of the sequence instruction calculation program 232 and the motion calculation program 234 included in the system program of the CPU unit 13. It is done.
  • the communication program 326 provides a function of transferring the user program 236 to the CPU unit 13 of the PLC 1.
  • the system program 210 mounted on the PLC 1 is stored in the nonvolatile memory 106 of the CPU unit 13 at the manufacturing stage of the CPU unit 13.
  • the system program 210 is stored in the CD-ROM 9
  • the user copies the system program 210 of the CD-ROM 9 to the PLC support device 8, and copies the system program using the function provided by the communication program 326. It is also possible to transfer 210 to the CPU unit 13.
  • the real-time OS 200 executed by the CPU unit 13 of the PLC 1 is stored in the CD-ROM 9, the real-time OS 200 can also be reinstalled in the PLC 1 by a user operation.

Abstract

 スケジューラプログラムは、マイクロプロセッサに、第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、通信回路による出力データの送信および入力データの受信の後に、第1の制御プログラムの実行を開始させる命令と、マイクロプロセッサに、第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、第1の制御プログラムの未実行の部分を実行させる命令とを含む。

Description

PLCのCPUユニット、PLC用システムプログラムおよびPLC用システムプログラムを格納した記録媒体
 本発明は、機械や設備などの動作を制御するために用いられるPLC(Programmable Logic Controller、あるいはプログラマブルコントローラとも称される)における出力処理、入力処理、演算処理などを含む制御動作のスケジューリングに関する。
 PLCは、たとえば、ユーザプログラムを実行するマイクロプロセッサを含むCPU(Central Processing Unit)ユニット、外部のスイッチやセンサからの信号入力および外部のリレーやアクチュエータへの信号出力を担当するIO(Input Output)ユニットといった複数のユニットで構成される。それらのユニット間で、制御プログラムの実行サイクルごとに、PLCシステムバスおよび/またはフィールドネットワークを経由してデータの授受をしながら、PLCは制御動作を実行する。
 たとえば、特許文献1(特開2000-105604号公報)には、PLCにおいて、出力リフレッシュ(出力処理)、入力リフレッシュ(入力処理)、およびシーケンスプログラム実行(演算処理)を一巡実行するスキャンタイム(実行サイクルの周期)を一定化する技術が開示されている。この技術の原理は、一巡実行に要すると想定される時間よりも長い時間であるコンスタントスキャン設定時間を設定しておき、毎回の一巡実行がなされた後に、そのサイクルにおける一巡実行を開始してからの経過時間がコンスタントスキャン設定時間に到達するのを待って次のサイクルの一巡実行を開始するというものである。この方式では、一巡実行中には経過時間とコンスタントスキャン設定時間との対比判断をしないので、何らかの事情により一巡実行がコンスタントスキャン設定時間を越えて継続した場合には、そのサイクルは一巡実行が終了するまで延長されてしまう。したがって、実行サイクルの周期が一定ではなくなる。
特開2000-105604号公報
 情報技術の分野においては、マイクロプロセッサや通信ネットワークの高速化が進展しつつある。そのため、PLCにおいてもそれらの技術を利用して制御プログラムの実行サイクルの周期が短縮化されつつある。それにより、PLCのCPUユニットと他のユニットとの間で行われる制御データ(入力データおよび出力データ)の通信の周期を高精度に一定化することが有利になりつつある。
 PLC内での制御データの通信周期が一定であれば、IOユニットにおいて外部の機器に与える出力信号の更新周期を一定化することが容易になる。これにより、外部の機器においても、PLCの制御サイクルの周期に同期した動作をすることが容易になる。
 また、制御データの通信周期が一定であれば、フィールドネットワークを介してCPUユニットと通信するリモートIOターミナルにおいて、CPUユニットに入力データを送信する予定時刻の直前に外部から入力データを取得するような、精密に時間制御された計画的な動作が可能になる。これにより、CPUユニットは、入手しうる最も新しい入力データを用いて演算処理を行うことができるようになる。そのため、制御サイクルの周期の短縮化とあいまって、入力データの取得から、その入力データを用いて演算した結果である出力データを送出するまでの応答時間を短縮することができる。
 さらに、制御データの通信周期が一定であれば、PLCのいずれかのユニットにおいて、予定された時刻に通信が行われなかったことを検知することによって通信異常の発生を迅速に判定することができる。
 CPUユニットがフィールドネットワークを経由してPLCの外部にあるサーボモータドライバのような制御対象機器と直接通信する場合にも、フィールドネットワークによる制御データの通信周期を一定化することができ有利である。PLCの実行サイクルの周期をサーボモータの制御周期として使用できるほどに短縮することが可能になってきたことにより、専用のモーションコントローラを別途設けることなく、PLCのCPUユニットが、サーボモータドライバに対する指令値を実行サイクルごとに生成し出力することによってモータ制御することも可能となってきているが、このような場合には、モータを高精度に制御するために、CPUユニットが一定周期で出力信号を送出できることは重要である。
 なお、本発明に係るPLCのCPUユニットの技術的範囲は、もっぱらシーケンスプログラムの実行によって制御を遂行する従来のCPUユニットの機能にとどまらず、モーションコントローラの機能を兼ね備えるなど、その機能が拡張されたものをも含む。
 ところで、制御プログラム(シーケンスプログラムおよびモーション演算プログラムなど)の実行所要時間は、制御プログラムを繰り返し実行するたびに異なりうる。この実行時間の分布を見ると、実行回数の大部分において比較的短く、かつ、ばらつきの小さな実行時間となり、一方で、実行回数の少数において比較的長い実行時間となる傾向を示すことが多い。
 実行時間がこのような分布となるのは、制御プログラムが特定の条件が成立した場合にだけ実行する処理を含むことがあるためである。そのような条件が成立したサイクルにおいては、他のサイクルにおける処理よりも多くの処理を行うので、実行時間が長くなる。実行時間が長くなる場合の例としては、シーケンスプログラム(ユーザプログラム)の中で用いられるモーションファンクションブロックのようなモーション命令の起動条件が成立したサイクルにおいて、初期処理を多数の軸について行う場合が挙げられる。この初期処理は、モーション命令の起動条件が成立したサイクルを含むそれ以降の各サイクルにおいて、モーション指令値を算出していくための処理を含む。
 特許文献1(特開2000-105604号公報)に示されたような実行サイクルの周期の一定化方式では、実行サイクルの周期を、制御プログラムの最大実行時間よりも長くなるように設定しなければ、通信周期を一定にすることができない。
 しかしながら、実行サイクルの周期を制御プログラムの最大実行時間よりも長くなるように設定したのでは、大部分のサイクルにおいて、より短い時間で制御プログラムが実行完了しているにもかかわらず、そのような短い実行時間に適合した短い実行サイクルの周期を実現することができない。
 本発明は、制御プログラムの実行時間が散発的に長くなりうることを考慮して、PLCのCPUユニットが行う制御データの出力および入力のための通信の周期を、制御プログラムの最大実行時間よりも短い一定時間としうるPLCのCPUユニットを提供することを目的とする。
 本発明のある局面によれば、制御対象を制御するPLCのCPUユニットを提供する。PLCのCPUユニットは、マイクロプロセッサと、記憶手段と、出力データの送信および入力データの受信を行う通信回路と、制御サイクルの周期を設定する手段とを含む。PLCのCPUユニットは、出力データの送信と、入力データの受信と、入力データを使用して出力データを生成する第1の制御プログラムの実行とを繰り返すことによって制御対象を制御するように構成されている。記憶手段は、第1の制御プログラムと、第1の制御プログラムの実行を制御するスケジューラプログラムとの格納に用いられる。マイクロプロセッサは、記憶手段に格納されたスケジューラプログラムおよび第1の制御プログラムを実行する。通信回路は、制御サイクルごとに、出力データの送信および入力データの受信を行う。スケジューラプログラムは、マイクロプロセッサに、第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、通信回路による出力データの送信および入力データの受信の後に、第1の制御プログラムの実行を開始させる命令と、マイクロプロセッサに、第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、第1の制御プログラムの未実行の部分を実行させる命令とを含む。
 この局面によれば、PLCのユーザは、第1の制御プログラムの実行を完了するまでに要する時間が散発的に長くなる状況において、PLCのCPUユニットが制御データの出力および入力のために制御サイクルと同期して行う通信の周期を、第1の制御プログラムの実行を完了するまでに要する時間の最大値よりも短い一定時間に設定することができる。
 好ましくは、第1の制御プログラムは、実行されるごとにモータドライバに対して出力される指令値を算出するモーション演算プログラムを含む。モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする。
 この局面によれば、モーション演算プログラムが起動された制御サイクル(モーション起動サイクル)より後の制御サイクルにおいては、モーション演算プログラムの実行周期の超過は発生しないが、モーション起動サイクルにおいては実行周期の超過が発生しうる程度に制御サイクルの周期を短く設定することにより、制御サイクルの周期が短く、かつ、モーション動作中における周期超過が発生しにくいモーション制御を実現できる。
 さらに好ましくは、第1の制御プログラムは、さらに、ユーザプログラムを含む。
 好ましくは、記憶手段は、さらに、制御サイクルの周期の2以上の整数倍の周期の実行サイクルが設定された第2の制御プログラムの格納に用いられる。スケジューラプログラムは、マイクロプロセッサに、制御サイクル内の第1の制御プログラムの終了後の期間において、実行サイクルに従って第2の制御プログラムを実行させる命令を含む。
 この局面によれば、その実行サイクルの周期が制御サイクルの周期よりも長くなっても影響がないような処理を第2の制御プログラムとして処理することにより、第1の制御プログラムの処理量を削減することができる。それにより、制御サイクルの周期をより短縮できる可能性がある。また、第1の制御プログラムの実行が1回の制御サイクル内に終了しない頻度を小さくできる可能性もある。さらに、第1の制御プログラムの実行が想定を超える制御サイクル数内で終了しない頻度を小さくできる可能性がある。
 あるいは好ましくは、記憶手段は、さらに、制御サイクルの周期の2以上の整数倍の周期の実行サイクルが設定された第2の制御プログラムの格納に用いられる。スケジューラプログラムは、マイクロプロセッサに、制御サイクル内の第1の制御プログラムの終了後の期間において、実行サイクルに従って第2の制御プログラムを実行させる命令を含む。第1の制御プログラムは、モーション演算プログラムを含み、第2の制御プログラムは、ユーザプログラムを含む。
 好ましくは、記憶手段は、さらに、第1の制御プログラムの1回の実行が継続する制御サイクル数の限度数を特定する設定内容と、第1の制御プログラムの1回の実行が限度数の制御サイクル内に終了しない場合に実行されるべき異常処理プログラムとの格納に用いられる。スケジューラプログラムは、第1の制御プログラムが1回の実行を継続している制御サイクルの数が限度数に達し、かつ、当該制御サイクル内で第1の制御プログラムの実行が終了しなかった場合に、次の制御サイクルにおいて、マイクロプロセッサに、第1の制御プログラムの未実行部分を実行させることなく異常処理プログラムを実行させる命令を含む。
 この局面によれば、想定を超える制御サイクル数まで第1の制御プログラムの実行が継続するといった異常状態が発生した場合には、制御プログラムの実行を停止しつつ、異常処理プログラムを実行することにより、より高い安全を確保することができる。
 好ましくは、通信回路は、マイクロプロセッサによる制御を受けて出力データの送信および入力データの受信を開始するように構成されている。スケジューラプログラムは、さらに、通信回路に、制御サイクルごとに通信を開始させる命令を含む。
 この局面によれば、マイクロプロセッサが集約的に制御サイクルを管理するので、通信回路に、一定周期で通信するための特別なハードウェアが不要となる。
 さらに好ましくは、スケジューラプログラムは、さらに、制御サイクル内に第1の制御プログラムの実行が終了しなかった場合は、次の制御サイクルにおいて、通信回路に、第1の制御プログラムの未実行の部分に優先して通信を開始させるための処理を実行させ、その後、マイクロプロセッサに、第1の制御プログラムの未実行の部分を実行させる命令を含む。
 この局面によれば、シングルコアのマイクロプロセッサで通信開始の制御をする場合であって、第1の制御プログラムを複数の制御サイクルにまたがって実行する場合でも、通信の一定周期性を維持することができる。
 好ましくは、PLCのCPUユニットは、制御サイクルの周期で信号を発生するタイマ回路をさらに含む。通信回路は、タイマ回路が発生する信号をトリガとして出力データの送信および入力データの受信を開始するように構成されている。
 この局面によれば、通信回路における通信開始は、タイマ回路が発生する制御サイクルの周期で発生する信号によってトリガされるので、スケジューラプログラムにおける処理量を低減できる。そのため、第1の制御プログラムに含まれる処理内容のうち未実行の部分を実行する制御サイクルにおいて、スケジューラプログラムは、制御プログラムに含まれる処理内容のうち未実行の部分を実行するための時間をより多く割り当てることができる。その結果、第1の制御プログラムに含まれる処理内容のうち未実行の部分をその制御サイクル内での実行を終了させる可能性を高めることができる。
 好ましくは、マイクロプロセッサは、第1および第2のコアを含む。第1のコアはスケジューラプログラムを実行し、第2のコアは第1の制御プログラムを実行する。スケジューラプログラムは、第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、第1の制御プログラムの実行を中断しないことにより第1の制御プログラムの未実行の部分をマイクロプロセッサに実行させる命令を含む。
 本発明の別の局面によれば、PLC用システムプログラムを提供する。PLC用システムプログラムは、マイクロプロセッサと、記憶手段と、出力データの送信および入力データの受信を行う通信回路とを含み、通信回路による出力データの送信および入力データの受信を制御サイクルごとに繰り返すとともに、入力データを使用して出力データを生成する、記憶手段に格納される第1の制御プログラムの実行を繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、記憶手段に格納されてマイクロプロセッサによって実行される。PLC用システムプログラムは、第1の制御プログラムの実行を制御するスケジューラプログラムと、制御サイクルの周期を設定するプログラムとを含む。スケジューラプログラムは、マイクロプロセッサに、第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、通信回路による出力データの送信および入力データの受信の後に、第1の制御プログラムの実行を開始させる命令と、マイクロプロセッサに、第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、第1の制御プログラムの未実行の部分を実行させる命令とを含む。
 好ましくは、PLC用システムプログラムは、実行されるごとにモータドライバに対して出力される指令値を算出するモーション演算プログラムを含む。モーション演算プログラムは、第1の制御プログラムの一部または全部である。モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする。
 本発明のさらに別の局面によれば、PLC用システムプログラムを格納した記録媒体を提供する。PLC用システムプログラムは、マイクロプロセッサと、記憶手段と、出力データの送信および入力データの受信を行う通信回路とを含み、通信回路による出力データの送信および入力データの受信を制御サイクルごとに繰り返すとともに、入力データを使用して出力データを生成する、記憶手段に格納される第1の制御プログラムの実行を繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、記憶手段に格納されてマイクロプロセッサによって実行される。PLC用システムプログラムは、第1の制御プログラムの実行を制御するスケジューラプログラムと、制御サイクルの周期を設定するプログラムとを含む。スケジューラプログラムは、マイクロプロセッサに、第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、通信回路による出力データの送信および入力データの受信の後に、第1の制御プログラムの実行を開始させる命令と、マイクロプロセッサに、第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、第1の制御プログラムの未実行の部分を実行させる命令とを含む。
 好ましくは、PLC用システムプログラムは、実行されるごとにモータドライバに対して出力される指令値を算出するモーション演算プログラムを含む。モーション演算プログラムは、第1の制御プログラムの一部または全部である。モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする。
 なお、本明細書における(日本語の)「命令」は、ある機能を実現するための、プログラムのソースリストに表れる個々の命令に限らず、それら個々の命令や関数等の集合をも意味しており、たとえば英語ではinstructionsのように複数形で表記されるべきものである。
 本発明によれば、PLCのユーザは、第1の制御プログラムの実行時間が散発的に長くなる状況において、PLCのCPUユニットが制御データの出力および入力のために制御サイクルと同期して行う通信の周期を、第1の制御プログラムの最大実行時間よりも短い一定時間に設定することができる。
本発明の実施の形態に係るPLCシステムの概略構成を示す模式図である。 本発明の実施の形態に係るCPUユニットのハードウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットで実行されるソフトウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットのメインメモリの領域構成を示す模式図である。 本発明の実施の形態1に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態2に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態3に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態4に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態5に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態6に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態7に係る全体処理動作を示すシーケンス図である。 本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置のハードウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置のソフトウェア構成を示す模式図である。
 本発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰り返さない。
 <A.システム構成>
 本実施の形態に係るPLCは、機械や設備などの制御対象を制御する。まず、図1を参照して、本実施の形態に係るPLC1のシステム構成について説明する。
 図1は、本発明の実施の形態に係るPLCシステムの概略構成を示す模式図である。図1を参照して、PLCシステムSYSは、PLC1と、PLC1とフィールドネットワーク2を介して接続されるサーボモータドライバ3およびリモートIOターミナル5と、フィールド機器である検出スイッチ6およびリレー7とを含む。また、PLC1には、接続ケーブル10などを介してPLCサポート装置8が接続される。
 PLC1は、主たる演算処理を実行するCPUユニット13と、1つ以上のIOユニット14と、特殊ユニット15とを含む。これらのユニットは、PLCシステムバス11を介して、データを互いに遣り取りできるように構成される。また、これらのユニットには、電源ユニット12によって適切な電圧の電源が供給される。なお、PLC1として構成される各ユニットは、PLCメーカーが提供するものであるので、PLCシステムバス11は、一般にPLCメーカーごとに独自に開発され、使用されている。これに対して、後述するようにフィールドネットワーク2については、異なるメーカーの製品同士が接続できるように、その規格などが公開されている場合も多い。
 CPUユニット13の詳細については、図2を参照して後述する。
 IOユニット14は、一般的な入出力処理に関するユニットであり、オン/オフといった2値化されたデータの入出力を司る。すなわち、IOユニット14は、検出スイッチ6などのセンサが何らかの対象物を検出している状態(オン)および何らの対象物も検出していない状態(オフ)のいずれであるかという情報を収集する。また、IOユニット14は、リレー7やアクチュエータといった出力先に対して、活性化するための指令(オン)および不活性化するための指令(オフ)のいずれかを出力する。
 特殊ユニット15は、アナログデータの入出力、温度制御、特定の通信方式による通信といった、IOユニット14ではサポートしない機能を有する。
 フィールドネットワーク2は、CPUユニット13と遣り取りされる各種データを伝送する。フィールドネットワーク2としては、典型的には、各種の産業用イーサネット(登録商標)を用いることができる。産業用イーサネット(登録商標)としては、たとえば、EtherCAT(登録商標)、Profinet IRT、MECHATROLINK(登録商標)-III、Powerlink、SERCOS(登録商標)-III、CIP Motionなどが知られており、これらのうちのいずれを採用してもよい。さらに、産業用イーサネット(登録商標)以外のフィールドネットワークを用いてもよい。たとえば、モーション制御を行わない場合であれば、DeviceNet、CompoNet/IP(登録商標)などを用いてもよい。本実施の形態に係るPLCシステムSYSでは、典型的に、本実施の形態においては、産業用イーサネット(登録商標)であるEtherCAT(登録商標)をフィールドネットワーク2として採用する場合の構成について例示する。
 なお、図1には、PLCシステムバス11およびフィールドネットワーク2の両方を有するPLCシステムSYSを例示するが、一方のみを搭載するシステム構成を採用することもできる。たとえば、フィールドネットワーク2ですべてのユニットを接続してもよい。あるいは、フィールドネットワーク2を使用せずに、サーボモータドライバ3をPLCシステムバス11に直接接続してもよい。さらに、フィールドネットワーク2の通信ユニットをPLCシステムバス11に接続し、CPUユニット13から当該通信ユニット経由で、フィールドネットワーク2に接続された機器との間の通信を行うようにしてもよい。
 なお、PLC1は、CPUユニット13にIOユニット14の機能やサーボモータドライバ3の機能を持たせることにより、IOユニット14やサーボモータドライバ3などを介さずにCPUユニット13が直接制御対象を制御する構成でもよい。
 サーボモータドライバ3は、フィールドネットワーク2を介してCPUユニット13と接続されるとともに、CPUユニット13からの指令値に従ってサーボモータ4を駆動する。より具体的には、サーボモータドライバ3は、PLC1から一定周期で、位置指令値、速度指令値、トルク指令値といった指令値を受ける。また、サーボモータドライバ3は、サーボモータ4の軸に接続されている位置センサ(ロータリーエンコーダ)やトルクセンサといった検出器から、位置、速度(典型的には、今回位置と前回位置との差から算出される)、トルクといったサーボモータ4の動作に係る実測値を取得する。そして、サーボモータドライバ3は、CPUユニット13からの指令値を目標値に設定し、実測値をフィードバック値として、フィードバック制御を行う。すなわち、サーボモータドライバ3は、実測値が目標値に近づくようにサーボモータ4を駆動するための電流を調整する。なお、サーボモータドライバ3は、サーボモータアンプと称されることもある。
 また、図1には、サーボモータ4とサーボモータドライバ3とを組み合わせたシステム例を示すが、その他の構成、たとえば、パルスモータとパルスモータドライバとを組み合わせたシステムを採用することもできる。
 図1に示すPLCシステムSYSのフィールドネットワーク2には、さらに、リモートIOターミナル5が接続されている。リモートIOターミナル5は、基本的には、IOユニット14と同様に、一般的な入出力処理に関する処理を行う。より具体的には、リモートIOターミナル5は、フィールドネットワーク2でのデータ伝送に係る処理を行うための通信カプラ52と、1つ以上のIOユニット53とを含む。これらのユニットは、リモートIOターミナルバス51を介して、データを互いに遣り取りできるように構成される。
 なお、PLCサポート装置8については後述する。
 <B.CPUユニットのハードウェア構成>
 次に、図2を参照して、CPUユニット13のハードウェア構成について説明する。図2は、本発明の実施の形態に係るCPUユニット13のハードウェア構成を示す模式図である。図2を参照して、CPUユニット13は、マイクロプロセッサ100と、チップセット102と、メインメモリ104と、不揮発性メモリ106と、システムタイマ108と、PLCシステムバスコントローラ120と、フィールドネットワークコントローラ140と、USBコネクタ110とを含む。チップセット102と他のコンポーネントとの間は、各種のバスを介してそれぞれ結合されている。
 マイクロプロセッサ100およびチップセット102は、典型的には、汎用的なコンピュータアーキテクチャに準じて構成される。すなわち、マイクロプロセッサ100は、チップセット102から内部クロックに従って順次供給される命令コードを解釈して実行する。チップセット102は、接続されている各種コンポーネントとの間で内部的なデータを遣り取りするとともに、マイクロプロセッサ100に必要な命令コードを生成する。さらに、チップセット102は、マイクロプロセッサ100での演算処理の実行の結果得られたデータなどをキャッシュする機能を有する。
 CPUユニット13は、記憶手段として、メインメモリ104および不揮発性メモリ106を有する。
 メインメモリ104は、揮発性の記憶領域(RAM)であり、CPUユニット13への電源投入後にマイクロプロセッサ100で実行されるべき各種プログラムを保持する。また、メインメモリ104は、マイクロプロセッサ100による各種プログラムの実行時の作業用メモリとしても使用される。このようなメインメモリ104としては、DRAM(Dynamic Random Access Memory)やSRAM(Static Random Access Memory)といったデバイスが用いられる。
 一方、不揮発性メモリ106は、リアルタイムOS(Operating System)、PLC1のシステムプログラム、ユーザプログラム、モーション演算プログラム、システム設定パラメータといったデータを不揮発的に保持する。これらのプログラムやデータは、必要に応じて、マイクロプロセッサ100がアクセスできるようにメインメモリ104にコピーされる。このような不揮発性メモリ106としては、フラッシュメモリのような半導体メモリを用いることができる。あるいは、ハードディスクドライブのような磁気記録媒体や、DVD-RAM(Digital Versatile Disk Random Access Memory)のような光学記録媒体などを用いることもできる。
 システムタイマ108は、一定周期ごとに割り込み信号を発生してマイクロプロセッサ100に提供する。典型的には、ハードウェアの仕様によって、複数の異なる周期でそれぞれ割り込み信号を発生するように構成されるが、OS(Operating System)やBIOS(Basic Input Output System)などによって、任意の周期で割り込み信号を発生するように設定することもできる。このシステムタイマ108が発生する割り込み信号を利用して、後述するような制御サイクルごとの制御動作が実現される。
 CPUユニット13は、通信回路として、PLCシステムバスコントローラ120およびフィールドネットワークコントローラ140を有する。これらの通信回路は、出力データの送信および入力データの受信を行う。
 なお、CPUユニット13自体にIOユニット14やサーボモータドライバ3の機能を持たせる場合は、通信回路による出力データの送信および入力データの受信は、それらの機能を担う部分を通信の相手方としてCPUユニット13の内部で行われる送信および受信となる。
 PLCシステムバスコントローラ120は、PLCシステムバス11を介したデータの遣り取りを制御する。より具体的には、PLCシステムバスコントローラ120は、DMA(Dynamic Memory Access)制御回路122と、PLCシステムバス制御回路124と、バッファメモリ126とを含む。なお、PLCシステムバスコントローラ120は、PLCシステムバスコネクタ130を介してPLCシステムバス11と内部的に接続される。
 バッファメモリ126は、PLCシステムバス11を介して他のユニットへ出力されるデータ(以下「出力データ」とも称す。)の送信バッファ、および、PLCシステムバス11を介して他のユニットから入力されるデータ(以下「入力データ」とも称す。)の受信バッファとして機能する。なお、マイクロプロセッサ100による演算処理によって作成された出力データは、原始的にはメインメモリ104に格納される。そして、特定のユニットへ転送されるべき出力データは、メインメモリ104から読み出されて、バッファメモリ126に一次的に保持される。また、他のユニットから転送された入力データは、バッファメモリ126に一次的に保持された後、メインメモリ104に移される。
 DMA制御回路122は、メインメモリ104からバッファメモリ126への出力データの転送、および、バッファメモリ126からメインメモリ104への入力データの転送を行う。
 PLCシステムバス制御回路124は、PLCシステムバス11に接続される他のユニットとの間で、バッファメモリ126の出力データを送信する処理および入力データを受信してバッファメモリ126に格納する処理を行う。典型的には、PLCシステムバス制御回路124は、PLCシステムバス11における物理層およびデータリンク層の機能を提供する。
 フィールドネットワークコントローラ140は、フィールドネットワーク2を介したデータの遣り取りを制御する。すなわち、フィールドネットワークコントローラ140は、用いられるフィールドネットワーク2の規格に従い、出力データの送信および入力データの受信を制御する。上述したように、本実施の形態においてはEtherCAT(登録商標)規格に従うフィールドネットワーク2が採用されるので、通常のイーサネット(登録商標)通信を行うためのハードウェアを含む、フィールドネットワークコントローラ140が用いられる。EtherCAT(登録商標)規格では、通常のイーサネット(登録商標)規格に従う通信プロトコルを実現する一般的なイーサネット(登録商標)コントローラを利用できる。但し、フィールドネットワーク2として採用される産業用イーサネット(登録商標)の種類によっては、通常の通信プロトコルとは異なる専用仕様の通信プロトコルに対応した特別仕様のイーサネット(登録商標)コントローラが用いられる。また、産業用イーサネット(登録商標)以外のフィールドネットワークを採用した場合には、当該規格に応じた専用のフィールドネットワークコントローラが用いられる。
 バッファメモリ146は、フィールドネットワーク2を介して他の装置などへ出力されるデータ(このデータについても、以下「出力データ」と称す。)の送信バッファ、および、フィールドネットワーク2を介して他の装置などから入力されるデータ(このデータについても、以下「入力データ」とも称す。)の受信バッファとして機能する。上述したように、マイクロプロセッサ100による演算処理によって作成された出力データは、原始的にはメインメモリ104に格納される。そして、特定の装置へ転送されるべき出力データは、メインメモリ104から読み出されて、バッファメモリ146に一次的に保持される。また、他の装置から転送された入力データは、バッファメモリ146に一次的に保持された後、メインメモリ104に移される。
 DMA制御回路142は、メインメモリ104からバッファメモリ146への出力データの転送、および、バッファメモリ146からメインメモリ104への入力データの転送を行う。
 フィールドネットワーク制御回路144は、フィールドネットワーク2に接続される他の装置との間で、バッファメモリ146の出力データを送信する処理および入力データを受信してバッファメモリ146に格納する処理を行う。典型的には、フィールドネットワーク制御回路144は、フィールドネットワーク2における物理層およびデータリンク層の機能を提供する。
 USBコネクタ110は、PLCサポート装置8とCPUユニット13とを接続するためのインターフェイスである。典型的には、PLCサポート装置8から転送される、CPUユニット13のマイクロプロセッサ100で実行可能なプログラムなどは、USBコネクタ110を介してPLC1に取込まれる。
 <C.CPUユニットのソフトウェア構成>
 次に、図3を参照して、本実施の形態に係る各種機能を提供するためのソフトウェア群について説明する。これらのソフトウェアに含まれる命令コードは、適切なタイミングで読み出され、CPUユニット13のマイクロプロセッサ100によって実行される。
 図3は、本発明の実施の形態に係るCPUユニット13で実行されるソフトウェア構成を示す模式図である。図3を参照して、CPUユニット13で実行されるソフトウェアとしては、リアルタイムOS200と、システムプログラム210と、ユーザプログラム236との3階層になっている。
 リアルタイムOS200は、CPUユニット13のコンピュータアーキテクチャに応じて設計されており、マイクロプロセッサ100がシステムプログラム210およびユーザプログラム236を実行するための基本的な実行環境を提供する。このリアルタイムOSは、典型的には、PLCのメーカーあるいは専門のソフトウェア会社などによって提供される。
 システムプログラム210は、PLC1としての機能を提供するためのソフトウェア群である。具体的には、システムプログラム210は、スケジューラプログラム212と、出力処理プログラム214と、入力処理プログラム216と、シーケンス命令演算プログラム232と、モーション演算プログラム234と、その他のシステムプログラム220とを含む。なお、一般には出力処理プログラム214および入力処理プログラム216は、連続的(一体として)に実行されるので、これらのプログラムを、IO処理プログラム218と総称する場合もある。
 ユーザプログラム236は、ユーザにおける制御目的に応じて作成される。すなわち、PLCシステムSYSを用いて制御する対象のライン(プロセス)などに応じて、任意に設計されるプログラムである。
 後述するように、ユーザプログラム236は、シーケンス命令演算プログラム232およびモーション演算プログラム234と協働して、ユーザにおける制御目的を実現する。すなわち、ユーザプログラム236は、シーケンス命令演算プログラム232およびモーション演算プログラム234によって提供される命令、関数、機能モジュールなどを利用することで、プログラムされた動作を実現する。そのため、ユーザプログラム236、シーケンス命令演算プログラム232、およびモーション演算プログラム234を、制御プログラム230と総称する場合もある。
 このように、CPUユニット13のマイクロプロセッサ100は、記憶手段に格納されたシステムプログラム210およびユーザプログラム236を実行する。
 以下、各プログラムについてより詳細に説明する。
 ユーザプログラム236は、上述したように、ユーザにおける制御目的(たとえば、対象のラインやプロセス)に応じて作成される。ユーザプログラム236は、典型的には、CPUユニット13のマイクロプロセッサ100で実行可能なオブジェクトプログラム形式になっている。このユーザプログラム236は、PLCサポート装置8などにおいて、ラダー言語などによって記述されたソースプログラムがコンパイルされることで生成される。そして、生成されたオブジェクトプログラム形式のユーザプログラム236は、PLCサポート装置8から接続ケーブル10を介してCPUユニット13へ転送され、不揮発性メモリ106などに格納される。
 スケジューラプログラム212は、出力処理プログラム214、入力処理プログラム216、および制御プログラム230について、各実行サイクルでの処理開始および処理中断後の処理再開を制御する。より具体的には、スケジューラプログラム212は、ユーザプログラム236およびモーション演算プログラム234の実行を制御する。
 本実施の形態に係るCPUユニット13では、モーション演算プログラム234に適した一定周期の実行サイクル(制御サイクル)を処理全体の共通サイクルとして採用する。そのため、1つの制御サイクル内で、すべての処理を完了することは難しいので、実行すべき処理の優先度などに応じて、各制御サイクルにおいて実行を完了すべき処理と、複数の制御サイクルに亘って実行してもよい処理とが区分される。スケジューラプログラム212は、これらの区分された処理の実行順序などを管理する。より具体的には、スケジューラプログラム212は、各制御サイクル期間内において、より高い優先度が与えられているプログラムほど先に実行する。
 出力処理プログラム214は、ユーザプログラム236(制御プログラム230)の実行によって生成された出力データを、PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140へ転送するのに適した形式に再配置する。PLCシステムバスコントローラ120またはフィールドネットワークコントローラ140が、マイクロプロセッサ100からの、送信を実行するための指示を必要とする場合は、出力処理プログラム214がそのような指示を発行する。
 入力処理プログラム216は、PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140によって受信された入力データを、制御プログラム230が使用するのに適した形式に再配置する。
 シーケンス命令演算プログラム232は、ユーザプログラム236で使用されるある種のシーケンス命令が実行されるときに呼び出されて、その命令の内容を実現するために実行されるプログラムである。
 モーション演算プログラム234は、ユーザプログラム236による指示に従って実行され、サーボモータドライバ3やパルスモータドライバといったモータドライバに対して出力する指令値を実行されるごとに算出するプログラムである。
 その他のシステムプログラム220は、図3に個別に示したプログラム以外の、PLC1の各種機能を実現するためのプログラム群をまとめて示したものである。その他のシステムプログラム220は、制御サイクルの周期を設定するプログラム222を含む。
 制御サイクルの周期は、制御目的に応じて適宜設定することができる。典型的には、制御サイクルの周期を指定する情報をユーザがPLCサポート装置8へ入力する。すると、その入力された情報は、PLCサポート装置8からCPUユニット13へ転送される。制御サイクルの周期を設定するプログラム222は、PLCサポート装置8からの情報を不揮発性メモリ106に格納させるとともに、システムタイマ108から指定された制御サイクルの周期で割り込み信号が発生されるように、システムタイマ108を設定する。CPUユニット13への電源投入時に、制御サイクルの周期を設定するプログラム222が実行されることで、制御サイクルの周期を指定する情報が不揮発性メモリ106から読み出され、読み出された情報に従ってシステムタイマ108が設定される。
 制御サイクルの周期を指定する情報の形式としては、制御サイクルの周期を示す時間の値や、制御サイクルの周期に関する予め用意された複数の選択肢のうちから1つを特定する情報(番号または文字)などを採用することができる。
 本実施の形態に係るCPUユニット13において、制御サイクルの周期を設定する手段としては、制御サイクルの周期を指定する情報を取得するために用いられるPLCサポート装置8との通信手段、制御サイクルの周期を設定するプログラム222、ならびに制御サイクルを規定する割り込み信号の周期を任意に設定可能に構成されているシステムタイマ108の構成といった、制御サイクルの周期を任意に設定するために用いられる要素が該当する。制御サイクルの周期を指定する情報をPLCサポート装置8から取得する代わりに、制御サイクルの周期を指定するための入力を受け付けるための操作スイッチ等の入力デバイスをCPUユニット13自身に設けてもよい。
 リアルタイムOS200は、複数のプログラムを時間の経過に従い切り替えて実行するための環境を提供する。本実施の形態に係るPLC1においては、CPUユニット13のプログラム実行によって生成された出力データを他のユニットまたは他の装置へ出力(送信)するためのイベント(割り込み)として、出力準備割り込み(P)およびフィールドネットワーク送信割り込み(X)が初期設定される。リアルタイムOS200は、出力準備割り込み(P)またはフィールドネットワーク送信割り込み(X)が発生すると、マイクロプロセッサ100での実行対象を、割り込み発生時点で実行中のプログラムからスケジューラプログラム212に切り替える。なお、リアルタイムOS200は、スケジューラプログラム212およびスケジューラプログラム212がその実行を制御するプログラムが何ら実行されていない場合に、その他のシステムプログラム210に含まれているプログラムを実行する。このようなプログラムとしては、たとえば、CPUユニット13とPLCサポート装置8との間の接続ケーブル10(USB)などを介した通信処理に関するものが含まれる。
 なお、制御プログラム230およびスケジューラプログラム212は、記憶手段であるメインメモリ104および不揮発性メモリ106に格納される。
 <D.メインメモリ構成>
 次に、図4を参照して、CPUユニット13のメインメモリ104に構成される記憶領域について説明する。
 図4は、本発明の実施の形態に係るCPUユニット13のメインメモリ104の領域構成を示す模式図である。図4を参照して、メインメモリ104には、各種のプログラム領域1041と、制御プログラムの作業領域1042と、PLCシステムバス送信バッファ1043と、PLCシステムバス受信バッファ1044と、フィールドネットワーク送信バッファ1045と、フィールドネットワーク受信バッファ1046とが形成される。
 各種のプログラム領域1041には、各種のプログラムを実行するためのコードが一時的に格納される。
 制御プログラムの作業領域1042には、制御プログラム230の実行により作成された出力データが一時的に格納される。
 PLCシステムバス送信バッファ1043およびPLCシステムバス受信バッファ1044は、PLCシステムバス11を介して送信および受信されるデータをそれぞれ一時的に格納する。同様に、フィールドネットワーク送信バッファ1045およびフィールドネットワーク受信バッファ1046は、フィールドネットワーク2を介して送信および受信されるデータをそれぞれ一時的に格納する。
 より具体的には、出力処理プログラム214は、PLCシステムバス11を介していずれかの出力データを送信する必要がある場合には、対象の出力データを制御プログラムの作業領域1042からPLCシステムバス送信バッファ1043へコピーする。その際、出力処理プログラム214は、同一のユニットに送信される複数の出力データを一括して送信できるように、PLCシステムバス送信バッファ1043において、同一のユニットに向けられた出力データ群がまとめられるように出力データを再配置する。
 同様に、出力処理プログラム214は、フィールドネットワーク2を介していずれかの出力データを送信する必要がある場合には、対象の出力データを制御プログラムの作業領域1042からフィールドネットワーク送信バッファ1045へコピーする。その際、出力処理プログラム214は、フィールドネットワーク送信バッファ1045において、シリアルフレームとして送信できる形式に出力データを再配置する。
 一方、入力処理プログラム216は、PLCシステムバスコントローラ120が受信してPLCシステムバス受信バッファ1044に格納された入力データ、および/または、フィールドネットワークコントローラ140が受信してフィールドネットワーク受信バッファ1046に格納された入力データを、制御プログラムの作業領域1042へコピーする。その際、入力処理プログラム216は、制御プログラムの作業領域1042において、制御プログラム230が使用するのに適した形式に入力データを再配置する。
 PLCシステムバスコントローラ120のDMA制御回路122は、PLCシステムバス送信バッファ1043に格納されている出力データをPLCシステムバスコントローラ120のバッファメモリ146へ転送するとともに、バッファメモリ146に格納されている入力データをPLCシステムバス受信バッファ1044へ転送する。
 フィールドネットワークコントローラ140のDMA制御回路142は、フィールドネットワーク送信バッファ1045に格納されている出力データをフィールドネットワークコントローラ140のバッファメモリ146へ転送するとともに、バッファメモリ146に格納されている入力データをフィールドネットワーク受信バッファ1046へ転送する。
 制御プログラムの作業領域1042、PLCシステムバス送信バッファ1043、PLCシステムバス受信バッファ1044、フィールドネットワーク送信バッファ1045、および、フィールドネットワーク受信バッファ1046は、それぞれのアクセスを互いに独立に制御できるように構成されている。そのため、たとえば、以下に示す(1)~(3)といった複数の動作を並列実行することができる。
 (1) マイクロプロセッサ100が行う、ユーザプログラム236実行に伴う制御プログラムの作業領域1042へのアクセス
 (2) PLCシステムバスコントローラ120のDMA制御回路122が行う、メインメモリ104上のPLCシステムバス送信バッファ1043および/またはPLCシステムバス受信バッファ1044とPLCシステムバスコントローラ120内のバッファメモリ126との間のデータ転送のための、メインメモリ104上のPLCシステムバス送信バッファ1043および/またはPLCシステムバス受信バッファ1044へのアクセス
 (3) フィールドネットワークコントローラ140のDMA制御回路142が行う、メインメモリ104上のフィールドネットワーク送信バッファ1045および/またはフィールドネットワーク受信バッファ1046とフィールドネットワークコントローラ140内のバッファメモリ146との間のデータ転送のための、メインメモリ104上のフィールドネットワーク送信バッファ1045および/またはフィールドネットワーク受信バッファ1046へのアクセス。
 <E.全体処理動作(実施の形態1)>
 次に、本実施の形態に係る各プログラムの実行順序などについて、以下説明する。なお、本明細書においては、本発明に係る技術思想の具現化例として、実施の形態1~7を例示する。図5は、本発明の実施の形態1に係る全体処理動作を示すシーケンス図である。
 本実施の形態においては、出力処理プログラム214、入力処理プログラム216、制御プログラム230(第1の制御プログラム)には、それぞれ優先度が与えられている。これらのプログラムに与えられている優先度は、たとえば、高い方から、出力処理プログラム214、入力処理プログラム216、制御プログラム230の順である。
 PLC1のCPUユニット13は、出力データの送信(出力処理プログラム214)と、入力データの受信(入力処理プログラム216)と、入力データを使用して出力データを生成する制御プログラム230の実行とを繰り返すことによって制御対象を制御する。すなわち、マイクロプロセッサ100は、記憶手段に格納されたスケジューラプログラム212および制御プログラム230を実行し、その実行結果に応じて、通信回路(PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140)は、制御サイクルごとに出力データの送信および入力データの受信を行う。
 スケジューラプログラム212は、各制御サイクル内において、優先度の高いプログラム/スレッドから順に、マイクロプロセッサ100に実行させる。以下、「マイクロプロセッサ100に実行させる」ことを単に「実行する」とも表現する。
 スケジューラプログラム212は、それ自体がオブジェクトインスタンスである場合に限らず、他の各種オブジェクトインスタンス(たとえば、出力処理プログラム214)に組込まれて動作するプログラム(プロセス)であってもよい。たとえば、他のオブジェクトインスタンスにおいて呼び出されて動作するプログラムであってもよい。
 図5に示される符号PおよびXは、それぞれシステムタイマ108(図2)から一定周期ごとに発生される割り込み信号を示す。具体的には、「P」は出力準備割り込みを示し、「X」はフィールドネットワーク送信割り込みを示す。なお、図5には、割り込みを示す符号「P」および「X」に、制御サイクルの番号を示す数字を付加して表現する。
 (e1:制御サイクル1について)
 スケジューラプログラム212は、出力準備割り込み(P-1)に応答して、優先度に従って、出力処理プログラム214を実行する。
 出力処理プログラム214は、PLCシステムバス11を介していずれかの出力データを送信する必要がある場合には、対象の出力データを制御プログラムの作業領域1042(図4)からPLCシステムバス送信バッファ1043へコピーする。また、出力処理プログラム214は、フィールドネットワーク2を介していずれかの出力データを送信する必要がある場合には、対象の出力データを制御プログラムの作業領域1042からフィールドネットワーク送信バッファ1045へコピーする。
 続いて、出力処理プログラム214は、PLCシステムバス送信バッファ1043への出力データのコピーが完了すると、PLCシステムバスコントローラ120に対して送信実行を指示する(符号A)。そして、出力処理プログラム214は、出力データのコピーがすべて完了すると、いったん実行を停止する。
 その後、スケジューラプログラム212は、フィールドネットワーク送信割り込み(X-1)に応答して、出力処理プログラム214の実行を再開する。
 出力処理プログラム214は、実行を再開すると、フィールドネットワークコントローラ140に対して送信実行を指示する(符号B)。そして、出力処理プログラム214は、自身の実行を終了する。
 スケジューラプログラム212は、出力処理プログラム214の実行が終了すると、優先度に従って、次に入力処理プログラム216を実行する。
 入力処理プログラム216は、PLCシステムバスコントローラ120からの受信完了通知(符号C)、または、フィールドネットワークコントローラ140からの受信完了通知(符号D)を受信するまで待機する。図5では、一例として、PLCシステムバスコントローラ120からの受信完了通知(符号C)が先に発生し、続いて、フィールドネットワークコントローラ140からの受信完了通知(符号D)が発生している例を示すが、この発生順序は逆になる場合もある。
 入力処理プログラム216は、受信完了通知(符号CまたはD)が発生すると、いずれの受信完了通知であるかに対応して、PLCシステムバス受信バッファ1044またはフィールドネットワーク受信バッファ1046から制御プログラムの作業領域1042に入力データをコピーする。
 入力処理プログラム216は、入力データのコピーが完了すると、実行を終了する。
 スケジューラプログラム212は、入力処理プログラム216の実行が終了すると、優先度に従って、次に制御プログラム230を実行する。
 制御プログラム230は、制御プログラムの作業領域1042に格納されている入力データを用いて処理を行い、処理結果の出力データを制御プログラムの作業領域1042に格納する。
 制御プログラム230の実行が終了してから、次の出力準備割り込み(P-2)があるまでの時間において、マイクロプロセッサ100は、リアルタイムOSの制御を利用して、その他のシステムプログラム220(図2)を実行する。
 (e2:PLCシステムバスコントローラ120の動作について)
 PLCシステムバスコントローラ120のDMA制御回路122は、送信実行指示(符号A)に応答して、メインメモリ104のPLCシステムバス送信バッファ1043に格納されている出力データをPLCシステムバスコントローラ120のバッファメモリ126へ転送する。
 バッファメモリ126への出力データの転送が完了すると、PLCシステムバス制御回路124は、バッファメモリ126から各出力データの宛先となっているユニットに対して対象の出力データを転送する。その後、PLCシステムバス制御回路124は、PLCシステムバス11上の各ユニットから入力データをPLCシステムバスコントローラ120のバッファメモリ126へ転送する。
 バッファメモリ126への入力データの転送が完了すると、PLCシステムバスコントローラ120のDMA制御回路122は、バッファメモリ126に格納されている入力データをメインメモリ104のPLCシステムバス受信バッファ1044へ転送する。その後、入力データの転送が完了すると、DMA制御回路122は、受信完了通知(符号C)をマイクロプロセッサ100に対して送信する。
 (e3:フィールドネットワークコントローラ140の動作について)
 フィールドネットワークコントローラ140のDMA制御回路142は、送信実行指示(符号B)に応答して、メインメモリ104のフィールドネットワーク送信バッファ1045に格納されている出力データをフィールドネットワークコントローラ140のバッファメモリ146へ転送する。
 バッファメモリ146への出力データの転送が完了すると、フィールドネットワーク制御回路144は、バッファメモリ146から各出力データの宛先となっている装置に対して出力データを転送する。その後、フィールドネットワーク制御回路144は、フィールドネットワーク2上の各装置から入力データをフィールドネットワークコントローラ140のバッファメモリ146へ転送する。
 バッファメモリ146への入力データの転送が完了すると、フィールドネットワークコントローラ140のDMA制御回路142は、バッファメモリ146に格納されている入力データをメインメモリ104のフィールドネットワーク受信バッファ1046へ転送する。その後、入力データの転送が完了すると、DMA制御回路142は、受信完了通知(符号D)をマイクロプロセッサ100に対して送信する。
 以上の動作は、フィールドネットワーク2の種類を問わず妥当するが、フィールドネットワーク2が本実施の形態で採用するEtherCAT(登録商標)である場合は、さらに次のような処理が実行される。
 すなわち、EtherCAT(登録商標)では、単一のフレームに、各ユニット宛の出力データおよび各ユニットからの入力データが含まれる。マスタに設定されるCPUユニット13からフレームが送信されると、送信されたフレームはデイジーチェーン接続されたそれぞれのユニットを経由して順次転送される。なお、CPUユニット13以外のそれぞれのユニットは、スレーブに設定される。フレームが末端のユニットに到達すると、そこで当該フレームは全二重の通信路を折り返して再びスレーブであるそれぞれのユニットを経由してCPUユニット13に戻る。各スレーブにおいては、往路のフレームをFIFO(First In First Out)方式で通過させながら、自スレーブ宛の出力データを選択的に取り込むとともに、自ユニットで発生した入力データをフレームの適切な位置に書き込む。各スレーブは、帰路のフレームについては、出力データの読み出し、および、入力データの書き込みは行わずに通過させる。
 このように、EtherCAT(登録商標)の場合は、各ユニットに対して個別にフレームを送信し、あるいは、各ユニットからフレームを個別に受信するのではなく、単一のフレームを送信および受信することが、フィールドネットワーク制御回路144による、バッファメモリ146から各ユニットへの出力データの転送、および、各ユニットからバッファメモリ146への入力データの転送に相当する。
 フィールドネットワーク2としてEtherCAT(登録商標)を用いる場合は、出力データを含むフレームを送信し、そのフレームがスレーブのそれぞれのユニットを経由して戻ってきた場合には、そのフレームに入力データが含まれることになる。そのため、実行順序については、出力処理の後に入力処理を実行することが自然である。但し、使用するフィールドネットワーク2の種類によっては、入力処理の後に出力処理を実行する方が好ましい場合がある。このように、出力処理と入力処理との順序は、フィールドネットワーク2などの仕様に応じて適宜に設計すればよい。
 (e4:制御サイクル2~4について)
 基本的には、制御サイクル2~4における動作は、制御サイクル1における動作と同様である。以下では、主として、制御サイクル1における動作と相違する点について説明する。
 制御サイクル2では、制御サイクル3の出力準備割り込み(P-3)が発生する時点においても制御プログラム230の実行が終了していない。制御プログラム230の実行周期は、制御サイクルの周期に等しいので、ここで制御プログラム230の実行周期の超過が発生したということができる。制御サイクル2で実行されていた制御プログラム230は、この時点で実行が中断され(実行対象がスケジューラプログラム212へ移り)、スケジューラプログラム212は、制御サイクル3の出力処理プログラム214および入力処理プログラム216を実行する。入力処理プログラム216の実行終了後、スケジューラプログラム212は、制御サイクル2において実行を開始した制御プログラム230(制御サイクル3の開始時に実行が中断されている)の実行を再開し、制御プログラム230に含まれる処理内容のうち未実行の部分を実行する。
 制御プログラム230の未実行の部分は、制御サイクル3の期間中に実行が終了する。スケジューラプログラム212は、制御サイクル3においては、新たに制御プログラムの実行を開始しない。
 制御サイクル4では、制御サイクル1と同じ通常の動作が実行される。
 ところで、制御サイクル3の出力処理時においては、制御サイクル2において実行を開始した制御プログラム230の実行が終了していないので、その演算結果である新たな出力データがまだ完全には得られていないことになる。そのため、制御プログラムの作業領域1042には、制御プログラム230の途中までの実行の結果更新された出力データと未更新の出力データとが混在している可能性がある。そこで、制御サイクル3の出力処理プログラム214は、制御プログラムの作業領域1042からPLCシステムバス送信バッファ1043および/またはフィールドネットワーク送信バッファ1045への出力データのコピーを行わずに、PLCシステムバスコントローラ120に対して送信実行を指示する(符号A)。
 また、制御サイクル3の出力処理プログラム214は、制御サイクル1および2などと同様に、フィールドネットワーク送信割り込み(X)に応じたスケジューラプログラム212からの実行の再開指示に従って、フィールドネットワークコントローラ140に対して送信実行の指示をする(符号B)。これにより、PLCシステムバス送信バッファ1043および/またはフィールドネットワーク送信バッファ1045に残っている、制御サイクル1において得られた出力データが再度送信される。
 なお、代替の処理例として、上述したような送信済みの出力データを繰り返し送信するのではなく、出力データの更新ができていないことを示すデータを送信するとともに、その場合の各ユニットにおける動作を各ユニット自身に決定させるように、PLCシステムを設計してもよい。
 制御サイクル3においても、各ユニットから新たな入力データが得られるが、この入力データを利用して新たに実行開始する制御プログラム230は存在しない。そのため、制御サイクル3の入力処理プログラム216は、PLCシステムバス受信バッファ1044およびフィールドネットワーク受信バッファ1046に格納されている入力データを、制御プログラムの作業領域1042へコピーしない。仮に、このコピー動作を実行すると、制御サイクル3において制御プログラム230の実行が再開されたとき、すなわち単一の制御プログラム230の実行途中で、入力データが更新されることになるので不都合となるためである。
 制御サイクル3の入力処理プログラム216は、PLCシステムバスコントローラ120からの受信完了通知(符号C)、および、フィールドネットワークコントローラ140からの受信完了通知(D)を確認すると実行を終了する。
 図5に示す例では、制御サイクル2で実行を開始した制御プログラム230は、制御サイクル2内では終了せず、制御サイクル3において未実行の部分を実行して一連の実行を終了する。なお、制御プログラム230が制御サイクル3内においても一連の実行を終了しなければ、制御サイクル4の開始時点で再び実行を中断し、その後、制御サイクル4において未実行の部分を実行する。この場合の制御サイクル4における処理は、図5に示す制御サイクル3における処理と同様となる。
 (e5:まとめ)
 上述のように、スケジューラプログラム212は、マイクロプロセッサ100に、制御プログラム230の実行が終了した制御サイクルの次の制御サイクルにおいて、通信回路(PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140)による出力データの送信および入力データの受信の後に、制御プログラム230の実行を開始させる命令を含む。また、スケジューラプログラム212は、マイクロプロセッサ100に、制御プログラム230の実行が終了しなかった制御サイクルの次の制御サイクルにおいて、制御プログラム230の未実行の部分を実行させる命令とを含む。さらに、スケジューラプログラム212は、制御サイクル内に制御プログラム230の実行が終了しなかった場合は、次の制御サイクルにおいて、通信回路(PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140)に、制御プログラム230の未実行の部分に優先して通信を開始させるための処理を実行させ、その後、マイクロプロセッサ100に、制御プログラム230の未実行の部分を実行させる命令を含む。
 本実施の形態によれば、制御プログラム230の実行時間が散発的に長くなる状況において、PLC1のCPUユニット13が制御データの出力および入力のために制御サイクルと同期して行う通信の周期を、制御プログラム230の最大実行時間よりも短い一定時間とすることができる。
 PLC1による制御データの通信周期が一定であるので、IOユニット14において外部の機器に与える出力信号の更新周期を一定化することが容易になる。これにより、外部の機器においても、PLC1の制御サイクルの周期に同期した動作をすることが容易になる。
 また、制御データの通信周期が一定であるので、リモートIOターミナル5において、CPUユニット13に入力データを送信する予定時刻の直前に外部から入力データを取得するような、精密に時間制御された計画的な動作が可能になる。これにより、CPUユニット13は、入手しうる最も新しい入力データを用いて演算処理を行うことができるようになる。そのため、制御サイクルの周期の短縮化とあいまって、入力データの取得から、その入力データを用いて演算した結果である出力データを送出するまでの応答時間を短縮することができる。
 さらに、制御データの通信周期が一定であるので、PLC1のいずれかのユニットにおいて、予定された時刻に通信が行われなかったことを検知することによって通信異常の発生を迅速に判定することができる。
 さらに、本実施の形態に従うCPUユニット13は、フィールドネットワーク2を経由してPLC1の外部にあるサーボモータドライバと直接通信する場合にも、フィールドネットワーク2による制御データの通信周期を一定化することができるので、モータを高精度に制御することができる。
 さらに、本実施の形態に従うCPUユニット13では、通信回路(PLCシステムバスコントローラ120および/またはフィールドネットワークコントローラ140)は、マイクロプロセッサ100による制御を受けて出力データの送信および入力データの受信を開始するように構成される。そして、スケジューラプログラム212は、通信回路に、制御サイクルごとに通信を開始させる命令を含む。このように、マイクロプロセッサ100が集約的に制御サイクルを管理するので、通信回路に、一定周期で通信するための特別なハードウェアが不要となるという利点もある。
 <F.全体処理動作(実施の形態2)>
 次に、制御目的に応じて作成される制御プログラムに対して異なる優先度を設定できるようにすることも実用的である。実施の形態2においては、より高い優先度を設定された制御プログラムと、より低い優先度を設定された制御プログラムとが存在する場合の処理動作について説明する。
 図6は、本発明の実施の形態2に係る全体処理動作を示すシーケンス図である。以下では、主として、図5に示すシーケンスと相違する点について説明する。
 本実施の形態においては、これらのプログラムを対比して説明する便宜上、図5に示される制御プログラム230(第1の制御プログラム)に対してより高い優先度が設定されているとして、このプログラムを「高優先制御プログラム230-1」と称し、より低い優先度が設定されているプログラム(第2の制御プログラム)を「低優先制御プログラム230-2」と称する。すなわち、実施の形態2における高優先制御プログラム230-1は、上述の実施の形態1における制御プログラム230と実質的に同じであり、説明の便宜上、呼び方を変えただけである。
 低優先制御プログラム230-2は、高優先制御プログラム230-1よりも実行の優先度が低いため、低優先制御プログラム230-2の実行周期は、制御サイクルの周期の2以上の整数倍に設定される。図6の例では、制御サイクル4回分に相当する期間が低優先制御プログラム230-2の実行周期とされる。すなわち、低優先制御プログラム230-2の実行周期は、高優先制御プログラム230-1の周期の4倍である。なお、低優先制御プログラム230-2についても、記憶手段であるメインメモリ104および不揮発性メモリ106に格納される。
 図6に示すシーケンスにおいて、制御サイクル1~4までが低優先制御プログラム230-2の1つの実行サイクルであり、次の実行サイクルは制御サイクル5~8までとなる。
 図6を参照して、スケジューラプログラム212は、制御サイクル1において、高優先制御プログラム230-1の実行が終了すると、低優先制御プログラム230-2を実行する。このとき、低優先制御プログラム230-2は、制御サイクル1内では終了せず、送信準備割り込み(P-2)が発生することで実行が中断される。
 続く制御サイクル2において、高優先制御プログラム230-1の実行が終了しなかったとすると、低優先制御プログラム230-2に含まれる処理内容のうち未実行の部分は、制御サイクル2においては実行されない。
 続く制御サイクル3において、スケジューラプログラム212は、高優先制御プログラム230-1の実行が終了すると、低優先制御プログラム230-2に含まれる処理内容のうち未実行の部分を実行する。そして、低優先制御プログラム230-2は、制御サイクル3内で終了する。
 制御サイクル1において実行を開始した低優先制御プログラム230-2の実行周期には、その後の制御サイクル4も含まれているが、図6に示す例では、低優先制御プログラム230-2が制御サイクル3内で既に実行を終了しているので、制御サイクル4内では低優先制御プログラム230-2は実行されない。
 制御サイクル5では、低優先制御プログラム230-2の新たな実行周期になるので、制御サイクル1の場合と同様に、スケジューラプログラム212は、低優先制御プログラム230-2の実行を開始して最初から処理を実行させる。
 制御サイクル1で実行を開始した低優先制御プログラム230-2は、制御サイクル1の入力処理プログラム216の実行により得られた入力データを用いて実行される。また、低優先制御プログラム230-2の実行の結果得られた出力データは、新たな低優先制御プログラム230-2の実行サイクルの開始タイミングに相当する制御サイクル5において、出力処理プログラム214の実行により送信される。
 上述のように、スケジューラプログラム212は、マイクロプロセッサ100に、制御サイクル内の高優先制御プログラム230-1の終了後の期間において、実行サイクルに従って低優先制御プログラム230-2を実行させる命令を含む。
 図6に示す例では、低優先制御プログラム230-2の出力処理および入力処理を、高優先制御プログラム230-1の出力処理および入力処理とまとめて行う例を示す。しかしながら、低優先制御プログラム230-2の出力および入力のための通信を、高優先制御プログラム230-1の出力および入力のための通信タイミングとは別のタイミングで行うようにしてもよい。そのような場合であっても、高優先制御プログラム230-1の出力および入力のための通信に着目すれば、一定周期で通信が行われていることになる。
 上述のように、実行の優先度が異なる複数の制御プログラム230が並列的に実行される場合、制御サイクルは、最も優先度が高い制御プログラムが周期を超過せずに実行できている場合の実行サイクルに対応する。
 上述したように、その実行サイクルの周期が制御サイクルの周期よりも長くなっても影響がないような処理を低優先制御プログラム230-2に含ませて実行させることにより、高優先の制御プログラム230-1に含まれる処理の処理量を削減することができる。それにより、制御サイクルの周期をより短縮できる可能性がある。また、高優先制御プログラム230-1の実行が1回の制御サイクル内に終了しない頻度を小さくできる可能性もある。さらに、高優先制御プログラム230-1の実行が想定を超える制御サイクル数内で終了しない頻度を小さくできる可能性がある。
 <G.全体処理動作(実施の形態3)>
 次に、上述の実施の形態2において説明した、高優先制御プログラムおよび低優先制御プログラムを具体的なプログラムに割り当てた場合の処理について説明する。
 図7は、本発明の実施の形態3に係る全体処理動作を示すシーケンス図である。図7に示すシーケンスでは、一例として、実施の形態2に係るシーケンスにおいて示された高優先制御プログラム230-1の内容をモーション演算プログラム234とし、低優先制御プログラム230-2の内容をユーザプログラム236およびその実行の際に必要になるシーケンス命令演算プログラム232とした。以下では、主として、図5に示すシーケンスと相違する点について説明する。
 モーション演算プログラム234は、ユーザプログラム236に含まれる命令に従って実行され、実行ごとに、モータドライバに対して出力する指令値を算出する。
 図7に示すシーケンスにおいて、制御サイクル1~4までがユーザプログラム236の1つの実行サイクルである。それより1つ前の実行サイクルにおいて、ユーザプログラム236は、モーション演算プログラム234の起動を指示したとする。
 制御サイクル1では、そのユーザプログラム236の指示を受けてモーション演算プログラム234が起動する。モーション演算プログラム234は、起動すると、まずプロファイルデータ生成と称される初期処理を実行する。プロファイルデータは、モーション演算プログラム234の実行ごとに制御対象のそれぞれの軸についての指令値を順次算出するために必要なデータである。このプロファイルデータは、ユーザプログラム236中のモーション命令で指定されたパラメータを用いて算出される。たとえば、モーション命令で指定される、開始位置、開始速度、目標速度、加速度、加加速度(Jerk)などのパラメータを用いて、運動開始時刻からの、加速度増加の終了時間(一定加速度運動の開始時間)、加速度減少の開始時間、一定速度運動の開始時間などが算出される。さらに、モーション演算プログラム234は、その起動時の実行サイクル内において、プロファイルデータ作成に続いて、第1回目の指令値を算出する。
 多数の軸についてのモーション演算プログラム234を同時に複数起動すると、1回の制御サイクル内ではすべての軸についてのプロファイルデータの生成が完了しないことがある。図7に示すシーケンスにおいては、そのような場合を示しており、制御サイクル1内ではモーション演算プログラム234の実行が完了していない。
 制御サイクル1は、ユーザプログラム236の1つの実行サイクルに含まれる(4個の)制御サイクルのうちの第1番目に相当するが、ユーザプログラム236などを実行するための余剰時間が発生しないので、制御サイクル1においては、ユーザプログラム236は実行されない。
 本実施の形態においては、モーション演算プログラム234は、ユーザにおける制御目的に応じて作成されたユーザプログラム236により起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とするとする。
 出力準備割り込み(P-1)に応答して、モーション演算プログラム234は実行を中断し、制御サイクル2において、スケジューラプログラム212は、出力処理プログラム214および入力処理プログラム216を実行する。その後、スケジューラプログラム212は、モーション演算プログラム234に含まれる処理内容のうち未実行の部分を実行する。
 モーション演算プログラム234が終了すると、スケジューラプログラム212は、ユーザプログラム236を実行する。ユーザプログラム236は、必要に応じてシーケンス命令演算プログラム232を呼び出して実行する。制御サイクル2内ではユーザプログラム236は終了しておらず、出力準備割り込み(P-3)に応答して、ユーザプログラム236は実行を中断する。
 制御サイクル3以降においては、モーション演算プログラム234は、指令値を算出する処理を行うだけであるので、各制御サイクル内で実行が終了する。
 図7に示すシーケンスにおいては、ユーザプログラム236が制御サイクル3内でも実行を終了できず、制御サイクル4ではじめて実行を終了する例を示す。
 なお、図7に示すシーケンスの例では、制御サイクル2において出力データ(モータドライバへの指令値を含む)は更新されないが、制御サイクル2ではまだモータが動作していないので、モータドライバへの指令値が更新されないことによる問題は少ない。図5のシーケンスに示される制御プログラム230がユーザプログラム236の他にモーション演算プログラム234をも含んでいる場合であっても同様のことがいえる。
 したがって、制御プログラム230がモーション演算プログラム234を含む場合、モーション演算プログラム234が起動された制御サイクル(モーション起動サイクル)より後の制御サイクルにおいては、モーション演算プログラム234の実行周期の超過は発生しないが、モーション起動サイクルにおいては実行周期の超過が発生しうる程度に制御サイクルの周期を短く設定することにより、制御サイクルの周期が短く、かつ、モーション動作中における周期超過が発生しにくいモーション制御を実現できる。
 <H.全体処理動作(実施の形態4)>
 次に、上述の実施の形態1において説明したシーケンスにおいて、実行周期の超過を監視および通知/報知するための異常処理プログラムがさらに実装されている場合の処理について説明する。
 図8は、本発明の実施の形態4に係る全体処理動作を示すシーケンス図である。図8を参照して、異常処理プログラム240は、図3に示すその他のシステムプログラム220に含まれる1つのプログラムとして、不揮発性メモリに格納されているものとする。そして、異常処理プログラム240は、PLC1の電源投入後にメインメモリ104に読み出されて実行可能な状態になっている。以下では、主として、図5に示すシーケンスと相違する点について説明する。
 上述の実施の形態1に係るシーケンスの一例(図5)においては、たとえば、制御サイクル2で実行開始した制御プログラムが制御サイクル2内で終了せず、未実行部分を実行する制御サイクル3においても実行終了しなければ、制御サイクル4においても実行を継続した。このように制御プログラムの1回の実行を継続する制御サイクル数には限度を設けていなかった。これに対して、本実施の形態においては、単一の制御プログラム230が実行を継続している期間が制御サイクル数の限度数に達し、かつ、その限度数に対応する制御サイクル内で制御プログラム230の実行が終了しなかった場合に、次の制御サイクルにおいて、制御プログラム230に含まれる処理内容のうち未実行の部分を実行するのではなく、異常処理プログラム240を実行する。
 この限度数は、制御プログラム230の1回の実行が継続する制御サイクル数の限度数、すなわち、異常処理プログラム240を実行する条件を定義するものである。限度数データ(限度数の設定内容)については、PLC1の製造時に不揮発性メモリ106に予め格納しておいてもよいし、ユーザが限度数データを不揮発性メモリ106に格納するようにしてもよい。この限度数データの表現形態としては、限度数の値自体を指定する形式、制御プログラムの未実行部分を実行する制御サイクルの数を定する形式(限度数より1小さい)、限度数に関する予め用意された複数の選択肢のうちから1つを特定する情報(番号または文字)など、PLCが限度数を特定できる形態であればよい。
 図8に示すシーケンスには、限度数が「2」とされている場合の処理例を示す。制御サイクル2で実行を開始した制御プログラム230については、制御サイクル3が限度数に対応する制御サイクルとなる。制御サイクル2で実行を開始した制御プログラム230が制御サイクル3で実行を終了しなければ、出力準備割り込み(P-4)に応答して実行されるスケジューラプログラム212は、制御プログラム230の実行サイクル(制御サイクル)の数が限度数に達していること、および、制御プログラム230の実行が終了していないことを検出する。そして、スケジューラプログラム212は、出力処理プログラム214を実行した後、異常処理プログラム240を実行する。なお、異常処理プログラム240を実行した後には、制御プログラム230の実行を行わないようにしてもよい。
 異常処理プログラム240は、典型的には、PLC1の外部に対して実行周期の超過という異常発生を報知するための処理を行う。たとえば、異常処理プログラム240は、PLC1に搭載された異常報知用のランプ(図示しない)を点灯する、上位ネットワーク(図示しない)を介してPLC1の運用管理者に対して異常発生を示すデータを送信する、などの処理を行う。
 制御サイクル5以降においては、スケジューラプログラム212は、出力処理プログラム214だけを実行する。この状態は、電源がリセットされる、あるいは、USBを介して接続されたPLCサポート装置8上でユーザによって適切な異常解除処置が行われる、といった何らかの解除アクションがあるまで継続する。
 上述のように、スケジューラプログラム212は、制御プログラム230が1回の実行を継続している制御サイクルの数が限度数に達し、かつ、当該制御サイクル内で制御プログラム230の実行が終了しなかった場合に、次の制御サイクルにおいて、マイクロプロセッサ100に、制御プログラム230の未実行部分を実行させることなく異常処理プログラム240を実行させる命令を含む。
 本実施の形態においては、実行周期が限度数の制御サイクルを超過する異常が発生した場合であっても、出力処理プログラム214の実行は継続して、PLCシステムバス11およびフィールドネットワーク2における一定周期の通信を維持するようにしたが、出力処理プログラム214の実行を中断するといった処理を採用することで、通信回路による一定周期の通信自体も停止させるようにしてもよい。
 また、異常処理プログラム240を、システムプログラム210に含まれるプログラムとして実装するのではなく、ユーザプログラム236の中の1つの特別なプログラムとして実装することにより、異常処理の内容をユーザが自由にプログラムできるように構成してもよい。
 本実施の形態によれば、想定を超える制御サイクル数まで制御プログラム230の実行が継続するといった異常状態が発生した場合には、制御プログラム230の実行を停止しつつ、異常処理プログラム240を実行することにより、より高い安全を確保することができる。
 <I.全体処理動作(実施の形態5)>
 次に、上述の実施の形態1において説明したシーケンスにおいて、制御プログラムが制御サイクル内で終了しなかった場合に、次の制御サイクルではPLCシステムバスの通信を行わず、フィールドネットワークの通信のみを行うようにした場合の処理について説明する。
 図9は、本発明の実施の形態5に係る全体処理動作を示すシーケンス図である。以下では、主として、図5に示すシーケンスと相違する点について説明する。
 図9に示すシーケンスには、制御サイクル2で実行を開始した制御プログラム230が、制御サイクル2内でその実行を終了できなかった場合を示す。この場合、出力準備割り込み(P-3)に応答して、制御プログラム230は実行を中断する。すると、スケジューラプログラム212は、制御プログラム230の実行が終了しなかったことに応答して、制御サイクル3ではPLCシステムバス11の通信処理を行わず、フィールドネットワーク2の通信処理のみを実行する。すなわち、PLCシステムバスコントローラ120のDMA制御回路122は、送信実行指示(符号A)が与えられないので、メインメモリ104のPLCシステムバス送信バッファ1043に格納されている出力データをPLCシステムバスコントローラ120のバッファメモリ126へ転送するという処理をスキップする。
 また、制御サイクル3においては、出力すべき更新された出力データが存在しないので、スケジューラプログラム212は、出力処理プログラム214のうち、PLCシステムバス11を介して送信される出力データを準備する部分の処理を実行しない。一方、スケジューラプログラム212は、出力処理プログラム214のうち、フィールドネットワーク送信割り込み(X-3)に応答して、フィールドネットワークコントローラ140に対して送信実行を指示する部分の処理については実行する。
 フィールドネットワーク2を介して送信される出力データを準備する部分の処理については実行する。すなわち、スケジューラプログラム212は、フィールドネットワーク送信割り込み(X-3)に応答して、出力処理プログラム214を実行する。
 図9に示すシーケンスでは、スケジューラプログラム212は、出力準備割り込み(P-3)が発生した後、フィールドネットワーク送信割り込み(X-3)が発生するまでの間は、いずれのプログラムも実行しないが、制御プログラムをこの期間に実行させてもよい。その場合、制御プログラム230は、フィールドネットワーク送信割り込み(X-3)に応答して、再び実行を中断する。そして、スケジューラプログラム212は、出力処理プログラム214からの送信実行指示(符号B)に応答して、制御プログラム230の実行を再開する。すなわち、スケジューラプログラムは、制御サイクル内でフィールドネットワーク2の送信指示よりも前の時間においても制御プログラム230に含まれる処理内容のうち未実行部分を実行する。このようにすると、制御プログラム230を制御サイクル3内で終了させることができる可能性が大きくなる。
 本実施の形態によれば、いずれかの通信経路(PLCシステムバス11またはフィールドネットワーク2)で一定周期の通信が行われていれば、その通信経路との関係で本実施の形態に係る作用効果を維持できる。一般に、フィールドネットワーク2に接続される機器は、公開されたネットワーク通信仕様に基づいて多くのメーカーにより提供される。そのような機器の間で互換性を維持する必要性があるので、フィールドネットワーク2の具体的仕様にも依存するが、一般に、PLCシステムバス11よりもフィールドネットワーク2の方が一定の通信周期を維持する必要性が高い場合が多い。
 <J.全体処理動作(実施の形態6)>
 次に、スケジューラプログラムによるスケジューリング処理の一部をシステムタイマに分担させることで、制御プログラムを本来の実行サイクル内で終了させる可能性を高めた構成について説明する。
 図10は、本発明の実施の形態6に係る全体処理動作を示すシーケンス図である。以下では、主として、図5に示すシーケンスと相違する点について説明する。図10には、上述のようなスケジューラプログラム212のスケジューリング処理の一部をシステムタイマ108に分担させる形態の一例を示す。具体的には、図10に示す構成は、上述の実施の形態1において説明したシーケンスにおいて、フィールドネットワークコントローラ140がスケジューラプログラム212からの送信実行指示(図5の符号B)を受信して送信動作をするのではなく、システムタイマ108からの送信トリガ信号(Y)を直接受信して送信動作をするものである。
 図10において、送信トリガ信号(Y)のタイミングは、図5に示すシーケンスにおけるフィールドネットワーク送信割り込み(X)のタイミングと同じに設定されている。すなわち、CPUユニット13は、制御サイクルの周期で信号を発生するタイマ回路をさらに含む。そして、通信回路(フィールドネットワークコントローラ140)は、タイマ回路が発生する信号をトリガとして出力データの送信および入力データの受信を開始する。
 スケジューラプログラム212は、送信準備割り込み(P)が発生すると、制御プログラム230の実行が終了しているかどうかを判断し、制御プログラム230の実行が終了していれば出力処理プログラム214を実行する(制御サイクル1,2,4)。これに対して、制御プログラム230の実行が終了していなければ、スケジューラプログラム212は、制御プログラム230に含まれる処理内容のうち未実行の部分を実行する(制御サイクル3)。
 なお、説明の便宜上、図10には、PLCシステムバス11およびPLCシステムバス11上のユニットを用いず、フィールドネットワーク2だけを用いて、出力データの送信および入力データの受信を実行する例を示しているが、上述の実施の形態1と同様に、PLCシステムバス11を併せて用いることにしてもよい。
 なお、システムタイマ108は、フィールドネットワークコントローラ140内に実装されていてもよい。
 本実施の形態によれば、通信回路における通信開始は、システムタイマ108が発生する一定周期の割り込み信号によってトリガされるので、スケジューラプログラム212における処理量を低減できる。そのため、制御プログラム230に含まれる処理内容のうち未実行の部分を実行する制御サイクルにおいて、スケジューラプログラム212は、制御プログラムに含まれる処理内容のうち未実行の部分を実行するための時間をより多く割り当てることができる。その結果、制御プログラム230に含まれる処理内容のうち未実行の部分をその制御サイクル内での実行を終了させる可能性を高めることができる。
 <K.全体処理動作(実施の形態7)>
 次に、複数の独立した演算主体を有するマイクロプロセッサを用いる場合の処理について説明する。汎用的なコンピュータアーキテクチャとして、複数のコアを有するマイクロプロセッサが実用化されている。各コアは、互いに独立して演算処理を実行できるので、それぞれのプログラムの実行をこれらのコアで分担することで、制御プログラムを本来の実行サイクル内で終了させる可能性を高めた構成について説明する。
 図11は、本発明の実施の形態7に係る全体処理動作を示すシーケンス図である。以下では、主として、図5に示すシーケンスと相違する点について説明する。
 図11に示すシーケンスを実行するマイクロプロセッサ100は、コア1およびコア2を有している。一例として、コア1が、スケジューラプログラム212、出力処理プログラム214、および入力処理プログラム216を実行し、コア2が、制御プログラム230を実行するものとする。
 図11に示す例では、制御サイクル1,2,4において、スケジューラプログラム212が、コア2に制御プログラム230を実行させる。
 たとえば、制御サイクル2において制御プログラム230の実行が終了しない場合には、制御サイクル3において、コア2はそのまま制御プログラム230の実行を継続する。すなわち、スケジューラプログラム212は、コア2が制御プログラム230の実行を継続することを妨げないことにより、コア2に制御プログラム230に含まれる処理内容のうち未実行の部分を実行させる。言い換えれば、スケジューラプログラム212は、制御プログラム230の実行が終了しなかった制御サイクルの次の制御サイクルにおいて、制御プログラム230の実行を中断しないことにより制御プログラム230の未実行の部分をマイクロプロセッサ100に実行させる命令を含む。この文脈においては、送信準備割り込み(P)があった場合でも制御プログラム230の実行をそのまま継続させることについての実行制御を支配しているシステムプログラム210の部分(たとえば、送信準備割り込み(P)によって起動する割り込み処理プログラム、送信準備割り込み(P)があっても制御プログラム230の実行を継続させる実行制御を行うことをOS310に指示するプログラムなど)を含めて、スケジューラプログラムという。
 その結果、制御プログラム230を本来の制御サイクル内での実行を終了させる可能性を高めることができる。
 <L.サポート装置>
 次に、PLC1で実行されるプログラムの作成およびPLC1のメンテナンスなどを行うためのPLCサポート装置8について説明する。
 図12は、本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置8のハードウェア構成を示す模式図である。図12を参照して、PLCサポート装置8は、典型的には、汎用のコンピュータで構成される。なお、メンテナンス性の観点からは、可搬性に優れたノート型のパーソナルコンピュータが好ましい。
 図12を参照して、PLCサポート装置8は、OSを含む各種プログラムを実行するCPU81と、BIOSや各種データを格納するROM(Read Only Memory)82と、CPU81でのプログラムの実行に必要なデータを格納するための作業領域を提供するメモリRAM83と、CPU81で実行されるプログラムなどを不揮発的に格納するハードディスク(HDD)84とを含む。
 PLCサポート装置8は、さらに、ユーザからの操作を受付けるキーボード85およびマウス86と、情報をユーザに提示するためのモニタ87とを含む。さらに、PLCサポート装置8は、PLC1(CPUユニット13)などと通信するための通信インターフェイス(IF)89を含む。
 後述するように、PLCサポート装置8で実行される各種プログラムは、CD-ROM9に格納されて流通する。このCD-ROM9に格納されたプログラムは、CD-ROM(Compact Disk-Read Only Memory)ドライブ88によって読取られ、ハードディスク(HDD)84などへ格納される。あるいは、上位のホストコンピュータなどからネットワークを通じてプログラムをダウンロードするように構成してもよい。
 上述したように、PLCサポート装置8は、汎用的なコンピュータを用いて実現されるので、これ以上の詳細な説明は行わない。
 図13は、本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置8のソフトウェア構成を示す模式図である。図13を参照して、PLCサポート装置8ではOS310が実行され、PLCサポートプログラム320に含まれる各種のプログラムを実行可能な環境が提供される。
 PLCサポートプログラム320は、エディタプログラム321と、コンパイラプログラム322と、デバッガプログラム323と、シミュレーション用シーケンス命令演算プログラム324と、シミュレーション用モーション演算プログラム325と、通信プログラム326とを含む。PLCサポートプログラム320に含まれるそれぞれのプログラムは、典型的には、CD-ROM9に格納された状態で流通して、PLCサポート装置8にインストールされる。
 エディタプログラム321は、ユーザプログラム236を作成するための入力および編集といった機能を提供する。より具体的には、エディタプログラム321は、ユーザがキーボード85やマウス86を操作してユーザプログラム236のソースプログラム330を作成する機能に加えて、作成したソースプログラム330の保存機能および編集機能を提供する。また、エディタプログラム321は、外部からのソースプログラム330の入力を受付ける。
 コンパイラプログラム322は、ソースプログラム330をコンパイルして、CPUユニット13のマイクロプロセッサ100で実行可能なオブジェクトプログラム形式のユーザプログラム236を生成する機能を提供する。また、コンパイラプログラム322は、ソースプログラム330をコンパイルして、PLCサポート装置8のCPU81で実行可能なオブジェクトプログラム形式のユーザプログラム340を生成する機能を提供する。このユーザプログラム340は、PLCサポート装置8によってPLC1の動作をシミュレート(模擬)するために使用される、シミュレーション用のオブジェクトプログラムである。
 デバッガプログラム323は、ユーザプログラムのソースプログラムに対してデバッグを行うための機能を提供する。このデバッグの内容としては、ソースプログラムのうちユーザが指定した範囲を部分的に実行する、ソースプログラムの実行中における変数値の時間的な変化を追跡する、といった動作を含む。
 デバッガプログラム323は、さらに、シミュレーション用のオブジェクトプログラムであるユーザプログラム340を実行する機能を提供する。このシミュレーション時には、CPUユニット13のシステムプログラムに含まれるシーケンス命令演算プログラム232およびモーション演算プログラム234に代えて、PLCサポートプログラム320に含まれるシミュレーション用シーケンス命令演算プログラム324およびシミュレーション用モーション演算プログラム325が用いられる。
 通信プログラム326は、PLC1のCPUユニット13へユーザプログラム236を転送する機能を提供する。
 一般的には、PLC1に実装されるシステムプログラム210は、CPUユニット13の製造段階でCPUユニット13の不揮発性メモリ106へ格納される。但し、CD-ROM9にシステムプログラム210を格納しておけば、ユーザは、CD-ROM9のシステムプログラム210をPLCサポート装置8へコピーし、通信プログラム326が提供する機能を利用してコピーしたシステムプログラム210をCPUユニット13へ転送することもできる。さらに、CD-ROM9に、PLC1のCPUユニット13で実行されるリアルタイムOS200を格納しておけば、リアルタイムOS200についてもユーザ操作によってPLC1へ再インストールできる。
 今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は、上記した説明ではなく、請求の範囲によって示され、請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。
 1 PLC、2 フィールドネットワーク、3 サーボモータドライバ、4 サーボモータ、5 リモートIOターミナル、6 検出スイッチ、7 リレー、8 PLCサポート装置、9 CD-ROM、10 接続ケーブル、11 PLCシステムバス、12 電源ユニット、13 CPUユニット、14,53 IOユニット、15 特殊ユニット、51 リモートIOターミナルバス、52 通信カプラ、81 CPU、83 RAM、85 キーボード、86 マウス、87 モニタ、88 CD-ROMドライブ、100 マイクロプロセッサ、102 チップセット、104 メインメモリ、106 不揮発性メモリ、108 システムタイマ、110 USBコネクタ、120 PLCシステムバスコントローラ、122 DMA制御回路、124 PLCシステムバス制御回路、126,146 バッファメモリ、130 PLCシステムバスコネクタ、140 フィールドネットワークコントローラ、142 DMA制御回路、144 フィールドネットワーク制御回路、200 リアルタイムOS、210 システムプログラム、212 スケジューラプログラム、214 出力処理プログラム、216 入力処理プログラム、218 IO処理プログラム、220 その他のシステムプログラム、222 制御サイクルの周期を設定するプログラム、230 制御プログラム、230-1 高優先制御プログラム、230-2 低優先制御プログラム、232 シーケンス命令演算プログラム、234 モーション演算プログラム、236 ユーザプログラム、240 異常処理プログラム、320 PLCサポートプログラム、321 エディタプログラム、322 コンパイラプログラム、323 デバッガプログラム、324 シミュレーション用シーケンス命令演算プログラム、325 シミュレーション用モーション演算プログラム、326 通信プログラム、330 ソースプログラム、340 ユーザプログラム、1041 プログラム領域、1042 制御プログラムの作業領域、1043 PLCシステムバス送信バッファ、1044 PLCシステムバス受信バッファ、1045 フィールドネットワーク送信バッファ、1046 フィールドネットワーク受信バッファ。

Claims (14)

  1.  制御対象を制御するPLCのCPUユニットであって、
     マイクロプロセッサと、
     記憶手段と、
     出力データの送信および入力データの受信を行う通信回路と、
     制御サイクルの周期を設定する手段とを備え、
     前記PLCのCPUユニットは、前記出力データの送信と、前記入力データの受信と、前記入力データを使用して前記出力データを生成する第1の制御プログラムの実行とを繰り返すことによって前記制御対象を制御するように構成されており、
     前記記憶手段は、前記第1の制御プログラムと、前記第1の制御プログラムの実行を制御するスケジューラプログラムとの格納に用いられ、
     前記マイクロプロセッサは、前記記憶手段に格納された前記スケジューラプログラムおよび前記第1の制御プログラムを実行し、
     前記通信回路は、前記制御サイクルごとに、前記出力データの送信および入力データの受信を行い、
     前記スケジューラプログラムは、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、前記通信回路による出力データの送信および入力データの受信の後に、前記第1の制御プログラムの実行を開始させる命令と、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、前記第1の制御プログラムの未実行の部分を実行させる命令とを含む、PLCのCPUユニット。
  2.  前記第1の制御プログラムは、実行されるごとにモータドライバに対して出力される指令値を算出するモーション演算プログラムを含み、
     前記モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする、請求項1に記載のPLCのCPUユニット。
  3.  前記第1の制御プログラムは、さらに、前記ユーザプログラムを含む、請求項2に記載のPLCのCPUユニット。
  4.  前記記憶手段は、さらに、前記制御サイクルの周期の2以上の整数倍の周期の実行サイクルが設定された第2の制御プログラムの格納に用いられ、
     前記スケジューラプログラムは、前記マイクロプロセッサに、前記制御サイクル内の前記第1の制御プログラムの終了後の期間において、前記実行サイクルに従って前記第2の制御プログラムを実行させる命令を含む、請求項1~3のいずれか1項に記載のPLCのCPUユニット。
  5.  前記記憶手段は、さらに、前記制御サイクルの周期の2以上の整数倍の周期の実行サイクルが設定された第2の制御プログラムの格納に用いられ、
     前記スケジューラプログラムは、前記マイクロプロセッサに、前記制御サイクル内の前記第1の制御プログラムの終了後の期間において、前記実行サイクルに従って前記第2の制御プログラムを実行させる命令を含み、
     前記第1の制御プログラムは、前記モーション演算プログラムを含み、
     前記第2の制御プログラムは、前記ユーザプログラムを含む、請求項2に記載のPLCのCPUユニット。
  6.  前記記憶手段は、さらに、前記第1の制御プログラムの1回の実行が継続する制御サイクル数の限度数を特定する設定内容と、前記第1の制御プログラムの1回の実行が前記限度数の制御サイクル内に終了しない場合に実行されるべき異常処理プログラムとの格納に用いられ、
     前記スケジューラプログラムは、前記第1の制御プログラムが1回の実行を継続している制御サイクルの数が前記限度数に達し、かつ、当該制御サイクル内で第1の制御プログラムの実行が終了しなかった場合に、次の制御サイクルにおいて、前記マイクロプロセッサに、第1の制御プログラムの未実行部分を実行させることなく前記異常処理プログラムを実行させる命令を含む、請求項1に記載のPLCのCPUユニット。
  7.  前記通信回路は、前記マイクロプロセッサによる制御を受けて前記出力データの送信および入力データの受信を開始するように構成されており、
     前記スケジューラプログラムは、さらに、前記通信回路に、前記制御サイクルごとに前記通信を開始させる命令を含む、請求項1に記載のPLCのCPUユニット。
  8.  前記スケジューラプログラムは、さらに、制御サイクル内に前記第1の制御プログラムの実行が終了しなかった場合は、次の制御サイクルにおいて、前記通信回路に、前記第1の制御プログラムの未実行の部分に優先して前記通信を開始させるための処理を実行させ、その後、前記マイクロプロセッサに、第1の制御プログラムの未実行の部分を実行させる命令を含む、請求項7に記載のPLCのCPUユニット。
  9.  前記制御サイクルの周期で信号を発生するタイマ回路をさらに備え、
     前記通信回路は、前記タイマ回路が発生する前記信号をトリガとして前記出力データの送信および入力データの受信を開始するように構成されている、請求項1に記載のPLCのCPUユニット。
  10.  前記マイクロプロセッサは、第1および第2のコアを含み、
     前記第1のコアは前記スケジューラプログラムを実行し、前記第2のコアは前記第1の制御プログラムを実行し、
     前記スケジューラプログラムは、前記第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、前記第1の制御プログラムの実行を中断しないことにより前記第1の制御プログラムの未実行の部分を前記マイクロプロセッサに実行させる命令を含む、請求項1、7、9のいずれか1項に記載のPLCのCPUユニット。
  11.  マイクロプロセッサと、記憶手段と、出力データの送信および入力データの受信を行う通信回路とを備え、前記通信回路による前記出力データの送信および前記入力データの受信を制御サイクルごとに繰り返すとともに、前記入力データを使用して前記出力データを生成する、前記記憶手段に格納される第1の制御プログラムの実行を繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、前記記憶手段に格納されて前記マイクロプロセッサによって実行されるためのPLC用システムプログラムであって、
     前記第1の制御プログラムの実行を制御するスケジューラプログラムと、前記制御サイクルの周期を設定するプログラムとを含み、
     前記スケジューラプログラムは、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、前記通信回路による出力データの送信および入力データの受信の後に、前記第1の制御プログラムの実行を開始させる命令と、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、前記第1の制御プログラムの未実行の部分を実行させる命令とを含む、PLC用システムプログラム。
  12.  さらに、前記第1の制御プログラムの一部または全部であり、実行されるごとにモータドライバに対して出力される指令値を算出するモーション演算プログラムを含み、
     前記モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、指令値の算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする、請求項11に記載のPLC用システムプログラム。
  13.  マイクロプロセッサと、記憶手段と、出力データの送信および入力データの受信を行う通信回路とを備え、前記通信回路による前記出力データの送信および前記入力データの受信を制御サイクルごとに繰り返すとともに、前記入力データを使用して前記出力データを生成する、前記記憶手段に格納される第1の制御プログラムの実行を繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、前記記憶手段に格納されて前記マイクロプロセッサによって実行されるためのPLC用システムプログラムを格納した記録媒体であって、
     前記第1の制御プログラムの実行を制御するスケジューラプログラムと、前記制御サイクルの周期を設定するプログラムとを含み、
     前記スケジューラプログラムは、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了した制御サイクルの次の制御サイクルにおいて、前記通信回路による出力データの送信および入力データの受信の後に、前記第1の制御プログラムの実行を開始させる命令と、
      前記マイクロプロセッサに、前記第1の制御プログラムの実行が終了しなかった制御サイクルの次の制御サイクルにおいて、前記第1の制御プログラムの未実行の部分を実行させる命令とを含む、PLC用システムプログラムを格納した記録媒体。
  14.  前記PLC用システムプログラムは、さらに、前記第1の制御プログラムの一部または全部であり、モータドライバに対して出力される指令値を算出するモーション演算プログラムを含み、
     前記モーション演算プログラムは、ユーザにおける制御目的に応じて作成されたユーザプログラムにより起動された初回の実行において、モーション指令値データの算出を開始するために必要な初期処理を実行することにより後続の実行に要する時間よりも長い実行時間を必要とする、請求項13に記載のPLC用システムプログラムを格納した記録媒体。
PCT/JP2011/056769 2011-03-15 2011-03-22 Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体 WO2012124133A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP11861122.7A EP2687927B1 (en) 2011-03-15 2011-03-22 Cpu of plc, system program for plc, and recording medium storing system program for plc
CN201180068885.3A CN103403633B (zh) 2011-03-15 2011-03-22 可编程控制器的中央处理器单元
US14/017,929 US9618922B2 (en) 2011-03-15 2013-09-04 CPU of PLC, system program for PLC, and recording medium storing system program for PLC

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2011-056767 2011-03-15
JP2011056767A JP4894961B1 (ja) 2011-03-15 2011-03-15 Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/017,929 Continuation US9618922B2 (en) 2011-03-15 2013-09-04 CPU of PLC, system program for PLC, and recording medium storing system program for PLC

Publications (1)

Publication Number Publication Date
WO2012124133A1 true WO2012124133A1 (ja) 2012-09-20

Family

ID=45907942

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2011/056769 WO2012124133A1 (ja) 2011-03-15 2011-03-22 Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体

Country Status (5)

Country Link
US (1) US9618922B2 (ja)
EP (1) EP2687927B1 (ja)
JP (1) JP4894961B1 (ja)
CN (1) CN103403633B (ja)
WO (1) WO2012124133A1 (ja)

Families Citing this family (34)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6119224B2 (ja) * 2012-12-10 2017-04-26 富士電機株式会社 診断装置、プログラマブルコントローラシステム、診断方法。
WO2015133175A1 (ja) 2014-03-04 2015-09-11 オムロン株式会社 制御システム、制御装置および制御方法
JP6626240B2 (ja) 2014-03-13 2019-12-25 オムロン株式会社 コントローラ
JP6442843B2 (ja) * 2014-03-14 2018-12-26 オムロン株式会社 制御装置
US10162328B2 (en) * 2014-03-14 2018-12-25 Omron Corporation Controller and control system
US10180674B2 (en) * 2014-03-14 2019-01-15 Omron Corporation Controller and control system
JP6338923B2 (ja) * 2014-04-30 2018-06-06 パナソニック デバイスSunx株式会社 プログラマブルコントローラ及び制御プログラム
KR101593835B1 (ko) * 2014-10-30 2016-02-12 엘에스산전 주식회사 Plc 시스템
CN105938324B (zh) 2015-03-04 2019-07-16 欧姆龙株式会社 控制装置及同步控制方法
JP2016194831A (ja) * 2015-03-31 2016-11-17 オムロン株式会社 制御装置
JP6488830B2 (ja) * 2015-03-31 2019-03-27 オムロン株式会社 制御装置
CN104932405B (zh) * 2015-05-26 2017-11-10 宝鸡石油机械有限责任公司 一种用设备虚拟样机辅助测试plc控制程序的方法
JP6520545B2 (ja) 2015-08-10 2019-05-29 オムロン株式会社 サポート装置およびサポートプログラム
KR102079499B1 (ko) * 2015-10-20 2020-02-21 엘에스산전 주식회사 Plc 위치 결정 시스템의 축별 제어주기 독립 할당 방법
KR102198204B1 (ko) * 2016-10-14 2021-01-04 미쓰비시덴키 가부시키가이샤 시뮬레이션 장치
JP6919186B2 (ja) 2016-12-14 2021-08-18 オムロン株式会社 制御システム、制御プログラムおよび制御方法
WO2018110259A1 (ja) 2016-12-14 2018-06-21 オムロン株式会社 制御装置、制御プログラムおよび制御方法
JP6792129B2 (ja) 2017-03-03 2020-11-25 株式会社安川電機 アーク溶接システム及びアーク溶接判定装置
JP6984199B2 (ja) * 2017-07-07 2021-12-17 オムロン株式会社 制御システム、および、制御方法
JP6919404B2 (ja) * 2017-08-10 2021-08-18 オムロン株式会社 制御装置
JP6806019B2 (ja) * 2017-09-26 2020-12-23 オムロン株式会社 制御装置
JP6977600B2 (ja) * 2018-02-14 2021-12-08 オムロン株式会社 制御装置、制御システム、制御方法、および、制御プログラム
JP7059673B2 (ja) * 2018-02-14 2022-04-26 オムロン株式会社 制御装置、制御システム、制御方法、および、制御プログラム
JP2019149763A (ja) 2018-02-28 2019-09-05 オムロン株式会社 データの処理方法、制御システム、制御装置
CN111788140A (zh) * 2018-03-05 2020-10-16 三菱电机株式会社 电梯安全控制装置
JP7020198B2 (ja) * 2018-03-09 2022-02-16 オムロン株式会社 制御装置および制御システム
US20210303495A1 (en) * 2018-09-13 2021-09-30 Mitsubishi Electric Corporation Setting assistance device, setting assistance method, and program
DE112018007978T5 (de) * 2018-10-15 2021-05-20 Mitsubishi Electric Corporation Programmierbare Logiksteuerung, externes Gerät, Verfahren und Programm
JP6761584B2 (ja) * 2018-10-23 2020-09-30 株式会社安川電機 産業機器の制御装置、産業機器の制御システム、及び産業機器の制御方法
JP7192427B2 (ja) * 2018-11-19 2022-12-20 オムロン株式会社 制御システムおよび制御装置
JP7251171B2 (ja) * 2019-01-30 2023-04-04 オムロン株式会社 コントローラシステム、制御ユニット、および制御プログラム
JP7003951B2 (ja) * 2019-03-14 2022-01-21 オムロン株式会社 制御システム
DE112019007840T5 (de) * 2019-11-26 2022-08-04 Mitsubishi Electric Corporation Programmierbare Steuerung
JP2022099958A (ja) 2020-12-23 2022-07-05 オムロン株式会社 制御装置、制御方法および制御プログラム

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS60101612A (ja) * 1983-11-08 1985-06-05 Toshiba Corp プログラマブルコントロ−ラ
JPH04372022A (ja) * 1991-06-20 1992-12-25 Mitsutoyo Corp 測定データ処理システム用タスクスケジューリング方法
JPH11219211A (ja) * 1998-01-30 1999-08-10 Yamazaki Mazak Corp 数値制御工作機械及びその制御方法
JP2000105604A (ja) 1998-09-29 2000-04-11 Mitsubishi Electric Corp プログラマブルコントローラのコンスタントスキャン設定時の出力間隔の一定化方法
JP2003345406A (ja) * 2002-05-29 2003-12-05 Fanuc Ltd 制御装置
JP2004038555A (ja) * 2002-07-03 2004-02-05 Toshiba Corp プログラマブルコントローラ
JP2005267335A (ja) * 2004-03-19 2005-09-29 Yokogawa Electric Corp プログラム実行処理装置
JP2006048231A (ja) * 2004-08-02 2006-02-16 Denso Wave Inc 制御装置及びコンピュータプログラム
JP2007140655A (ja) * 2005-11-15 2007-06-07 Yaskawa Electric Corp モーションコントローラ

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57152065A (en) * 1981-03-13 1982-09-20 Omron Tateisi Electronics Co Programmable logic controller
JPS63310004A (ja) * 1987-06-12 1988-12-19 Omron Tateisi Electronics Co プログラマブル・コントロ−ラ
CA2048944A1 (en) * 1990-08-31 1992-03-01 Otomar S. Schmidt Processor for a programmable controller
DE10143756A1 (de) * 2001-09-06 2003-03-27 Siemens Ag Synchronisationsverfahren und -vorrichtung
JP2006048284A (ja) * 2004-08-03 2006-02-16 Yaskawa Electric Corp プログラマブルコントローラ装置およびオプションモジュールとの同期方法
JP4791909B2 (ja) * 2006-08-21 2011-10-12 株式会社東芝 高速入出力機能を備える制御装置、及びその制御データの制御方法
US7774626B2 (en) * 2007-03-29 2010-08-10 Intel Corporation Method to control core duty cycles using low power modes
US8155769B2 (en) * 2008-03-17 2012-04-10 National Instruments Corporation Industrial control with integrated machine vision
JP2010170536A (ja) * 2008-12-26 2010-08-05 Omron Corp プログラマブル・コントローラ
JP2010198600A (ja) * 2009-02-02 2010-09-09 Omron Corp 産業用コントローラ
JP4752983B1 (ja) * 2011-03-15 2011-08-17 オムロン株式会社 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
JP4752984B1 (ja) * 2011-03-15 2011-08-17 オムロン株式会社 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS60101612A (ja) * 1983-11-08 1985-06-05 Toshiba Corp プログラマブルコントロ−ラ
JPH04372022A (ja) * 1991-06-20 1992-12-25 Mitsutoyo Corp 測定データ処理システム用タスクスケジューリング方法
JPH11219211A (ja) * 1998-01-30 1999-08-10 Yamazaki Mazak Corp 数値制御工作機械及びその制御方法
JP2000105604A (ja) 1998-09-29 2000-04-11 Mitsubishi Electric Corp プログラマブルコントローラのコンスタントスキャン設定時の出力間隔の一定化方法
JP2003345406A (ja) * 2002-05-29 2003-12-05 Fanuc Ltd 制御装置
JP2004038555A (ja) * 2002-07-03 2004-02-05 Toshiba Corp プログラマブルコントローラ
JP2005267335A (ja) * 2004-03-19 2005-09-29 Yokogawa Electric Corp プログラム実行処理装置
JP2006048231A (ja) * 2004-08-02 2006-02-16 Denso Wave Inc 制御装置及びコンピュータプログラム
JP2007140655A (ja) * 2005-11-15 2007-06-07 Yaskawa Electric Corp モーションコントローラ

Non-Patent Citations (1)

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

Also Published As

Publication number Publication date
CN103403633B (zh) 2016-08-10
US9618922B2 (en) 2017-04-11
JP2012194663A (ja) 2012-10-11
EP2687927B1 (en) 2016-10-19
US20140012402A1 (en) 2014-01-09
JP4894961B1 (ja) 2012-03-14
EP2687927A1 (en) 2014-01-22
EP2687927A4 (en) 2014-10-15
CN103403633A (zh) 2013-11-20

Similar Documents

Publication Publication Date Title
JP4894961B1 (ja) Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体
JP6540166B2 (ja) 制御装置
JP4752984B1 (ja) Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
US9618924B2 (en) CPU of PLC, system program for PLC, and recording medium storing system program for PLC
JP5099251B1 (ja) Plcのcpuユニット、plc用のシステムプログラム、plc用のシステムプログラムを格納した記録媒体、plcシステム、plcサポート装置、plcサポートプログラム、および、plcサポートプログラムを格納した記録媒体
JP4877423B1 (ja) Plcのcpuユニット、plc用システムプログラムおよびplc用システムプログラムを格納した記録媒体
JP6488830B2 (ja) 制御装置
WO2012124143A1 (ja) 演算ユニット、支援装置、出力制御方法、表示制御方法、およびプログラム
US8504176B2 (en) CPU unit of PLC, system program for PLC, and recording medium storing system program for PLC
JP6299064B2 (ja) 制御装置、制御方法、およびプログラム
JP6729746B2 (ja) 制御装置
JP2016194831A (ja) 制御装置
CN110192159B (zh) 控制装置
JP2012194667A (ja) Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
US9568905B2 (en) CPU of PLC, system program for PLC, and recording medium storing system program for PLC
JP2012194955A (ja) 支援装置、表示制御方法、およびプログラム
JP2012194954A (ja) Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体

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: 11861122

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2011861122

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2011861122

Country of ref document: EP