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

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

Info

Publication number
WO2012124136A1
WO2012124136A1 PCT/JP2011/056772 JP2011056772W WO2012124136A1 WO 2012124136 A1 WO2012124136 A1 WO 2012124136A1 JP 2011056772 W JP2011056772 W JP 2011056772W WO 2012124136 A1 WO2012124136 A1 WO 2012124136A1
Authority
WO
WIPO (PCT)
Prior art keywords
control program
state
referrer
buffer
execution
Prior art date
Application number
PCT/JP2011/056772
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 CN201180068881.5A priority Critical patent/CN103403684B/zh
Priority to EP11860793.6A priority patent/EP2672384B1/en
Publication of WO2012124136A1 publication Critical patent/WO2012124136A1/ja
Priority to US14/017,904 priority patent/US9618924B2/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/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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • 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/13005Subroutine
    • 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/13067Use of variables, symbols in instructions, to indicate mechanisms, interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/52Indexing scheme relating to G06F9/52
    • G06F2209/523Mode

Definitions

  • the present invention relates to synchronization of global variables when a plurality of control programs are executed in a PLC (Programmable Logic Controller, also referred to as a programmable controller) used for controlling operations of machines, facilities, and the like.
  • PLC Process Control Controller
  • the PLC is, for example, a CPU (Central Processing Unit) unit with a microprocessor that executes a control program, 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 multiple units.
  • the CPU unit controls the controlled object by repeatedly transmitting output data to other units, receiving input data from other units, and executing a control program that generates output data using the input data.
  • the control program includes a user program created according to the control purpose of the user.
  • the control program may include a motion control program to be executed in the user program.
  • Patent Document 1 Japanese Patent Laid-Open No. 2007-140655
  • a device that processes a motion control function for controlling a motor and a PLC function for executing a sequence operation with one CPU every cycle of a basic clock is disclosed.
  • a global variable referred to by a plurality of control programs may be required in addition to a local variable used by each control program only for its own processing.
  • control program From the start to the end of execution of one control program, the control program can obtain the same contents no matter how many times the same global variable is referenced unless it rewrites the contents of the global variable itself. Should. However, if another control program rewrites the contents of the global variable between the start and end of the execution of the control program, the control program cannot perform a consistent operation using the global variable.
  • control program itself copies the contents of the global variable to its own local variable before using the global variable, and the actual calculation is performed by referring to the local variable.
  • the control program when rewriting a global variable, it may be possible to wait until a timing at which rewriting is not inconvenient for other control programs before executing the rewriting. In order to do so, the creator of the control program must determine the procedure for using the global variable and program accordingly, so that such processing is performed, which is a burden on the creator of the control program. It becomes.
  • the present invention does not require the control program itself to process a procedure for ensuring the consistency of global variables in a PLC, and does not prevent parallel execution of a plurality of control programs.
  • the goal is to be able to reference a consistent global variable.
  • a PLC CPU unit for controlling a controlled object.
  • the CPU unit of the PLC includes a microprocessor, storage means, and a communication circuit.
  • the CPU unit of the PLC is configured to control an object to be controlled by repeating transmission of output data, reception of input data, and execution of a control program that generates output data using the input data.
  • the storage means is used for storing a control program, a system program for controlling the execution of the control program, and attribute data for variables used by the control program.
  • the microprocessor executes a system program and a control program stored in the storage means.
  • the communication circuit transmits output data and receives input data.
  • the attribute data specifies one owner-side control program that can rewrite the variable and one or more referers that can only refer to the variable.
  • Side control program designation The system program prepares a global variable area for storing global variables in the storage means as a control program execution preparation process, and for each global variable referred to by the referrer-side control program for each referrer-side control program.
  • the referrer-side control program generates a synchronization buffer in the storage means as a reference destination instead of the global variable area when referring to the global variable.
  • the system program includes, as control program execution control processing, an owner-side start process for starting execution of the owner-side control program, and a global variable that is rewritten by the owner-side control program when execution of the owner-side control program ends. To the synchronous buffer corresponding to the global variable, and referrer side start processing for starting execution of the referrer side control program.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the first synchronization buffer and the second synchronization buffer are either one of a write destination state in which a global variable can be copied from a global variable area and a reference destination state in which a reference can be referenced from a referrer-side control program. The state is given without overlapping.
  • the copy process is a process of copying to the synchronous buffer that is in the write destination state.
  • the process of generating the synchronization buffer includes, for each referrer side control program, a first synchronization buffer, a second synchronization buffer, and a third synchronization buffer for each global variable referenced from the referrer side control program. Is generated as a set of synchronization buffers.
  • the first synchronization buffer, the second synchronization buffer, and the third synchronization buffer are given without any overlap of the write destination state, the reference destination state, and the standby state.
  • the copy process further includes a first replacement process for exchanging the write destination state and the standby state of the synchronous buffer that is in the standby state within the same set as the synchronous buffer that is the write destination state that is the copy destination and the synchronous buffer. including.
  • the referrer-side start processing is further performed with respect to the synchronization buffer of the referrer-side control program to be executed, on the condition that the synchronization buffer storing the latest data is in a standby state, It includes a second replacement process for switching a standby state and a reference destination state of a certain synchronization buffer.
  • the system program further generates a latest data update flag in the storage unit for each combination of the owner side control program and the referrer side control program related by the global variable.
  • the copy process further includes a process of turning on the latest data update flag related to the copy process.
  • the referrer side start process further includes a process for turning off the second replacement process and the latest data update flag on condition that the latest data update flag related to the synchronization buffer of the referrer side control program to be started is on. Including. This implements the second replacement process that is executed on condition that the synchronous buffer storing the latest data is in a standby state.
  • the system program further includes a process for generating a latest state recording area in the storage means as a control program execution preparation process.
  • the copy processing further includes processing for recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process further includes a second replacement process that is executed on condition that the synchronization buffer that is the latest state specified by the contents of the latest state recording area is in the standby state.
  • the referrer-side start processing is further performed in the write-destination state on the condition that the synchronization buffer storing the latest data is in the write-destination state for the sync buffer of the referrer-side control program to be started. It includes a third replacement process for switching the write destination state and the reference destination state of a certain synchronization buffer and the reference buffer state synchronization buffer.
  • the system program further generates a latest data update flag in the storage unit for each combination of the owner-side control program and the referrer-side control program related by the global variable as the control program execution preparation process.
  • the copy process further includes a process of turning on the latest data update flag related to the copy process.
  • the referrer-side start process further includes a third replacement process and a process for turning off the latest data update flag on condition that the latest data update flag related to the synchronization buffer of the referrer-side control program to be started is on. Including. This implements the third replacement process executed on condition that the synchronous buffer storing the latest data is in the write destination state.
  • the system program further includes a process for generating a latest state recording area in the storage means as a control program execution preparation process.
  • the copy processing further includes processing for recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process further includes a third replacement process that is executed on condition that the synchronous buffer that is the latest state specified by the contents of the latest state recording area is in the write destination state.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the system program further includes processing for generating the latest state recording area in the storage means as control program execution preparation processing.
  • the copy processing further includes processing for recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process further includes a process of setting a synchronization buffer that is the latest state specified by the contents of the latest-state recording area to a reference destination state that is referred to in the execution of the referrer-side control program.
  • the first synchronization buffer, the second synchronization buffer, and the third synchronization buffer are synchronized for each global variable referenced from the referrer side control program. Is generated as a set.
  • any of the write destination state, the reference destination state, and the standby state in which the global variable can be copied from the global variable area does not overlap. It is given to.
  • the copy process is a process of copying to the synchronous buffer that is in the write destination state, and further, the synchronous buffer that is the write destination state that is the copy destination and the synchronization that is in the standby state in the same set as the synchronous buffer.
  • a first replacement process for switching between the write destination state and the standby state of the buffer is included.
  • the referrer-side start process further includes a process for setting a synchronization buffer that belongs to the same set as the reference buffer in the reference destination state and is not in the write destination state to a standby state.
  • any one of a write destination state and a reference destination state in which a global variable can be copied from the global variable area does not overlap. It is given.
  • the copy process is a process of copying to the synchronous buffer that is in the write destination state.
  • the referrer-side start process further includes a process of setting the other synchronization buffer belonging to the same set as the synchronization buffer to be referred to as the reference destination state to the write destination state.
  • the referrer-side start process further includes a process of setting the synchronization buffer which is the latest state specified by the contents of the latest state recording area to the write-inhibited state.
  • the system program further includes a write prohibition canceling process for canceling the write prohibition state of the synchronous buffer that was in the write prohibition state when the execution of the referrer side control program is completed as the execution control process of the control program.
  • the copy process is a process of copying using any one of the first synchronization buffer and the second synchronization buffer that is not in the write protected state as a copy destination.
  • the referrer-side start process further includes a process of setting a synchronous buffer referred to in the execution to a write-inhibited state.
  • the system program further includes a write prohibition canceling process for canceling the write prohibition state of the synchronous buffer that was in the write prohibition state when the execution of the referrer side control program is completed as the execution control process of the control program.
  • the copy process is a process that is executed on condition that the synchronous buffer at the copy destination is not in a write-protected state.
  • the process of generating a synchronization buffer is a process of generating one synchronization buffer for each global variable referenced from the referrer-side control program for each referrer-side control program.
  • the process for generating a synchronization buffer generates, for each referrer-side control program, a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program. It is processing.
  • the system program further includes processing for generating the latest state recording area in the storage means as control program execution preparation processing.
  • the copy process is a process of copying one of the first synchronization buffer and the second synchronization buffer that is not in a write-protected state as a copy destination, and the copy destination synchronization buffer is in the latest state. This includes a process of recording this in the latest state recording area.
  • the referrer-side start process further includes a process of setting a synchronization buffer that is the latest state specified by the contents of the latest-state recording area to a reference destination state that is referred to in the execution of the referrer-side control program.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the second synchronization buffer is a synchronization buffer that is referred to when the referrer-side control program refers to a global variable.
  • the copy process is a process for copying to the first synchronization buffer.
  • the referrer side start process further includes a process of copying the data stored in the first synchronization buffer to the second synchronization buffer.
  • a control program that includes a microprocessor, storage means, and a communication circuit, and that transmits output data, receives input data, and generates output data using the input data.
  • a system program for PLC to be stored in a storage unit and executed by a microprocessor.
  • the storage means is used for storing a control program, a system program for controlling the execution of the control program, and attribute data for variables used by the control program.
  • the microprocessor executes a control program in addition to the system program.
  • the communication circuit transmits output data and receives input data.
  • the attribute data specifies one owner-side control program that can rewrite the variable and one or more referers that can only refer to the variable.
  • Side control program designation The system program is referred to by the referrer-side control program as to the microprocessor as a control program execution preparation process for generating a global variable area for storing a global variable in the storage means and each referrer-side control program.
  • the referrer-side control program refers to the global variable, a process of generating a synchronization buffer in the storage means as a reference destination instead of the global variable area is executed.
  • the system program is a global variable that is rewritten by the owner-side control program when the owner-side start program is executed, and when the owner-side control program finishes executing, as the execution control process of the control program. Is copied from the global variable area to the synchronization buffer corresponding to the global variable, and the referrer side start process for starting execution of the referrer side control program is executed.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the first synchronization buffer and the second synchronization buffer are either one of a write destination state in which a global variable can be copied from a global variable area and a reference destination state in which a reference can be referenced from a referrer-side control program. The state is given without overlapping.
  • the copy process is a process of copying to the synchronous buffer that is in the write destination state.
  • the process of generating the synchronization buffer includes, for each referrer side control program, a first synchronization buffer, a second synchronization buffer, and a third synchronization buffer for each global variable referenced from the referrer side control program. Is generated as a set of synchronization buffers.
  • the first synchronization buffer, the second synchronization buffer, and the third synchronization buffer are given without any overlap of the write destination state, the reference destination state, and the standby state.
  • the copy process further includes a first replacement process for exchanging the write destination state and the standby state of the synchronous buffer that is in the standby state within the same set as the synchronous buffer that is the write destination state that is the copy destination and the synchronous buffer. including.
  • the referrer-side start processing is further performed with respect to the synchronization buffer of the referrer-side control program to be executed, on the condition that the synchronization buffer storing the latest data is in a standby state, It includes a second replacement process for switching a standby state and a reference destination state of a certain synchronization buffer.
  • the referrer-side start processing is further performed in the write-destination state on the condition that the synchronization buffer storing the latest data is in the write-destination state for the sync buffer of the referrer-side control program to be started. It includes a third replacement process for switching the write destination state and the reference destination state of a certain synchronization buffer and the reference buffer state synchronization buffer.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the system program causes the microprocessor to further execute a process for generating the latest state recording area in the storage means as the execution preparation process of the control program.
  • the copy processing further includes processing for recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process further includes a process of setting a synchronization buffer that is the latest state specified by the contents of the latest-state recording area to a reference destination state that is referred to in the execution of the referrer-side control program.
  • the referrer-side start process further includes a process of setting a synchronous buffer referred to in the execution to a write-inhibited state.
  • the system program causes the microprocessor to execute a control program execution control process. Further, when the execution of the referrer-side control program ends, the write prohibition release process for canceling the write prohibition state of the synchronous buffer that was in the write prohibition state. Is executed.
  • the copy process is a process that is executed on condition that the synchronous buffer at the copy destination is not in a write-protected state.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the second synchronization buffer is a synchronization buffer that is referred to when the referrer-side control program refers to a global variable.
  • the copy process is a process for copying to the first synchronization buffer.
  • the referrer side start process further includes a process of copying the data stored in the first synchronization buffer to the second synchronization buffer.
  • a control program including a microprocessor, a storage unit, and a communication circuit, which transmits output data, receives input data, and generates output data using the input data.
  • a PLC CPU unit that controls a control object by repeating the execution of the above
  • a recording medium storing a PLC system program to be stored in a storage unit and executed by a microprocessor is provided.
  • the storage means is used for storing a control program, a system program for controlling the execution of the control program, and attribute data for variables used by the control program.
  • the microprocessor executes a control program in addition to the system program.
  • the communication circuit transmits output data and receives input data.
  • the attribute data specifies one owner-side control program that can rewrite the variable and one or more referers that can only refer to the variable.
  • Side control program designation The system program is referred to by the referrer-side control program as to the microprocessor as a control program execution preparation process for generating a global variable area for storing a global variable in the storage means and each referrer-side control program.
  • the referrer-side control program refers to the global variable, a process of generating a synchronization buffer in the storage means as a reference destination instead of the global variable area is executed.
  • the system program is a global variable that is rewritten by the owner-side control program when the owner-side start program is executed, and when the owner-side control program finishes executing, as the execution control process of the control program. Is copied from the global variable area to the synchronization buffer corresponding to the global variable, and the referrer side start process for starting execution of the referrer side control program is executed.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the first synchronization buffer and the second synchronization buffer are either one of a write destination state in which a global variable can be copied from a global variable area and a reference destination state in which a reference can be referenced from a referrer-side control program. The state is given without overlapping.
  • the copy process is a process of copying to the synchronous buffer that is in the write destination state.
  • the process of generating the synchronization buffer includes, for each referrer side control program, a first synchronization buffer, a second synchronization buffer, and a third synchronization buffer for each global variable referenced from the referrer side control program. Is generated as a set of synchronization buffers.
  • the first synchronization buffer, the second synchronization buffer, and the third synchronization buffer are given without any overlap of the write destination state, the reference destination state, and the standby state.
  • the copy process further includes a first replacement process for exchanging the write destination state and the standby state of the synchronous buffer that is in the standby state within the same set as the synchronous buffer that is the write destination state that is the copy destination and the synchronous buffer. including.
  • the referrer-side start processing is further performed with respect to the synchronization buffer of the referrer-side control program to be executed, on the condition that the synchronization buffer storing the latest data is in a standby state, It includes a second replacement process for switching a standby state and a reference destination state of a certain synchronization buffer.
  • the referrer-side start processing is further performed in the write-destination state on the condition that the synchronization buffer storing the latest data is in the write-destination state for the sync buffer of the referrer-side control program to be started. It includes a third replacement process for switching the write destination state and the reference destination state of a certain synchronization buffer and the reference buffer state synchronization buffer.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the system program causes the microprocessor to further execute a process for generating the latest state recording area in the storage means as the execution preparation process of the control program.
  • the copy processing further includes processing for recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process further includes a process of setting a synchronization buffer that is the latest state specified by the contents of the latest-state recording area to a reference destination state that is referred to in the execution of the referrer-side control program.
  • the referrer-side start process further includes a process of setting a synchronous buffer referred to in the execution to a write-inhibited state.
  • the system program causes the microprocessor to execute a control program execution control process. Further, when the execution of the referrer-side control program ends, the write prohibition release process for canceling the write prohibition state of the synchronous buffer that was in the write prohibition state. Is executed.
  • the copy process is a process that is executed on condition that the synchronous buffer at the copy destination is not in a write-protected state.
  • the process of generating a synchronization buffer is a process of generating a first synchronization buffer and a second synchronization buffer as a set of synchronization buffers for each global variable referenced from the referrer-side control program for each referrer-side control program. It is.
  • the second synchronization buffer is a synchronization buffer that is referred to when the referrer-side control program refers to a global variable.
  • the copy process is a process for copying to the first synchronization buffer.
  • the referrer side start process further includes a process of copying the data stored in the first synchronization buffer to the second synchronization buffer.
  • a plurality of control programs can refer to global variables in which consistency is ensured. At this time, it is not necessary for the control program itself to perform a procedure for ensuring the consistency of the global variables. In addition, the time-sharing or parallel execution of a plurality of control programs is not hindered due to waiting for release of access rights to global variables over a long period of time.
  • FIG. 6 is a sequence diagram illustrating an execution operation according to Embodiment 1.
  • FIG. 7 is an enlarged sequence diagram showing control cycles 1 and 2 shown in FIG. 6.
  • 3 is a flowchart showing an execution operation according to the first embodiment.
  • FIG. 10 is a sequence diagram showing another execution operation according to the first embodiment. 6 is a flowchart showing another execution operation according to the first embodiment. 10 is a sequence diagram illustrating an execution operation according to Embodiment 2.
  • FIG. 10 is a flowchart showing an execution operation according to the second embodiment.
  • FIG. 10 is a sequence diagram showing another execution operation according to the second embodiment.
  • 10 is a flowchart showing another execution operation according to the second embodiment.
  • FIG. 10 is a sequence diagram showing an execution operation according to the third embodiment. 10 is a flowchart showing an execution operation according to the third embodiment.
  • FIG. 10 is a flowchart showing another execution operation according to the third embodiment.
  • FIG. 10 is a flowchart showing another execution operation according to the third embodiment.
  • FIG. 10 is a flowchart showing another execution operation according to the third embodiment.
  • FIG. 10 is a sequence diagram illustrating an execution operation in a multi-core microprocessor according to a third embodiment.
  • FIG. 10 is a sequence diagram illustrating an execution operation in a multi-core microprocessor according to a third embodiment.
  • 10 is a flowchart showing an execution operation according to the third embodiment.
  • FIG. 10 is a sequence diagram illustrating another execution operation in the multi-core microprocessor according to the third embodiment.
  • 10 is a flowchart showing another execution operation according to the third embodiment.
  • FIG. 10 is a sequence diagram illustrating an execution operation in a multi-core microprocessor according to Embodiments 4 and 5.
  • FIG. 10 is a sequence diagram illustrating an execution operation in a multi-core microprocessor according to Embodiments 4 and 5.
  • FIG. 10 is a flowchart showing an execution operation according to the fourth embodiment.
  • FIG. 10 is a sequence diagram showing another execution operation in the multi-core microprocessor according to the fourth and fifth embodiments.
  • 10 is a flowchart showing another execution operation according to the fourth embodiment.
  • 10 is a flowchart showing an execution operation according to the fifth embodiment.
  • 10 is a flowchart showing another execution operation according to the fifth embodiment.
  • FIG. 10 is a sequence diagram showing an execution operation in a multi-core microprocessor according to the sixth and seventh embodiments.
  • FIG. 10 is a sequence diagram showing an execution operation in a multi-core microprocessor according to the sixth and seventh embodiments.
  • 18 is a flowchart showing an execution operation according to the sixth embodiment.
  • FIG. 10 is a sequence diagram showing another execution operation in the multi-core microprocessor according to the fourth and fifth embodiments.
  • 10 is a flowchart showing another execution operation according to the fifth embodiment.
  • FIG. 10 is a sequence diagram showing an execution operation
  • 16 is a sequence diagram illustrating another execution operation in the multi-core microprocessor according to the sixth embodiment.
  • 18 is a flowchart showing another execution operation according to the sixth embodiment.
  • 18 is a flowchart showing an execution operation according to the seventh embodiment.
  • 18 is a flowchart showing another execution operation according to the seventh embodiment.
  • It is a schematic diagram which shows the hardware constitutions of the PLC support apparatus used by connecting with the CPU unit which concerns on embodiment of this invention.
  • It is a schematic diagram which shows the software structure of the PLC support apparatus used by connecting with the CPU unit which concerns on embodiment of this invention.
  • the PLC according to the present embodiment controls a control target such as a machine or equipment.
  • the PLC according to the present embodiment includes a CPU unit as its component.
  • the CPU unit includes a microprocessor, storage means, and a communication circuit.
  • the storage means is used for storing control data, a system program that controls execution of the program, and attribute data for variables used by the control program.
  • the microprocessor executes a system program and a control program stored in the storage means.
  • the communication circuit transmits output data and receives input data.
  • the attribute data specifies one owner-side control program that can rewrite the variable and one or more referers that can only refer to the variable. Side control program specification can be included.
  • 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 microprocessor 100 is assumed to be a single core when it is not explicitly stated that it is a multi-core.
  • Multi-core means that the number of cores is 2 or more (including the case where the number of cores is 2).
  • 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 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 real-time OS 200 provides an environment for switching and executing a plurality of programs over time.
  • a control cycle start interrupt is generated as an event (interrupt) for outputting (transmitting) output data generated by program execution of the CPU unit 13 to another unit or another device. Initially set.
  • the real-time OS 200 switches the execution target in the microprocessor 100 from the program being executed at the time of occurrence of the interrupt 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 include not only an area for storing the program itself but also an area 1041a for storing attribute data of variables used by the program for execution.
  • the variable is a global variable that is referenced from a plurality of control programs
  • the variable attribute data is one or more that can be specified by one owner-side control program that can rewrite the variable and can only refer to the variable. Designation of the referrer side control program.
  • control program work area 1042 In the control program work area 1042, a global variable area 1042 a and a synchronization buffer area 1042 b are generated by the system program 210 in addition to the local variable area of each control program 230.
  • the control program work area 1042 stores output data created by executing the control program 230 and input data referred to by the control program.
  • 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.
  • Access is for data transfer between the buffer memory 146 in the field network reception buffer 1046 and the field network controller 140, to the field network transmission buffer 1045 and / or the field network reception buffer 1046 in the main memory 104.
  • ⁇ E. Overall processing of system program> Next, the overall processing operation of the system program 210 will be described.
  • the execution preparation process of the control program 230 and the execution control process of the control program 230 are sequentially executed. More specifically, the system program 210 includes the following processes (1) and (2) as an execution preparation process for the control program 230.
  • Processing to generate a global variable area for storing global variables in the storage means (2) For each referrer-side control program, the referrer-side control program is global for each global variable referenced from the referrer-side control program. Processing for generating in the storage means a synchronization buffer to be referred to instead of the global variable area when referring to a variable. Further, the execution preparation processing of the control program 230 includes other execution preparation processing according to a specific implementation. Can be included.
  • the system program 210 includes the following processes (3) to (5) as the execution control process of the control program 230.
  • Owner-side start processing for starting execution of the owner-side control program (4) When execution of the owner-side control program ends, a global variable that is rewritten by the owner-side control program is synchronized from the global variable area to the global variable. Copy processing to copy to buffer (5) Referrer side start processing to start execution of referrer side control program Further, the execution control processing of the control program 230 may include other execution control processing according to a specific implementation form.
  • FIG. 5 is a flowchart showing the overall processing of the system program in the CPU unit according to the embodiment of the present invention.
  • the execution preparation process of the control program 230 is executed (step S1), and then the execution control process of the control program 230 is executed (step S2).
  • the execution order of each process included in the execution preparation process (step S1) of the control program 230 is appropriately designed.
  • each process included in the execution control process (step S2) of the control program 230 is repeatedly executed as the control program 230 is repeatedly executed, and the execution order depends on a specific implementation form. To do.
  • control program 1 The control program with the higher execution priority and shorter execution cycle is the owner of the global variable
  • control programs 1 to 3 a plurality of control programs having different execution priorities and execution cycle lengths are executed.
  • the execution priority of the control program is higher than that of the other control programs 2 and 3
  • the execution cycle of the control program 1 is shorter than that of the other control programs 2 and 3.
  • the control program 1 with the shorter execution cycle is set as the global variable owner (owner-side control program), and the control programs 2 and 3 are set as the global variable referrer (referrer-side control program).
  • FIG. 6 is a sequence diagram showing an execution operation according to the first embodiment. Referring to FIG. 6, control programs 1 to 3 are executed.
  • FIG. 7 is an enlarged sequence diagram showing control cycles 1 and 2 shown in FIG.
  • FIG. 8 is a flowchart showing an execution operation according to the first embodiment.
  • the broken-line rounded rectangles shown along the time axes of the control programs 1 to 3 in FIG. 6 indicate the execution cycle of the corresponding control program.
  • the control program 1 uses one control cycle as an execution cycle, and similarly, the control programs 2 and 3 use two and four control cycles as execution cycles, respectively.
  • execution cycles are represented in the same manner.
  • solid horizontal arrows in FIG. 6 indicate data exchange, and the numbers shown in association with the arrows indicate which control cycle state the corresponding data reflects.
  • an arrow to which (1) is assigned indicates that data generated by executing the control program in the control cycle 1 is exchanged.
  • the execution cycle is expressed in the same manner in the sequence diagrams used for the description.
  • control program 1 since the control program 1 is the owner of the global variable, the control program 1 writes the execution result and the like in the global variable area 1 in the global variable area 1042a.
  • control programs 2 and 3 set in the referrer-side control program execute processing with reference to data stored in the corresponding synchronization buffers 2 and 3 in the synchronization buffer area 1042b.
  • the execution result or the like may be written in the corresponding synchronization buffers 2 and 3, respectively.
  • the data in the synchronization buffers 2 and 3 is kept synchronized with the global variable area 1 according to a procedure described later.
  • Such an execution state is represented by recording the execution state of each control program in the execution state recording area.
  • the execution state recording area is generated in the control program work area 1042 in the main memory 104 by the system program 210 in “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording the execution state can be determined as appropriate. For example, for each execution state, information for identifying a control program in the execution state (such as the name and identification number of the control program) is recorded, and a flag or state variable indicating the execution state is provided for each control program. A mode of recording using the value of the state variable can be employed.
  • the execution state flag is used, for example, such as “before execution” state if “pre-execution flag” is on, “in execution” state if “in-execution flag” is on.
  • Such an execution state variable can be set, for example, “before execution” if the value of the state variable is “1”, “in execution” if the value of “2”, and the like. The same applies to the management of the execution state of the control program in other embodiments described below.
  • FIG. 7 is an enlarged view of the execution operations in the control cycles 1 and 2 in the sequence diagram shown in FIG. FIG. 7 also shows the system program 210 in order to explain the execution operation in the CPU unit 13 in more detail.
  • the system program 210 mainly indicates a time during which the scheduler program 212, the output processing program 214, and the input processing program 216 operate.
  • the output processing program 214 and the input processing program 216 are executed at the beginning time of each control cycle (the time before the execution of the control program 1 in FIG. 7) by the execution control performed by the scheduler program 212.
  • Each control cycle shown in FIGS. 6 and 7 is started when an interrupt signal for starting a control cycle generated by the system timer 108 is input to the microprocessor 100. If there is an interrupt for starting the control cycle, the real-time OS 200 interrupts the execution of the control program being executed and causes the microprocessor 100 to execute the system program 210 (scheduler program 212).
  • the microprocessor 100 executes an execution preparation process for the control program 230 in the system program 210 (step S1). Subsequently, the microprocessor 100 executes an execution control process of the control program 230 in the system program 210 (step S2 shown in FIG. 5). A detailed example of the execution control process of the control program 230 corresponds to steps S200 to S270.
  • the microprocessor 100 waits for an interrupt signal for starting a control cycle (step S200).
  • the microprocessor 100 sets the control program starting from the current control cycle to the “before execution” state. That is, when the execution cycle of the control program 1 starts from the current control cycle, the control program 1 is set to the “before execution” state.
  • the control program 2 starts from the current control cycle, the control program 2 is set to the “before execution” state.
  • the control program 3 is set to the “before execution” state (step S202).
  • the microprocessor 100 executes the IO processing program 218 (the output processing program 214 and the input processing program 216) in the system program 210 (step S204).
  • the microprocessor 100 determines the execution state of the control program 1 (owner side control program) (step S210).
  • the control program 1 owner-side control program
  • the microprocessor 100 sets the execution state of the control program 1 to the “in execution” state.
  • execution of the control program 1 is started (step S212).
  • control program 1 owner-side control program
  • execution in step S210
  • the microprocessor 100 starts executing the unexecuted portion of the control program 1 (step S210). S214).
  • control program 1 owner-side control program
  • step S212 After the execution of the control program 1 is started in step S212 or step S214, the microprocessor 100 determines whether or not an execution end notification of the control program 1 has been received (step S216).
  • step S228 determines whether or not a control cycle start interrupt signal has been received.
  • the processes in and after step S202 are repeated. That is, if a control cycle start interrupt occurs before receiving an execution end notification of the control program 1, the execution of the control program 1 is temporarily suspended, and the control program 1 is not executed after the IO processing program is executed in the next control cycle. Part is executed.
  • FIGS. 6 and 7 show a case where the execution cycle of the control program 1 is equal to the control cycle, and the control program 1 is programmed so as to include only the processing amount to be completed in the control cycle.
  • the execution cycle of the control program 1 is extended. That is, the execution of the control program 1 is interrupted, and the unexecuted portion of the control program 1 is executed in the next control cycle.
  • error processing may be performed by determining that an error has occurred at a stage where the execution of the control program 1 has not ended within the control cycle (execution cycle).
  • execution cycle is extended or error processing is similarly performed.
  • the interrupt signal for starting the control cycle has not been received (NO in step S218), the processes in and after step S216 are repeated.
  • the processing of the interrupt signal at the start of the control cycle is expressed in this way for convenience in the flowchart of the system program 210.
  • the microprocessor 100 does not execute the loop of steps S216 and S218, but the control program.
  • the system program 210 is not executed from the start to the end of execution of No. 1. If there is an interrupt for starting a control cycle until the execution of the control program 1 is completed, the real-time OS 200 interrupts the execution of the control program 1 and causes the system program 210 to be executed from step S202.
  • step S216 when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state and the global variable area 1 Is stored in the synchronous buffer 2 and the synchronous buffer 3 (step S220).
  • the copying operation of the data stored in the global variable area 1 to the synchronous buffer 2 and the synchronous buffer 3 is indicated by solid arrows in FIGS.
  • step S230 the microprocessor 100 determines the execution state of the control program 2 (referrer-side control program) (step S230).
  • the control program 2 (referrer-side control program) is in the “pre-execution” state (“pre-execution” in step S230)
  • the microprocessor 100 sets the corresponding synchronization buffer 2 to the “write prohibited” state.
  • the execution state of the control program 2 is set to the “running” state, and the execution of the control program 2 is started (step S232).
  • control program 2 (referrer-side control program) is in the “execution” state (“execution” in step S230)
  • the microprocessor 100 starts executing an unexecuted portion of the control program 2 (step S230). S234).
  • the “write prohibition” state of the corresponding synchronization buffer 2 is not released and is maintained as it is.
  • control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230), the process proceeds to step S250.
  • step S232 After the execution of the control program 2 is started in step S232 or step S234, the microprocessor 100 determines whether or not an execution end notification of the control program 2 has been received (step S236).
  • step S236 determines whether or not an interrupt signal for starting the control cycle has been received. If an interrupt signal for starting a control cycle is received (YES in step S238), the processing in step S202 and subsequent steps is repeated. On the other hand, if the interrupt signal for starting the control cycle has not been received (NO in step S238), the processes in and after step S236 are repeated.
  • step S236 when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state and the corresponding synchronization buffer. 2 is canceled (step S240).
  • the period during which the synchronous buffer 2 is in the “write-inhibited” state is indicated by broken-line arrows in FIGS. 6 and 7.
  • step S250 the microprocessor 100 determines the execution state of the control program 3 (referrer-side control program) (step S250).
  • the control program 3 (referrer-side control program) is in the “pre-execution” state (“pre-execution” in step S250)
  • the microprocessor 100 sets the corresponding synchronization buffer 3 to the “write prohibited” state.
  • the execution state of the control program 3 is set to the “running” state, and the execution of the control program 3 is started (step S252).
  • control program 3 (referrer-side control program) is in the “execution” state (“execution” in step S250)
  • the microprocessor 100 starts executing an unexecuted portion of the control program 3 (step S250). S254).
  • the “write-inhibited” state of the corresponding synchronization buffer 3 is not released and is maintained as it is.
  • control program 3 (referrer-side control program) is in the “execution end” state (“execution end” in step S250), the process proceeds to step S270.
  • step S252 After the execution of the control program 3 is started in step S252 or step S254, the microprocessor 100 determines whether or not the execution end notification of the control program 3 has been received (step S256).
  • step S258 determines whether or not a control cycle start interrupt signal has been received. If the interrupt signal for starting the control cycle is received (YES in step S258), the processes in and after step S202 are repeated. On the other hand, if the interrupt signal for starting the control cycle has not been received (NO in step S258), the processes in and after step S256 are repeated.
  • step S256 when the execution end notification of the control program 3 is received (YES in step S256), the microprocessor 100 sets the execution state of the control program 3 to the “execution end” state and the corresponding synchronization buffer. 3 is canceled (step S260).
  • the period during which the synchronization buffer 3 is in the “write-inhibited” state is indicated by broken-line arrows in FIGS. 6 and 7.
  • step S270 a control cycle start interrupt signal is awaited (step S270).
  • the interrupt signal for starting the control cycle is received (YES in step S270)
  • the processes in and after step S202 are executed again.
  • the copy processing of these global variables from the global variable area to the synchronization buffer of the referrer-side control program is performed all at once. Done.
  • the synchronization buffers are grouped in units in which the copy process is performed collectively.
  • the write-inhibited state of the synchronous buffer is set in common for the synchronous buffers in the same group.
  • the fact that the state of the synchronization buffer is set in common to the synchronization buffers of the same group is referred to as the “write inhibit” state, “write destination” state, “ The same applies to any of the “reference destination” state, the “standby” state, and the “latest” state.
  • the write-inhibited state of the synchronization buffer as described above is represented by recording that the synchronization buffer is in the “write-inhibited” state in the write-inhibited state recording area.
  • the write prohibition state recording area is generated by the system program 210 in the control program work area 1042 in the main memory 104 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the “write-inhibited” state can be determined as appropriate.
  • a mode of recording information (such as an identification number of a group of synchronization buffers) that identifies a group of synchronization buffers grouped in a unit in which a copy process is performed in a “write prohibited” state
  • a mode in which a flag or a state variable indicating whether or not it is in a “write-inhibited” state is provided for each group of such synchronous buffers, and recording is performed using the value of the flag or the state variable can be employed. The same applies to the management of the execution state of the control program in other embodiments described below.
  • control program 1 set in the global variable referrer (referrer-side control program) has a higher execution priority and a shorter execution cycle
  • the global variable owner owner It is assumed that the control program 2 set in the (side control program) has a lower execution priority and a longer execution cycle.
  • FIG. 9 is a sequence diagram showing another execution operation according to the first embodiment.
  • the control program 2 since the control program 2 is the owner of the global variable, the control program 2 writes the execution result and the like in the global variable area 2 in the global variable area 1042a.
  • the control program 1 set in the referrer-side control program executes processing with reference to data stored in the synchronization buffer 1 in the synchronization buffer area 1042b.
  • the execution result or the like may be written in the corresponding synchronization buffer 1.
  • the execution cycle of the control program 1 is shorter than that of the control program 2.
  • the execution cycle of the control program 1 corresponds to one control cycle
  • the execution cycle of the control program 2 corresponds to two control cycles.
  • FIG. 10 is a flowchart showing another execution operation according to the first embodiment.
  • the same step numbers as those in FIG. 8 are assigned to the steps for executing the same processing as in the flowchart shown in FIG.
  • the microprocessor 100 executes an execution preparation process for the control program 230 in the system program 210 (step S1). Subsequently, the microprocessor 100 executes an execution control process of the control program 230 in the system program 210 (step S2 shown in FIG. 5).
  • the microprocessor 100 waits for an interrupt signal for starting a control cycle (step S200).
  • the interrupt signal for starting the control cycle is received (YES in step S200)
  • the control program starting from the current control cycle is set to the “before execution” state (step S202).
  • the microprocessor 100 executes the IO processing program 218 (the output processing program 214 and the input processing program 216) in the system program 210 (step S204).
  • the microprocessor 100 determines the execution state of the control program 1 (referrer-side control program) (step S210A).
  • the control program 1 (referrer-side control program) is in the “pre-execution” state (“pre-execution” in step S210A)
  • the microprocessor 100 sets the corresponding synchronous buffer 1 to the “write-inhibited” state.
  • the execution state of the control program 1 is set to the “running” state, and the execution of the control program 1 is started (step S212A).
  • control program 1 (referrer-side control program) is in the “execution” state (“execution” in step S210A)
  • the microprocessor 100 starts executing an unexecuted portion of the control program 1 (step S210A).
  • step S210A the “write prohibition” state of the corresponding synchronization buffer 1 is not released and is maintained as it is.
  • control program 1 (referrer-side control program) is in the “execution end” state (“execution end” in step S210A), the process proceeds to step S230A.
  • step S212A After the execution of the control program 1 is started in step S212A or step S214, the microprocessor 100 determines whether or not an execution completion notification of the control program 1 has been received (step S216).
  • step S228 determines whether or not a control cycle start interrupt signal has been received.
  • the processes in and after step S202 are repeated. That is, if a control cycle start interrupt occurs before receiving an execution end notification of the control program 1, the execution of the control program 1 is temporarily suspended, and the control program 1 is not executed after the IO processing program is executed in the next control cycle. Part is executed.
  • the interrupt signal for starting the control cycle has not been received (NO in step S218), the processes in and after step S216 are repeated.
  • step S216 when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state and the corresponding synchronization buffer. 1 is canceled (step S220A).
  • the period during which the synchronous buffer 1 is in the “write-inhibited” state is indicated by a dashed arrow in FIG.
  • step S230A the microprocessor 100 determines the execution state of the control program 2 (owner-side control program) (step S230A).
  • the microprocessor 100 sets the execution state of the control program 2 to the “in execution” state.
  • execution of the control program 2 is started (step S232A).
  • control program 2 owner-side control program
  • the microprocessor 100 starts executing an unexecuted portion of the control program 2 (step S230A). S234).
  • control program 2 owner-side control program
  • step S232 After the execution of the control program 2 is started in step S232 or step S234, the microprocessor 100 determines whether or not an execution end notification of the control program 2 has been received (step S236).
  • step S236 determines whether or not an interrupt signal for starting the control cycle has been received. If an interrupt signal for starting a control cycle is received (YES in step S238), the processing in step S202 and subsequent steps is repeated. On the other hand, if the interrupt signal for starting the control cycle has not been received (NO in step S238), the processes in and after step S236 are repeated.
  • step S236 when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state and also sets the global variable area 2 Is stored in the synchronization buffer 1 (step S240A).
  • the copying operation of the data stored in the global variable area 2 to the synchronous buffer 1 is indicated by a solid arrow in FIG.
  • step S270 a control cycle start interrupt signal is awaited (step S270).
  • the interrupt signal for starting the control cycle is received (YES in step S270)
  • the processes in and after step S202 are executed again.
  • FIG. 9 shows an example in which the number of referrer-side control programs referring to one global variable is “1”, but the number of referrer-side control programs can be arbitrarily set. In any embodiment, the number of referrer-side control programs referring to one global variable is arbitrary. With respect to an embodiment in which only one referrer-side control program is shown, the operation when there are a plurality of referrer-side control programs can be understood with reference to FIGS.
  • control program 1 when there is the control program 1 and the control program 2, it is possible that the control program 1 is the owner for a certain global variable and the control program 2 is the owner for another global variable. .
  • the operation of the “control program execution control process” of the system program can be understood for each global variable.
  • the system program 210 includes the following processing (1) and (2) as execution preparation processing of the control program 230.
  • processing for generating global variable area 1042a for storing global variables in storage means (basically, main memory 104)
  • a global that is referred to by the referrer-side control program For each variable, when the referrer-side control program refers to the global variable, the synchronization buffer area 1042b that provides one synchronization buffer as a reference destination instead of the global variable area is stored in the storage means (basically, the main memory 104
  • the system program 210 includes the following processes (1) to (4) as the execution control process of the control program 230.
  • Owner-side start processing for starting execution of the owner-side control program (step S212 in FIG. 8 and step S232 in FIG. 10) (2) When execution of the owner-side control program is completed, the copy destination synchronization buffer writes that the global variable to be rewritten by the owner-side control program is copied from the global variable area to the synchronization buffer corresponding to the global variable. Copy processing performed on condition that it is not in a prohibited state (S220 in FIG. 8 and S240A in FIG. 10) (3) Referrer-side start processing (S232, S252 in FIG. 8) and processing for starting execution of the referrer-side control program and further executing processing for setting the synchronous buffer referred to in the execution to a write-inhibited state (S212A in FIG.
  • the write prohibition release process for canceling the write prohibition state of the synchronous buffer that was in the write prohibition state (S240, S260 in FIG. 8 and S220A in FIG. 10).
  • the referrer-side control program can refer to the value of the latest global variable at the start of its execution. That is, in such a case, the value of the global variable to be referred to in the referrer-side control program can be obtained by the copy process in a period that is not in the write protected state.
  • the number of global variables and the number of referrer-side control programs Even if there are many, the memory size occupied by the synchronization buffer can be small. Furthermore, since the algorithm is simple in that there is a single synchronization buffer, the design of the system program is easy.
  • an area for temporarily storing data from the global variable area and an area where the referrer-side control program actually refers to the data are provided as synchronization buffers.
  • the data stored in the global variable area can be copied to the synchronization buffer without being affected by the execution state of the referrer-side control program.
  • FIG. 11 is a sequence diagram illustrating an execution operation according to the second embodiment.
  • control program 1 and control program 2 are executed in a time-sharing manner, and the control program 1 having the higher priority and the shorter execution cycle is the global variable owner. It is assumed that it is set to (owner side control program).
  • the control program 1 since the control program 1 is the owner of the global variable, the control program 1 writes the execution result and the like in the global variable area 1 in the global variable area 1042a.
  • synchronization buffers 2A and 2B are set in the synchronization buffer area 1042b.
  • the data in the global variable area 1 is first written to the synchronization buffer 2A, and then transferred from the synchronization buffer 2A to the synchronization buffer 2B at an appropriate timing.
  • a synchronization process between the global variable area 1 and the synchronization buffers 2A and 2B as shown in FIG. 11 will be described with reference to FIG.
  • FIG. 12 is a flowchart showing an execution operation according to the second embodiment.
  • the same step numbers as in FIG. 8 are assigned to the steps for executing the same processing as in the flowchart shown in FIG.
  • the microprocessor 100 executes an execution preparation process for the control program 230 in the system program 210 (step S1). Subsequently, the microprocessor 100 executes an execution control process of the control program 230 in the system program 210 (step S2 shown in FIG. 5).
  • step S220B is executed instead of step S220.
  • step S220B the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state and copies the data stored in the global variable area 1 to the synchronization buffer 2A.
  • the operation of copying the data stored in the global variable area 1 to the synchronization buffer 2A is indicated by a solid arrow in FIG.
  • step S230 the microprocessor 100 determines the execution state of the control program 2 (referrer-side control program) (step S230).
  • the control program 2 (referrer-side control program) is in the “before execution” state (“before execution” in step S230)
  • the microprocessor 100 copies the data stored in the synchronization buffer 2A to the synchronization buffer 2B.
  • the execution state of the control program 2 is set to the “running” state, and the execution of the control program 2 is started (step S232B).
  • control program 2 (referrer-side control program) is in the “execution” state (“execution” in step S230)
  • the microprocessor 100 starts executing an unexecuted portion of the control program 2 (step S230). S234). At this time, the data stored in the synchronization buffer 2A is not copied to the synchronization buffer 2B.
  • control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230), the process proceeds to step S270.
  • step S232B After the execution of the control program 2 is started in step S232B or step S234, the microprocessor 100 determines whether or not an execution end notification of the control program 2 has been received (step S236).
  • step S236 determines whether or not an interrupt signal for starting the control cycle has been received. If an interrupt signal for starting a control cycle is received (YES in step S238), the processing in step S202 and subsequent steps is repeated. On the other hand, if the interrupt signal for starting the control cycle has not been received (NO in step S238), the processes in and after step S236 are repeated.
  • step S236 when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state (step S240B).
  • step S270 a control cycle start interrupt signal is awaited (step S270).
  • the interrupt signal for starting the control cycle is received (YES in step S270)
  • the processes in and after step S202 are executed again.
  • control program 1 set in the global variable referrer (referrer-side control program) has a higher execution priority and a shorter execution cycle
  • the global variable owner owner It is assumed that the control program 2 set in the (side control program) has a longer execution cycle.
  • FIG. 13 is a sequence diagram showing another execution operation according to the second embodiment.
  • the control program 2 since the control program 2 is the owner of the global variable, the control program 2 writes the execution result and the like in the global variable area 2 in the global variable area 1042a.
  • the synchronization buffers 1A and 1B are set in the control program 1 set in the referrer-side control program.
  • synchronization is maintained between the synchronization buffers 1A and 1B and the global variable area 2 in accordance with the following procedure.
  • FIG. 14 is a flowchart showing another execution operation according to the second embodiment.
  • the same step numbers as in FIG. 10 are assigned to the steps for executing the same processing as in the flowchart shown in FIG.
  • the flowchart shown in FIG. 14 differs from the flowchart shown in FIG. 10 in that steps S212C, S220C, and S240C are executed instead of steps S212A, S220A, and S240A, respectively.
  • steps S212C, S220C, and S240C are executed instead of steps S212A, S220A, and S240A, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212C executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210A), the microprocessor 100 stores the data stored in the synchronization buffer 1A. Is copied to the synchronous buffer 1B, the execution state of the control program 1 is set to the “running” state, and the execution of the control program 1 is started (step S212C).
  • step S220C which is executed when the execution end notification of the control program 1 is received (YES in step S216)
  • the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state (step S220). S220C).
  • step S240C which is executed when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state, Data stored in the global variable area 2 is copied to the synchronization buffer 1A (step S240C).
  • the copying operation of the data stored in the global variable area 2 to the synchronous buffer 1A is indicated by a solid arrow in FIG.
  • the system program 210 includes the following processes (1) and (2) as the execution preparation process of the control program 230.
  • Processing for generating global variable area 1042a for storing global variables in storage means (basically, main memory 104)
  • a global that is referred to by the referrer-side control program
  • Processing for generating a synchronization buffer area 1042b that provides the first synchronization buffer and the second synchronization buffer as a set of synchronization buffers for each variable in the storage means (basically, the main memory 104).
  • This is a synchronous buffer that is used as a reference destination when the side control program references a global variable.
  • the system program 210 includes the following processes (1) to (3) as the execution control process of the control program 230.
  • Owner-side start processing for starting execution of the owner-side control program (step S212 in FIG. 12 and step S232A in FIG. 14) (2) When the execution of the owner-side control program ends, a copy process (S220B in FIG. 12 and S220B in FIG. 12) that copies the global variable rewritten by the owner-side control program from the global variable area to the first synchronization buffer , S240C in FIG. 14) (3) Referrer-side start processing (S232B in FIG. 12), which is processing for starting execution of the referrer-side control program, and further executing processing for copying the data stored in the first synchronization buffer to the second synchronization buffer. And S212C in FIG.
  • the second embodiment has a simple algorithm in that it is not necessary to determine the state of the copy destination synchronization buffer during the copy process to the first synchronization buffer.
  • the timing of writing to the first synchronization buffer (copy processing from the global variable area) and the timing of reading from the first synchronization buffer (copying to the second synchronization buffer)
  • the other process may be performed after the process started first is completed.
  • FIG. 15 is a sequence diagram illustrating an execution operation according to the third embodiment.
  • control program 1 and control program 2 are executed in a time-sharing manner, and the control program 1 with the higher execution priority and the shorter execution cycle is the global variable.
  • owner owner-side control program
  • the control program 1 since the control program 1 is the owner of the global variable, the control program 1 writes the execution result and the like in the global variable area 1 in the global variable area 1042a.
  • synchronization buffers 2A and 2B are set in the synchronization buffer area 1042b. Data in global variable area 1 is written into one of synchronization buffer 2A and synchronization buffer 2B. More specifically, it is copied to a synchronization buffer that is not in the “write-inhibited” state, out of the two synchronization buffers.
  • a synchronization process between the global variable area 1 and the synchronization buffers 2A and 2B as shown in FIG. 15 will be described with reference to FIG.
  • FIG. 16 is a flowchart showing an execution operation according to the third embodiment.
  • the same step numbers as in FIG. 12 are assigned to the steps for executing the same processing as in the flowchart shown in FIG. 12.
  • the flowchart shown in FIG. 16 differs from the flowchart shown in FIG. 12 in that steps S220D, S232D, and S240D are executed instead of steps S220B, S232B, and S240B, respectively.
  • steps S220D, S232D, and S240D are executed instead of steps S220B, S232B, and S240B, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S220D which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state.
  • the data stored in the global variable area 1 is copied to the same synchronization buffer 2 (synchronization buffer 2A or synchronization buffer 2B) as previously copied, and the synchronization buffer 2 to which the data has been written is set to the “latest” state. (Step S220D).
  • step S232D executed when the control program 2 (referrer-side control program) is in the “before execution” state (“before execution” in step S230), the microprocessor 100 is set to the “latest” state.
  • the synchronization buffer 2 (synchronization buffer 2A or synchronization buffer 2B) is set to the “reference destination” state of the control program 2 (referrer-side control program) and also set to the “write inhibit” state.
  • the execution state is set to the “running” state, and the execution of the control program 2 is started (step S232D).
  • step S234 which is executed when the control program 2 (referrer-side control program) is in the “running” state (“running” in step S230), the synchronization buffer 2 set to the “latest” state. However, the “reference destination” state and the “write prohibition” state are not canceled and are maintained as they are.
  • step S240D which is executed when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state, The “write prohibition” state of the corresponding synchronization buffer 2 is canceled (step S240D).
  • the state of the synchronous buffer as described above that is, the write prohibited state, the reference destination state, and the state storing the latest data (latest state) are the write prohibited state recording area, the reference destination state recording area, and the latest state, respectively.
  • This is represented by recording in the recording area that the corresponding synchronization buffer is in the write-inhibited state, the reference destination state, and the latest state.
  • Each of these recording areas is generated in the control program work area 1042 in the main memory 104 by the system program 210 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the write-inhibited state, the reference destination state, and the latest state can be appropriately determined.
  • information specifying the write-inhibited state, the reference destination state, and the latest state among the synchronous buffer groups grouped in units of batch copy processing (such as the identification number of the synchronous buffer group)
  • a flag or state variable indicating whether the state is the write-inhibited state, the reference destination state, or the latest state and recording is performed using the value of the flag or state variable. Aspect, etc. can be adopted. The same applies to the management of the execution state of the control program in other embodiments described below.
  • control program 1 set in the global variable referrer (referrer-side control program) has a higher execution priority and a shorter execution cycle
  • the global variable owner owner It is assumed that the control program 2 set in the (side control program) has a lower execution priority and a longer execution cycle.
  • FIG. 17 is a sequence diagram showing another execution operation according to the third embodiment.
  • the control program 2 since the control program 2 is the owner of the global variable, the control program 2 writes the execution result and the like in the global variable area 2 in the global variable area 1042a.
  • the synchronization buffers 1A and 1B are set in the control program 1 set in the referrer-side control program.
  • synchronization is maintained between the synchronization buffers 1A and 1B and the global variable area 2 in accordance with the following procedure.
  • FIG. 18 is a flowchart showing another execution operation according to the third embodiment.
  • the same step numbers as in FIG. 14 are assigned to the steps for executing the same processing as in the flowchart shown in FIG.
  • the flowchart shown in FIG. 18 differs from the flowchart shown in FIG. 14 in that the processes of steps S212E, S220E, and S240E are executed instead of steps S212C, S220C, and S240C, respectively.
  • steps S212E, S220E, and S240E are executed instead of steps S212C, S220C, and S240C, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212E executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210A), the microprocessor 100 is set to the “latest” state.
  • the synchronization buffer 1 (synchronization buffer 1A or synchronization buffer 1B) is set to the “reference destination” state and the “write-inhibited” state of the control program 1 (referrer side control program).
  • the execution state is set to the “running” state, and the execution of the control program 1 is started (step S212E).
  • step S214 executed when the control program 1 (referrer-side control program) is in the “running” state (“running” in step S210A), the synchronization buffer 1 set to the “latest” state. However, the “reference destination” state and the “write prohibition” state are not canceled and are maintained as they are.
  • step S220E which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state, The “write inhibit” state of the corresponding synchronization buffer 1 is canceled (step S220E).
  • step S240E which is executed when the execution end notification of the control program 2 is received (YES in step S236), the microprocessor 100 sets the execution state of the control program 2 to the “execution end” state.
  • the data stored in the global variable area 2 is copied to the same synchronization buffer 1 (synchronization buffer 1A or synchronization buffer 1B) as previously copied, and the synchronization buffer 1 in which the data is written is set to the “latest” state. (Step S240E).
  • FIG. 19 and 20 are sequence diagrams illustrating execution operations in the multi-core microprocessor according to the third embodiment. More specifically, in FIG. 19 and FIG. 20, it is assumed that the core 1 executes the control program 1 and the core 2 executes the control program 2. At this time, in addition to the control program 1, the system program is also executed in the core 1. It is assumed that the control program 1 is set as the owner side control program.
  • FIG. 19 shows an example in which the execution cycle of the control program 1 and the execution cycle of the control program 2 are substantially the same
  • FIG. 20 shows that the execution cycle of the control program 1 is that of the control program 2. An example when the execution cycle is shorter is shown.
  • control program 2 can be executed at any time in terms of utilization of core resources, but when considered as a PLC, the control program 2 also needs to use the output processing and input processing of the system program. Basically, the execution of the control program 2 is started after the completion of the output process and the input process executed at the beginning.
  • control program 2 does not need to use the output processing and input processing of the system program, the design may be changed so that the execution cycle of the control program 2 is executed without being synchronized with the control cycle.
  • the next referrer-side start process may be performed immediately after the execution of the control program 2 is completed.
  • the synchronization is maintained between the global variable area 1 and the synchronization buffers 2A and 2B according to the following procedure.
  • FIG. 21 is a flowchart showing an execution operation according to the third embodiment.
  • the flowchart shown in FIG. 21 is applied to both FIG. 19 and FIG.
  • the same step numbers as in FIG. 16 are assigned to the steps that execute substantially the same processing as the flowchart shown in FIG. 16.
  • the microprocessor 100 executes execution preparation processing of the control program 230 in the system program 210 (step S1). Subsequently, the microprocessor 100 (core 1) executes an execution control process of the control program 230 in the system program 210 (step S2 shown in FIG. 5). A detailed example of the execution control process of the control program 230 corresponds to steps S200 to S270.
  • the microprocessor 100 (core 1) waits for an interrupt signal for starting a control cycle (step S200).
  • the microprocessor 100 (core 1) “executes the control program 1 when the execution cycle of the control program 1 starts from the current control cycle.
  • the state is set to the “previous” state (step S202F).
  • the microprocessor 100 (core 1) executes the IO processing program 218 (the output processing program 214 and the input processing program 216) in the system program 210 (step S204).
  • the microprocessor 100 determines the execution state of the control program 1 (owner-side control program) (step S210F).
  • the microprocessor 100 sets the execution state of the control program 1 to “in execution”. While setting to a state, execution of the control program 1 is started (step S212).
  • steps S230F, S232D, and S234F needs to be performed before the core 1 of the microprocessor 100 is exclusively used for the execution of the control program 1, the execution of the control program 1 is started regardless of the expression of this flowchart. This is performed after the end of these processes.
  • control program 1 owner-side control program
  • the microprocessor 100 executes the unexecuted portion of the control program 1. Start (step S214). However, for the same reason as described above, the execution is actually started after the processing of steps S230F, S232D, and S234F is completed.
  • the microprocessor 100 determines the execution state of the control program 2 (referrer-side control program) (step S230F).
  • the microprocessor 100 sets the synchronization buffer set to the “latest” state.
  • control program 2 (synchronization buffer 2A or synchronization buffer 2B) is set to the “reference destination” state of control program 2 (referrer-side control program) and also set to the “write inhibit” state, and the execution state of control program 2 Is set to the “running” state, and the core 2 is caused to start executing the control program 2 (step S232D).
  • control program 2 (referrer-side control program) is in the “running” state (“running” in step S230F)
  • the microprocessor 100 (core 1) does not control the execution of the control program 2 (step S234F).
  • neither the “reference destination” state nor the “write prohibition” state of the corresponding synchronization buffer 2 is released, and the execution of the control program 2 is continued.
  • step S232D or step S234F the microprocessor 100 (core 1) determines whether or not the control program 1 (owner-side control program) is in the “execution completed” state (step S211F). Actually, the real-time OS 200 detecting the end of execution of the control program 1 corresponds to step S211F. If the control program 1 has not finished executing (NO in step S211F), since the core 1 of the microprocessor 100 is dedicated to the execution of the control program 1, actually, step S216, which will be described next, is executed. The loop process consisting of S236 and S218 and step S240D cannot be executed as shown in this flowchart. Actually, when the real-time OS 200 detects the end of execution of the control program 2 in the core 2, step S240D is executed as an interrupt process in the core 1, but this will be described along this flowchart for convenience.
  • control program 1 owner-side control program
  • the process proceeds to step S236F.
  • control program 1 owner-side control program
  • the microprocessor 100 core 1 has received an execution end notification of the control program 1 or not. Is determined (step S216). If an execution end notification of control program 1 is received (YES in step S216), the process proceeds to step S220D.
  • step S216 the microprocessor 100 (core 1) determines whether or not the execution completion notification of the control program 2 has been received (Ste S236). If the execution end notification of control program 2 is received (YES in step S236), the process proceeds to step S240D. That is, when the execution end notification of the control program 2 is received before the execution end notification of the control program 1 is received, the process of step S240D is executed.
  • step S228 it is determined whether or not an interrupt signal for starting the control cycle has been received. If the interrupt signal for starting the control cycle is received (YES in step S218), the processing from step S202F onward is executed again. That is, when a control cycle start interrupt occurs before receiving an execution end notification of the control program 1, the processing from step S202F is executed again. On the other hand, if the interrupt signal for starting the control cycle has not been received (NO in step S218), the processes in and after step S216 are repeated.
  • step S220D the microprocessor 100 (core 1) sets the execution state of the control program 1 to the “execution end” state, and the same synchronization as the previous copy of the data stored in the global variable area 1 In addition to copying to the buffer 2 (synchronization buffer 2A or synchronization buffer 2B), the synchronization buffer 2 into which the data has been written is set to the “latest” state (step S220D). Subsequently, the microprocessor 100 (core 1) determines whether or not an execution end notification of the control program 2 has been received (step S236F). If an execution end notification of control program 2 is received (YES in step S236F), the process proceeds to step S240D. That is, when the execution end notification of the control program 2 is received before the control cycle start interrupt, the process of step S240D is executed.
  • step S270 it is determined whether or not an interrupt signal for starting the control cycle has been received (step S270). If the interrupt signal for starting the control cycle is received (YES in step S270), the processing from step S202F onward is executed again. On the other hand, when the interrupt signal for starting the control cycle has not been received (NO in step S270), the processing from step S236F is repeated.
  • step S240D the microprocessor 100 (core 1) sets the execution state of the control program 2 to the “execution end” state and cancels the “write prohibition” state of the corresponding synchronization buffer 2 (step S240D). . After executing step S240D, the process returns to the process that was being executed before proceeding to step S240D.
  • FIG. 22 is a sequence diagram showing another execution operation in the multi-core microprocessor according to the third embodiment. In the sequence diagram shown in FIG. 22, it is assumed that the control program 2 executed by the core 2 is set as the owner-side control program.
  • FIG. 23 is a flowchart showing another execution operation according to the third embodiment.
  • the same step numbers as those of FIG. 18 and FIG. 21 are given to the steps for executing the same processes as those of the flowcharts of FIG. 18 and FIG.
  • the flowchart shown in FIG. 23 is different from the flowchart shown in FIG. 21 in that steps S210G, S212E, S230G, S232A, S220E, and S240E are executed instead of steps S210F, S212, S230F, S232D, S220D, and S240D, respectively. Is different. Hereinafter, this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S210G the microprocessor 100 (core 1) determines the execution state of the control program 1 (referrer-side control program) (step S210G).
  • step S212E which is executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210G), the microprocessor 100 (core 1) is in the “latest” state.
  • the set synchronization buffer 1 (synchronization buffer 1A or synchronization buffer 1B) is set to the “reference destination” state and the “write inhibit” state of the control program 1 (referrer side control program).
  • the execution state of the control program 1 is set to the “running” state, and the execution of the control program 1 is started (step S212E). However, the execution of the control program 1 is performed after the processing of steps S230F, S232A, and S234F is completed.
  • step S214 which is executed when the control program 1 (referrer-side control program) is in the “running” state (“running” in step S210G), the synchronization buffer 2 set in the “latest” state. However, the “reference destination” state and the “write prohibition” state are not canceled and are maintained as they are.
  • step S230G the microprocessor 100 (core 1) determines the execution state of the control program 2 (owner side control program) (step S230G).
  • step S232A executed when the control program 2 (owner-side control program) is in the “execution end” state (“execution end” in step S230G), the microprocessor 100 (core 1) executes the control program 2 The state is set to the “running” state, and the core 2 is caused to start executing the control program 2 (step S232A).
  • step S234F which is executed when the control program 2 (owner-side control program) is in the “running” state (“running” in step S230G), the execution of the control program 2 is continued.
  • step S220E which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 (core 1) changes the execution state of the control program 1 to the “execution end” state. At the same time as setting, the "write-inhibited" state of the corresponding synchronization buffer 1 is released (step S220E).
  • step S240E the microprocessor 100 (core 1) sets the execution state of the control program 2 to the “execution end” state, and the same synchronization as the previous copy of the data stored in the global variable area 2 In addition to copying to the buffer 1 (synchronization buffer 1A or synchronization buffer 1B), the synchronization buffer 1 to which data has been written is set to the “latest” state (step S240E).
  • the system program 210 includes the following processes (1) and (2) as an execution preparation process for the control program 230.
  • the system program 210 includes the following processes (1) to (4) as the execution control process of the control program 230.
  • Owner-side start processing for starting execution of the owner-side control program (step S212 in FIGS. 16 and 21 and step S232A in FIGS. 18 and 23) (2) Processing for starting execution of the referrer-side control program, and further, setting the synchronization buffer that is the latest state specified by the contents of the latest-state recording area as a reference destination state to be referred to in the execution of the referrer-side control program,
  • the referrer-side start process for executing the process for setting the synchronous buffer in the write-inhibited state (step S232D in FIGS. 16 and 21 and step S212E in FIGS. 18 and 23).
  • each referrer-side control program has two synchronization buffers for each global variable referenced from the referrer-side control program, and can always be written to at least one synchronization buffer. Because there is, copy processing is possible at any time. Further, when the referrer-side control program starts executing, the referrer-side control program is set to the reference destination by referring to the synchronization buffer storing the latest copied data based on the contents of the latest state recording area. You can refer to the value of the latest global variable in.
  • the third embodiment for example, as shown by circles in FIG.
  • the referrer-side control program refers to data copied during the write-protection period of one synchronous buffer. 3 is more advantageous.
  • FIG. 24 and FIG. 25 are sequence diagrams illustrating an execution operation in the multi-core microprocessor according to the fourth embodiment. More specifically, in FIG. 24 and FIG. 25, it is assumed that the core 1 executes the control program 1 and the core 2 executes the control program 2. At this time, in addition to the control program 1, the system program is also executed in the core 1. It is assumed that the control program 1 is set as the owner side control program.
  • FIG. 24 shows an example in which the execution cycle of the control program 1 and the execution cycle of the control program 2 are substantially the same.
  • FIG. 25 shows that the execution cycle of the control program 1 is that of the control program 2. An example when the execution cycle is shorter is shown.
  • Embodiment 24 and 25 are sequence diagrams for explaining in common with the fifth embodiment to be described later.
  • information for identifying a synchronous buffer storing the latest copied data as a reference destination is handled. Therefore, when the fourth embodiment is described with reference to FIGS. 24 and 25, attention is paid only to the “latest data update flag”, and the “latest” shown along the time axis of the synchronization buffers 2A and 2B. State identification is not necessary.
  • attention is paid only to the identification of the “latest” state shown along the time axis of the synchronization buffers 2A and 2B. The “update flag” becomes unnecessary.
  • control program 2 can be executed at any time in terms of utilization of core resources, but when considered as a PLC, the control program 2 also needs to use the output processing and input processing of the system program. Basically, the execution of the control program 2 is started after the completion of the output process and the input process executed at the beginning.
  • control program 2 does not need to use the output processing and input processing of the system program, the design may be changed so that the execution cycle of the control program 2 is executed without being synchronized with the control cycle.
  • the next referrer-side start process may be performed immediately after the execution of the control program 2 is completed.
  • the synchronization is maintained between the global variable area 1 and the synchronization buffers 2A and 2B according to the following procedure.
  • FIG. 26 is a flowchart showing an execution operation according to the fourth embodiment.
  • the flowchart shown in FIG. 26 is applied to both FIG. 24 and FIG.
  • the same step numbers as in FIG. 21 are assigned to the steps for executing substantially the same processes as those in the flowchart of FIG.
  • the flowchart shown in FIG. 26 is different from the flowchart shown in FIG. 21 in that the processes of steps S232G, S220G, and S240G are executed instead of steps S232D, S220D, and S240D, respectively.
  • steps S232G, S220G, and S240G are executed instead of steps S232D, S220D, and S240D, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S232G executed when the control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230F), the microprocessor 100 (core 1) If the latest data update flag 2 is set to ON, the synchronous buffer 2 (synchronization buffer 2A or 2B) that has been in the “write destination” state is changed to the “reference destination” state, and in the “reference destination” state. After the existing synchronous buffer 2 (synchronous buffer 2A or 2B) is changed to the “write destination” state, the latest data update flag 2 is changed from ON to OFF.
  • latest data update flag 2 If the latest data update flag 2 is not set to ON (if the latest data update flag 2 is set to OFF), the “write destination” state and “reference destination” state of the synchronization buffer 2 are changed. The latest data update flag 2 is also kept off.
  • microprocessor 100 sets the execution state of the control program 2 to the “running” state and causes the core 2 to start executing the control program 2 (step S232G).
  • step S220G which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state.
  • the data stored in the global variable area 1 is copied to the synchronous buffer 2 (synchronous buffer 2A or synchronous buffer 2B) set to the “write destination” state, and the latest data update flag 2 is set to ON. (Step S220G).
  • step S240G which is executed when a notice of completion of execution of the control program 2 is received (YES in step S236 or YES in step S236F), the microprocessor 100 sets the execution state of the control program 2 to “ The “execution end” state is set (step S240G).
  • the states of the synchronization buffer as described above, that is, the write destination state and the reference destination state are respectively in the write destination state recording area and the reference destination state recording area, and the corresponding synchronization buffer is in the write destination state and the reference destination state. It is expressed by recording each thing.
  • Each of these recording areas is generated in the control program work area 1042 in the main memory 104 by the system program 210 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the write destination state or the reference destination state can be appropriately determined. For example, information (such as a synchronization buffer group identification number) that identifies a write buffer state or a reference destination state among synchronous buffer groups that are grouped in units of batch copy processing is recorded.
  • a mode a mode in which a flag or a state variable indicating whether it is a write destination state or a reference destination state is provided for each group of such synchronous buffers, and recording is performed using the value of the flag or the state variable, etc. be able to.
  • the write destination state and the reference destination state are assigned so as not to overlap for one synchronization buffer, a common state recording region is generated without dividing the write destination state recording region and the reference destination state recording region.
  • the writing destination state or the reference destination state may be represented by one flag or state variable.
  • a thick line portion indicates that the latest data update flag is on.
  • the latest data update flag is generated by the system program 210 in the control program work area 1042 in the main memory 104 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the latest data update flag is provided for each group of synchronous buffers grouped in units in which copy processing is performed collectively.
  • FIG. 27 is a sequence diagram showing another execution operation in the multi-core microprocessor according to the fourth embodiment.
  • the control program 2 executed by the core 2 is set as the owner-side control program.
  • FIG. 27 is a sequence diagram for explaining in common with the fifth embodiment to be described later, like FIGS. 24 and 25 described above. Therefore, in the case of describing the fourth embodiment with reference to FIG. 27, focusing on only the “latest data update flag”, the identification of the “latest” state shown along the time axis of the synchronization buffers 2A and 2B. Is unnecessary.
  • attention is paid only to the identification of the “latest” state shown along the time axis of the synchronization buffers 2A and 2B, and the “latest data update flag”. Is no longer necessary.
  • FIG. 28 is a flowchart showing another execution operation according to the fourth embodiment.
  • the same step numbers as in FIG. 23 are assigned to the steps for executing the same processing as in the flowchart of FIG.
  • the flowchart shown in FIG. 28 differs from the flowchart shown in FIG. 23 in that steps S212H, S220H, and S240H are executed instead of steps S212E, S220E, and S240E, respectively.
  • steps S212H, S220H, and S240H are executed instead of steps S212E, S220E, and S240E, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212H executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210G), the microprocessor 100 (core 1) sets the latest data update flag 1 Is set to ON, the synchronous buffer 1 (synchronization buffer 1A or 1B) in the “write destination” state is changed to the “reference destination” state, and the synchronization buffer 1 in the “reference destination” state is changed. After changing (synchronization buffer 1A or 1B) to the “write destination” state, the latest data update flag 1 is changed from ON to OFF.
  • latest data update flag 1 is not set to ON (if the latest data update flag 1 is set to OFF), the “write destination” state and the “reference destination” state of the synchronization buffer 1 are changed. The latest data update flag 1 is also kept off.
  • microprocessor 100 sets the execution state of the control program 1 to the “running” state and starts the execution of the control program 1 (step S212H).
  • step S220H which is executed when the execution end notification of the control program 1 is received (YES in step S216)
  • the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state (step S220). S220H).
  • step S240H that is executed when a notice of completion of execution of the control program 2 is received (YES in step S236 or YES in step S236F)
  • the microprocessor 100 sets the execution state of the control program 2 to “
  • the data stored in the global variable area 2 is copied to the synchronous buffer 1 (synchronous buffer 1A or synchronous buffer 1B) set to the “write destination” state and set to the “execution completed” state.
  • Data update flag 1 is set to ON (step S240H).
  • the system program 210 includes the following processes (1) to (3) as the execution preparation process of the control program 230.
  • the system program 210 includes the following processes (1) to (3) as the execution control process of the control program 230.
  • Owner-side start processing for starting execution of the owner-side control program (step S212 in FIG. 26 and step S232A in FIG. 28) (2) When execution of the owner-side control program ends, the global variable that is rewritten by the owner-side control program is copied from the global variable area to the synchronous buffer that is the write destination state corresponding to the global variable. Further, a copy process (step S220G in FIG. 26 and step S240H in FIG. 28) for executing a process for turning on the latest data update flag related to the copy process.
  • FIGS. 24 and 25 are sequence diagrams for explaining in common with the above-described fourth embodiment.
  • the “latest” shown along the time axis of the synchronization buffers 2A and 2B. “Only the status identification is focused on, and the“ latest data update flag ”becomes unnecessary.
  • FIG. 29 is a flowchart showing an execution operation according to the fifth embodiment.
  • the flowchart shown in FIG. 29 is applied to both FIG. 24 and FIG.
  • the same step numbers as in FIG. 21 are assigned to the steps that execute substantially the same processing as in the flowchart shown in FIG.
  • the flowchart shown in FIG. 29 differs from the flowchart shown in FIG. 21 in that the processes of steps S232I, S220I, and S240I are executed instead of steps S232D, S220D, and S240D, respectively.
  • steps S232I, S220I, and S240I are executed instead of steps S232D, S220D, and S240D, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S232I executed when the control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230F), the microprocessor 100 is set to the “latest” state.
  • the synchronization buffer 2 (synchronization buffer 2A or synchronization buffer 2B) is set to the “reference destination” state of the control program 2 (referrer side control program), and the other synchronization buffer 2 is set to the “write destination” state. Further, the execution state of the control program 2 is set to the “running” state, and the execution of the control program 2 is started (step S232I).
  • step S220I which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state.
  • the data stored in the global variable area 1 is copied to the synchronous buffer 2 (synchronous buffer 2A or synchronous buffer 2B) set to the “write destination” state, and the data stored in the global variable area 1 Is set to the "latest" state (step S220I).
  • step S240I that is executed when a notice of completion of execution of the control program 2 is received (YES in step S236 or YES in step S236F)
  • the microprocessor 100 sets the execution state of the control program 2 to “ The “execution end” state is set (step S240I).
  • the states of the synchronization buffer as described above that is, the write destination state, the reference destination state, and the latest state are written in the write destination state recording area, the reference destination state recording area, and the latest state recording area, respectively. This is expressed by recording the destination state, the reference destination state, and the latest state.
  • Each of these recording areas is generated in the control program work area 1042 in the main memory 104 by the system program 210 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the write destination state, the reference destination state, and the latest state can be determined as appropriate.
  • information that identifies the write destination state, reference destination state, and latest state among synchronous buffer groups grouped in units of batch copy processing (synchronization buffer group identification number, etc.)
  • a flag or state variable indicating whether the state is the write destination state, the reference destination state, or the latest state and records using the value of the flag or state variable can be adopted. Since the write destination state and the reference destination state are given so as not to overlap with respect to one synchronization buffer, a common state recording area is generated without dividing the write destination state recording area and the reference destination state recording area, One flag or state variable may represent the write destination state or the reference destination state.
  • FIG. 27 is a sequence diagram for explaining in common with the above-described fourth embodiment, and in the fifth embodiment, the “latest” state shown along the time axis of the synchronization buffers 2A and 2B is shown. Focusing only on the identification, the “latest data update flag” is unnecessary.
  • FIG. 30 is a flowchart showing another execution operation according to the fifth embodiment.
  • steps that execute the same processing as in the flowchart shown in FIG. 23 are assigned the same step numbers as in FIG. 23.
  • the flowchart shown in FIG. 30 differs from the flowchart shown in FIG. 23 in that the processes of steps S212J, S220J, and S240J are executed instead of steps S212E, S220E, and S240E, respectively.
  • steps S212J, S220J, and S240J are executed instead of steps S212E, S220E, and S240E, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212J executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210G), the microprocessor 100 (core 1) is set in the “latest” state.
  • the set synchronization buffer 1 (synchronization buffer 1A or synchronization buffer 1B) is set to the “reference destination” state of the control program 1 (referrer-side control program), and the other synchronization buffer 1 is set to the “write destination” state.
  • the execution state of the control program 1 is set to the “running” state, and the execution of the control program 1 is started (step S212J).
  • step S220J which is executed when the execution end notification of the control program 1 is received (YES in step S216)
  • the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state (step S220). S220J).
  • step S240J which is executed when a notice of completion of execution of the control program 1 is received (YES in step S236 or YES in step S236F)
  • the microprocessor 100 sets the execution state of the control program 2 to “
  • the data stored in the global variable area 2 is copied to the synchronization buffer 1 (synchronization buffer 1A or synchronization buffer 1B) set to the “write destination” state after being set to the “execution end” state, and the global The synchronization buffer 1 to which the data stored in the variable area 1 is written is set to the “latest” state (step S240J).
  • the system program 210 includes the following processes (1) to (3) as the execution preparation process of the control program 230.
  • the system program 210 includes the following processes (1) to (3) as the execution control process of the control program 230.
  • Owner-side start process for starting execution of the owner-side control program (step S212 in FIG. 29 and step S232A in FIG. 30) (2) When execution of the owner-side control program ends, the global variable that is rewritten by the owner-side control program is copied from the global variable area to the synchronous buffer that is the write destination state corresponding to the global variable. Further, a copy process (step S220I in FIG. 29 and step S240J in FIG. 30) for executing a process of recording in the latest state recording area that the copy destination synchronization buffer is in the latest state.
  • the referrer-side start process (FIG. 29) that executes a third replacement process for switching the write destination state and the reference destination state of the synchronous buffer that is the write destination state and the synchronous buffer that is the reference destination state on condition that the state is the state.
  • Step S232I and step S212J of FIG. 30 The referrer-side start process can also be described as follows.
  • the copy process can be performed at any time.
  • the referrer-side control program starts executing, the referrer-side control program is set to the reference destination by referring to the synchronization buffer storing the latest copied data based on the contents of the latest state recording area. You can refer to the value of the latest global variable in.
  • FIG. 31 and FIG. 32 are sequence diagrams showing execution operations in the multi-core microprocessor according to the sixth embodiment. More specifically, in FIG. 31 and FIG. 32, it is assumed that the core 1 executes the control program 1 and the core 2 executes the control program 2. At this time, in addition to the control program 1, the system program is also executed in the core 1. It is assumed that the control program 1 is set as the owner side control program.
  • FIG. 31 shows an example where the execution cycle of the control program 1 and the execution cycle of the control program 2 are substantially the same
  • FIG. 32 shows that the execution cycle of the control program 1 is that of the control program 2. An example when the execution cycle is shorter is shown.
  • control program 1 is associated with the global variable area 1 and the control program 2 is associated with the synchronization buffers 2A, 2B, and 2C.
  • FIG. 31 and FIG. 32 are sequence diagrams for explaining in common with the seventh embodiment to be described later.
  • this is equivalent to a configuration in which the configuration of the fifth embodiment is expanded to three synchronous buffers, and information for identifying the synchronous buffer storing the latest copied data as a reference destination Handle. Therefore, when the sixth embodiment is described with reference to FIGS. 31 and 32, only the “latest data update flag” is focused on, and is shown along the time axis of the synchronization buffers 2A, 2B, and 2C. Identification of the “latest” state is not necessary. On the other hand, in the case of describing the seventh embodiment with reference to FIGS. 31 and 32, attention is paid only to the identification of the “latest” state shown along the time axis of the synchronization buffers 2A, 2B, and 2C. The “latest data update flag” becomes unnecessary.
  • control program 2 can be executed at any time in terms of utilization of core resources, but when considered as a PLC, the control program 2 also needs to use the output processing and input processing of the system program. Basically, the execution of the control program 2 is started after the completion of the output process and the input process executed at the beginning.
  • control program 2 does not need to use the output processing and input processing of the system program, the design may be changed so that the execution cycle of the control program 2 is executed without being synchronized with the control cycle.
  • the next referrer-side start process may be performed immediately after the execution of the control program 2 is completed.
  • the synchronization is maintained between the global variable area 1 and the synchronization buffers 2A and 2B according to the following procedure.
  • FIG. 33 is a flowchart showing an execution operation according to the sixth embodiment.
  • the flowchart shown in FIG. 33 is applied to both FIG. 31 and FIG.
  • the same step numbers as in FIG. 26 are assigned to the steps for executing the processes substantially the same as those in the flowchart of FIG.
  • the flowchart shown in FIG. 33 is different from the flowchart shown in FIG. 26 in that the processes of steps S232K and S220K are executed instead of steps S232G and S220G, respectively.
  • steps S232K and S220K are executed instead of steps S232G and S220G, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S232K executed when the control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230F), the microprocessor 100 sets the latest data update flag 2 to ON. If so, the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, and 2C) in the “standby” state is changed to the “reference destination” state, and the synchronization buffer 2 in the “reference destination” state ( Any one of the synchronization buffers 2A, 2B, and 2C) is changed to the “standby” state, and then the latest data update flag 2 is changed from ON to OFF.
  • the synchronization buffer 2 any one of the synchronization buffers 2A, 2B, and 2C
  • latest data update flag 2 is not set to ON (if the latest data update flag 2 is set to OFF), the “standby” state and “reference destination” state of the synchronization buffer 2 are not changed.
  • the latest data update flag 2 is also kept off.
  • microprocessor 100 sets the execution state of the control program 2 to the “running” state and causes the core 2 to start executing the control program 2 (step S232K).
  • step S220K which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state.
  • the data stored in the global variable area 1 is copied to the synchronous buffer 2 (any one of the synchronous buffers 2A, 2B, 2C) set to the “write destination” state.
  • the microprocessor 100 changes the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, and 2C) that has been in the “write destination” state to the “standby” state, and also has the synchronization buffer that has been in the “standby” state. 2 (one of the synchronization buffers 2A, 2B, and 2C) is changed to the “write destination” state, and the latest data update flag 2 is set to ON (step S220K).
  • the states of the synchronization buffer as described above, that is, the write destination state, the reference destination state, and the standby state of the synchronization buffer correspond respectively to the write destination state recording area, the reference destination state recording area, and the standby state recording area. This is expressed by recording that the buffer is in the write destination state, the reference destination state, and the standby state.
  • Each of these recording areas is generated in the control program work area 1042 in the main memory 104 by the system program 210 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the write destination state, the reference destination state, and the standby state can be appropriately determined.
  • information for identifying a group in a synchronous buffer grouped in a unit in which a copy process is performed in a write destination state, a reference destination state, or a standby state (such as an identification number of a synchronous buffer group)
  • a flag or a state variable indicating whether the state is a write destination state, a reference destination state, or a standby state is provided for each group of such synchronous buffers, and recording is performed using the value of the flag or state variable. Aspect, etc. can be adopted.
  • write destination state the reference destination state, and the standby state are given so as not to overlap for one synchronous buffer, so that a common state recording area is generated without dividing these recording areas, and a set of flags or The state may be represented by one state variable.
  • a thick line portion indicates that the latest data update flag is on.
  • the latest data update flag is generated by the system program 210 in the control program work area 1042 in the main memory 104 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the latest data update flag is provided for each group of synchronous buffers grouped in units in which copy processing is performed collectively.
  • FIG. 34 is a sequence diagram showing another execution operation in the multi-core microprocessor according to the sixth embodiment.
  • the control program 2 executed by the core 2 is set as the owner-side control program.
  • FIG. 34 is a sequence diagram for explaining in common with Embodiment 7 to be described later, similarly to FIGS. 31 and 32 described above. Therefore, when the sixth embodiment is described with reference to FIG. 34, attention is paid only to the “latest data update flag”, and the “latest” state shown along the time axis of the synchronization buffers 2A, 2B, 2C. Identification of is unnecessary. On the other hand, in the case of describing the seventh embodiment with reference to FIG. 34, attention is paid only to the identification of the “latest” state shown along the time axis of the synchronization buffers 2A, 2B, and 2C. The “flag” becomes unnecessary.
  • FIG. 35 is a flowchart showing another execution operation according to the sixth embodiment.
  • the same step numbers as in FIG. 28 are assigned to the steps for executing the same processing as in the flowchart of FIG.
  • the flowchart shown in FIG. 35 differs from the flowchart shown in FIG. 28 in that steps S212L and S240L are executed instead of steps S212H and S240H, respectively.
  • steps S212L and S240L are executed instead of steps S212H and S240H, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212L executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210G), the microprocessor 100 sets the latest data update flag 1 to ON. If so, the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) in the “standby” state is changed to the “reference destination” state, and the synchronization buffer 1 in the “reference destination” state ( Any one of the synchronization buffers 1A, 1B, and 1C) is changed to the “standby” state, and then the latest data update flag 1 is changed from ON to OFF.
  • the synchronization buffer 1 any one of the synchronization buffers 1A, 1B, and 1C
  • latest data update flag 1 is not set to ON (if the latest data update flag 1 is set to OFF), the “standby” state and “reference destination” state of the synchronization buffer 1 are not changed. The latest data update flag 1 is also kept off.
  • microprocessor 100 sets the execution state of the control program 1 to the “running” state and starts the execution of the control program 1 (step S212L).
  • step S240L that is executed when a notice of completion of execution of the control program 2 is received (YES in step S236 or YES in step S236F)
  • the microprocessor 100 sets the execution state of the control program 2 to “
  • the data stored in the global variable area 2 is copied to the synchronous buffer 1 (any one of the synchronous buffers 1A, 1B, and 1C) set to the “write destination” state after being set to the “execution completed” state.
  • the microprocessor 100 changes the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) in the “write destination” state to the “standby” state and also the synchronization buffer in the “standby” state.
  • the latest data update flag 1 is set to ON (step S220L).
  • the system program 210 includes the following processes (1) to (3) as the execution preparation process for the control program 230.
  • the first synchronization buffer, the second synchronization buffer, and the third synchronization buffer are in a “write destination” state in which global variables can be copied from the global variable area, and in a state in which reference can be made from the referrer-side control program. Either the “reference destination” state or the “standby” state is given without duplication.
  • the system program 210 includes the following processes (1) to (3) as the execution control process of the control program 230.
  • Owner-side start process for starting execution of the owner-side control program (step S212 in FIG. 33 and step S232A in FIG. 35) (2) When execution of the owner-side control program ends, the global variable that is rewritten by the owner-side control program is copied from the global variable area to the synchronous buffer that is the write destination state corresponding to the global variable.
  • a first replacement process for switching the write destination state and the standby state of the synchronous buffer that is in the standby state in the same set as the synchronous buffer that is the write destination state and the synchronous buffer that is the copy destination;
  • Copy processing for executing processing for turning on the latest data update flag related to the processing to be copied (step S220K in FIG. 33 and step S240L in FIG.
  • the referrer-side control program for each referrer-side control program, there are three synchronization buffers for each global variable referenced from the referrer-side control program, and any one of the synchronization buffers is always in the write destination state. Therefore, copy processing is possible at any time. Furthermore, when the referrer-side control program starts executing, the referrer-side control program refers to the value of the latest global variable at the start of execution by using the synchronous buffer storing the latest copied data as a reference destination. be able to.
  • the write destination state and the standby state of the synchronous buffer are used in the copy process.
  • the synchronization buffer standby state and reference destination state are replaced based on the state of the latest data update flag.
  • the synchronous buffer that was in the write destination state when the copy was performed from the global variable area enters the reference destination state through the standby state.
  • the synchronization buffer wait is performed in the referrer side start process. It is possible to design to execute the copy process from the global variable area to the synchronization buffer even during the replacement process (second replacement process) between the state and the reference destination state.
  • FIGS. 31 and 32 are sequence diagrams for explaining in common with the above-described sixth embodiment, and in the seventh embodiment, they are shown along the time axis of the synchronization buffers 2A, 2B, and 2C. Focusing only on the identification of the “latest” state, the “latest data update flag” becomes unnecessary.
  • FIG. 36 is a flowchart showing an execution operation according to the seventh embodiment.
  • the flowchart shown in FIG. 36 is applied to both FIG. 31 and FIG.
  • the same step numbers as in FIG. 29 are assigned to the steps for executing substantially the same processing as in the flowchart shown in FIG.
  • the flowchart shown in FIG. 36 differs from the flowchart shown in FIG. 29 in that the processes of steps S232M and S220M are executed instead of steps S232I and S220I, respectively.
  • steps S232M and S220M are executed instead of steps S232I and S220I, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S232M executed when the control program 2 (referrer-side control program) is in the “execution end” state (“execution end” in step S230F), the microprocessor 100 (core 1) is in the “latest” state. If the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, 2C) is set to the “standby” state, the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, 2C) that has been in the “standby” state is selected. While changing to the “reference destination” state, the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, and 2C) that was in the “reference destination” state is changed to the “standby” state.
  • the synchronization buffer 2 in the “latest” state one of the synchronization buffers 2A, 2B, 2C
  • the “standby” state and the “reference destination” state of the synchronization buffer 2 will be described. Keep it unchanged.
  • microprocessor 100 sets the execution state of the control program 2 to the “running” state and causes the core 2 to start executing the control program 2 (step S232M).
  • step S220M which is executed when the execution end notification of the control program 1 is received (YES in step S216), the microprocessor 100 sets the execution state of the control program 1 to the “execution end” state.
  • the data stored in the global variable area 1 is copied to the synchronous buffer 2 (any one of the synchronous buffers 2A, 2B, 2C) set to the “write destination” state.
  • the microprocessor 100 changes the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, and 2C) that has been in the “write destination” state to the “standby” state and also sets it to the “latest” state.
  • the synchronization buffer 2 (any one of the synchronization buffers 2A, 2B, 2C) that was in the “waiting” state is set to the “write destination” state (step S220M).
  • the state of the synchronization buffer as described above that is, the write destination state, the reference destination state, the standby state, and the latest state of the synchronization buffer are the write destination state recording area, the reference destination state recording area, the standby state recording area, and the latest state, respectively. It is represented by recording in the state recording area that the corresponding synchronization buffer is in the write destination state, the reference destination state, the standby state, and the latest state.
  • Each of these recording areas is generated in the control program work area 1042 in the main memory 104 by the system program 210 in the “control program execution preparation process” (step S1 shown in FIG. 5).
  • the mode of recording that the synchronization buffer is in the write destination state, the reference destination state, the standby state, and the latest state can be appropriately determined.
  • information that identifies a group of synchronous buffers that are grouped in units of batch copy processing that is, a write destination state, a reference destination state, a standby state, and a latest state (identification of the group of synchronous buffers) Number, etc.
  • a flag or state variable indicating whether the state is a write destination state, a reference destination state, a standby state, or the latest state for each group of such synchronous buffers and the flag or state variable A mode of recording using values, etc.
  • the write destination state, reference destination state, and standby state are assigned so as not to overlap for one synchronization buffer, the common state is not divided into the write destination state recording area, the reference destination state recording area, and the standby state recording area.
  • a recording area may be generated and one of these three states may be represented by one set of flags or one state variable.
  • FIG. 34 is a sequence diagram for explaining in common with the above-described sixth embodiment, and in the seventh embodiment, “latest” shown along the time axis of the synchronization buffers 2A, 2B, and 2C. Focusing only on the status identification, the “latest data update flag” is not necessary.
  • FIG. 37 is a flowchart showing another execution operation according to the seventh embodiment.
  • steps that execute the same processing as in the flowchart shown in FIG. 30 are assigned the same step numbers as in FIG.
  • the flowchart shown in FIG. 37 differs from the flowchart shown in FIG. 30 in that the processes of steps S212N and S240N are executed instead of steps S212J and S240J, respectively.
  • this difference will be mainly described, and detailed description of other processes will not be repeated.
  • step S212N executed when the control program 1 (referrer-side control program) is in the “before execution” state (“before execution” in step S210G), the microprocessor 100 sets the synchronization buffer 1 (in the “latest” state) ( If any one of the synchronization buffers 1A, 1B, and 1C) is set to the “standby” state, the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) that is in the “standby” state is referred to as “reference destination”. At the same time, the synchronous buffer 1 (any one of the synchronous buffers 1A, 1B, and 1C) in the “reference destination” state is changed to the “standby” state.
  • the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) in the “latest” state is set to the “reference” state, the “standby” state and the “reference destination” state of the synchronization buffer 1 will be described. Keep it unchanged.
  • microprocessor 100 sets the execution state of the control program 1 to the “running” state and starts the execution of the control program 1 (step S212N).
  • step S240N which is executed when a notice of completion of execution of the control program 1 is received (YES in step S236 or YES in step S236F)
  • the microprocessor 100 sets the execution state of the control program 2 to “ The data stored in the global variable area 2 is copied to the synchronous buffer 1 (any one of the synchronous buffers 1A, 1B, and 1C) set to the “write destination” state after being set to the “execution completed” state.
  • the microprocessor 100 changes the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) that has been in the “write destination” state to the “standby” state and also sets it to the “latest” state. Then, the synchronization buffer 1 (any one of the synchronization buffers 1A, 1B, and 1C) in the “standby” state is changed to the “write destination” state (step S240N).
  • the system program 210 includes the following processes (1) to (3) as the execution preparation process of the control program 230.
  • the system program 210 includes the following processes (1) to (3) as the execution control process of the control program 230.
  • Owner-side start process for starting execution of the owner-side control program (step S212 in FIG. 36 and step S232A in FIG. 37) (2) When execution of the owner-side control program ends, the global variable that is rewritten by the owner-side control program is copied from the global variable area to the synchronous buffer that is the write destination state corresponding to the global variable.
  • Step S232M in FIG. Step S212N in FIG. 37 The referrer-side start process can also be described as follows.
  • the referrer-side control program for each referrer-side control program, there are three synchronization buffers for each global variable referenced from the referrer-side control program, and any one of the synchronization buffers is always in the write destination state. Therefore, copy processing is possible at any time. Furthermore, when the referrer-side control program starts executing, the referrer-side control program refers to the value of the latest global variable at the start of execution by using the synchronous buffer storing the latest copied data as a reference destination. be able to.
  • the write destination state and the standby state of the synchronous buffer are used in the copy process.
  • the synchronization buffer standby state and reference destination state are replaced based on the contents of the latest state recording area.
  • the synchronous buffer that was in the write destination state when the copy was performed from the global variable area enters the reference destination state through the standby state.
  • the synchronization buffer standby is performed in the referrer side start process. It is possible to design to execute the copy process from the global variable area to the synchronization buffer even during the replacement process (second replacement process) between the state and the reference destination state.
  • FIG. 38 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 composed 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. 39 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 apparatus 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 inputs a source program of an external control program 230 (in particular, the user program 236), and edits an existing source program of the control program 230 by a user operation.
  • the editor program 321 further inputs and edits attribute data for variables used by the control program 230.
  • the compiler program 322 provides a function of compiling a source program of the control program 230 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 control program 230.
  • 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 an object program for simulation of the control program 230.
  • 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 object program for the CPU unit 13 of the control program 230 and variable attribute data 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.

Landscapes

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

Abstract

 システムプログラムは、制御プログラムの実行制御処理として、オーナー側制御プログラムを実行開始させるオーナー側開始処理と、オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーするコピー処理と、リファラ側制御プログラムを実行開始させるリファラ側開始処理とを含む。

Description

PLCのCPUユニット、PLC用のシステムプログラムおよびPLC用のシステムプログラムを格納した記録媒体
 本発明は、機械、設備などの動作を制御するために用いられるPLC(Programmable Logic Controller。プログラマブルコントローラともよばれる。)において、複数の制御プログラムを実行する場合のグローバル変数の同期に関する。
 PLCは、たとえば、制御プログラムを実行するマイクロプロセッサを備えるCPU(Central Processing Unit)ユニット、外部のスイッチやセンサからの信号入力および外部のリレーやアクチュエータへの信号出力を担当するIO(Input Output)ユニットなどの複数のユニットで構成される。CPUユニットは、他のユニットへの出力データの送信と、他のユニットからの入力データの受信と、入力データを使用して出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御する。制御プログラムは、ユーザにおける制御目的に応じて作成されるユーザプログラムを含む。制御プログラムは、ユーザプログラムの中で実行が指示されるモーション制御プログラムを含んでいてもよい。
 PLCにおいて、複数の制御プログラムを時分割で実行することが知られている。
 たとえば、特許文献1(特開2007-140655号公報)には、モータを制御するモーション制御機能とシーケンス演算を実行するPLC機能とを1つのCPUで処理する装置において、基本クロックの1サイクルごとに、「定周期モーション制御処理および各軸処理」と「高速シーケンス処理」とを実行し、さらに各基本クロックサイクル内の残りの時間において、「低速シーケンス処理」または「非定周期モーション制御処理」を実行することが記載されている。また、低速シーケンス処理が基本クロックサイクル内に終了しない場合は、所定の基本クロック回数分の時間の停止後に残りの処理を実行することが記載されている。
特開2007-140655号公報
 PLCにおいて複数の制御プログラムを実行する場合に、各制御プログラムが自己の処理のみに使用するローカル変数のほかに、複数の制御プログラムから参照されるグローバル変数が必要となることがある。
 1つの制御プログラムが実行を開始してから終了するまでの間、その制御プログラムは、自らグローバル変数の内容を書き換えるのでない限り、同一のグローバル変数を何回参照しても同一の内容を得られるべきである。しかし、その制御プログラムの実行開始から終了までの間に、他の制御プログラムがグローバル変数の内容を書き換えてしまうと、その制御プログラムはグローバル変数を用いた一貫性のある演算ができなくなる。
 このような場合に、制御プログラム自身が、グローバル変数を使用する前にグローバル変数の内容を自己のローカル変数にコピーし、実際の演算はローカル変数を参照して行うことが考えられる。あるいは、グローバル変数を書き換えるときは、他の制御プログラムにとって書き換えが不都合でないタイミングまで待ってから書き換えを実行することが考えられる。そうするためには、そのような処理が行われるように、制御プログラムの作成者が、グローバル変数使用上の手続を決めて、それにしたがってプログラミングしなければならず、制御プログラムの作成者にとっての負担となる。
 PLCのシステムプログラムが、グローバル変数を使用する1つの制御プログラムが実行を開始してから終了するまでの間、他の制御プログラムが当該グローバル変数を使用できないようにする排他制御を行えば、制御プログラムの演算の一貫性は確保される。しかし、排他制御を行えば、グローバル変数へのアクセス権を得た制御プログラムが実行終了するまでグローバル変数を使用する他の制御プログラムを実行できなくなるので、リアルタイム性が重視されるPLCにおいて、このような長時間のアクセス制限を伴う排他制御を行うことは現実的でない。
 本発明は、PLCにおいて、グローバル変数の一貫性を確保するための手続の処理を制御プログラム自身が行うことを必要とせず、複数の制御プログラムの並行実行が妨げられることもなく、複数の制御プログラムが一貫性の確保されたグローバル変数を参照できるようにすることを目的とする。
 本発明のある局面によれば、制御対象を制御するPLCのCPUユニットを提供する。PLCのCPUユニットは、マイクロプロセッサと、記憶手段と、通信回路とを含む。PLCのCPUユニットは、出力データの送信と、入力データの受信と、入力データを使用して出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御するように構成されている。記憶手段は、制御プログラムと、制御プログラムの実行を制御するシステムプログラムと、制御プログラムが使用する変数についての属性データとの格納に用いられる。マイクロプロセッサは、記憶手段に格納されたシステムプログラムおよび制御プログラムを実行する。通信回路は、出力データを送信しおよび入力データを受信する。属性データは、変数が複数の制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能である。システムプログラムは、制御プログラムの実行準備処理として、グローバル変数を格納するグローバル変数領域を記憶手段内に生成する処理と、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする同期バッファを記憶手段内に生成する処理とを含む。システムプログラムは、制御プログラムの実行制御処理として、オーナー側制御プログラムを実行開始させるオーナー側開始処理と、オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーするコピー処理と、リファラ側制御プログラムを実行開始させるリファラ側開始処理とを含む。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第1同期バッファおよび第2同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、書込先状態である同期バッファにコピーする処理である。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファと、第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理である。第1同期バッファ、第2同期バッファおよび第3同期バッファは、書込先状態、参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含む。リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが待機状態であることを条件として、待機状態である同期バッファおよび参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む。
 あるいは好ましくは、システムプログラムは、制御プログラムの実行準備処理として、さらに、グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを記憶手段内に生成する処理を含む。コピー処理は、さらに、当該コピー処理に関連する最新データ更新フラグをオンにする処理を含む。リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として、第2入替処理および当該最新データ更新フラグをオフにする処理を含む。それにより、最新データを格納している同期バッファが待機状態であることを条件として実行する第2入替処理を実現する。
 あるいは好ましくは、システムプログラムは、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を含む。コピー処理は、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファが待機状態であることを条件として実行される第2入替処理を含む。
 あるいは好ましくは、リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが書込先状態であることを条件として、書込先状態である同期バッファおよび参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む。
 さらに好ましくは、システムプログラムは、制御プログラムの実行準備処理として、さらに、グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを記憶手段内に生成する処理を含む。コピー処理は、さらに、当該コピー処理に関連する最新データ更新フラグをオンにする処理を含む。リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として、第3入替処理および当該最新データ更新フラグをオフにする処理を含む。それにより、最新データを格納している同期バッファが書込先状態であることを条件として実行される第3入替処理を実現する。
 あるいはさらに好ましくは、システムプログラムは、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を含む。コピー処理は、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファが書込先状態であることを条件として実行される第3入替処理を含む。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。システムプログラムは、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を含む。コピー処理は、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファ、第2同期バッファおよび第3同期バッファを同期バッファの組として生成する処理である。第1同期バッファ、第2同期バッファおよび第3同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、書込先状態である同期バッファにコピーする処理であって、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含む。リファラ側開始処理は、さらに、参照先状態とする同期バッファと同じ組に属する同期バッファであって書込先状態でない同期バッファを待機状態とする処理を含む。
 あるいは好ましくは、第1同期バッファおよび第2同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、参照先状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、書込先状態である同期バッファにコピーする処理である。リファラ側開始処理は、さらに、参照先状態とする同期バッファと同じ組に属する他方の同期バッファを書込先状態とする処理を含む。
 あるいは好ましくは、リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファを書込禁止状態とする処理を含む。システムプログラムは、制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理を含む。コピー処理は、第1同期バッファおよび第2同期バッファのうち書込禁止状態ではないいずれかの同期バッファをコピー先として、コピーする処理である。
 好ましくは、リファラ側開始処理は、さらに、その実行において参照する同期バッファを書込禁止状態とする処理を含む。システムプログラムは、制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理を含む。コピー処理は、コピー先の同期バッファが書込禁止状態でないことを条件として実行される処理である。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、1つの同期バッファを生成する処理である。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。システムプログラムは、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を含む。コピー処理は、第1同期バッファおよび第2同期バッファのうち書込禁止状態ではないいずれかの同期バッファをコピー先として、コピーする処理であって、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファである。コピー処理は、第1同期バッファにコピーする処理である。リファラ側開始処理は、さらに、第1同期バッファに格納されているデータを第2同期バッファにコピーする処理を含む。
 この発明の別の局面に従えば、マイクロプロセッサと、記憶手段と、通信回路とを備え、出力データの送信と、入力データの受信と、入力データを使用して出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、記憶手段に格納されてマイクロプロセッサによって実行されるためのPLC用のシステムプログラムを提供する。記憶手段は、制御プログラムと、制御プログラムの実行を制御するシステムプログラムと、制御プログラムが使用する変数についての属性データとの格納に用いられる。マイクロプロセッサは、システムプログラムに加えて、制御プログラムを実行する。通信回路は、出力データを送信しおよび入力データを受信する。属性データは、変数が複数の制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能である。システムプログラムは、マイクロプロセッサに、制御プログラムの実行準備処理として、グローバル変数を格納するグローバル変数領域を記憶手段内に生成する処理と、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする同期バッファを記憶手段内に生成する処理とを実行させる。システムプログラムは、マイクロプロセッサに、制御プログラムの実行制御処理として、オーナー側制御プログラムを実行開始させるオーナー側開始処理と、オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーするコピー処理と、リファラ側制御プログラムを実行開始させるリファラ側開始処理とを実行させる。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第1同期バッファおよび第2同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、書込先状態である同期バッファにコピーする処理である。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファと、第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理である。第1同期バッファ、第2同期バッファおよび第3同期バッファは、書込先状態、参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含む。リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが待機状態であることを条件として、待機状態である同期バッファおよび参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む。
 あるいは好ましくは、リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが書込先状態であることを条件として、書込先状態である同期バッファおよび参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。システムプログラムは、マイクロプロセッサに、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を実行させる。コピー処理は、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む。
 好ましくは、リファラ側開始処理は、さらに、その実行において参照する同期バッファを書込禁止状態とする処理を含む。システムプログラムは、マイクロプロセッサに、制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理を実行させる。コピー処理は、コピー先の同期バッファが書込禁止状態でないことを条件として実行される処理である。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファである。コピー処理は、第1同期バッファにコピーする処理である。リファラ側開始処理は、さらに、第1同期バッファに格納されているデータを第2同期バッファにコピーする処理を含む。
 この発明のさらに別の局面に従えば、マイクロプロセッサと、記憶手段と、通信回路とを備え、出力データの送信と、入力データの受信と、入力データを使用して出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、記憶手段に格納されてマイクロプロセッサによって実行されるためのPLC用のシステムプログラムを格納した記録媒体を提供する。記憶手段は、制御プログラムと、制御プログラムの実行を制御するシステムプログラムと、制御プログラムが使用する変数についての属性データとの格納に用いられる。マイクロプロセッサは、システムプログラムに加えて、制御プログラムを実行する。通信回路は、出力データを送信しおよび入力データを受信する。属性データは、変数が複数の制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能である。システムプログラムは、マイクロプロセッサに、制御プログラムの実行準備処理として、グローバル変数を格納するグローバル変数領域を記憶手段内に生成する処理と、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする同期バッファを記憶手段内に生成する処理とを実行させる。システムプログラムは、マイクロプロセッサに、制御プログラムの実行制御処理として、オーナー側制御プログラムを実行開始させるオーナー側開始処理と、オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーするコピー処理と、リファラ側制御プログラムを実行開始させるリファラ側開始処理とを実行させる。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第1同期バッファおよび第2同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、書込先状態である同期バッファにコピーする処理である。
 さらに好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファと、第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理である。第1同期バッファ、第2同期バッファおよび第3同期バッファは、書込先状態、参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものである。コピー処理は、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含む。リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが待機状態であることを条件として、待機状態である同期バッファおよび参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む。
 あるいは好ましくは、リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが書込先状態であることを条件として、書込先状態である同期バッファおよび参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。システムプログラムは、マイクロプロセッサに、制御プログラムの実行準備処理として、さらに、最新状態記録領域を記憶手段内に生成する処理を実行させる。コピー処理は、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を含む。リファラ側開始処理は、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む。
 好ましくは、リファラ側開始処理は、さらに、その実行において参照する同期バッファを書込禁止状態とする処理を含む。システムプログラムは、マイクロプロセッサに、制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理を実行させる。コピー処理は、コピー先の同期バッファが書込禁止状態でないことを条件として実行される処理である。
 好ましくは、同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理である。第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファである。コピー処理は、第1同期バッファにコピーする処理である。リファラ側開始処理は、さらに、第1同期バッファに格納されているデータを第2同期バッファにコピーする処理を含む。
 本発明によれば、PLCにおいて、複数の制御プログラムが一貫性の確保されたグローバル変数を参照することができる。その際、グローバル変数の一貫性を確保するための手続の処理を制御プログラム自身が行うことを必要としない。また、グローバル変数へのアクセス権の長時間にわたる開放待ちのために複数の制御プログラムの時分割実行または並列実行が妨げられることもない。
本発明の実施の形態に係るPLCシステムの概略構成を示す模式図である。 本発明の実施の形態に係るCPUユニットのハードウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットで実行されるソフトウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットのメインメモリの領域構成を示す模式図である。 本発明の実施の形態に係るCPUユニットにおけるシステムプログラムの全体処理を示すフローチャートである。 実施の形態1に係る実行動作を示すシーケンス図である。 図6に示す制御サイクル1および2について拡大して示すシーケンス図である。 実施の形態1に係る実行動作を示すフローチャートである。 実施の形態1に係る別の実行動作を示すシーケンス図である。 実施の形態1に係る別の実行動作を示すフローチャートである。 実施の形態2に係る実行動作を示すシーケンス図である。 実施の形態2に係る実行動作を示すフローチャートである。 実施の形態2に係る別の実行動作を示すシーケンス図である。 実施の形態2に係る別の実行動作を示すフローチャートである。 実施の形態3に係る実行動作を示すシーケンス図である。 実施の形態3に係る実行動作を示すフローチャートである。 実施の形態3に係る別の実行動作を示すシーケンス図である。 実施の形態3に係る別の実行動作を示すフローチャートである。 実施の形態3に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態3に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態3に係る実行動作を示すフローチャートである。 実施の形態3に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。 実施の形態3に係る別の実行動作を示すフローチャートである。 実施の形態4および5に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態4および5に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態4に係る実行動作を示すフローチャートである。 実施の形態4および5に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。 実施の形態4に係る別の実行動作を示すフローチャートである。 実施の形態5に係る実行動作を示すフローチャートである。 実施の形態5に係る別の実行動作を示すフローチャートである。 実施の形態6および7に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態6および7に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。 実施の形態6に係る実行動作を示すフローチャートである。 実施の形態6に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。 実施の形態6に係る別の実行動作を示すフローチャートである。 実施の形態7に係る実行動作を示すフローチャートである。 実施の形態7に係る別の実行動作を示すフローチャートである。 本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置のハードウェア構成を示す模式図である。 本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置のソフトウェア構成を示す模式図である。
 本発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰り返さない。
 <A.システム構成>
 本実施の形態に係るPLCは、機械や設備などの制御対象を制御する。本実施の形態に係るPLCは、その構成要素としてCPUユニットを含む。CPUユニットは、マイクロプロセッサと、記憶手段と、通信回路とを含む。記憶手段は、制御プログラム、プログラムの実行を制御するシステムプログラム、および制御プログラムが使用する変数についての属性データの格納に用いられる。マイクロプロセッサは、記憶手段に格納されたシステムプログラムおよび制御プログラムを実行する。通信回路は、出力データを送信しおよび記入力データを受信する。属性データは、変数が複数の制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定を含むことが可能である。まず、図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での演算処理の実行の結果得られたデータなどをキャッシュする機能を有する。
 マイクロプロセッサ100は、以下に説明する実施の形態1~7においては、マルチコアであることを明示していない場合には、シングルコアであるとする。マルチコアとはコア数が2以上の場合を意味する(コア数が2の場合も含む)。
 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の各種機能を実現するためのプログラム群をまとめて示したものである。
 リアルタイムOS200は、複数のプログラムを時間の経過に従い切り替えて実行するための環境を提供する。本実施の形態に係るPLC1においては、CPUユニット13のプログラム実行によって生成された出力データを他のユニットまたは他の装置へ出力(送信)するためのイベント(割り込み)として、制御サイクル開始の割り込みが初期設定される。リアルタイムOS200は、制御サイクル開始の割り込みが発生すると、マイクロプロセッサ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には、プログラム自体を格納する領域のほか、プログラムが実行に用いる変数の属性データを格納する領域1041aも含まれる。変数の属性データは、変数が複数の制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能である。
 制御プログラムの作業領域1042には、各制御プログラム230のローカル変数領域のほか、グローバル変数領域1042aおよび同期バッファ領域1042bがシステムプログラム210によって生成される。制御プログラムの作業領域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.システムプログラムの全体処理動作>
 次に、システムプログラム210の全体処理動作について説明する。
 システムプログラム210の実行段階では、制御プログラム230の実行準備処理および制御プログラム230の実行制御処理が順次実行される。より具体的には、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)および(2)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域を記憶手段内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする同期バッファを記憶手段内に生成する処理
 さらに、制御プログラム230の実行準備処理は、具体的な実装形態に応じたその他の実行準備処理を含みうる。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(3)~(5)の処理を含む。
 (3) オーナー側制御プログラムを実行開始させるオーナー側開始処理
 (4) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーするコピー処理
 (5) リファラ側制御プログラムを実行開始させるリファラ側開始処理
 さらに、制御プログラム230の実行制御処理は、具体的な実装形態に応じたその他の実行制御処理を含みうる。
 図5は、本発明の実施の形態に係るCPUユニットにおけるシステムプログラムの全体処理を示すフローチャートである。図5に示すように、まず、制御プログラム230の実行準備処理が実行され(ステップS1)、続いて、制御プログラム230の実行制御処理が実行される(ステップS2)。制御プログラム230の実行準備処理(ステップS1)に含まれる各処理の実行順序は、適宜設計される。同様に、制御プログラム230の実行制御処理(ステップS2)に含まれる各処理は、制御プログラム230を繰り返し実行するのに伴い繰り返し実行されるものであり、その実行順序は具体的な実装形態に依存する。
 以下、具体的な実装形態の典型例として、実施の形態1~7について説明する。
 <F.単一同期バッファ方式(実施の形態1)>
 (f1:概要)
 実施の形態1においては、複数の制御プログラムが時分割的に実行される場合を想定する。この際、複数の制御プログラムから参照されるグローバル変数が存在する。このグローバル変数に対して、書き換えが可能となっている1つのオーナー側制御プログラムが設定されるとともに、グローバル変数の参照のみが可能となっている1つまたは複数のリファラ側制御プログラムが設定される。以下、オーナー側制御プログラムに設定されている制御プログラムを「グローバル変数のオーナー」、あるいは、単に「オーナー」とも称す。以下、実行サイクルの大小関係の別に、制御プログラムのうちいずれかをグローバル変数のオーナーとして指定した場合について例示する。
 (f2:実行優先度が高く実行サイクルが短い方の制御プログラムがグローバル変数のオーナー)
 以下に示す例では、実行優先度と実行サイクルの長さとが異なる複数の制御プログラム(制御プログラム1~3)が実行される状態を想定する。このとき、制御プログラムの実行優先度が他の制御プログラム2および3に比較して高く、かつ、制御プログラム1の実行サイクルが他の制御プログラム2および3に比較して短いとする。このような状況下において、実行サイクルの短い方の制御プログラム1がグローバル変数のオーナー(オーナー側制御プログラム)に設定され、制御プログラム2および3がグローバル変数のリファラ(リファラ側制御プログラム)に設定されているとする。
 図6は、実施の形態1に係る実行動作を示すシーケンス図である。図6を参照して、制御プログラム1~3が実行されるものとする。図7は、図6に示す制御サイクル1および2について拡大して示すシーケンス図である。図8は、実施の形態1に係る実行動作を示すフローチャートである。
 図6の制御プログラム1~3のそれぞれの時間軸に沿って示した破線の角丸の矩形は、対応する制御プログラムの実行サイクルを示す。たとえば、制御プログラム1は、1回分の制御サイクルを実行サイクルとしており、同様に、制御プログラム2および3は、それぞれ2および4回分の制御サイクルを実行サイクルとしている。なお、以下、説明に用いるシーケンス図においては同様の方法で実行サイクルを表す。
 また、図6の横方向の実線の矢印はデータの遣り取りを示し、また、各矢印に対応付けて示される数字は、対応するデータがいずれの制御サイクルの状態を反映しているかを示す。たとえば、(1)が付与された矢印では、制御サイクル1において制御プログラムが実行されたことで生成されたデータが遣り取りされることを示す。以下、説明に用いるシーケンス図においても同様の方法で実行サイクルを表す。
 図6に示す例では、制御プログラム1がグローバル変数のオーナーであるので、制御プログラム1は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域1に書き込む。一方、リファラ側制御プログラムに設定されている制御プログラム2および3は、同期バッファ領域1042b内のそれぞれ対応する同期バッファ2および3に格納されるデータを参照して処理を実行する。実行の結果などを対応する同期バッファ2および3にそれぞれ書き込むようにしてもよい。また、同期バッファ2および3のデータは、後述するような手順に従って、グローバル変数領域1との間で同期が保たれる。
 図6には、制御プログラム1~3のそれぞれの時間軸に沿って、その制御プログラムの実行状態を示す。より具体的には、予め定められた処理を実行すべき実行サイクル内において、未だ処理を開始していない状態である「実行前」、当該実行サイクル内において処理が行なわれている「実行中」、および、当該実行サイクル内においては既に処理が完了している「実行終了」のいずれかの実行状態が監視される。
 このような実行状態は、実行状態記録領域に各制御プログラムの実行状態を記録することよって表される。実行状態記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。実行状態の記録の態様は、適宜定めることができる。たとえば、実行状態ごとにその実行状態にある制御プログラムを特定する情報(制御プログラムの名称や識別番号など)を記録する態様、制御プログラムごとに実行状態を表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。実行状態フラグは、たとえば、「実行前フラグ」がオンなら「実行前」状態、「実行中フラグ」がオンなら「実行中」状態、などのように用いる。このような実行状態変数としては、たとえば、状態変数の値が「1」なら「実行前」、「2」なら「実行中」、などのように設定することができる。以下、説明する他の実施の形態における制御プログラムの実行状態の管理についても同様である。
 図7には、図6に示すシーケンス図の制御サイクル1および2における実行動作について拡大表示する。なお、図7には、CPUユニット13における実行動作をより詳細に説明するために、システムプログラム210についても示している。このシステムプログラム210は、主として、スケジューラプログラム212、出力処理プログラム214、入力処理プログラム216が動作する時間を示している。出力処理プログラム214、入力処理プログラム216は、スケジューラプログラム212が行う実行制御によって各制御サイクルの冒頭部分の時間(図7では制御プログラム1が実行開始される前の時間)に実行される。以下、説明する他の実施の形態においても、図7の例から理解できるように、システムプログラム210が動作している時間が存在するが、説明を簡略化する観点から図示しないこととする。図6および7の各制御サイクルは、システムタイマ108が発生する制御サイクル開始の割り込み信号が、マイクロプロセッサ100に入力することにより開始される。制御サイクル開始の割り込みがあれば、リアルタイムOS200は、実行中の制御プログラムがある場合、その実行を中断して、システムプログラム210(スケジューラプログラム212)をマイクロプロセッサ100に実行させる。
 図8を参照して、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行準備処理を実行する(ステップS1)。続いて、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行制御処理を実行する(図5に示すステップS2)。この制御プログラム230の実行制御処理の詳細な一例がステップS200~S270に相当する。
 まず、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を待つ(ステップS200)。制御サイクル開始の割り込み信号を受けると(ステップS200においてYES)、マイクロプロセッサ100は、現在の制御サイクルから開始する制御プログラムを「実行前」状態に設定する。すなわち、制御プログラム1の実行サイクルが現在の制御サイクルから開始する場合には、制御プログラム1を「実行前」状態に設定する。同様に、制御プログラム2の実行サイクルが現在の制御サイクルから開始する場合には、制御プログラム2を「実行前」状態に設定する。制御プログラム3の実行サイクルが現在の制御サイクルから開始する場合には、制御プログラム3を「実行前」状態に設定する(ステップS202)。続いて、マイクロプロセッサ100は、システムプログラム210内のIO処理プログラム218(出力処理プログラム214および入力処理プログラム216)を実行する(ステップS204)。
 その後、マイクロプロセッサ100は、制御プログラム1(オーナー側制御プログラム)の実行状態を判断する(ステップS210)。制御プログラム1(オーナー側制御プログラム)が「実行前」状態である場合(ステップS210において「実行前」)には、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212)。
 制御プログラム1(オーナー側制御プログラム)が「実行中」状態である場合(ステップS210において「実行中」)には、マイクロプロセッサ100は、制御プログラム1の未実行の部分の実行を開始する(ステップS214)。
 制御プログラム1(オーナー側制御プログラム)が「実行終了」状態である場合(ステップS210において「実行終了」)には、処理はステップS230へ進む。
 ステップS212またはステップS214において制御プログラム1の実行が開始された後、マイクロプロセッサ100は、制御プログラム1の実行終了通知を受けたか否かを判断する(ステップS216)。
 制御プログラム1の実行終了通知を受けていない場合(ステップS216においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS218)。制御サイクル開始の割り込み信号を受けた場合(ステップS218においてYESの場合)には、ステップS202以下の処理が繰り返される。すなわち、制御プログラム1の実行終了通知を受けるまでに制御サイクル開始割り込みが発生すると、制御プログラム1の実行はいったん中断され、次の制御サイクルにおいて、IO処理プログラムの実行後に、制御プログラム1の未実行部分が実行される。ただし、図6および7は、制御プログラム1の実行サイクルが制御サイクルに等しく、制御プログラム1が制御サイクル内に終了する処理量しか含まないようにプログラムされている場合を示している。制御プログラム1の実行が制御サイクル内に終了しなければ、制御プログラム1の実行サイクルが延長される。すなわち、制御プログラム1の実行が中断されて、次の制御サイクルにおいて制御プログラム1の未実行の部分が実行される。あるいは、制御プログラム1の実行が制御サイクル(実行サイクル)内に終了しなかった段階で、エラー発生と判断してエラー処理を行うようにしてもよい。図6および図7の制御プログラム2および3や、他の実施の形態についても、制御プログラムが実行サイクル内に終了しなかった場合には、同様に、実行サイクルの延長またはエラー処理が行われる。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS218においてNOの場合)には、ステップS216以下の処理が繰り返される。制御サイクル開始の割り込み信号の処理は、システムプログラム210のフローチャート上便宜的にこのように表現するが、実装上は、マイクロプロセッサ100は、ステップS216およびS218のループを実行するのではなく、制御プログラム1の実行を開始してから終了するまで、システムプログラム210を実行していない。制御プログラム1の実行が終了するまでに制御サイクル開始の割り込みがあれば、リアルタイムOS200は、制御プログラム1の実行を中断させてシステムプログラム210をステップS202から実行させる。本フローチャートの制御プログラム2および3に関する制御サイクル開始の割り込み信号の処理(ステップS236およびS238、ならびに、ステップS256およびS258)、および他のフローチャートの制御サイクル開始の割り込み信号の処理についても、同様である。
 一方、制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)には、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定するとともに、グローバル変数領域1に格納されているデータを同期バッファ2および同期バッファ3にコピーする(ステップS220)。このグローバル変数領域1に格納されているデータの同期バッファ2および同期バッファ3へのコピー動作は、図6および図7において、実線の矢印で示されている。
 但し、このグローバル変数領域1に格納されているデータは、「書込禁止」状態になっている同期バッファにはコピーされない。この書込禁止状態については、後述する。
 ステップS220に続いて、マイクロプロセッサ100は、制御プログラム2(リファラ側制御プログラム)の実行状態を判断する(ステップS230)。制御プログラム2(リファラ側制御プログラム)が「実行前」状態である場合(ステップS230において「実行前」)には、マイクロプロセッサ100は、対応する同期バッファ2を「書込禁止」状態に設定した上で、制御プログラム2の実行状態を「実行中」状態に設定するとともに、制御プログラム2の実行を開始する(ステップS232)。
 制御プログラム2(リファラ側制御プログラム)が「実行中」状態である場合(ステップS230において「実行中」)には、マイクロプロセッサ100は、制御プログラム2の未実行の部分の実行を開始する(ステップS234)。このとき、対応する同期バッファ2の「書込禁止」状態は解除されず、そのまま維持される。
 制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230において「実行終了」)には、処理はステップS250へ進む。
 ステップS232またはステップS234において制御プログラム2の実行が開始された後、マイクロプロセッサ100は、制御プログラム2の実行終了通知を受けたか否かを判断する(ステップS236)。
 制御プログラム2の実行終了通知を受けていない場合(ステップS236においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS238)。制御サイクル開始の割り込み信号を受けた場合(ステップS238においてYESの場合)には、ステップS202以下の処理が繰り返される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS238においてNOの場合)には、ステップS236以下の処理が繰り返される。
 一方、制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)には、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ2の「書込禁止」状態を解除する(ステップS240)。この同期バッファ2の「書込禁止」状態の期間は、図6および図7において破線の矢印で示されている。
 ステップS240に続いて、マイクロプロセッサ100は、制御プログラム3(リファラ側制御プログラム)の実行状態を判断する(ステップS250)。制御プログラム3(リファラ側制御プログラム)が「実行前」状態である場合(ステップS250において「実行前」)には、マイクロプロセッサ100は、対応する同期バッファ3を「書込禁止」状態に設定した上で、制御プログラム3の実行状態を「実行中」状態に設定するとともに、制御プログラム3の実行を開始する(ステップS252)。
 制御プログラム3(リファラ側制御プログラム)が「実行中」状態である場合(ステップS250において「実行中」)には、マイクロプロセッサ100は、制御プログラム3の未実行の部分の実行を開始する(ステップS254)。このとき、対応する同期バッファ3の「書込禁止」状態は解除されず、そのまま維持される。
 制御プログラム3(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS250において「実行終了」)には、処理はステップS270へ進む。
 ステップS252またはステップS254において制御プログラム3の実行が開始された後、マイクロプロセッサ100は、制御プログラム3の実行終了通知を受けたか否かを判断する(ステップS256)。
 制御プログラム3の実行終了通知を受けていない場合(ステップS256においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS258)。制御サイクル開始の割り込み信号を受けた場合(ステップS258においてYESの場合)には、ステップS202以下の処理が繰り返される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS258においてNOの場合)には、ステップS256以下の処理が繰り返される。
 一方、制御プログラム3の実行終了通知を受けた場合(ステップS256においてYESの場合)には、マイクロプロセッサ100は、制御プログラム3の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ3の「書込禁止」状態の状態を解除する(ステップS260)。この同期バッファ3の「書込禁止」状態の期間は、図6および図7において破線の矢印で示されている。
 ステップS260に続いて、制御サイクル開始の割り込み信号を待つ(ステップS270)。制御サイクル開始の割り込み信号を受けると(ステップS270においてYES)、ステップS202以下の処理が再度実行される。
 オーナー側制御プログラムとリファラ側制御プログラムとが共通であるグローバル変数が複数ある場合には、それらのグローバル変数についての、グローバル変数領域から当該リファラ側制御プログラムの同期バッファへのコピー処理は一括して行われる。同期バッファは、そのように一括してコピー処理が行われる単位でグループ化される。同期バッファの書込禁止状態は、同じグループの同期バッファに共通に設定される。同期バッファの状態が、そのような同じグループの同期バッファに共通して設定されることは、以下、説明する他の実施の形態における、「書込禁止」状態、「書込先」状態、「参照先」状態、「待機」状態、「最新」状態のいずれについても同様である。
 また、上述したような、同期バッファの書込禁止状態は、書込禁止状態記録領域に同期バッファが「書込禁止」状態であることを記録することよって表される。書込禁止状態記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが「書込禁止」状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち「書込禁止」状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに「書込禁止」状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。以下、説明する他の実施の形態における制御プログラムの実行状態の管理についても同様である。
 (f3:実行優先度が低く実行サイクルが長い方の制御プログラムがグローバル変数のオーナー)
 以下に示す例では、グローバル変数のリファラ(リファラ側制御プログラム)に設定されている制御プログラム1の方がより高い実行優先度とより短い実行サイクルとを有しており、グローバル変数のオーナー(オーナー側制御プログラム)に設定されている制御プログラム2の方がより低い実行優先度とより長い実行サイクルとを有しているとする。
 図9は、実施の形態1に係る別の実行動作を示すシーケンス図である。図9に示す例では、制御プログラム2がグローバル変数のオーナーであるので、制御プログラム2は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域2に書き込む。一方、リファラ側制御プログラムに設定されている制御プログラム1は、同期バッファ領域1042b内の同期バッファ1に格納されるデータを参照して処理を実行する。実行の結果などを対応する同期バッファ1に書き込むようにしてもよい。一方、制御プログラム1の実行サイクルは、制御プログラム2に比較して短いものとする。図9に示す例では、制御プログラム1の実行サイクルは1回分の制御サイクルに相当し、制御プログラム2の実行サイクルは2回分の制御サイクルに相当する。
 このような場合には、以下に示すような手順に従って、同期バッファ2とグローバル変数領域1との間で同期が保たれる。
 図10は、実施の形態1に係る別の実行動作を示すフローチャートである。図10のフローチャートにおいては、図8に示すフローチャートと同一の処理を実行するステップについては、図8と同一のステップ番号を付与している。
 図10を参照して、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行準備処理を実行する(ステップS1)。続いて、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行制御処理を実行する(図5に示すステップS2)。
 より具体的には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を待つ(ステップS200)。制御サイクル開始の割り込み信号を受けると(ステップS200においてYES)、現在の制御サイクルから開始する制御プログラムを「実行前」状態に設定する(ステップS202)。続いて、マイクロプロセッサ100は、システムプログラム210内のIO処理プログラム218(出力処理プログラム214および入力処理プログラム216)を実行する(ステップS204)。
 その後、マイクロプロセッサ100は、制御プログラム1(リファラ側制御プログラム)の実行状態を判断する(ステップS210A)。制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Aにおいて「実行前」)には、マイクロプロセッサ100は、対応する同期バッファ1を「書込禁止」状態に設定した上で、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212A)。
 制御プログラム1(リファラ側制御プログラム)が「実行中」状態である場合(ステップS210Aにおいて「実行中」)には、マイクロプロセッサ100は、制御プログラム1の未実行の部分の実行を開始する(ステップS214)。このとき、対応する同期バッファ1の「書込禁止」状態は解除されず、そのまま維持される。
 制御プログラム1(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS210Aにおいて「実行終了」)には、処理はステップS230Aへ進む。
 ステップS212AまたはステップS214において制御プログラム1の実行が開始された後、マイクロプロセッサ100は、制御プログラム1の実行終了通知を受けたか否かを判断する(ステップS216)。
 制御プログラム1の実行終了通知を受けていない場合(ステップS216においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS218)。制御サイクル開始の割り込み信号を受けた場合(ステップS218においてYESの場合)には、ステップS202以下の処理が繰り返される。すなわち、制御プログラム1の実行終了通知を受けるまでに制御サイクル開始割り込みが発生すると、制御プログラム1の実行はいったん中断され、次の制御サイクルにおいて、IO処理プログラムの実行後に、制御プログラム1の未実行部分が実行される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS218においてNOの場合)には、ステップS216以下の処理が繰り返される。
 一方、制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)には、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ1の「書込禁止」状態を解除する(ステップS220A)。この同期バッファ1の「書込禁止」状態の期間は、図9において破線の矢印で示されている。
 ステップS220Aに続いて、マイクロプロセッサ100は、制御プログラム2(オーナー側制御プログラム)の実行状態を判断する(ステップS230A)。制御プログラム2(オーナー側制御プログラム)が「実行前」状態である場合(ステップS230Aにおいて「実行前」)には、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行中」状態に設定するとともに、制御プログラム2の実行を開始する(ステップS232A)。
 制御プログラム2(オーナー側制御プログラム)が「実行中」状態である場合(ステップS230Aにおいて「実行中」)には、マイクロプロセッサ100は、制御プログラム2の未実行の部分の実行を開始する(ステップS234)。
 制御プログラム2(オーナー側制御プログラム)が「実行終了」状態である場合(ステップS230Aにおいて「実行終了」)には、処理はステップS270へ進む。
 ステップS232またはステップS234において制御プログラム2の実行が開始された後、マイクロプロセッサ100は、制御プログラム2の実行終了通知を受けたか否かを判断する(ステップS236)。
 制御プログラム2の実行終了通知を受けていない場合(ステップS236においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS238)。制御サイクル開始の割り込み信号を受けた場合(ステップS238においてYESの場合)には、ステップS202以下の処理が繰り返される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS238においてNOの場合)には、ステップS236以下の処理が繰り返される。
 一方、制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)には、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定するとともに、グローバル変数領域2に格納されているデータを同期バッファ1にコピーする(ステップS240A)。このグローバル変数領域2に格納されているデータの同期バッファ1へのコピー動作は、図9において、実線の矢印で示されている。
 ステップS240Aに続いて、制御サイクル開始の割り込み信号を待つ(ステップS270)。制御サイクル開始の割り込み信号を受けると(ステップS270においてYES)、ステップS202以下の処理が再度実行される。
 説明を簡略化する観点から、図9には1つのグローバル変数を参照するリファラ側制御プログラムの数が「1」である例を示すが、リファラ側制御プログラムの数は任意に設定できる。いずれの実施形態においても、1つのグローバル変数を参照するリファラ側制御プログラムの数は任意である。リファラ側制御プログラムを1つしか示していない実施形態についても、図6~8を参考にすれば、リファラ側制御プログラムが複数ある場合の動作を理解できるであろう。
 (f4:まとめ)
 いずれの実施形態においても、制御プログラム1および制御プログラム2がある場合に、あるグローバル変数については制御プログラム1がオーナーであり、別のグローバル変数については制御プログラム2がオーナーであるということがありうる。システムプログラムの「制御プログラムの実行制御処理」の動作は、グローバル変数ごとに理解することができる。
 上述したように、実施の形態1においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)および(2)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする1つの同期バッファを提供する同期バッファ領域1042bを記憶手段(基本的には、メインメモリ104)内に生成する処理
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(4)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図8のステップS212、および、図10のステップS232)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する同期バッファにコピーすることを、コピー先の同期バッファが書込禁止状態でないことを条件として行うコピー処理(図8のS220、および、図10のS240A)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、その実行において参照する同期バッファを書込禁止状態とする処理を実行するリファラ側開始処理(図8のS232,S252、および、図10のS212A)
 (4) リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理(図8のS240,S260、および、図10のS220A)
 上述のような実施の形態1によれば、同期バッファへの書込禁止状態の期間の存在にもかかわらず、たとえば各制御プログラムに共通の制御サイクルの中で各制御プログラムの実行の優先度制御がなされているような場合には、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。すなわち、このような場合には、リファラ側制御プログラムにおいて参照すべきグローバル変数の値は書込禁止状態ではない期間におけるコピー処理によって得ることができる。
 また、実施の形態1によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが単一であるので、グローバル変数の数やリファラ側制御プログラムの数が多くても同期バッファが占めるメモリサイズが小さくてすむ。さらに、同期バッファが単一である点でアルゴリズムが単純であるので、システムプログラムの設計が容易である。
 <G.複数同期バッファへの順次コピー方式(実施の形態2)>
 (g1:概要)
 上述の実施の形態1においては、「書込禁止」状態になっている同期バッファには、グローバル変数領域に格納されているデータはコピーされない構成を採用した例を示す。これに対して、同期バッファを参照するリファラ側制御プログラムの実行状態にかかわらず、グローバル変数領域に格納されているデータを同期バッファにコピーできる構成について説明する。
 より具体的には、実施の形態2においては、同期バッファとして、グローバル変数領域からのデータを一次的に格納する領域と、リファラ側制御プログラムが実際にデータを参照する領域とをそれぞれ設ける。これにより、リファラ側制御プログラムの実行状態に影響されることなく、グローバル変数領域に格納されているデータを同期バッファにコピーできる。
 (g2:実行優先度が高く実行サイクルが短い方の制御プログラムがグローバル変数のオーナー)
 図11は、実施の形態2に係る実行動作を示すシーケンス図である。図11に示すシーケンス図においては、2つの制御プログラム(制御プログラム1および制御プログラム2)が時分割的に実行されるとし、優先度が高く実行サイクルが短い方の制御プログラム1がグローバル変数のオーナー(オーナー側制御プログラム)に設定されているとする。
 図11に示す例では、制御プログラム1がグローバル変数のオーナーであるので、制御プログラム1は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域1に書き込む。一方、同期バッファ領域1042b内には、同期バッファ2Aおよび2Bが設定される。グローバル変数領域1のデータは、まずは、同期バッファ2Aに書き込まれ、続いて、同期バッファ2Aから同期バッファ2Bへ適切なタイミングで転送される。図11に示すような、グローバル変数領域1と同期バッファ2Aおよび2Bとの間の同期処理について、図12を参照して説明する。
 図12は、実施の形態2に係る実行動作を示すフローチャートである。図12のフローチャートにおいては、図8に示すフローチャートと同一の処理を実行するステップについては、図8と同一のステップ番号を付与している。
 図12を参照して、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行準備処理を実行する(ステップS1)。続いて、マイクロプロセッサ100は、システムプログラム210における、制御プログラム230の実行制御処理を実行する(図5に示すステップS2)。
 図12に示すフローチャートにおいては、図8に示すフローチャートのステップS200~S218と同様の処理が実行される。但し、図12に示すフローチャートにおいては、ステップS220に代えてステップS220Bの処理が実行される。
 具体的には、ステップS220Bにおいて、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定するとともに、グローバル変数領域1に格納されているデータを同期バッファ2Aにコピーする。このグローバル変数領域1に格納されているデータの同期バッファ2Aへのコピー動作は、図11において、実線の矢印で示されている。
 ステップS220Bに続いて、マイクロプロセッサ100は、制御プログラム2(リファラ側制御プログラム)の実行状態を判断する(ステップS230)。制御プログラム2(リファラ側制御プログラム)が「実行前」状態である場合(ステップS230において「実行前」)には、マイクロプロセッサ100は、同期バッファ2Aに格納されているデータを同期バッファ2Bにコピーした上で、制御プログラム2の実行状態を「実行中」状態に設定するとともに、制御プログラム2の実行を開始する(ステップS232B)。
 制御プログラム2(リファラ側制御プログラム)が「実行中」状態である場合(ステップS230において「実行中」)には、マイクロプロセッサ100は、制御プログラム2の未実行の部分の実行を開始する(ステップS234)。このとき、同期バッファ2Aに格納されているデータの同期バッファ2Bへのコピーは行われない。
 制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230において「実行終了」)には、処理はステップS270へ進む。
 ステップS232BまたはステップS234において制御プログラム2の実行が開始された後、マイクロプロセッサ100は、制御プログラム2の実行終了通知を受けたか否かを判断する(ステップS236)。
 制御プログラム2の実行終了通知を受けていない場合(ステップS236においてNOの場合)には、マイクロプロセッサ100は、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS238)。制御サイクル開始の割り込み信号を受けた場合(ステップS238においてYESの場合)には、ステップS202以下の処理が繰り返される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS238においてNOの場合)には、ステップS236以下の処理が繰り返される。
 一方、制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)には、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定する(ステップS240B)。
 ステップS240Bに続いて、制御サイクル開始の割り込み信号を待つ(ステップS270)。制御サイクル開始の割り込み信号を受けると(ステップS270においてYES)、ステップS202以下の処理が再度実行される。
 (g3:実行優先度が低く実行サイクルが長い方の制御プログラムがグローバル変数のオーナー)
 以下に示す例では、グローバル変数のリファラ(リファラ側制御プログラム)に設定されている制御プログラム1の方がより高い実行優先度とより短い実行サイクルとを有しており、グローバル変数のオーナー(オーナー側制御プログラム)に設定されている制御プログラム2の方がより長い実行サイクルを有しているとする。
 図13は、実施の形態2に係る別の実行動作を示すシーケンス図である。図13に示す例では、制御プログラム2がグローバル変数のオーナーであるので、制御プログラム2は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域2に書き込む。一方、リファラ側制御プログラムに設定されている制御プログラム1には、同期バッファ1Aおよび1Bが設定される。
 このような場合には、以下に示すような手順に従って、同期バッファ1Aおよび1Bとグローバル変数領域2との間で同期が保たれる。
 図14は、実施の形態2に係る別の実行動作を示すフローチャートである。図14のフローチャートにおいては、図10に示すフローチャートと同一の処理を実行するステップについては、図10と同一のステップ番号を付与している。
 図14に示すフローチャートは、図10に示すフローチャートと比較して、ステップS212A,S220A,S240Aに代えて、それぞれステップS212C,S220C,S240Cの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Aにおいて「実行前」)に実行されるステップS212Cにおいては、マイクロプロセッサ100は、同期バッファ1Aに格納されているデータを同期バッファ1Bにコピーした上で、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212C)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Cにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定する(ステップS220C)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)に実行されるステップS240Cにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定するとともに、グローバル変数領域2に格納されているデータを同期バッファ1Aにコピーする(ステップS240C)。このグローバル変数領域2に格納されているデータの同期バッファ1Aへのコピー動作は、図13において、実線の矢印で示されている。
 (g4:まとめ)
 上述したように、実施の形態2においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)および(2)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として提供する同期バッファ領域1042bを記憶手段(基本的には、メインメモリ104)内に生成する処理
 第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファである。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(3)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図12のステップS212、および、図14のステップS232A)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数をグローバル変数領域からそのグローバル変数に対応する第1同期バッファにコピーするコピー処理(図12のS220B、および、図14のS240C)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、第1同期バッファに格納されているデータを第2同期バッファにコピーする処理を実行するリファラ側開始処理(図12のS232B、および、図14のS212C)
 上述のような実施の形態2によれば、グローバル変数領域から第1同期バッファへのコピー処理を行うことが常に可能であり、さらにリファラ側制御プログラムの実行開始時に第1同期バッファから第2同期バッファへのコピーを行うので、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 また、実施の形態2は、第1同期バッファへのコピー処理の際にコピー先の同期バッファの状態についての判断をする必要がない点で、アルゴリズムが単純である。
 なお、マイクロプロセッサ100がマルチコアの場合には、第1同期バッファへの書き込み(グローバル変数領域からのコピー処理)のタイミングと、第1同期バッファからの読み出し(第2同期バッファへのコピー)のタイミングとが重なることがありえるが、そのような場合は、先に開始した処理が完了してから他方の処理を行うようにすればよい。
 <H.複数同期バッファの選択利用方式(実施の形態3)>
 (h1:概要)
 実施の形態2においては、2つの同期バッファを使用してデータを順送りする形態について例示した。これに対して、実施の形態3においては、複数(典型的には、2つ)の同期バッファを選択的に利用することで、同期バッファを参照するリファラ側制御プログラムの実行状態にかかわらず、グローバル変数領域に格納されているデータを同期バッファにコピーできる構成について説明する。
 (h2:実行優先度が高く実行サイクルが短い方の制御プログラムがグローバル変数のオーナー)
 図15は、実施の形態3に係る実行動作を示すシーケンス図である。図15に示すシーケンス図においては、2つの制御プログラム(制御プログラム1および制御プログラム2)が時分割的に実行されるとし、実行優先度が高く実行サイクルが短い方の制御プログラム1がグローバル変数のオーナー(オーナー側制御プログラム)に設定されているとする。
 図15に示す例では、制御プログラム1がグローバル変数のオーナーであるので、制御プログラム1は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域1に書き込む。一方、同期バッファ領域1042b内には、同期バッファ2Aおよび2Bが設定される。グローバル変数領域1のデータは、同期バッファ2Aおよび同期バッファ2Bの一方に書き込まれる。より具体的には、2つの同期バッファのうち、「書込禁止」状態にはなっていない同期バッファにコピーされる。図15に示すような、グローバル変数領域1と同期バッファ2Aおよび2Bとの間の同期処理について、図16を参照して説明する。
 図16は、実施の形態3に係る実行動作を示すフローチャートである。図16のフローチャートにおいては、図12に示すフローチャートと同一の処理を実行するステップについては、図12と同一のステップ番号を付与している。
 図16に示すフローチャートは、図12に示すフローチャートと比較して、ステップS220B,S232B,S240Bに代えて、それぞれステップS220D,S232D,S240Dの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Dにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを前回コピーしたのと同じ同期バッファ2(同期バッファ2Aまたは同期バッファ2B)にコピーするとともに、データを書き込んだ同期バッファ2を「最新」状態に設定する(ステップS220D)。
 但し、グローバル変数領域1に格納されているデータの書き込み先となっている同期バッファ2が「書込禁止」状態に設定されている場合には、他方の同期バッファ2にデータが書き込まれる。
 制御プログラム2(リファラ側制御プログラム)が「実行前」状態である場合(ステップS230において「実行前」)に実行されるステップS232Dにおいては、マイクロプロセッサ100は、「最新」状態に設定されている同期バッファ2(同期バッファ2Aまたは同期バッファ2B)を、制御プログラム2(リファラ側制御プログラム)の「参照先」状態に設定するとともに「書込禁止」状態にも設定し、さらに、制御プログラム2の実行状態を「実行中」状態に設定するとともに、制御プログラム2の実行を開始する(ステップS232D)。
 なお、制御プログラム2(リファラ側制御プログラム)が「実行中」状態である場合(ステップS230において「実行中」)に実行されるステップS234においては、「最新」状態に設定されている同期バッファ2に対する、「参照先」状態および「書込禁止」状態は解除されず、そのまま維持される。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)に実行されるステップS240Dにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ2の「書込禁止」状態を解除する(ステップS240D)。
 上述したような同期バッファの状態、すなわち、書込禁止状態、参照先状態、最新データを格納している状態(最新状態)は、それぞれ書込禁止状態記録領域、参照先状態記録領域、最新状態記録領域に、対応する同期バッファが書込禁止状態、参照先状態、最新状態であることをそれぞれ記録することよって表される。これらの各記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが書込禁止状態、参照先状態、最新状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち書込禁止状態、参照先状態、最新状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに書込禁止状態、参照先状態、最新状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。以下、説明する他の実施の形態における制御プログラムの実行状態の管理についても同様である。
 (h3:実行優先度が低く実行サイクルが長い方の制御プログラムがグローバル変数のオーナー)
 以下に示す例では、グローバル変数のリファラ(リファラ側制御プログラム)に設定されている制御プログラム1の方がより高い実行優先度とより短い実行サイクルとを有しており、グローバル変数のオーナー(オーナー側制御プログラム)に設定されている制御プログラム2の方がより低い実行優先度とより長い実行サイクルとを有しているとする。
 図17は、実施の形態3に係る別の実行動作を示すシーケンス図である。図17に示す例では、制御プログラム2がグローバル変数のオーナーであるので、制御プログラム2は、その実行の結果などを、グローバル変数領域1042a内のグローバル変数領域2に書き込む。一方、リファラ側制御プログラムに設定されている制御プログラム1には、同期バッファ1Aおよび1Bが設定される。
 このような場合には、以下に示すような手順に従って、同期バッファ1Aおよび1Bとグローバル変数領域2との間で同期が保たれる。
 図18は、実施の形態3に係る別の実行動作を示すフローチャートである。図18のフローチャートにおいては、図14に示すフローチャートと同一の処理を実行するステップについては、図14と同一のステップ番号を付与している。
 図18に示すフローチャートは、図14に示すフローチャートと比較して、ステップS212C,S220C,S240Cに代えて、それぞれステップS212E,S220E,S240Eの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Aにおいて「実行前」)に実行されるステップS212Eにおいては、マイクロプロセッサ100は、「最新」状態に設定されている同期バッファ1(同期バッファ1Aまたは同期バッファ1B)を、制御プログラム1(リファラ側制御プログラム)の「参照先」状態に設定するとともに「書込禁止」状態にも設定し、さらに、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212E)。
 なお、制御プログラム1(リファラ側制御プログラム)が「実行中」状態である場合(ステップS210Aにおいて「実行中」)に実行されるステップS214においては、「最新」状態に設定されている同期バッファ1に対する、「参照先」状態および「書込禁止」状態は解除されず、そのまま維持される。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Eにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ1の「書込禁止」状態を解除する(ステップS220E)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)に実行されるステップS240Eにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを前回コピーしたのと同じ同期バッファ1(同期バッファ1Aまたは同期バッファ1B)にコピーするとともに、データを書き込んだ同期バッファ1を「最新」状態に設定する(ステップS240E)。
 但し、グローバル変数領域2に格納されているデータの書き込み先となっている同期バッファ1が「書込禁止」状態に設定されている場合には、他方の同期バッファ1にデータが書き込まれる。
 (h4:[マルチコア]システムプログラムと同一のコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合について例示する。図19および図20は、実施の形態3に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。より具体的には、図19および図20には、コア1が制御プログラム1を実行し、コア2が制御プログラム2を実行するものとする。このとき、コア1では、制御プログラム1に加えてシステムプログラムも実行される。そして、制御プログラム1がオーナー側制御プログラムに設定されているものとする。図19には、制御プログラム1の実行サイクルと制御プログラム2の実行サイクルとが実質的に同じである場合の例を示し、図20には、制御プログラム1の実行サイクルの方が制御プログラム2の実行サイクルより短い場合の例を示す。
 図19および図20に示すようなマルチコアを採用して、制御プログラム1および制御プログラム2を並列的に実行する場合を考える。制御プログラム2は、コアの資源利用上はいつでも実行可能であるが、PLCとして考えた場合には、制御プログラム2もシステムプログラムの出力処理および入力処理を利用する必要があるため、各制御サイクルの冒頭で実行される出力処理および入力処理の終了を待って、制御プログラム2の実行が開始されることを基本としている。
 なお、制御プログラム2がシステムプログラムの出力処理および入力処理を利用する必要がないのであれば、制御プログラム2の実行サイクルを制御サイクルと同期せずに実行するように設計を変更してもよい。たとえば、制御プログラム2が実行終了すると、すぐに次回のリファラ側開始処理を行うようにしてもよい。
 このような場合には、以下に示すような手順に従って、グローバル変数領域1と同期バッファ2Aおよび2Bとの間で同期が保たれる。
 図21は、実施の形態3に係る実行動作を示すフローチャートである。図21に示すフローチャートは、図19および図20のいずれにも適用される。図21のフローチャートにおいては、図16に示すフローチャートと実質的に同一の処理を実行するステップについては、図16と同一のステップ番号を付与している。
 図21を参照して、マイクロプロセッサ100(コア1)は、システムプログラム210における、制御プログラム230の実行準備処理を実行する(ステップS1)。続いて、マイクロプロセッサ100(コア1)は、システムプログラム210における、制御プログラム230の実行制御処理を実行する(図5に示すステップS2)。この制御プログラム230の実行制御処理の詳細な一例がステップS200~S270に相当する。
 まず、マイクロプロセッサ100(コア1)は、制御サイクル開始の割り込み信号を待つ(ステップS200)。制御サイクル開始の割り込み信号を受けると(ステップS200においてYES)、マイクロプロセッサ100(コア1)は、制御プログラム1の実行サイクルが現在の制御サイクルから開始する場合には、その制御プログラム1を「実行前」状態に設定する(ステップS202F)。続いて、マイクロプロセッサ100(コア1)は、システムプログラム210内のIO処理プログラム218(出力処理プログラム214および入力処理プログラム216)を実行する(ステップS204)。
 その後、マイクロプロセッサ100(コア1)は、制御プログラム1(オーナー側制御プログラム)の実行状態を判断する(ステップS210F)。制御プログラム1(オーナー側制御プログラム)が「実行前」状態である場合(ステップS210Fにおいて「実行前」)には、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212)。但し、マイクロプロセッサ100のコア1が制御プログラム1の実行に専有される前にステップS230F,S232D,S234Fの処理を行う必要があるので、このフローチャートの表現にかかわらず、制御プログラム1の実行開始はこれらの処理の終了後に行う。
 制御プログラム1(オーナー側制御プログラム)が「実行中」状態である場合(ステップS210Fにおいて「実行中」)には、マイクロプロセッサ100(コア1)は、制御プログラム1の未実行の部分の実行を開始する(ステップS214)。但し、上述と同様の理由により、実際には、ステップS230F,S232D,S234Fの処理の終了後に実行を開始する。
 ステップS212またはステップS214において制御プログラム1の実行が開始された後、マイクロプロセッサ100(コア1)は、制御プログラム2(リファラ側制御プログラム)の実行状態を判断する(ステップS230F)。制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230Fにおいて「実行終了」)には、マイクロプロセッサ100(コア1)は、「最新」状態に設定されている同期バッファ2(同期バッファ2Aまたは同期バッファ2B)を、制御プログラム2(リファラ側制御プログラム)の「参照先」状態に設定するとともに「書込禁止」状態にも設定し、さらに、制御プログラム2の実行状態を「実行中」状態に設定するとともに、コア2に制御プログラム2の実行を開始させる(ステップS232D)。
 制御プログラム2(リファラ側制御プログラム)が「実行中」状態である場合(ステップS230Fにおいて「実行中」)には、マイクロプロセッサ100(コア1)は、制御プログラム2の実行制御を行わない(ステップS234F)。このとき、対応する同期バッファ2の「参照先」状態および「書込禁止」状態はいずれも解除されず、制御プログラム2の実行が継続される。
 ステップS232DまたはステップS234Fの後、マイクロプロセッサ100(コア1)は、制御プログラム1(オーナー側制御プログラム)が「実行終了」状態であるか否かを判断する(ステップS211F)。実際には、リアルタイムOS200が制御プログラム1の実行終了を検出することがステップS211Fに相当する。制御プログラム1が実行を終了していない場合(ステップS211FにおいてNOの場合)、マイクロプロセッサ100のコア1は制御プログラム1の実行に専有されているから、実際には、次に説明するステップS216,S236およびS218からなるループ処理、ならびに、ステップS240Dは、このフローチャートのとおりには実行できない。実際には、リアルタイムOS200がコア2における制御プログラム2の実行終了を検出すると、コア1における割り込み処理としてステップS240Dが実行されるのであるが、便宜上このフローチャートに沿って説明する。
 制御プログラム1(オーナー側制御プログラム)が「実行終了」状態である場合(ステップS211FにおいてYESの場合)には、処理はステップS236Fへ進む。
 制御プログラム1(オーナー側制御プログラム)が「実行終了」状態ではない場合(ステップS211FにおいてNOの場合)には、マイクロプロセッサ100(コア1)は、制御プログラム1の実行終了通知を受けたか否かを判断する(ステップS216)。制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)には、処理はステップS220Dへ進む。
 一方、制御プログラム1の実行終了通知を受けていない場合(ステップS216においてNOの場合)には、マイクロプロセッサ100(コア1)は、制御プログラム2の実行終了通知を受けたか否かを判断する(ステップS236)。制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合)には、処理はステップS240Dへ進む。すなわち、制御プログラム1の実行終了通知を受けるまでに制御プログラム2の実行終了通知を受けると、ステップS240Dの処理が実行される。
 一方、制御プログラム2の実行終了通知を受けていない場合(ステップS236においてNOの場合)には、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS218)。制御サイクル開始の割り込み信号を受けた場合(ステップS218においてYESの場合)には、ステップS202F以下の処理が再度実行される。すなわち、制御プログラム1の実行終了通知を受けるまでに制御サイクル開始割り込みが発生すると、ステップS202F以下の処理が再度実行される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS218においてNOの場合)には、ステップS216以下の処理が繰り返される。
 ステップS220Dにおいては、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを前回コピーしたのと同じ同期バッファ2(同期バッファ2Aまたは同期バッファ2B)にコピーするとともに、データを書き込んだ同期バッファ2を「最新」状態に設定する(ステップS220D)。続いて、マイクロプロセッサ100(コア1)は、制御プログラム2の実行終了通知を受けたか否かを判断する(ステップS236F)。制御プログラム2の実行終了通知を受けた場合(ステップS236FにおいてYESの場合)には、処理はステップS240Dへ進む。すなわち、制御サイクル開始割り込みまでに制御プログラム2の実行終了通知を受けると、ステップS240Dの処理が実行される。
 一方、制御プログラム2の実行終了通知を受けていない場合(ステップS236においてNOの場合)には、制御サイクル開始の割り込み信号を受けたか否かを判断する(ステップS270)。制御サイクル開始の割り込み信号を受けた場合(ステップS270においてYESの場合)には、ステップS202F以下の処理が再度実行される。一方、制御サイクル開始の割り込み信号を受けていない場合(ステップS270においてNOの場合)には、ステップS236F以下の処理が繰り返される。
 ステップS240Dにおいては、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ2の「書込禁止」状態を解除する(ステップS240D)。ステップS240Dの実行後、ステップS240Dに進む前に実行されていた処理へ戻る。
 (h5:[マルチコア]システムプログラムとは異なるコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合において、システムプログラムを実行するコアとは異なるコアで実行される制御プログラムがオーナー側制御プログラムに設定されている場合について例示する。
 図22は、実施の形態3に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。図22に示すシーケンス図において、コア2で実行される制御プログラム2がオーナー側制御プログラムに設定されているものとする。
 図23は、実施の形態3に係る別の実行動作を示すフローチャートである。図23のフローチャートにおいては、図18および図21に示すフローチャートと同一の処理を実行するステップについては、それぞれ図18および図21と同一のステップ番号を付与している。
 図23に示すフローチャートは、図21に示すフローチャートと比較して、ステップS210F,S212,S230F,S232D,S220D,S240Dに代えて、それぞれステップS210G,S212E,S230G,S232A,S220E,S240Eの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 ステップS210Gにおいては、マイクロプロセッサ100(コア1)は、制御プログラム1(リファラ側制御プログラム)の実行状態を判断する(ステップS210G)。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Gにおいて「実行前」)に実行されるステップS212Eにおいては、マイクロプロセッサ100(コア1)は、「最新」状態に設定されている同期バッファ1(同期バッファ1Aまたは同期バッファ1B)を、制御プログラム1(リファラ側制御プログラム)の「参照先」状態に設定するとともに「書込禁止」状態にも設定し、さらに、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212E)。但し、制御プログラム1の実行開始はステップS230F,S232A,S234Fの処理の終了後に行う。
 なお、制御プログラム1(リファラ側制御プログラム)が「実行中」状態である場合(ステップS210Gにおいて「実行中」)に実行されるステップS214においては、「最新」状態に設定されている同期バッファ2に対する、「参照先」状態および「書込禁止」状態は解除されず、そのまま維持される。
 ステップS230Gにおいては、マイクロプロセッサ100(コア1)は、制御プログラム2(オーナー側制御プログラム)の実行状態を判断する(ステップS230G)。
 制御プログラム2(オーナー側制御プログラム)が「実行終了」状態である場合(ステップS230Gにおいて「実行終了」)に実行されるステップS232Aにおいては、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行中」状態に設定するとともに、コア2に制御プログラム2の実行を開始させる(ステップS232A)。
 なお、制御プログラム2(オーナー側制御プログラム)が「実行中」状態である場合(ステップS230Gにおいて「実行中」)に実行されるステップS234Fにおいては、制御プログラム2の実行が継続される。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Eにおいては、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行終了」状態に設定するとともに、対応する同期バッファ1の「書込禁止」状態を解除する(ステップS220E)。
 ステップS240Eにおいては、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを前回コピーしたのと同じ同期バッファ1(同期バッファ1Aまたは同期バッファ1B)にコピーするとともに、データを書き込んだ同期バッファ1を「最新」状態に設定する(ステップS240E)。
 但し、グローバル変数領域2に格納されているデータの書き込み先となっている同期バッファ1が「書込禁止」状態に設定されている場合には、他方の同期バッファ1にデータが書き込まれる。
 (h6:まとめ)
 上述したように、実施の形態3においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)および(2)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする第1同期バッファおよび第2同期バッファを同期バッファの組(同期バッファ1Aおよび1B、または、同期バッファ2Aまたは2B)として記憶手段(基本的には、メインメモリ104)内に生成する処理
 このとき、最新データを格納している状態(最新状態)を格納するための最新状態記録領域が記憶手段(基本的には、メインメモリ104)内に生成する処理も含まれる。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(4)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図16および図21のステップS212、ならびに、図18および図23のステップS232A)
 (2) リファラ側制御プログラムを実行開始させる処理であって、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とし、かつ、当該同期バッファを書込禁止状態とする処理を実行するリファラ側開始処理(図16および図21のステップS232D、ならびに、図18および図23のステップS212E)
 (3) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を、グローバル変数領域から、そのグローバル変数に対応する第1同期バッファおよび第2同期バッファのうち書込禁止状態ではないいずれかの同期バッファをコピー先として、コピーする処理であって、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を実行するコピー処理(図16および図21のステップS220D、ならびに、図18および図23のステップS240E)
 (4) リファラ側制御プログラムの実行が終了すると、書込禁止状態であった同期バッファの書込禁止状態を解除する書込禁止解除処理(図16および図21のステップS240D、ならびに、図18および図23のステップS220E)
 上述のような実施の形態3によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが2つあり、常に少なくとも1つの同期バッファに書込可能であるので、いつでもコピー処理が可能である。さらに、リファラ側制御プログラムの実行開始時に、最新状態記録領域の内容に基づいて、コピーされた最新データが格納されている同期バッファを参照先とすることにより、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 書込禁止状態を用いることにおいて共通する上述の実施の形態1と比較すると、実施の形態3では、たとえば、図19に円で囲って示すように、一方の同期バッファの書込禁止期間中にコピー処理を行うべきタイミングが来た場合でも、他方の同期バッファに対してコピー処理を実行した上で、そのコピーしたデータを後に参照側制御プログラムが参照することが可能である。したがって、コピー処理のタイミングが書込禁止期間中に到来したためにそのデータをリファラ側制御プログラムが参照できなくなるということがない。特に、マルチコアのマイクロプロセッサで制御プログラムを並列実行する場合には、一方の同期バッファの書込禁止期間中にコピー処理したデータをリファラ側制御プログラムが参照するということが発生するので、実施の形態3はより有利となる。
 <I.更新フラグ型2バッファ入替方式(実施の形態4)>
 (i1:概要)
 上述の実施の形態3においては、グローバル変数領域1に格納されているデータがコピーされた同期バッファを「書込禁止」状態に設定することで、グローバル変数領域1との間で同期を保つ構成を説明した。これに対して、実施の形態4および5では、同期バッファを「書込先」状態と「参照先」状態とに設定し、これらの状態を入れ替えることにより、グローバル変数領域1との間で同期を保つ構成が採用される。特に、実施の形態4においては、最新データ更新フラグを利用して同期バッファの状態の入れ替えを制御する構成について例示する。
 実施の形態4においても、マイクロプロセッサ100がマルチコアである場合について例示する。
 (i2:[マルチコア]システムプログラムと同一のコアで実行される制御プログラムがグローバル変数のオーナー)
 図24および図25は、実施の形態4に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。より具体的には、図24および図25には、コア1が制御プログラム1を実行し、コア2が制御プログラム2を実行するものとする。このとき、コア1では、制御プログラム1に加えてシステムプログラムも実行される。そして、制御プログラム1がオーナー側制御プログラムに設定されているものとする。図24には、制御プログラム1の実行サイクルと制御プログラム2の実行サイクルとが実質的に同じである場合の例を示し、図25には、制御プログラム1の実行サイクルの方が制御プログラム2の実行サイクルより短い場合の例を示す。
 なお、図24および図25は、後述する実施の形態5と共通的に説明するためのシーケンス図である。後述する実施の形態5においては、コピーされた最新データが格納されている同期バッファを参照先として識別するための情報を扱う。そのため、図24および図25を参照して、実施の形態4について説明する場合には、「最新データ更新フラグ」についてのみ着目し、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別は不要である。一方、図24および図25を参照して、実施の形態5について説明する場合には、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 また、図24および図25においては、「書込先」状態および「参照先」状態を、単に、「書込先」および「参照先」と記述する。
 図24および図25に示すようなマルチコアを採用して、制御プログラム1および制御プログラム2を並列的に実行する場合を考える。制御プログラム2は、コアの資源利用上はいつでも実行可能であるが、PLCとして考えた場合には、制御プログラム2もシステムプログラムの出力処理および入力処理を利用する必要があるため、各制御サイクルの冒頭で実行される出力処理および入力処理の終了を待って、制御プログラム2の実行が開始されることを基本としている。
 なお、制御プログラム2がシステムプログラムの出力処理および入力処理を利用する必要がないのであれば、制御プログラム2の実行サイクルを制御サイクルと同期せずに実行するように設計を変更してもよい。たとえば、制御プログラム2が実行終了すると、すぐに次回のリファラ側開始処理を行うようにしてもよい。
 このような場合には、以下に示すような手順に従って、グローバル変数領域1と同期バッファ2Aおよび2Bとの間で同期が保たれる。
 図26は、実施の形態4に係る実行動作を示すフローチャートである。図26に示すフローチャートは、図24および図25のいずれにも適用される。図26のフローチャートにおいては、図21に示すフローチャートと実質的に同一の処理を実行するステップについては、図21と同一のステップ番号を付与している。
 図26に示すフローチャートは、図21に示すフローチャートと比較して、ステップS232D,S220D,S240Dに代えて、それぞれステップS232G,S220G,S240Gの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 マイクロプロセッサ100は、制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230Fにおいて「実行終了」)に実行されるステップS232Gにおいては、マイクロプロセッサ100(コア1)は、最新データ更新フラグ2がオンに設定されていれば、「書込先」状態であった同期バッファ2(同期バッファ2Aまたは2B)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ2(同期バッファ2Aまたは2B)を「書込先」状態に変更した上で、最新データ更新フラグ2をオンからオフに変更する。
 なお、最新データ更新フラグ2がオンに設定されていなければ(最新データ更新フラグ2がオフに設定されていれば)、同期バッファ2の「書込先」状態および「参照先」状態については変更せず、最新データ更新フラグ2についてもオフのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行中」状態に設定するとともに、コア2に制御プログラム2の実行を開始させる(ステップS232G)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Gにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを「書込先」状態に設定されている同期バッファ2(同期バッファ2Aまたは同期バッファ2B)にコピーするとともに、最新データ更新フラグ2をオンに設定する(ステップS220G)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Gにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定する(ステップS240G)。
 上述したような同期バッファの状態、すなわち、書込先状態および参照先状態は、それぞれ書込先状態記録領域および参照先状態記録領域に、対応する同期バッファが書込先状態および参照先状態であることをそれぞれ記録することよって表される。これらの各記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが書込先状態または参照先状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち書込先状態または参照先状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに書込先状態、参照先状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。なお、1つの同期バッファについて書込先状態と参照先状態とは重複しないように付与されるので、書込先状態記録領域と参照先状態記録領域とを分けずに共通の状態記録領域を生成し、1つのフラグまたは状態変数によって書込先状態か参照先状態かを表してもよい。
 なお、実施の形態4に係るシーケンス図に表されている最新データ更新フラグの垂直線(時間軸に沿った線)のうち、太い線の部分は最新データ更新フラグがオンであることを表す。
 最新データ更新フラグは、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。最新データ更新フラグは、一括してコピー処理が行われる単位でグループ化された同期バッファのグループごとに設けられる。
 (i3:[マルチコア]システムプログラムとは異なるコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合において、システムプログラムを実行するコアとは異なるコアで実行される制御プログラムがオーナー側制御プログラムに設定されている場合について例示する。
 図27は、実施の形態4に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。図27に示すシーケンス図において、コア2で実行される制御プログラム2がオーナー側制御プログラムに設定されているものとする。図27については、上述の図24および図25と同様に、後述する実施の形態5と共通的に説明するためのシーケンス図である。そのため、図27を参照して、実施の形態4について説明する場合には、「最新データ更新フラグ」についてのみ着目し、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別は不要である。一方、図27を参照して、実施の形態5について説明する場合には、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図28は、実施の形態4に係る別の実行動作を示すフローチャートである。図28のフローチャートにおいては、図23に示すフローチャートと同一の処理を実行するステップについては、それぞれ図23と同一のステップ番号を付与している。
 図28に示すフローチャートは、図23に示すフローチャートと比較して、ステップS212E,S220E,S240Eに代えて、それぞれステップS212H,S220H,S240Hの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Gにおいて「実行前」)に実行されるステップS212Hにおいては、マイクロプロセッサ100(コア1)は、最新データ更新フラグ1がオンに設定されていれば、「書込先」状態であった同期バッファ1(同期バッファ1Aまたは1B)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ1(同期バッファ1Aまたは1B)を「書込先」状態に変更した上で、最新データ更新フラグ1をオンからオフに変更する。
 なお、最新データ更新フラグ1がオンに設定されていなければ(最新データ更新フラグ1がオフに設定されていれば)、同期バッファ1の「書込先」状態および「参照先」状態については変更せず、最新データ更新フラグ1についてもオフのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212H)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Hにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定する(ステップS220H)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Hにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを「書込先」状態に設定されている同期バッファ1(同期バッファ1Aまたは同期バッファ1B)にコピーするとともに、最新データ更新フラグ1をオンに設定する(ステップS240H)。
 (i4:まとめ)
 上述したように、実施の形態4においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)~(3)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段内(基本的には、メインメモリ104)に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする、第1同期バッファおよび第2同期バッファを同期バッファの組(同期バッファ1Aおよび1B、または、同期バッファ2Aまたは2B)として記憶手段(基本的には、メインメモリ104)内に生成する処理
 (3) グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを記憶手段(基本的には、メインメモリ104)内に生成する処理
 第1同期バッファおよび第2同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である「書込先」状態、および、リファラ側制御プログラムから参照可能な状態である「参照先」状態のうち、いずれかの状態が重複せずに付与される。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(3)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図26のステップS212、および、図28のステップS232A)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を、グローバル変数領域から、そのグローバル変数に対応する書込先状態である同期バッファにコピーする処理であって、さらに、当該コピー処理に関連する最新データ更新フラグをオンにする処理を実行するコピー処理(図26のステップS220G、および、図28のステップS240H)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが書込先状態であることを条件として(すなわち、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として)、書込先状態である同期バッファおよび参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理と、当該オン状態であった最新データ更新フラグをオフにする処理とを実行するリファラ側開始処理(図26のステップS232G、および、図28のステップS212H)
 上述のような実施の形態4によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが2つあり、リファラ側開始処理において同期バッファの書込先状態と参照先状態との入替処理(第3入替処理)をしている間の短い時間を除き、常にいずれかの同期バッファが書込先状態であるので、いつでもコピー処理が可能である。さらに、リファラ側制御プログラムの実行開始時に、最新データ更新フラグの状態に基づいて、コピーされた最新データが格納されている同期バッファを参照先とすることにより、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 <J.最新データ型2バッファ入替方式(実施の形態5)>
 (j1:概要)
 上述したように、実施の形態5においては、コピーされた最新データが格納されている同期バッファを参照先として識別するための情報を扱う。
 (j2:[マルチコア]システムプログラムと同一のコアで実行される制御プログラムがグローバル変数のオーナー)
 実施の形態5に係るマルチコアのマイクロプロセッサでの実行動作は、上述した図24および図25のシーケンス図に示す。但し、図24および図25は、上述の実施の形態4と共通的に説明するためのシーケンス図であり、実施の形態5においては、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図29は、実施の形態5に係る実行動作を示すフローチャートである。図29に示すフローチャートは、図24および図25のいずれにも適用される。図29のフローチャートにおいては、図21に示すフローチャートと実質的に同一の処理を実行するステップについては、図21と同一のステップ番号を付与している。
 図29に示すフローチャートは、図21に示すフローチャートと比較して、ステップS232D,S220D,S240Dに代えて、それぞれステップS232I,S220I,S240Iの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230Fにおいて「実行終了」)に実行されるステップS232Iにおいては、マイクロプロセッサ100は、「最新」状態に設定されている同期バッファ2(同期バッファ2Aまたは同期バッファ2B)を、制御プログラム2(リファラ側制御プログラム)の「参照先」状態に設定するとともに、他方の同期バッファ2を「書込先」状態に設定し、さらに、制御プログラム2の実行状態を「実行中」状態に設定するとともに、制御プログラム2の実行を開始する(ステップS232I)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Iにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを「書込先」状態に設定されている同期バッファ2(同期バッファ2Aまたは同期バッファ2B)にコピーするとともに、グローバル変数領域1に格納されているデータを書き込んだ先の同期バッファ2を「最新」状態に設定する(ステップS220I)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Iにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定する(ステップS240I)。
 上述したような同期バッファの状態、すなわち、書込先状態、参照先状態、最新状態は、それぞれ書込先状態記録領域、参照先状態記録領域、最新状態記録領域に、対応する同期バッファが書込先状態、参照先状態、最新状態であることをそれぞれ記録することよって表される。これらの各記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが書込先状態、参照先状態、最新状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち書込先状態、参照先状態、最新状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに書込先状態、参照先状態、最新状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。1つの同期バッファについて書込先状態と参照先状態とは重複しないように付与されるので、書込先状態記録領域と参照先状態記録領域とを分けずに共通の状態記録領域を生成し、1つのフラグまたは状態変数によって書込先状態か参照先状態かを表してもよい。
 (j3:[マルチコア]システムプログラムとは異なるコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合において、システムプログラムを実行するコアとは異なるコアで実行される制御プログラムがオーナー側制御プログラムに設定されている場合について例示する。
 実施の形態5に係るマルチコアのマイクロプロセッサでの別の実行動作は、上述した図27のシーケンス図に示す。但し、図27は、上述の実施の形態4と共通的に説明するためのシーケンス図であり、実施の形態5においては、同期バッファ2Aおよび2Bの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図30は、実施の形態5に係る別の実行動作を示すフローチャートである。図30のフローチャートにおいては、図23に示すフローチャートと同一の処理を実行するステップについては、それぞれ図23と同一のステップ番号を付与している。
 図30に示すフローチャートは、図23に示すフローチャートと比較して、ステップS212E,S220E,S240Eに代えて、それぞれステップS212J,S220J,S240Jの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Gにおいて「実行前」)に実行されるステップS212Jにおいては、マイクロプロセッサ100(コア1)は、「最新」状態に設定されている同期バッファ1(同期バッファ1Aまたは同期バッファ1B)を、制御プログラム1(リファラ側制御プログラム)の「参照先」状態に設定するとともに、他方の同期バッファ1を「書込先」状態に設定し、さらに、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212J)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Jにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定する(ステップS220J)。
 制御プログラム1の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Jにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを「書込先」状態に設定されている同期バッファ1(同期バッファ1Aまたは同期バッファ1B)にコピーするとともに、グローバル変数領域1に格納されているデータを書き込んだ先の同期バッファ1を「最新」状態に設定する(ステップS240J)。
 (j4:まとめ)
 上述したように、実施の形態5においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)~(3)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする、第1同期バッファおよび第2同期バッファを同期バッファの組(同期バッファ1Aおよび1B、または、同期バッファ2Aまたは2B)として記憶手段内に生成する処理
 (3) 最新状態記録領域を記憶手段(基本的には、メインメモリ104)内に生成する処理
 第1同期バッファおよび第2同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である「書込先」状態、および、リファラ側制御プログラムから参照可能な状態である「参照先」状態のうち、いずれかの状態が重複せずに付与される。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(3)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図29のステップS212、および、図30のステップS232A)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を、グローバル変数領域から、そのグローバル変数に対応する書込先状態である同期バッファにコピーする処理であって、さらに、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理を実行するコピー処理(図29のステップS220I、および、図30のステップS240J)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新状態記録領域の内容によって特定される最新状態である同期バッファが書込先状態であることを条件として、書込先状態である同期バッファおよび参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を実行するリファラ側開始処理(図29のステップS232I、および、図30のステップS212J)
 なお、リファラ側開始処理は、次のように説明することもできる。すなわち、リファラ側制御プログラムを実行開始させる処理であって、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とし、かつ、参照先状態とする同期バッファと同じ組に属する他方の同期バッファを書込先状態とする処理を実行するリファラ側開始処理。
 上述のような実施の形態5によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが2つあり、リファラ側開始処理において同期バッファの書込先状態と参照先状態との入替処理(第3入替処理)をしている間の短い時間を除き、常にいずれかの同期バッファが書込先状態であるので、いつでもコピー処理が可能である。さらに、リファラ側制御プログラムの実行開始時に、最新状態記録領域の内容に基づいて、コピーされた最新データが格納されている同期バッファを参照先とすることにより、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 <K.更新フラグ型3バッファ入替方式(実施の形態6)>
 (k1:概要)
 上述の実施の形態4においては、最新データ更新フラグを利用して、2つの同期バッファにデータを格納する構成について例示したが、実施の形態6においては、3つの同期バッファにデータを格納する構成について例示する。すなわち、実施の形態4の構成を3つの同期バッファに拡張した構成について例示する。
 実施の形態6においても、マイクロプロセッサ100がマルチコアである場合について例示する。
 (k2:[マルチコア]システムプログラムと同一のコアで実行される制御プログラムがグローバル変数のオーナー)
 図31および図32は、実施の形態6に係るマルチコアのマイクロプロセッサでの実行動作を示すシーケンス図である。より具体的には、図31および図32には、コア1が制御プログラム1を実行し、コア2が制御プログラム2を実行するものとする。このとき、コア1では、制御プログラム1に加えてシステムプログラムも実行される。そして、制御プログラム1がオーナー側制御プログラムに設定されているものとする。図31には、制御プログラム1の実行サイクルと制御プログラム2の実行サイクルとが実質的に同じである場合の例を示し、図32には、制御プログラム1の実行サイクルの方が制御プログラム2の実行サイクルより短い場合の例を示す。
 図31および図32に示すように、実施の形態6においては、制御プログラム1にグローバル変数領域1が対応付けられ、制御プログラム2に同期バッファ2A,2B,2Cが対応付けられている。
 なお、図31および図32は、後述する実施の形態7と共通的に説明するためのシーケンス図である。後述する実施の形態7においては、実施の形態5の構成を同期バッファを3個に拡張した構成に相当し、コピーされた最新データが格納されている同期バッファを参照先として識別するための情報を扱う。そのため、図31および図32を参照して、実施の形態6について説明する場合には、「最新データ更新フラグ」についてのみ着目し、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別は不要である。一方、図31および図32を参照して、実施の形態7について説明する場合には、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 また、図31および図32においては、「書込先」状態および「参照先」状態を、単に、「書込先」および「参照先」と記述する。
 図31および図32に示すようなマルチコアを採用して、制御プログラム1および制御プログラム2を並列的に実行する場合を考える。制御プログラム2は、コアの資源利用上はいつでも実行可能であるが、PLCとして考えた場合には、制御プログラム2もシステムプログラムの出力処理および入力処理を利用する必要があるため、各制御サイクルの冒頭で実行される出力処理および入力処理の終了を待って、制御プログラム2の実行が開始されることを基本としている。
 なお、制御プログラム2がシステムプログラムの出力処理および入力処理を利用する必要がないのであれば、制御プログラム2の実行サイクルを制御サイクルと同期せずに実行するように設計を変更してもよい。たとえば、制御プログラム2が実行終了すると、すぐに次回のリファラ側開始処理を行うようにしてもよい。
 このような場合には、以下に示すような手順に従って、グローバル変数領域1と同期バッファ2Aおよび2Bとの間で同期が保たれる。
 図33は、実施の形態6に係る実行動作を示すフローチャートである。図33に示すフローチャートは、図31および図32のいずれにも適用される。図33のフローチャートにおいては、図26に示すフローチャートと実質的に同一の処理を実行するステップについては、図26と同一のステップ番号を付与している。
 図33に示すフローチャートは、図26に示すフローチャートと比較して、ステップS232GおよびS220Gに代えて、それぞれステップS232KおよびS220Kの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230Fにおいて「実行終了」)に実行されるステップS232Kにおいては、マイクロプロセッサ100は、最新データ更新フラグ2がオンに設定されていれば、「待機」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「待機」状態に変更した上で、最新データ更新フラグ2をオンからオフに変更する。
 なお、最新データ更新フラグ2がオンに設定されていなければ(最新データ更新フラグ2がオフに設定されていれば)、同期バッファ2の「待機」状態および「参照先」状態については変更せず、最新データ更新フラグ2についてもオフのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行中」状態に設定するとともに、コア2に制御プログラム2の実行を開始させる(ステップS232K)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Kにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを「書込先」状態に設定されている同期バッファ2(同期バッファ2A,2B,2Cのいずれか)にコピーする。さらに、マイクロプロセッサ100は、「書込先」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「待機」状態に変更するとともに、「待機」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「書込先」状態に変更した上で、最新データ更新フラグ2をオンに設定する(ステップS220K)。
 上述したような同期バッファの状態、すなわち、同期バッファの書込先状態、参照先状態、待機状態は、それぞれ書込先状態記録領域、参照先状態記録領域、待機状態記録領域に、対応する同期バッファが書込先状態、参照先状態、待機状態であることをそれぞれ記録することよって表される。これらの各記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが書込先状態、参照先状態、待機状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち書込先状態、参照先状態、待機状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに書込先状態、参照先状態、待機状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。なお、1つの同期バッファについて書込先状態、参照先状態、待機状態は重複しないように付与されるので、これらの記録領域を分けずに共通の状態記録領域を生成し、1組のフラグまたは1つの状態変数によってどの状態であるかを表してもよい。
 なお、実施の形態6に係るシーケンス図に表されている最新データ更新フラグの垂直線(時間軸に沿った線)のうち、太い線の部分は最新データ更新フラグがオンであることを表す。
 最新データ更新フラグは、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。最新データ更新フラグは、一括してコピー処理が行われる単位でグループ化された同期バッファのグループごとに設けられる。
 (k3:[マルチコア]システムプログラムとは異なるコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合において、システムプログラムを実行するコアとは異なるコアで実行される制御プログラムがオーナー側制御プログラムに設定されている場合について例示する。
 図34は、実施の形態6に係るマルチコアのマイクロプロセッサでの別の実行動作を示すシーケンス図である。図34に示すシーケンス図において、コア2で実行される制御プログラム2がオーナー側制御プログラムに設定されているものとする。図34については、上述の図31および図32と同様に、後述する実施の形態7と共通的に説明するためのシーケンス図である。そのため、図34を参照して、実施の形態6について説明する場合には、「最新データ更新フラグ」についてのみ着目し、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別は不要である。一方、図34を参照して、実施の形態7について説明する場合には、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図35は、実施の形態6に係る別の実行動作を示すフローチャートである。図35のフローチャートにおいては、図28に示すフローチャートと同一の処理を実行するステップについては、それぞれ図28と同一のステップ番号を付与している。
 図35に示すフローチャートは、図28に示すフローチャートと比較して、ステップS212HおよびS240Hに代えて、それぞれステップS212LおよびS240Lの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Gにおいて「実行前」)に実行されるステップS212Lにおいては、マイクロプロセッサ100は、最新データ更新フラグ1がオンに設定されていれば、「待機」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「待機」状態に変更した上で、最新データ更新フラグ1をオンからオフに変更する。
 なお、最新データ更新フラグ1がオンに設定されていなければ(最新データ更新フラグ1がオフに設定されていれば)、同期バッファ1の「待機」状態および「参照先」状態については変更せず、最新データ更新フラグ1についてもオフのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212L)。
 制御プログラム2の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Lにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを「書込先」状態に設定されている同期バッファ1(同期バッファ1A,1B,1Cのいずれか)にコピーする。さらに、マイクロプロセッサ100は、「書込先」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「待機」状態に変更するとともに、「待機」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「書込先」状態に変更した上で、最新データ更新フラグ1をオンに設定する(ステップS220L)。
 (k4:まとめ)
 上述したように、実施の形態6においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)~(3)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする、第1同期バッファ、第2同期バッファおよび第3同期バッファを同期バッファの組(同期バッファ1A,1B,1C、または、同期バッファ2A,2B,2C)として記憶手段内に生成する処理
 (3) グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを記憶手段内に生成する処理
 このとき、第1同期バッファ、第2同期バッファ、および第3同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である「書込先」状態、リファラ側制御プログラムから参照可能な状態である「参照先」状態、「待機」状態のいずれかの状態が重複せずに付与される。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(3)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図33のステップS212、および、図35のステップS232A)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を、グローバル変数領域から、そのグローバル変数に対応する書込先状態である同期バッファにコピーする処理であって、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理と、当該コピーする処理に関連する最新データ更新フラグをオンにする処理とを実行するコピー処理(図33のステップS220K、および、図35のステップS240L)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが待機状態であることを条件として(すなわち、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として)、待機状態である同期バッファおよび参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理と、当該オン状態であった最新データ更新フラグをオフにする処理を実行するリファラ側開始処理(図33のステップS232K、および、図35のステップS212L)
 上述のような実施の形態6によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが3つあり、常にいずれかの同期バッファが書込先状態であるので、いつでもコピー処理が可能である。さらに、リファラ側制御プログラムの実行開始時に、コピーされた最新データが格納されている同期バッファを参照先とすることにより、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 また、実施の形態6では、リファラ側制御プログラムの実行開始時にコピーされた最新データが格納されている同期バッファを参照先とする手段として、コピー処理において同期バッファの書込先状態と待機状態の入替を行い、リファラ側開始処理において、最新データ更新フラグの状態に基づいて、同期バッファの待機状態と参照先状態の入替を行う。グローバル変数領域からコピーが行われたときに書込先状態であった同期バッファは、待機状態を経て参照先状態となる。
 上述の実施の形態4の場合には、リファラ側開始処理において同期バッファの書込先状態と参照先状態との入替処理(第3入替処理)をしている短い時間の間はグローバル変数領域から同期バッファへのコピー処理をすることができず、第3入替処理の終了を待ってコピー処理を行う必要があったが、実施の形態6の場合には、リファラ側開始処理において同期バッファの待機状態と参照先状態との入替処理(第2入替処理)をしている間であってもグローバル変数領域から同期バッファへのコピー処理を実行するように設計することが可能である。
 <L.最新データ型3バッファ入替方式(実施の形態7)>
 (l1:概要)
 上述の実施の形態5においては、コピーされた最新データが格納されている同期バッファを参照先として識別するための情報を利用して、2つの同期バッファにデータを格納する構成について例示したが、実施の形態7においては、3つの同期バッファにデータを格納する構成について例示する。すなわち、実施の形態5の構成を3つの同期バッファに拡張した構成について例示する。
 実施の形態7においても、マイクロプロセッサ100がマルチコアである場合について例示する。
 (l2:[マルチコア]システムプログラムと同一のコアで実行される制御プログラムがグローバル変数のオーナー)
 実施の形態7に係るマルチコアのマイクロプロセッサでの実行動作は、上述した図31および図32のシーケンス図に示す。但し、図31および図32は、上述の実施の形態6と共通的に説明するためのシーケンス図であり、実施の形態7においては、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図36は、実施の形態7に係る実行動作を示すフローチャートである。図36に示すフローチャートは、図31および図32のいずれにも適用される。図36のフローチャートにおいては、図29に示すフローチャートと実質的に同一の処理を実行するステップについては、図29と同一のステップ番号を付与している。
 図36に示すフローチャートは、図29に示すフローチャートと比較して、ステップS232IおよびS220Iに代えて、それぞれステップS232MおよびS220Mの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム2(リファラ側制御プログラム)が「実行終了」状態である場合(ステップS230Fにおいて「実行終了」)に実行されるステップS232Mにおいては、マイクロプロセッサ100(コア1)は、「最新」状態の同期バッファ2(同期バッファ2A,2B,2Cのいずれか)が「待機」状態に設定されていれば、「待機」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「待機」状態に変更する。
 なお、「最新」状態の同期バッファ2(同期バッファ2A,2B,2Cのいずれか)が「参照」状態に設定されていれば、同期バッファ2の「待機」状態および「参照先」状態については変更せず、そのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム2の実行状態を「実行中」状態に設定するとともに、コア2に制御プログラム2の実行を開始させる(ステップS232M)。
 制御プログラム1の実行終了通知を受けた場合(ステップS216においてYESの場合)に実行されるステップS220Mにおいては、マイクロプロセッサ100は、制御プログラム1の実行状態を「実行終了」状態に設定した上で、グローバル変数領域1に格納されているデータを「書込先」状態に設定されている同期バッファ2(同期バッファ2A,2B,2Cのいずれか)にコピーする。さらに、マイクロプロセッサ100は、「書込先」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「待機」状態に変更するとともに「最新」状態にも設定し、「待機」状態であった同期バッファ2(同期バッファ2A,2B,2Cのいずれか)を「書込先」状態に設定する(ステップS220M)。
 上述したような同期バッファの状態、すなわち、同期バッファの書込先状態、参照先状態、待機状態、最新状態は、それぞれ書込先状態記録領域、参照先状態記録領域、待機状態記録領域、最新状態記録領域に、対応する同期バッファが書込先状態、参照先状態、待機状態、最新状態であることをそれぞれ記録することよって表される。これらの各記録領域は、システムプログラム210が「制御プログラムの実行準備処理」(図5に示すステップS1)において、メインメモリ104内の制御プログラムの作業領域1042に生成する。同期バッファが書込先状態、参照先状態、待機状態、最新状態であることの記録の態様は適宜に定めることができる。たとえば、一括してコピー処理が行われる単位でグループ化された同期バッファのグループのうち書込先状態、参照先状態、待機状態、最新状態であるものを特定する情報(同期バッファのグループの識別番号など)を記録する態様、そのような同期バッファのグループごとに書込先状態、参照先状態、待機状態、最新状態であるかどうかを表すフラグまたは状態変数を設けてそのフラグまたは状態変数の値を用いて記録する態様、などを採用することができる。1つの同期バッファについて書込先状態、参照先状態、待機状態は重複しないように付与されるので、書込先状態記録領域、参照先状態記録領域、待機状態記録領域を分けずに共通の状態記録領域を生成し、1組のフラグまたは1つの状態変数によってこれら3つの状態のうちのどの状態であるかを表してもよい。
 (l3:[マルチコア]システムプログラムとは異なるコアで実行される制御プログラムがグローバル変数のオーナー)
 次に、マイクロプロセッサ100がマルチコアである場合において、システムプログラムを実行するコアとは異なるコアで実行される制御プログラムがオーナー側制御プログラムに設定されている場合について例示する。
 実施の形態7に係るマルチコアのマイクロプロセッサでの別の実行動作は、上述した図34のシーケンス図に示す。但し、図34は、上述の実施の形態6と共通的に説明するためのシーケンス図であり、実施の形態7においては、同期バッファ2A,2B,2Cの時間軸に沿って示した「最新」状態の識別についてのみ着目し、「最新データ更新フラグ」は不要となる。
 図37は、実施の形態7に係る別の実行動作を示すフローチャートである。図37のフローチャートにおいては、図30に示すフローチャートと同一の処理を実行するステップについては、それぞれ図30と同一のステップ番号を付与している。
 図37に示すフローチャートは、図30に示すフローチャートと比較して、ステップS212JおよびS240Jに代えて、それぞれステップS212NおよびS240Nの処理が実行される点が異なっている。以下、主としてこの相違点について説明し、その他の処理についての詳細な説明は繰り返さない。
 制御プログラム1(リファラ側制御プログラム)が「実行前」状態である場合(ステップS210Gにおいて「実行前」)に実行されるステップS212Nにおいては、マイクロプロセッサ100は、「最新」状態の同期バッファ1(同期バッファ1A,1B,1Cのいずれか)が「待機」状態に設定されていれば、「待機」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「参照先」状態に変更するとともに、「参照先」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「待機」状態に変更する。
 なお、「最新」状態の同期バッファ1(同期バッファ1A,1B,1Cのいずれか)が「参照」状態に設定されていれば、同期バッファ1の「待機」状態および「参照先」状態については変更せず、そのまま維持する。
 さらに、マイクロプロセッサ100(コア1)は、制御プログラム1の実行状態を「実行中」状態に設定するとともに、制御プログラム1の実行を開始する(ステップS212N)。
 制御プログラム1の実行終了通知を受けた場合(ステップS236においてYESの場合、または、ステップS236FにおいてYESの場合)に実行されるステップS240Nにおいては、マイクロプロセッサ100は、制御プログラム2の実行状態を「実行終了」状態に設定した上で、グローバル変数領域2に格納されているデータを「書込先」状態に設定されている同期バッファ1(同期バッファ1A,1B,1Cのいずれか)にコピーする。さらに、マイクロプロセッサ100は、「書込先」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「待機」状態に変更するとともに「最新」状態にも設定し、さらに、「待機」状態であった同期バッファ1(同期バッファ1A,1B,1Cのいずれか)を「書込先」状態に変更する(ステップS240N)。
 (l4:まとめ)
 上述したように、実施の形態7においては、システムプログラム210は、制御プログラム230の実行準備処理として、以下の(1)~(3)の処理を含む。
 (1) グローバル変数を格納するグローバル変数領域1042aを記憶手段(基本的には、メインメモリ104)内に生成する処理
 (2) 各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときにグローバル変数領域に代えて参照先とする、第1同期バッファ、第2同期バッファおよび第3同期バッファを同期バッファの組(同期バッファ1A,1B,1C、または、同期バッファ2A,2B,2C)として記憶手段内に生成する処理
 (3) 最新状態記録領域を記憶手段内に生成する処理
 第1同期バッファ、第2同期バッファ、および第3同期バッファは、グローバル変数領域からグローバル変数をコピー可能な状態である「書込先」状態、リファラ側制御プログラムから参照可能な状態である「参照先」状態、「待機」状態のいずれかの状態が重複せずに付与される。
 また、システムプログラム210は、制御プログラム230の実行制御処理として、以下の(1)~(3)の処理を含む。
 (1) オーナー側制御プログラムを実行開始させるオーナー側開始処理(図36のステップS212、および、図37のステップS232A)
 (2) オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を、グローバル変数領域から、そのグローバル変数に対応する書込先状態である同期バッファにコピーする処理であって、さらに、コピー先となった書込先状態である同期バッファおよびその同期バッファと同じ組の中で待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理と、コピー先の同期バッファが最新状態であることを最新状態記録領域に記録する処理とを実行するコピー処理(図36のステップS220M、および、図37のステップS240N)
 (3) リファラ側制御プログラムを実行開始させる処理であって、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新状態記録領域の内容によって特定される最新状態である同期バッファが待機状態であることを条件として、待機状態である同期バッファおよび参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を実行するリファラ側開始処理(図36のステップS232M、および、図37のステップS212N)
 なお、リファラ側開始処理は、次のように説明することもできる。すなわち、リファラ側制御プログラムを実行開始させる処理であって、さらに、最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とし、かつ、参照先状態とする同期バッファと同じ組に属する同期バッファであって書込先状態でない同期バッファを待機状態とする処理を実行するリファラ側開始処理。
 上述のような実施の形態7によれば、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに同期バッファが3つあり、常にいずれかの同期バッファが書込先状態であるので、いつでもコピー処理が可能である。さらに、リファラ側制御プログラムの実行開始時に、コピーされた最新データが格納されている同期バッファを参照先とすることにより、リファラ側制御プログラムはその実行開始時における最新のグローバル変数の値を参照することができる。
 さらに、実施の形態7では、リファラ側制御プログラムの実行開始時にコピーされた最新データが格納されている同期バッファを参照先とする手段として、コピー処理において同期バッファの書込先状態と待機状態の入替を行い、リファラ側開始処理において、最新状態記録領域の内容に基づいて、同期バッファの待機状態と参照先状態の入替を行う。グローバル変数領域からコピーが行われたときに書込先状態であった同期バッファは、待機状態を経て参照先状態となる。
 上述の実施の形態5の場合には、リファラ側開始処理において同期バッファの書込先状態と参照先状態との入替処理(第3入替処理)をしている短い時間の間はグローバル変数領域から同期バッファへのコピー処理をすることができず、第3入替処理の終了を待ってコピー処理を行う必要があったが、実施の形態7の場合には、リファラ側開始処理において同期バッファの待機状態と参照先状態との入替処理(第2入替処理)をしている間であってもグローバル変数領域から同期バッファへのコピー処理を実行するように設計することが可能である。
 <M.サポート装置>
 次に、PLC1で実行されるプログラムの作成およびPLC1のメンテナンスなどを行うためのPLCサポート装置8について説明する。
 図38は、本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置8のハードウェア構成を示す模式図である。図38を参照して、PLCサポート装置8は、典型的には、汎用のコンピュータで構成される。なお、メンテナンス性の観点からは、可搬性に優れたノート型のパーソナルコンピュータが好ましい。
 図38を参照して、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は、汎用的なコンピュータを用いて実現されるので、これ以上の詳細な説明は行わない。
 図39は、本発明の実施の形態に係るCPUユニットに接続して用いられるPLCサポート装置8のソフトウェア構成を示す模式図である。図39を参照して、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は、外部からの制御プログラム230(その中でも特に、ユーザプログラム236)のソースプログラムを入力し、またユーザの操作により既存の制御プログラム230のソースプログラムを編集する。エディタプログラム321は、さらに、制御プログラム230が使用する変数についての属性データの入力および編集も行う。
 コンパイラプログラム322は、制御プログラム230のソースプログラムをコンパイルして、CPUユニット13のマイクロプロセッサ100で実行可能なオブジェクトプログラム形式のユーザプログラム236を生成する機能を提供する。また、コンパイラプログラム322は、ソースプログラム330をコンパイルして、PLCサポート装置8のCPU81で実行可能なオブジェクトプログラム形式のユーザプログラム340を生成する機能を提供する。このユーザプログラム340は、PLCサポート装置8によってPLC1の動作をシミュレート(模擬)するために使用される、シミュレーション用のオブジェクトプログラムである。
 デバッガプログラム323は、制御プログラム230のソースプログラムに対してデバッグを行うための機能を提供する。このデバッグの内容としては、ソースプログラムのうちユーザが指定した範囲を部分的に実行する、ソースプログラムの実行中における変数値の時間的な変化を追跡する、といった動作を含む。
 デバッガプログラム323は、さらに、制御プログラム230のシミュレーション用のオブジェクトプログラムを実行する機能を提供する。このシミュレーション時には、CPUユニット13のシステムプログラムに含まれるシーケンス命令演算プログラム232およびモーション演算プログラム234に代えて、PLCサポートプログラム320に含まれるシミュレーション用シーケンス命令演算プログラム324およびシミュレーション用モーション演算プログラム325が用いられる。
 通信プログラム326は、PLC1のCPUユニット13へ制御プログラム230のCPUユニット13用のオブジェクトプログラムと変数の属性データとを転送する機能を提供する。
 一般的には、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 ターミナル、6 検出スイッチ、7 リレー、8 PLCサポート装置、9 CD-ROM、10 接続ケーブル、11 PLCシステムバス、12 電源ユニット、13 CPUユニット、14,53 IOユニット、15 特殊ユニット、51 ターミナルバス、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 フィールドネットワーク制御回路、210,220 システムプログラム、212 スケジューラプログラム、214 出力処理プログラム、216 入力処理プログラム、218 IO処理プログラム、230 制御プログラム、232 シーケンス命令演算プログラム、234 モーション演算プログラム、236,340 ユーザプログラム、320 サポートプログラム、321 エディタプログラム、322 コンパイラプログラム、323 デバッガプログラム、324 シミュレーション用シーケンス命令演算プログラム、325 シミュレーション用モーション演算プログラム、326 通信プログラム、330 ソースプログラム、1041 プログラム領域、1042 制御プログラムの作業領域、1042a グローバル変数領域、1042b 同期バッファ領域、1043 PLCシステムバス送信バッファ、1044 PLCシステムバス受信バッファ、1045 フィールドネットワーク送信バッファ、1046 フィールドネットワーク受信バッファ、200 リアルタイムOS、SYS システム。

Claims (30)

  1.  制御対象を制御するPLCのCPUユニットであって、
     マイクロプロセッサと、
     記憶手段と、
     通信回路と、を備え、
     前記PLCのCPUユニットは、出力データの送信と、入力データの受信と、前記入力データを使用して前記出力データを生成する制御プログラムの実行とを繰り返すことによって前記制御対象を制御するように構成されており、
     前記記憶手段は、前記制御プログラムと、前記制御プログラムの実行を制御するシステムプログラムと、前記制御プログラムが使用する変数についての属性データとの格納に用いられ、
     前記マイクロプロセッサは、前記記憶手段に格納された前記システムプログラムおよび前記制御プログラムを実行し、
     前記通信回路は、前記出力データを送信しおよび前記入力データを受信し、
     前記属性データは、前記変数が複数の前記制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能であり、
     前記システムプログラムは、前記制御プログラムの実行準備処理として、
      グローバル変数を格納するグローバル変数領域を前記記憶手段内に生成する処理と、
      各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときに前記グローバル変数領域に代えて参照先とする同期バッファを前記記憶手段内に生成する処理とを含み、
     前記システムプログラムは、前記制御プログラムの実行制御処理として、
      オーナー側制御プログラムを実行開始させるオーナー側開始処理と、
      オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を前記グローバル変数領域からそのグローバル変数に対応する前記同期バッファにコピーするコピー処理と、
      リファラ側制御プログラムを実行開始させるリファラ側開始処理とを含む、PLCのCPUユニット。
  2.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第1同期バッファおよび前記第2同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、前記書込先状態である同期バッファにコピーする処理である、請求項1に記載のPLCのCPUユニット。
  3.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、前記第1同期バッファと、前記第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理であり、
     前記第1同期バッファ、前記第2同期バッファおよび前記第3同期バッファは、前記書込先状態、前記参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、さらに、コピー先となった前記書込先状態である同期バッファおよびその同期バッファと同じ組の中で前記待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含み、
     前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記待機状態であることを条件として、前記待機状態である同期バッファおよび前記参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む、請求項2に記載のPLCのCPUユニット。
  4.  前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを前記記憶手段内に生成する処理を含み、
     前記コピー処理は、さらに、当該コピー処理に関連する最新データ更新フラグをオンにする処理を含み、
     前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として、前記第2入替処理および当該最新データ更新フラグをオフにする処理を含み、
     それにより、最新データを格納している同期バッファが前記待機状態であることを条件として実行する前記第2入替処理を実現する、請求項3に記載のPLCのCPUユニット。
  5.  前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を含み、
     前記コピー処理は、さらに、コピー先の同期バッファが最新状態であることを前記最新状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファが前記待機状態であることを条件として実行される前記第2入替処理を含む、請求項3に記載のPLCのCPUユニット。
  6.  前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記書込先状態であることを条件として、前記書込先状態である同期バッファおよび前記参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む、請求項2に記載のPLCのCPUユニット。
  7.  前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、グローバル変数によって関係付けられるオーナー側制御プログラムとリファラ側制御プログラムとの組み合わせごとに最新データ更新フラグを前記記憶手段内に生成する処理を含み、
     前記コピー処理は、さらに、当該コピー処理に関連する最新データ更新フラグをオンにする処理を含み、
     前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファに関連する最新データ更新フラグがオンであることを条件として、前記第3入替処理および当該最新データ更新フラグをオフにする処理を含み、
     それにより、最新データを格納している同期バッファが前記書込先状態であることを条件として実行される前記第3入替処理を実現する、請求項6に記載のPLCのCPUユニット。
  8.  前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を含み、
     前記コピー処理は、さらに、コピー先の同期バッファが最新状態であることを前記最新
    状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファが前記書込先状態であることを条件として実行される前記第3入替処理を含む、請求項6に記載のPLCのCPUユニット。
  9.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を含み、
     前記コピー処理は、さらに、コピー先の同期バッファが最新状態であることを前記最新状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む、請求項1に記載のPLCのCPUユニット。
  10.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、前記第1同期バッファ、前記第2同期バッファおよび第3同期バッファを同期バッファの組として生成する処理であり、
     前記第1同期バッファ、前記第2同期バッファおよび前記第3同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、前記参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、前記書込先状態である同期バッファにコピーする処理であって、さらに、コピー先となった前記書込先状態である同期バッファおよびその同期バッファと同じ組の中で前記待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含み、
     前記リファラ側開始処理は、さらに、前記参照先状態とする同期バッファと同じ組に属する同期バッファであって前記書込先状態でない同期バッファを前記待機状態とする処理を含む、請求項9に記載のPLCのCPUユニット。
  11.  前記第1同期バッファおよび前記第2同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、前記参照先状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、前記書込先状態である同期バッファにコピーする処理であり、
     前記リファラ側開始処理は、さらに、前記参照先状態とする同期バッファと同じ組に属する他方の同期バッファを前記書込先状態とする処理を含む、請求項9に記載のPLCのCPUユニット。
  12.  前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファを書込禁止状態とする処理を含み、
     前記システムプログラムは、前記制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、前記書込禁止状態であった同期バッファの前記書込禁止状態を解除する書込禁止解除処理を含み、
     前記コピー処理は、前記第1同期バッファおよび前記第2同期バッファのうち前記書込禁止状態ではないいずれかの同期バッファをコピー先として、コピーする処理である、請求項9に記載のPLCのCPUユニット。
  13.  前記リファラ側開始処理は、さらに、その実行において参照する前記同期バッファを書込禁止状態とする処理を含み、
     前記システムプログラムは、前記制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、前記書込禁止状態であった同期バッファの前記書込禁止状態を解除する書込禁止解除処理を含み、
     前記コピー処理は、コピー先の前記同期バッファが前記書込禁止状態でないことを条件として実行される処理である、請求項1に記載のPLCのCPUユニット。
  14.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、1つの同期バッファを生成する処理である、請求項13に記載のPLCのCPUユニット。
  15.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記システムプログラムは、前記制御プログラムの実行準備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を含み、
     前記コピー処理は、前記第1同期バッファおよび第2同期バッファのうち前記書込禁止状態ではないいずれかの同期バッファをコピー先として、コピーする処理であって、さらに、コピー先の同期バッファが最新状態であることを前記最新状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む、請求項13に記載のPLCのCPUユニット。
  16.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファであり、
     前記コピー処理は、前記第1同期バッファにコピーする処理であり、
     前記リファラ側開始処理は、さらに、前記第1同期バッファに格納されているデータを前記第2同期バッファにコピーする処理を含む、請求項1に記載のPLCのCPUユニット。
  17.  マイクロプロセッサと、記憶手段と、通信回路とを備え、出力データの送信と、入力データの受信と、前記入力データを使用して前記出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、前記記憶手段に格納されて前記マイクロプロセッサによって実行されるためのPLC用のシステムプログラムであって、
     前記記憶手段は、前記制御プログラムと、前記制御プログラムの実行を制御する前記システムプログラムと、前記制御プログラムが使用する変数についての属性データとの格納に用いられ、
     前記マイクロプロセッサは、前記システムプログラムに加えて、前記制御プログラムを実行し、
     前記通信回路は、前記出力データを送信しおよび前記入力データを受信し、
     前記属性データは、前記変数が複数の前記制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能であり、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行準備処理として、
      グローバル変数を格納するグローバル変数領域を前記記憶手段内に生成する処理と、
      各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときに前記グローバル変数領域に代えて参照先とする同期バッファを前記記憶手段内に生成する処理とを実行させ、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行制御処理として、
      オーナー側制御プログラムを実行開始させるオーナー側開始処理と、
      オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を前記グローバル変数領域からそのグローバル変数に対応する前記同期バッファにコピーするコピー処理と、
      リファラ側制御プログラムを実行開始させるリファラ側開始処理とを実行させる、PLC用のシステムプログラム。
  18.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第1同期バッファおよび前記第2同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、前記書込先状態である同期バッファにコピーする処理である、請求項17に記載のPLC用のシステムプログラム。
  19.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、前記第1同期バッファと、前記第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理であり、
     前記第1同期バッファ、前記第2同期バッファおよび前記第3同期バッファは、前記書込先状態、前記参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、さらに、コピー先となった前記書込先状態である同期バッファおよびその同期バッファと同じ組の中で前記待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含み、
     前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記待機状態であることを条件として、前記待機状態である同期バッファおよび前記参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む、請求項18に記載のPLC用のシステムプログラム。
  20.  前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記書込先状態であることを条件として、前記書込先状態である同期バッファおよび前記参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む、請求項18に記載のPLC用のシステムプログラム。
  21.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行準
    備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を実行させ、
     前記コピー処理は、さらに、コピー先の同期バッファが最新状態であることを前記最新状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む、請求項17に記載のPLC用のシステムプログラム。
  22.  前記リファラ側開始処理は、さらに、その実行において参照する前記同期バッファを書込禁止状態とする処理を含み、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、前記書込禁止状態であった同期バッファの前記書込禁止状態を解除する書込禁止解除処理を実行させ、
     前記コピー処理は、コピー先の前記同期バッファが前記書込禁止状態でないことを条件として実行される処理である、請求項17に記載のPLC用のシステムプログラム。
  23.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファであり、
     前記コピー処理は、前記第1同期バッファにコピーする処理であり、
     前記リファラ側開始処理は、さらに、前記第1同期バッファに格納されているデータを前記第2同期バッファにコピーする処理を含む、請求項17に記載のPLC用のシステムプログラム。
  24.  マイクロプロセッサと、記憶手段と、通信回路とを備え、出力データの送信と、入力データの受信と、前記入力データを使用して前記出力データを生成する制御プログラムの実行とを繰り返すことによって制御対象を制御するPLCのCPUユニットにおいて、前記記憶手段に格納されて前記マイクロプロセッサによって実行されるためのPLC用のシステムプログラムを格納した記録媒体であって、
     前記記憶手段は、前記制御プログラムと、前記制御プログラムの実行を制御する前記システムプログラムと、前記制御プログラムが使用する変数についての属性データとの格納に用いられ、
     前記マイクロプロセッサは、前記システムプログラムに加えて、前記制御プログラムを実行し、
     前記通信回路は、前記出力データを送信しおよび前記入力データを受信し、
     前記属性データは、前記変数が複数の前記制御プログラムから参照されるグローバル変数である場合に、その変数の書き換えができる1つのオーナー側制御プログラムの指定と、その変数の参照のみができる1つまたは複数のリファラ側制御プログラムの指定とを含むことが可能であり、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行準備処理として、
      グローバル変数を格納するグローバル変数領域を前記記憶手段内に生成する処理と、
      各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、そのリファラ側制御プログラムがグローバル変数を参照するときに前記グローバル変数領域に代えて参照先とする同期バッファを前記記憶手段内に生成する処理とを実行させ、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行制御処理として、
      オーナー側制御プログラムを実行開始させるオーナー側開始処理と、
      オーナー側制御プログラムの実行が終了すると、そのオーナー側制御プログラムによって書き換えられるグローバル変数を前記グローバル変数領域からそのグローバル変数に対応する前記同期バッファにコピーするコピー処理と、
      リファラ側制御プログラムを実行開始させるリファラ側開始処理とを実行させる、PLC用のシステムプログラムを格納した記録媒体。
  25.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第1同期バッファおよび前記第2同期バッファは、前記グローバル変数領域からグローバル変数をコピー可能な状態である書込先状態、および、リファラ側制御プログラムから参照可能な状態である参照先状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、前記書込先状態である同期バッファにコピーする処理である、請求項24に記載のPLC用のシステムプログラムを格納した記録媒体。
  26.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、前記第1同期バッファと、前記第2同期バッファと、第3同期バッファとを同期バッファの組として生成する処理であり、
     前記第1同期バッファ、前記第2同期バッファおよび前記第3同期バッファは、前記書込先状態、前記参照先状態、待機状態、のいずれかの状態が重複せずに付与されるものであり、
     前記コピー処理は、さらに、コピー先となった前記書込先状態である同期バッファおよびその同期バッファと同じ組の中で前記待機状態である同期バッファの書込先状態と待機状態とを入れ替える第1入替処理を含み、
     前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記待機状態であることを条件として、前記待機状態である同期バッファおよび前記参照先状態である同期バッファの待機状態と参照先状態とを入れ替える第2入替処理を含む、請求項25に記載のPLC用のシステムプログラムを格納した記録媒体。
  27.  前記リファラ側開始処理は、さらに、実行開始させるリファラ側制御プログラムの同期バッファについて、最新データを格納している同期バッファが前記書込先状態であることを条件として、前記書込先状態である同期バッファおよび前記参照先状態である同期バッファの書込先状態と参照先状態とを入れ替える第3入替処理を含む、請求項25に記載のPLC用のシステムプログラムを格納した記録媒体。
  28.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行準備処理として、さらに、最新状態記録領域を前記記憶手段内に生成する処理を実行させ、
     前記コピー処理は、さらに、コピー先の同期バッファが最新状態であることを前記最新状態記録領域に記録する処理を含み、
     前記リファラ側開始処理は、さらに、前記最新状態記録領域の内容によって特定される最新状態である同期バッファをそのリファラ側制御プログラムの実行において参照する参照先状態とする処理を含む、請求項24に記載のPLC用のシステムプログラムを格納した記録媒体。
  29.  前記リファラ側開始処理は、さらに、その実行において参照する前記同期バッファを書込禁止状態とする処理を含み、
     前記システムプログラムは、前記マイクロプロセッサに、前記制御プログラムの実行制御処理として、さらに、リファラ側制御プログラムの実行が終了すると、前記書込禁止状態であった同期バッファの前記書込禁止状態を解除する書込禁止解除処理を実行させ、
     前記コピー処理は、コピー先の前記同期バッファが前記書込禁止状態でないことを条件として実行される処理である、請求項24に記載のPLC用のシステムプログラムを格納した記録媒体。
  30.  前記同期バッファを生成する処理は、各リファラ側制御プログラムについて、そのリファラ側制御プログラムから参照されるグローバル変数ごとに、第1同期バッファおよび第2同期バッファを同期バッファの組として生成する処理であり、
     前記第2同期バッファは、リファラ側制御プログラムがグローバル変数を参照するときに参照先とする同期バッファであり、
     前記コピー処理は、前記第1同期バッファにコピーする処理であり、
     前記リファラ側開始処理は、さらに、前記第1同期バッファに格納されているデータを前記第2同期バッファにコピーする処理を含む、請求項24に記載のPLC用のシステムプログラムを格納した記録媒体。
PCT/JP2011/056772 2011-03-15 2011-03-22 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体 WO2012124136A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201180068881.5A CN103403684B (zh) 2011-03-15 2011-03-22 可编程逻辑控制器的cpu单元
EP11860793.6A EP2672384B1 (en) 2011-03-15 2011-03-22 Cpu of plc, system program for plc, and recording medium storing system program for plc
US14/017,904 US9618924B2 (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
JP2011056772A JP4957853B1 (ja) 2011-03-15 2011-03-15 Plcのcpuユニット、plc用のシステムプログラムおよびplc用のシステムプログラムを格納した記録媒体
JP2011-056772 2011-03-15

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/017,904 Continuation US9618924B2 (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
WO2012124136A1 true WO2012124136A1 (ja) 2012-09-20

Family

ID=46506007

Family Applications (1)

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

Country Status (5)

Country Link
US (1) US9618924B2 (ja)
EP (1) EP2672384B1 (ja)
JP (1) JP4957853B1 (ja)
CN (1) CN103403684B (ja)
WO (1) WO2012124136A1 (ja)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105122158B (zh) * 2013-04-16 2017-12-22 西门子公司 具有短延迟时间的可编程控制装置
JP2015130121A (ja) * 2014-01-08 2015-07-16 ヤマハ株式会社 中継装置
JP6626240B2 (ja) * 2014-03-13 2019-12-25 オムロン株式会社 コントローラ
CN106104397B (zh) * 2014-03-14 2018-07-10 欧姆龙株式会社 控制装置及控制***
JP6488830B2 (ja) * 2015-03-31 2019-03-27 オムロン株式会社 制御装置
JP2016194831A (ja) * 2015-03-31 2016-11-17 オムロン株式会社 制御装置
JP6540166B2 (ja) * 2015-03-31 2019-07-10 オムロン株式会社 制御装置
JP6356736B2 (ja) * 2016-06-29 2018-07-11 ファナック株式会社 コントローラシステムおよび制御方法
US10466674B2 (en) * 2017-04-24 2019-11-05 Mitsubishi Electric Corporation Programmable logic controller system, and engineering tool computer program product
JP6922583B2 (ja) * 2017-09-15 2021-08-18 オムロン株式会社 情報処理装置、情報処理方法、および、情報処理プログラム
JP6927089B2 (ja) 2018-03-05 2021-08-25 オムロン株式会社 制御装置、システムプログラム、制御方法
US12019774B2 (en) * 2018-04-19 2024-06-25 Murata Machinery, Ltd. Exclusive control system and exclusive control method
DE112018000198T5 (de) * 2018-05-11 2019-12-24 Mitsubishi Electric Corporation Compiler und Programmierungsunterstützungsgerät
JP6729746B2 (ja) * 2019-04-08 2020-07-22 オムロン株式会社 制御装置
JP7404748B2 (ja) * 2019-10-03 2023-12-26 オムロン株式会社 プログラム開発装置およびプログラム開発装置を実現するためのプログラム

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149421A (ja) * 2000-11-15 2002-05-24 Denso Corp 情報処理装置
JP2003203062A (ja) * 2002-01-09 2003-07-18 National Institute Of Advanced Industrial & Technology リアルタイム処理用共有メモリ制御方式及び方法、並びにそれを実行させるためのプログラム
JP2005063033A (ja) * 2003-08-08 2005-03-10 Toshiba Corp クラスタシステム及びサーバプログラム
JP2007140655A (ja) 2005-11-15 2007-06-07 Yaskawa Electric Corp モーションコントローラ

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5119318A (en) * 1989-04-17 1992-06-02 Del Partners L.P. Expert control system for real time management of automated factory equipment
JP3447432B2 (ja) 1995-06-07 2003-09-16 三菱電機株式会社 ネットワークデータサーバ装置およびプログラマブルロジックコントローラシステム
US6608638B1 (en) * 2000-02-07 2003-08-19 National Instruments Corporation System and method for configuring a programmable hardware instrument to perform measurement functions utilizing estimation of the hardware implentation and management of hardware resources
US7203553B2 (en) * 2002-12-23 2007-04-10 Siemens Energy & Automation, Inc. Methods and structures for utilizing a memory device for a PLC
JP2005129026A (ja) * 2003-10-02 2005-05-19 Omron Corp プログラマブルコントローラおよび通信ユニットならびにコントローラシステムおよびデータ処理方法ならびに変数解決方法およびデータ受渡方法
DE102004017050A1 (de) * 2004-04-07 2005-10-27 Robert Bosch Gmbh Datenkonsistenz in Datenverarbeitungsanlagen
US20080313413A1 (en) 2004-07-27 2008-12-18 Franz Hutner Method and Device for Insuring Consistent Memory Contents in Redundant Memory Units
JP2010198600A (ja) 2009-02-02 2010-09-09 Omron Corp 産業用コントローラ
CN101950281B (zh) * 2010-07-06 2015-11-25 无锡中星微电子有限公司 一种控制协处理器的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002149421A (ja) * 2000-11-15 2002-05-24 Denso Corp 情報処理装置
JP2003203062A (ja) * 2002-01-09 2003-07-18 National Institute Of Advanced Industrial & Technology リアルタイム処理用共有メモリ制御方式及び方法、並びにそれを実行させるためのプログラム
JP2005063033A (ja) * 2003-08-08 2005-03-10 Toshiba Corp クラスタシステム及びサーバプログラム
JP2007140655A (ja) 2005-11-15 2007-06-07 Yaskawa Electric Corp モーションコントローラ

Also Published As

Publication number Publication date
JP4957853B1 (ja) 2012-06-20
US20140005805A1 (en) 2014-01-02
JP2012194666A (ja) 2012-10-11
EP2672384A1 (en) 2013-12-11
CN103403684B (zh) 2017-09-08
US9618924B2 (en) 2017-04-11
CN103403684A (zh) 2013-11-20
EP2672384A4 (en) 2015-11-11
EP2672384B1 (en) 2019-07-31

Similar Documents

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

Legal Events

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

Ref document number: 11860793

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2011860793

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE