WO2021106064A1 - Programmable controller - Google Patents

Programmable controller Download PDF

Info

Publication number
WO2021106064A1
WO2021106064A1 PCT/JP2019/046114 JP2019046114W WO2021106064A1 WO 2021106064 A1 WO2021106064 A1 WO 2021106064A1 JP 2019046114 W JP2019046114 W JP 2019046114W WO 2021106064 A1 WO2021106064 A1 WO 2021106064A1
Authority
WO
WIPO (PCT)
Prior art keywords
input
output
unit
controller
programmable controller
Prior art date
Application number
PCT/JP2019/046114
Other languages
French (fr)
Japanese (ja)
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 CN201980102404.2A priority Critical patent/CN114730168B/en
Priority to PCT/JP2019/046114 priority patent/WO2021106064A1/en
Priority to DE112019007840.2T priority patent/DE112019007840T5/en
Priority to JP2020519811A priority patent/JP6739689B1/en
Publication of WO2021106064A1 publication Critical patent/WO2021106064A1/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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Definitions

  • the present invention relates to a programmable controller to which virtualization technology is applied.
  • a programmable controller is a controller generally used for device control in a factory, and executes a control program for device control created by a user such as a device manufacturer. Programmable controllers may be replaced due to failure or update to a new product. However, in the programmable controller, the program specifications are not unified for each product, so even if a new product of the same manufacturer is replaced, the conventional control program cannot be used as it is. Therefore, it is necessary to modify the control program corresponding to the replaced product.
  • Patent Document 1 discloses a process control device to which virtualization technology is applied for a control system for process control.
  • Virtualization technology is a technology that runs software for existing systems on new hardware.
  • the process control device described in Patent Document 1 has a virtualization unit that operates as a substitute for the hardware on the hardware.
  • the replaced operating system is installed on the virtualization unit while the operating system in use is in an operable state.
  • the same control program as the one in use is installed on the replaced operating system.
  • the operation of the control program on the operating system in use is compared with the operation of the control program on the replaced operating system to see if the control program operates normally on the replaced operating system. Is determined. If it works normally, it will be switched to the replaced operating system, but if it does not work properly, the new installed operating system will be stopped.
  • the present invention has been made in view of the above, and when replacing a programmable controller, the control program before replacement is used without being dependent on the hardware and firmware of the programmable controller before replacement.
  • the purpose is to obtain a programmable controller that can be used.
  • the programmable controller of the present invention includes a storage unit and a controller emulator unit in order to solve the above-mentioned problems and achieve the object.
  • the storage unit stores the firmware and control program executed by the programmable controller to be simulated, and the hardware information required to simulate the hardware of the programmable controller to be simulated.
  • the controller emulator unit simulates the operation of the hardware in the programmable controller to be simulated based on the hardware information.
  • the controller emulator section executes the firmware and the control program on the simulated hardware.
  • the firmware and hardware information in the storage unit can be changed according to the programmable controller to be simulated.
  • the programmable controller according to the present invention has an effect that when replacing a programmable controller, the control program before replacement can be used without being dependent on the hardware and firmware of the programmable controller before replacement.
  • the operation of the programmable controller before the replacement is simulated by the programmable controller after the replacement as an example. That is, the programmable controller before replacement is replaced with the programmable controller according to the embodiment.
  • the programmable controller according to the embodiment is simply referred to as a "programmable controller”, and the programmable controller to be replaced is referred to as a "programmable controller before replacement”.
  • the virtualized "programmable controller before replacement" when the operation of the "programmable controller before replacement" is simulated on the programmable controller is referred to as a "virtual controller”.
  • the "programmable controller before replacement” is one of the programmable controllers to be simulated.
  • FIG. 1 is a block diagram schematically showing an example of the configuration of the programmable controller according to the first embodiment.
  • the programmable controller 1 includes a calculation unit 10, a storage unit 20, a communication interface unit 30, and an input / output interface unit 40.
  • the calculation unit 10, the storage unit 20, the communication interface unit 30, and the input / output interface unit 40 are connected via the bus 50.
  • the arithmetic unit 10 is a microprocessor and a chipset configured according to a predetermined hardware architecture.
  • the arithmetic unit 10 is also referred to as a microcomputer or a microcomputer.
  • the calculation unit 10 has a virtualization unit 11 which is a functional unit that simulates an execution environment in which a control program for the hardware of another type of programmable controller 1 is executed on the hardware of the programmable controller 1.
  • the virtualization unit 11 has a management unit 12, a controller emulator unit 13, a mapping information generation unit 15, and a memory-mapped I / O (Input / Output) area 14.
  • the management unit 12 is a functional unit that manages software executed by the calculation unit 10.
  • the management unit 12 is an operating system (OS) having a scheduling function that enables a plurality of software to be executed in parallel.
  • OS operating system
  • the controller emulator unit 13 is a functional unit that simulates the operation of hardware in the programmable controller before replacement. Further, the controller emulator unit 13 is a functional unit that executes the firmware and the control program read from the storage unit 20 and used in the programmable controller before replacement on the hardware simulating the firmware and the control program.
  • the programmable controller before replacement simulated by the controller emulator unit 13 becomes a virtual controller.
  • the controller emulator unit 13 executes an instruction by using the hardware information described later regarding the programmable controller before replacement, and also simulates the operation of the peripheral device of the microcomputer in the programmable controller before replacement to execute the firmware. Further, the controller emulator unit 13 executes a control program on the firmware.
  • the memory-mapped I / O area 14 is an area for virtualizing the input / output between the controller emulator unit 13 and the peripheral devices of the microcomputer, which is generated when the firmware and the control program are simulated.
  • the memory-mapped I / O area 14 is a virtualization of the input / output control registers of the microcomputer of the programmable controller before replacement.
  • An address is assigned to the memory-mapped I / O area 14 as a memory area to be emulated.
  • the mapping information generation unit 15 is a functional unit that generates input / output mapping information in which the input / output numbers of the input / output terminals of the programmable controller 1 and the input / output numbers of the input / output terminals of the programmable controller before replacement are associated with each other. ..
  • the mapping information generation unit 15 stores the generated input / output mapping information in the input / output mapping information storage unit 24 of the storage unit 20.
  • the mapping information generation unit 15 generates input / output mapping information so that the input / output number of the programmable controller before replacement and the input / output number of the programmable controller 1 are the same.
  • the mapping information generation unit 15 refers to the input / output numbers in the control program, the input / output numbers in the control program, that is, the input / output numbers in the programmable controller before replacement, and the input / output numbers in the programmable controller 1. Correspond with the number.
  • the storage unit 20 includes a firmware storage unit 21, a control program storage unit 22, a hardware information storage unit 23, and an input / output mapping information storage unit 24.
  • the storage unit 20 is a storage device that can rewrite the stored data, and for example, is a hard disk device or a non-volatile storage device such as an SSD (Solid State Drive). Further, the storage unit 20 has a volatile storage device such as a RAM (Random Access Memory) for loading a program or temporarily holding data when executing a process in the calculation unit 10. You may.
  • the firmware storage unit 21 is a functional unit that stores the firmware executed by the programmable controller before replacement.
  • the programmable controller before replacement is one of the programmable controllers to be simulated.
  • the firmware storage unit 21 stores the firmware in the binary data format.
  • the control program storage unit 22 is a functional unit that stores the control program executed by the programmable controller before replacement.
  • the hardware information storage unit 23 is a functional unit that stores hardware information necessary for simulating the hardware of the programmable controller before replacement.
  • the hardware information includes hardware configuration information that depends on the hardware of the programmable controller before replacement simulated by the controller emulator unit 13.
  • the hardware configuration information includes a memory map, instruction simulation processing, register configuration, simulation processing at the time of each register operation, and the like.
  • the input / output mapping information storage unit 24 is a functional unit that stores input / output mapping information.
  • the input / output mapping information is information in which the input / output numbers assigned to the input / output terminals in the input / output interface unit 40 of the programmable controller 1 are associated with the input / output numbers assigned to the input / output terminals in the virtual controller. ..
  • the input / output numbers assigned to the input / output terminals in the virtual controller correspond to the input / output numbers assigned to the input / output terminals in the programmable controller before replacement.
  • the controller emulator unit 13 accesses the memory-mapped I / O area 14
  • the input / output number of the memory-mapped I / O area 14 is set to the actual input / output terminal of the input / output interface unit 40. Used when converting to input / output numbers.
  • the communication interface unit 30 is connected to the human interface 70, which is an external device of the programmable controller 1.
  • the human interface 70 is a device that can access the storage unit 20 of the programmable controller 1.
  • the human interface 70 is, for example, an information processing device such as a personal computer.
  • the human interface 70 stores firmware, control program, hardware information, or input / output mapping information in the storage unit 20, or stores firmware, control program, hardware information, or input / output mapping information already stored in the storage unit 20. It can be deleted from the storage unit 20.
  • the human interface 70 is a device capable of receiving the result of automatic allocation of input / output mapping information and confirming the result by the user.
  • the human interface 70 is a device capable of modifying the contents of the input / output mapping information.
  • the user can perform wiring to the input / output terminals of the programmable controller 1 while viewing the input / output mapping information on the human interface 70. Further, when the user changes the wiring to the input / output terminals, the user can change the input / output mapping information on the human interface 70.
  • Hardware information and firmware define the operating environment of the programmable controller before replacement. Therefore, the hardware information and the firmware, which are the operating environment of the programmable controller before the replacement to be simulated, are written from the human interface 70 to the storage unit 20 and executed by the virtualization unit 11 before the replacement. It is possible to simulate the desired operation of the programmable controller of.
  • the input / output interface unit 40 has an input terminal 41, an output terminal 42, and an input / output control unit 43.
  • the input terminal 41 is connected to the input device via wiring.
  • An example of an input device is a switch, sensor or rotary encoder.
  • the output terminal 42 is connected to the output device via wiring.
  • An example of an output device is a relay, valve or actuator.
  • the input terminals 41 are sequentially numbered from the input numbers "0" to "N" (N is an arbitrary natural number).
  • the output terminals 42 are sequentially numbered from output numbers "0" to "N".
  • the input number "i" is expressed as "Input i" (i is a natural number from 0 to N), and the output number "i" is expressed as "Output i". Further, in FIG.
  • a switch 81 is attached to the input terminal 41 of the input number “0”, and a lamp 91 is attached to the output terminal 42 of the output number “0”.
  • the input terminal 41 and the output terminal 42 are collectively referred to as an input / output terminal, and the input device and the output device are collectively referred to as an input / output device.
  • the input / output control unit 43 is a functional unit that controls the transfer of data between the memory-mapped I / O area 14 and the input / output device via the input terminal 41 and the output terminal 42. Specifically, when the input / output control unit 43 accesses the input terminal 41 or the output terminal 42, the input / output control unit 43 cooperates with the controller emulator unit 13 to execute the input / output refresh process.
  • the input / output refresh process is a process of setting the calculated output information in the output device via the output terminal 42 and receiving the input information from the input device via the input terminal 41.
  • FIG. 1 shows a case where one input device and one output device are connected to the programmable controller 1, but the number of input devices and output devices connected to the programmable controller 1 is not limited. .. That is, a plurality of input devices or a plurality of output devices may be connected to the programmable controller 1.
  • the way in which the input / output device is connected to the input / output terminal in the programmable controller before replacement may be different from the way in which the input / output device is connected to the input / output terminal in the programmable controller 1.
  • the input / output number assigned to the input / output terminal of the programmable controller 1 and the input / output number assigned to the input / output terminal of the programmable controller before replacement are associated with each other.
  • Output mapping information is used. That is, the controller emulator unit 13 converts the output destination of the output information from the virtualized output destination in the memory-mapped I / O area 14 to the actual output destination of the programmable controller 1 by using the input / output mapping information. To do. Further, the controller emulator unit 13 converts the virtualized input source in the memory-mapped I / O area 14 into the actual input source in the programmable controller 1 and receives the input information.
  • FIG. 2 is a diagram schematically showing an example of the relationship of each block related to the execution of the control program in the first embodiment.
  • the controller emulator unit 13, the firmware 211a, and the control program 221a are shown as blocks.
  • Firmware 211a is provided as a binary data format file that can be executed by the microcomputer mounted on the programmable controller before replacement.
  • the controller emulator unit 13 is an instruction set simulator (ISS) that can decode a binary file indicating firmware 211a, interpret it with software, and execute it. Further, the controller emulator unit 13 is configured as one process on the management unit 12. Here, in order to execute the firmware 211a for hardware having a different instruction set architecture, the controller emulator unit 13 is specifically described as an ISS, but the controller emulator is provided by a hardware function having an equivalent function. Part 13 may be substituted. Further, when executing the firmware 211a for hardware having the same instruction set architecture, the firmware 211a may be directly executed by the process of the controller emulator unit 13.
  • ISS instruction set simulator
  • the control program 221a is provided as data converted into a format that can be executed by the programmable controller before replacement.
  • the data format and execution method of the control program 221a vary from programmable controller to programmable controller.
  • As the execution method a method executed by the firmware 211a in an interpreter method, a method equipped with dedicated hardware capable of directly executing the control program 221a, or a method combining both of them is assumed.
  • the firmware 211a directly interprets and executes the control program 221a in an interpreter system. As shown in FIG. 2, when the firmware 211a is executed on the controller emulator unit 13, the logic for executing the control program 221a is executed, and as a result, the execution of the control program 221a can be realized. ..
  • FIG. 3 is a diagram showing an example of the relationship between the controller emulator unit and the memory area.
  • FIG. 3 shows the controller emulator unit 13, the memory area 310 emulated by the controller emulator unit 13, and the memory space 350 allocated to the process of the controller emulator unit 13.
  • a memory address is assigned to the ROM (Read Only Memory), RAM, and memory-mapped I / O area 14 included in the virtual controller in the memory area 310.
  • the memory-mapped I / O area 14 is a register area of the peripheral device of the microcomputer in the programmable controller before replacement.
  • control program 221a converted into the execution code for the programmable controller 1, the firmware 211a in the binary data format, the hardware information 231 and the input / output mapping information 241 and are arranged.
  • the hardware information 231 and input / output mapping information 241 of the programmable controller before replacement, and the control program 221a and firmware 211a executed by the programmable controller to be simulated are the memory spaces allocated to the process of the controller emulator unit 13. Expanded to 350.
  • the control program 221a the control program 221 in the memory area 310 is converted into an execution code for the programmable controller 1.
  • the firmware 211a is obtained by converting the firmware 211 of the memory area 310 into a binary data format.
  • the input number assigned to the input terminal 41 of the programmable controller 1 is assigned to the input number of the input terminal of the virtual controller. Therefore, the input number of the input terminal 41 in the programmable controller 1 is associated with the information for identifying the virtual controller to be assigned and the input number of the input terminal in this virtual controller. Further, in the input / output mapping information 241, the output number assigned to the output terminal 42 of the programmable controller 1 is assigned to the virtual controller. Therefore, the output number of the output terminal 42 in the programmable controller 1 is associated with the information that identifies the virtual controller to be assigned and the output number of the output terminal in this virtual controller.
  • the controller emulator unit 13 has a virtual program counter 131 and a virtual general-purpose register 132 in order to simulate the operation of the arithmetic unit including the CPU (Central Processing Unit).
  • the substance of the virtual program counter 131 and the virtual general-purpose register 132 are both one data on the process of the controller emulator unit 13.
  • the virtual general-purpose register 132 stores arbitrary data generated as a result of arithmetic processing in the controller emulator unit 13.
  • the virtual program counter 131 is data for indicating an address on the memory area currently being executed by the controller emulator unit 13, that is, on the memory area 310 to be emulated.
  • the controller emulator unit 13 interprets and executes the firmware 211 at the address held in the virtual program counter 131.
  • the substance of the firmware 211 is the firmware 211a on the memory space 350 allocated to the process of the controller emulator unit 13. Therefore, the controller emulator unit 13 converts the address stored in the virtual program counter 131 into the address of the memory space 350, and reads the data of the firmware 211a in the actual binary data format from the memory space 350.
  • the logic for interpreting and executing the binary data format firmware 211a as an instruction and the process for simulating the interpreted instruction are stored in the hardware information 231. Therefore, the controller emulator unit 13 simulates the instruction based on the hardware information 231.
  • the controller emulator unit 13 When the memory-mapped I / O area 14 of the memory area 310 to be emulated is accessed by the execution of the firmware 211a, a process for simulating the corresponding hardware operation by software is executed. Since the simulated processing of the peripheral device of the microcomputer is stored in the hardware information 231, the controller emulator unit 13 simulates the hardware operation related to the access to the memory-mapped I / O area 14 based on the hardware information 231. To do. When the corresponding hardware operation is for controlling the input / output of the programmable controller 1, the controller emulator unit 13 further refers to the input / output mapping information 241 and follows the allocation of the input / output mapping information 241. Information is input / output via the actual input terminal 41 or output terminal 42.
  • the controller emulator unit 13 converts the input / output numbers of the virtual input / output terminals to be accessed into the input / output numbers of the actual input / output terminals, receives the input information from the actual input terminals 41, or actually outputs the data. Output information is output to the terminal 42.
  • the memory-mapped I / O area 14 calculated by the controller emulator unit 13 is in the programmable controller before replacement, so that the input / output numbers of the registers that actually perform the input / output control in the programmable controller 1 are used. This is because conversion is required.
  • FIG. 4 is a flowchart showing an example of the procedure of the emulation process in the programmable controller according to the first embodiment.
  • the controller emulator unit 13 When the controller emulator unit 13 is generated as a process on the management unit 12 by the arithmetic unit 10, the controller emulator unit 13 includes the hardware information 231 and the input / output mapping information 241 about the programmable controller before the replacement, and the input / output mapping information 241 before the replacement.
  • the firmware 211a and the control program 221a executed by the programmable controller are read from the storage unit 20 and loaded into the memory (step S11).
  • the controller emulator unit 13 sets the virtual program counter 131 to the firmware startup address, which is the address for booting the firmware 211 (step S12). In the initial state, the controller emulator unit 13 sets the firmware startup address on the memory area 310 that emulates the address for fetching instructions.
  • the controller emulator unit 13 converts the firmware startup address set in the virtual program counter 131 to the address of the firmware 211a in the binary data format loaded in the memory, and decodes the firmware 211a for one instruction at the corresponding address.
  • Execute step S13.
  • This process is called a microcomputer instruction decoding process.
  • microcomputer instructions such as normal operation, logical operation, floating point operation, jump, comparison, memory transfer, NOP (no operation), and privileged instruction. Execute the process to simulate the instruction.
  • the privileged instructions include control register operation, interrupt level change, supervisor call, and the like.
  • the microcomputer of the programmable controller before replacement has the instruction "ADD R1, R2, # 100".
  • This instruction realizes the process of "storing the result of adding the value of the R2 register and the immediate value 100 to the R1 register”.
  • the controller emulator unit 13 of the virtualization unit 11 executes equivalent processing according to this instruction, and stores the result in the virtual general-purpose register 132.
  • the controller emulator unit 13 determines whether the instruction to be executed is an instruction to access the memory (step S14). When the instruction to be executed is not an instruction to access the memory (No in step S14), the controller emulator unit 13 refers to the hardware information 231 and executes the instruction process to be executed (step S15). ). This process is called a microcomputer instruction simulation process.
  • the controller emulator unit 13 determines whether the access destination address is the memory-mapped I / O area 14. (Step S16). When the access destination address is not the memory-mapped I / O area 14 (No in step S16), the microcomputer instruction simulation process in step S15 is executed. When the access destination address is the memory-mapped I / O area 14 (Yes in step S16), the controller emulator unit 13 refers to the hardware information 231 and performs instruction processing to be executed. The hardware simulation process for the corresponding peripheral device is executed (step S17). This process is called a microcomputer peripheral device simulation process. Here, the controller emulator unit 13 simulates the hardware operation according to the hardware information 231.
  • the controller emulator unit 13 obtains the input information or the output information via the actual input / output terminals according to the input / output mapping information 241. Reflect. Specifically, the controller emulator unit 13 refers to the input / output mapping information 241 and outputs the output information to the output device assigned to the input / output mapping information 241 via the input / output control unit 43 or from the input device. Import the input information.
  • step S15 the controller emulator unit 13 sets the virtual program counter 131 to the address corresponding to the next instruction of the firmware 211 (step S18), and the process returns to step S13.
  • FIG. 5 is a diagram showing an example of a method of converting the virtual output of the programmable controller according to the first embodiment into the actual output of the programmable controller.
  • the output control in the programmable controller before replacement is controlled by using the output control register 341.
  • the output control register 341 is a register mapped to the address "0x10001000" of the memory area 310 to be emulated, and each bit “b0" to "b15" is used as an output terminal of each output number of the programmable controller before replacement. It shall be supported.
  • the first bit of the output control register 341 may be set to "1".
  • the controller emulator unit 13 If the firmware on the controller emulator unit 13, that is, the virtual controller, executes a process for turning the output terminals of the output numbers "1" and “2" to "ON”, the controller emulator unit 13 will perform the process. , The hardware simulation process of the output control register 341 is executed. That is, the controller emulator unit 13 performs virtual output to the virtual register 141 in the memory-mapped I / O area 14 corresponding to the output control register 341. At this time, the first bit "X1" and the second bit "X2" of the virtual register 141 are set to "ON".
  • this output control register 341 is a register for controlling the input / output of the programmable controller 1
  • hardware simulation processing is performed on the actual input / output control register 441 of the programmable controller 1 with reference to the input / output mapping information 241.
  • the result of is output. That is, the input / output control unit 43 controls "ON” or “OFF” of the input terminal 41 or the output terminal 42 based on the contents of the input / output control register 441.
  • the output numbers “0”, “1”, and “2” of the programmable controller 1 are the output numbers “2” and “1” on the virtual controller simulated by the controller emulator unit 13, respectively. , “0". Therefore, when the values of the output numbers “0”, “1”, and “2” on the virtual controller are “0", “1", and “1”, respectively, the output number "0" of the output terminal 42, The values of "1” and “2” are set to “1", "1", and “0", respectively. Similarly, the values of the output terminals after the output number "3” on the virtual controller are set to the output terminal 42 of the associated programmable controller 1 output number with reference to the input / output mapping information 241. In the example of FIG. 5, all the values after the output number “3” on the virtual controller are “0”.
  • the controller emulator unit 13 executes while decoding one instruction of the firmware 211a, and simulates the instruction. If the instruction access destination is the memory-mapped I / O area 14, the hardware is simulated at the same time. When the simulation for one instruction is completed, the controller emulator unit 13 continues the process of performing the simulation while executing the next instruction.
  • the simulated processing of each instruction referred to when the firmware 211a is executed and the simulated processing of the hardware when the memory-mapped I / O area 14 is accessed are held in the hardware information 231 and the firmware 211 and The hardware information 231 can be changed through the communication interface unit 30. Therefore, by exchanging these, it is possible to freely exchange the programmable controller to be simulated.
  • the input / output mapping information 241 referred to when accessing the input / output terminals of the programmable controller 1 in the hardware simulation process can be manually changed by the user, the virtual in the virtual controller simulated on the controller emulator unit 13 It is possible to freely change the correspondence between the input / output and the actual input / output of the programmable controller 1.
  • the programmable controller before replacement has been described as a method in which the firmware directly interprets and executes the control program.
  • the firmware directly interprets and executes the control program.
  • the execution of the control program can be simulated in the same manner by preparing the hardware information for simulating this dedicated hardware.
  • the firmware 211, the control program 221 and the hardware information 231 are replaced, or the contents of the input / output mapping information 241 are changed via the communication interface unit 30.
  • the programmable controller 1 has an interface for attaching a storage medium in which such information is stored, and the programmable controller 1 is configured to read data from the storage medium via this interface and perform a simulated operation. You may. Examples of storage media are SD memory cards, CD (Compact Disc) -ROM, DVD (Digital Versatile Disc or Digital Video Disc) -ROM, BD (Blu-ray (registered trademark) Disc) -ROM, CompactFlash (registered trademark). ), Blu-ray (registered trademark) discs, etc.
  • FIG. 6 is a block diagram schematically showing an example of the configuration of the programmable controller according to the second embodiment.
  • FIG. 6 is a block diagram schematically showing an example of the configuration of the programmable controller according to the second embodiment.
  • the same components as those in the first embodiment are designated by the same reference numerals, and the description thereof will be omitted.
  • the controller emulator unit 13 estimates the time required to execute the firmware instruction in the programmable controller before replacement, calculates the start time of the input / output refresh process in the programmable controller before replacement, and obtains the result. Further has a function of notifying the input / output timing adjusting unit 431 described later. Specifically, the controller emulator unit 13 decodes one instruction statement of the firmware 211a and estimates the instruction execution time, which is the time when the instruction is actually executed by the programmable controller before replacement, each time the firmware 211a is executed. Further, the controller emulator unit 13 calculates the integrated instruction execution time by integrating the instruction execution time from the time when the previous input / output refresh process is completed.
  • the controller emulator unit 13 accesses the register for input / output refresh, the time when the scan process for executing the control program on the programmable controller before replacement is completed by using the integrated instruction execution time at that time. That is, the time when the input / output refresh process actually starts is estimated.
  • the controller emulator unit 13 outputs the estimated start time of the input / output refresh process to the input / output timing adjustment unit 431.
  • the input / output control unit 43 of the programmable controller 1 further includes an input / output timing adjusting unit 431.
  • the input / output timing adjusting unit 431 has a function of making the timing of performing input / output refresh in the programmable controller 1 equal to the timing of performing input / output refresh in the programmable controller before replacement.
  • the input / output timing adjustment unit 431 puts the input / output control unit 43 in the standby state until the start time of the input / output refresh process estimated by the controller emulator unit 13, and when the start time of the input / output refresh process is reached, the input / output control unit 431.
  • the input / output refresh process by 43 can be executed.
  • FIG. 7 is a time chart schematically showing an example of adjusting the input / output refresh timing according to the second embodiment.
  • the operation on the programmable controller before replacement is shown in the upper row, and the operation on the controller emulator unit 13 is shown in the lower row.
  • the programmable controller generally has a scan 511 that executes a control program and captures input information of an external input device or a calculation result to an external output device.
  • I / O refresh 521 which outputs certain output information, is repeatedly executed. As a result, control of the device and the like is realized.
  • the input / output timing adjustment unit 431 provides the time for the timing adjustment 532 shown in FIG. 7.
  • the input / output refresh 521 in the programmable controller before replacement and the input / output refresh 522 on the controller emulator unit 13 are adjusted so as to start at the same time.
  • the input from the device to be controlled and the output timing to the device are the same as the operation of the actual device.
  • FIG. 8 is a flowchart showing an example of the procedure of emulation processing in the programmable controller according to the second embodiment. In the following, a part different from FIG. 4 of the first embodiment will be described.
  • step S11 the controller emulator unit 13 initializes the integration instruction execution time (step S31). After that, the process moves to step S12.
  • step S15 the controller emulator unit 13 estimates the instruction execution time in the programmable controller before the replacement of the emulated instruction and adds it to the integrated instruction execution time at that time (step S32).
  • the integrated instruction execution time to which the instruction execution time is added becomes the new integrated instruction execution time. After that, the process proceeds to step S18.
  • step S16 When the access destination address is the memory-mapped I / O area 14 in step S16 (Yes in step S16), the controller emulator unit 13 determines whether the access destination address is an I / O refresh register. (Step S33). If the access destination address is not an I / O refresh register (No in step S33), the controller emulator unit 13 executes hardware simulation processing on the corresponding register (step S34). After that, the process proceeds to step S32.
  • the controller emulator unit 13 acquires the integration instruction execution time at that time and simulates from the integration instruction execution time.
  • the start time of the input / output refresh process in the programmable controller of the actual machine is estimated (step S35).
  • the controller emulator unit 13 outputs the estimated start time of the input / output refresh process to the input / output timing adjusting unit 431 (step S36).
  • the controller emulator unit 13 goes into a standby state until it receives a notification from the input / output timing adjusting unit 431 that the execution of the input / output refresh has been completed (step S37).
  • the input / output timing adjustment unit 431 Upon receiving the start time of the input / output refresh process, the input / output timing adjustment unit 431 sets the start time of the input / output refresh process (step S38). Then, the input / output timing adjustment unit 431 determines whether the current time has reached the start time of the input / output refresh process (step S39), and when the current time has not become the start time of the input / output refresh process (step). In the case of No in S39), the standby state is set.
  • the input / output timing adjustment unit 431 permits the input / output control unit 43 to execute the input / output refresh process. To do. That is, the input / output control unit 43 executes an input / output refresh process for capturing input information or setting output information (step S40). After that, the input / output timing adjustment unit 431 notifies the controller emulator unit 13 of the completion of the execution of the input / output refresh process (step S41).
  • step S42 When the controller emulator unit 13 receives a notification from the input / output timing adjustment unit 431 that the execution of the input / output refresh process is completed (step S42), the process shifts to step S31.
  • the controller emulator unit 13 estimates the instruction execution time of the same instruction on the actual machine each time the instruction of the microcomputer is executed, and estimates the scan time on the actual machine based on the integrated instruction execution time.
  • Other time estimation methods may be used.
  • the instruction execution time may be estimated for each instruction of the control program 221 and the scan time on the actual machine may be estimated based on the integrated instruction execution time.
  • FIG. 9 is a diagram showing an example of a method of converting the virtual output by emulation according to the second embodiment into the actual output in the programmable controller.
  • the operation at the time of output when a value is set in the virtual register 141 corresponding to the output control register 341 described in the first embodiment and reflected in the actual output will be described.
  • a virtual output is output to the virtual register 141 in the same manner as the output to the output control register 341 in the programmable controller before replacement. It is output.
  • the virtual output is premised on the connection of input / output devices and the hardware configuration in the programmable controller before replacement. Therefore, when input / output is performed to the input / output terminals of the actual programmable controller 1, the output is converted according to the connection of the input / output devices in the programmable controller 1 and the hardware configuration. That is, the output number in the virtual output is converted into the actual output number by referring to the input / output mapping information 241.
  • the controller emulator unit 13 calculates the input / output refresh start time “A” with reference to the integration instruction execution time 435. That is, in this case, the output time of the output information from the actual output terminal 42 is calculated.
  • the actual output number and the input / output refresh start time "A” obtained here are held in the input / output timing adjusting unit 431.
  • the input / output timing adjustment unit 431 notifies the input / output control unit 43 that the start time of the input / output refresh process has been reached, and the input / output control unit 43 informs the input / output control unit 43 of each output information. Output.
  • the controller emulator unit 13 estimates the instruction execution time required when the instruction executed by the controller emulator unit 13 is executed by the programmable controller to be simulated, and further estimates the integrated instruction execution time. Then, when the access destination address of the instruction to be executed is a register for input / output refresh, the controller emulator unit 13 starts the input / output refresh process in the programmable controller to be simulated by using the integrated instruction execution time. Estimate the time.
  • the input / output timing adjustment unit 431 adjusts the timing of performing the input / output refresh process in the programmable controller 1 by using the start time of the input / output refresh process. This has the effect that the timing of input / output refresh in the programmable controller 1 can be made equal to that of the actual programmable controller to be simulated.
  • FIG. 10 is a block diagram schematically showing an example of the configuration of the programmable controller according to the third embodiment.
  • FIG. 10 is a block diagram schematically showing an example of the configuration of the programmable controller according to the third embodiment.
  • the same components as those in the first embodiment are designated by the same reference numerals, and the description thereof will be omitted.
  • the programmable controller 1 has a plurality of arithmetic units 10A and 10B.
  • Each of the calculation units 10A and 10B has virtualization units 11A and 11B as described in the first embodiment. That is, the programmable controller 1 is provided with a plurality of virtualization units 11A and 11B.
  • the virtualization unit 11A has a management unit 12A, a controller emulator unit 13A, a memory-mapped I / O area 14A, and a mapping information generation unit 15A, similarly to the calculation unit 10 of the first embodiment.
  • the virtualization unit 11B includes a management unit 12B, a controller emulator unit 13B, a memory-mapped I / O area 14B, and a mapping information generation unit 15B.
  • the programmable controller 1 can simulate a plurality of programmable controllers before replacement. That is, the firmware 211a is executed on the virtualization unit 11A, and the control program 221a is executed on the firmware 211a. The firmware 212a is executed on the virtualization unit 11B, and the control program 222a is executed on the firmware 212a.
  • FIG. 10 shows a case where two calculation units 10A and 10B are provided, three or more calculation units may be provided.
  • the hardware information storage unit 23 stores the number of hardware information of the controller emulator units 13A and 13B provided in the virtualization units 11A and 11B. Further, the firmware storage unit 21 stores the number of firmwares 211a and 212a of the controller emulator units 13A and 13B provided in the virtualization units 11A and 11B, and the control program storage unit 22 is provided in the virtualization units 11A and 11B. Stores the number of control programs 221a and 222a of the controller emulator units 13A and 13B.
  • the input / output mapping information storage unit 24 stores one input / output mapping information common to the plurality of controller emulator units 13.
  • the switch 82 is further connected to the input terminal 41 of the input number “60”, and the magnet switch 92 is further connected to the output terminal 42 of the output number “60”.
  • control program 221a is executed by the calculation unit 10A
  • control program 222a is executed by the calculation unit 10B
  • the external input devices and output devices are executed by these control programs 221a and 222a. Is controlled.
  • the input terminal 41 from the input numbers "0" to “59” and the output terminal 42 from the output numbers “0” to “59” are controlled by the control program 221a. Further, the input terminals 41 from the input numbers "60” to “139” and the output terminals 42 from the output numbers "60” to “139” are controlled by the control program 222a.
  • controller emulator units 13A and 13B operate independently.
  • a case is shown in which the hardware of the programmable controller 1 has a plurality of arithmetic units 10A and 10B, and different controller emulator units 13A and 13B are executed in parallel on the respective arithmetic units 10A and 10B. ..
  • the virtualization unit 11 may have a plurality of controller emulator units 13A and 13B by switching the operation in a time division manner. In this case, the processes in the controller emulator units 13A and 13B are executed while switching the operation in a time division manner.
  • FIG. 11 is a diagram showing an example of a method of converting the virtual output by emulation according to the third embodiment into the actual output in the programmable controller.
  • the controller emulator unit 13A accesses the input / output interface unit 40, that is, when the firmware accesses the hardware for input / output control as in the process in step S17 of FIG. 4, the input / output is input / output.
  • the mapping information 241 is referred to, and the corresponding actual output number is output to the output terminal 42.
  • the content of the input / output mapping information 241 is different from that in FIG.
  • the calculation unit 10 simulates one virtual controller, but in the third embodiment, the calculation units 10A and 10B simulate two virtual controllers. Therefore, in the "Virtual controller allocation" field of the input / output mapping information 241, either the virtual controller A simulated by the calculation unit 10A or the virtual controller B simulated by the calculation unit 10B is input.
  • the output control register 341 is the same as that described in the first embodiment, is an output control register of the actual programmable controller to be simulated, and each bit corresponds to each output number of the programmable controller.
  • the controller emulator unit 13A When writing to the 1st bit and the 2nd bit of this output control register 341 is performed on the controller emulator unit 13A, the corresponding hardware simulation process is executed. That is, the controller emulator unit 13A writes to the first bit and the second bit of the virtual register 141 of the memory-mapped I / O area 14 corresponding to the output control register 341. Then, the controller emulator unit 13A refers to the input / output mapping information 241 and reflects the information on the actual output terminal 42. In the input / output mapping information 241, output numbers "0" to "59” are assigned to "virtual controller A" simulated by the controller emulator unit 13A, and output numbers "0" and "1" of the programmable controller 1 are assigned.
  • the input / output of the controller emulator units 13A and 13B are assigned to the actual input terminal 41 and output terminal 42 of any one of the programmable controllers 1.
  • the input / output between the controller emulator units 13A and 13B may be internally connected.
  • the input / output relationship between the controller emulator units 13A and 13B is described in the input / output mapping information 241 and one controller emulator unit accesses the output connected to the other controller emulator unit, for example, It is possible to use a method of reflecting the output result in the input of the other controller emulator unit by inter-process communication.
  • the programmable controller 1 has a plurality of controller emulator units 13A and 13B, and the respective controller emulator units 13A and 13B simulate different operations of the programmable controller before replacement. This makes it possible to integrate a plurality of existing control programs 221a and 222a on the hardware of one programmable controller 1 and execute them at the same time.
  • FIG. 12 is a block diagram schematically showing an example of the configuration of the programmable controller according to the fourth embodiment.
  • the parts different from the first and third embodiments will be described. Further, the same components as those in the first and third embodiments are designated by the same reference numerals, and the description thereof will be omitted.
  • the programmable controller 1 has a plurality of controller emulator units 13A and 13B.
  • the programmable controller 1 has a plurality of physically different arithmetic units 10A and 10B, and the respective arithmetic units 10A and 10B have the controller emulator units 13A and 13B.
  • the programmable controller 1 has one calculation unit 10, and the virtualization unit 11 in the calculation unit 10 has a plurality of controller emulator units 13A and 13B. As described above, in such a case, the arithmetic unit 10 operates while switching the plurality of controller emulator units 13A and 13B in a time division manner.
  • the rotary encoder 83 is connected to the input terminal 41 of the input number “0”, and the switch 82 is connected to the input terminal 41 of the input number “60”. Further, the lamp 91 is connected to the output terminal 42 of the output number “0”, and the magnet switch 92 is connected to the output terminal 42 of the output number “60”.
  • the input / output control unit 43 of the programmable controller 1 further includes a priority event detection unit 432.
  • the priority event detection unit 432 detects the occurrence of an event associated with the interrupt program to be preferentially processed during the simulated operation processing by the plurality of controller emulator units 13A and 13B, and indicates that an event has occurred. It has a function of notifying the calculation unit 10 of the notification.
  • the event associated with the interrupt program to be processed preferentially is referred to as a priority event.
  • the management unit 12 of the calculation unit 10 further has a switching unit 121.
  • the switching unit 121 executes the interrupt program even if a controller emulator unit other than the controller emulator unit that executes the interrupt program due to the occurrence of the priority event is operating. This is a functional unit that switches processing to the controller emulator unit.
  • the programmable controller 1 generally has an interrupt program execution function that operates at high speed triggered by a specific event. Events include rising or falling edges of input signals, fluctuations in pulse counter values, and internal timer count-ups. An interrupt program that operates with these events as a trigger operates with a higher priority than a running control program, and is required to have high-speed responsiveness.
  • a priority event to be processed by the controller emulator unit 13B may occur while the controller emulator unit 13A is executing.
  • the controller emulator unit 13B cannot execute the interrupt processing corresponding to the priority event until the time allotted to the controller emulator unit 13A elapses, so that the responsiveness of the interrupt program deteriorates.
  • the input / output control unit 43 is provided with the priority event detection unit 432, and the management unit 12 is provided with the switching unit 121 in order to improve the response performance when the priority event occurs.
  • controller emulator unit 13B executes the interrupt program when the pulse count of the rotary encoder 83 reaches a predetermined set value.
  • the priority event detection unit 432 is set with conditions that require notification as a priority event.
  • the priority event is an event in which the interrupt program must be executed preferentially when the event occurs.
  • "when the number of pulses for the input terminal 41 of the input number” 0 is a predetermined set value" is set as a condition.
  • the firmwares 211a and 212a simulated on the controller emulator units 13A and 13B make this setting depends on the hardware specifications of the programmable controller to be simulated by the controller emulator units 13A and 13B.
  • the controller emulator unit 13A simulates a programmable controller equipped with dedicated hardware for performing pulse counting.
  • Firmware for programmable controllers with dedicated hardware accesses the registers of this dedicated hardware. By accessing this register, hardware simulation processing by the controller emulator unit 13A is executed.
  • the input number “0” that requires pulse monitoring for the priority event detection unit 432 and the number of pulses that are event conditions are set.
  • the priority event detection unit 432 When the set priority event condition is satisfied, the priority event detection unit 432 notifies the switching unit 121 of the event occurrence.
  • the switching unit 121 sets the hardware register information stored in the virtual general-purpose register 132 on the controller emulator unit 13B that should process the priority event to the state at the time of the event, and the controller emulator unit 13B that should process the priority event. If it is not executed, the controller emulator units 13A and 13B executed on the arithmetic unit 10 are switched.
  • FIG. 13 is a diagram showing an example of switching timing of a plurality of controller emulator units executed on the same arithmetic unit.
  • the upper part shows the operating state of the controller emulator unit 13A
  • the lower part shows the operating state of the controller emulator unit 13B.
  • the horizontal axis is time.
  • the controller emulator units 13A and 13B execute the process while being switched in a time division based on a specific execution cycle.
  • the controller emulator unit 13A executes the process in the execution cycle 551, and then the controller emulator unit 13B executes the process in the execution cycle 552.
  • the controller emulator unit 13A executes the process, and it is assumed that the priority event 560 occurs at time t1 in the execution cycle 553.
  • the priority event 560 is that the number of pulse counters by the rotary encoder 83 reaches the set value.
  • the priority event detection unit 432 detects the occurrence of the priority event 560 and notifies the switching unit 121 of an event notification indicating the occurrence of the priority event.
  • the switching unit 121 switches the process from the controller emulator unit 13A to the controller emulator unit 13B even during the execution cycle 553 in which the controller emulator unit 13A is operating, and the controller emulator unit 13B switches the process. Make it operational. After that, the controller emulator unit 13B executes the interrupt program corresponding to the priority event.
  • the interrupt program execution allocation time 570 which is the time for executing the interrupt program, is calculated based on a specific algorithm.
  • the interrupt program execution allocation time 570 may change the firmware 212a itself and add a hook process when the interrupt program is completed, thereby detecting the completion of the interrupt program execution. In the case of the method of adding the hook processing, it is not necessary to predict the execution completion time of the interrupt program, so that the calculation of the interrupt program execution allocation time 570 is unnecessary.
  • the switching unit 121 switches the process to the controller emulator unit 13A. Then, in the execution cycle 554, the hardware register information is returned to the state at the time of the occurrence of the priority event 560, and the controller emulator unit 13A performs processing.
  • the priority event detection unit 432 has been described as a functional block having a pulse counting function, but the embodiment is not limited to this.
  • the priority event detection unit 432 may be configured to have a plurality of other event detection functions such as rising or falling edges of an input signal.
  • the programmable controller 1 includes a priority event detection unit 432 that detects a priority event, and a switching unit 121 that switches processing to controller emulator units 13A and 13B that should perform interrupt processing when a priority event is detected. , Equipped with. As a result, it is forcibly switched to the controller emulator units 13A and 13B that execute the interrupt program when the priority event occurs, and when a plurality of controller emulator units 13A and 13B are executed on the same arithmetic unit 10, the priority event is dealt with. The responsiveness can be enhanced.
  • the above-described second embodiment may be combined with the third and fourth embodiments.
  • the timing of input / output refresh in the programmable controller 1 can be made equivalent to that of the actual programmable controller to be simulated.
  • the configuration shown in the above-described embodiment shows an example of the content of the present invention, can be combined with another known technique, and is one of the configurations without departing from the gist of the present invention. It is also possible to omit or change the part.

Landscapes

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

Abstract

A programmable controller (1) is provided with a storage unit (20) and a controller emulator unit (13). The storage unit (20) stores firmware and control programs that are executed on a programmable controller to be emulated, and hardware information required to emulate hardware of the programmable controller to be emulated. The controller emulator unit (13) emulates the operation of hardware in the programmable controller to be emulated on the basis of the hardware information. The controller emulator unit (13) executes firmware (211a) and a control program (221a) on the emulated hardware. The firmware and hardware information in the storage unit (20) can be changed depending on the programmable controller to be emulated.

Description

プログラマブルコントローラProgrammable controller
 本発明は、仮想化技術を適用したプログラマブルコントローラに関する。 The present invention relates to a programmable controller to which virtualization technology is applied.
 プログラマブルコントローラは、一般に、工場内での装置制御に用いられるコントローラであり、装置製造メーカ等のユーザによって作成された装置制御用の制御プログラムを実行する。プログラマブルコントローラは、故障または新製品への更新のために、置き換えられることがある。しかし、プログラマブルコントローラでは、製品毎にプログラム仕様が統一されていないので、同一メーカの新製品に置き換える場合でも、従来の制御プログラムをそのまま流用することはできない。そのため、置き換え後の製品に対応した制御プログラムの修正が必要となる。 A programmable controller is a controller generally used for device control in a factory, and executes a control program for device control created by a user such as a device manufacturer. Programmable controllers may be replaced due to failure or update to a new product. However, in the programmable controller, the program specifications are not unified for each product, so even if a new product of the same manufacturer is replaced, the conventional control program cannot be used as it is. Therefore, it is necessary to modify the control program corresponding to the replaced product.
 特許文献1には、プロセス制御を対象とした制御システム向けに仮想化技術を適用したプロセス制御装置が開示されている。仮想化技術は、既存システム向けのソフトウェアを新しいハードウェア上で実行する技術である。特許文献1に記載のプロセス制御装置は、ハードウェア上に、ハードウェアの代わりとして動作する仮想化部を有する。また、特許文献1に記載のプロセス制御装置では、仮想化部上に、使用中のオペレーティングシステムを動作可能な状態としたまま、入れ替え後のオペレーティングシステムがインストールされる。また、入れ替え後のオペレーティングシステム上に、使用中の制御プログラムと同じ制御プログラムがインストールされる。そして、使用中のオペレーティングシステム上での制御プログラムの動作と、入れ替え後のオペレーティングシステム上での制御プログラムの動作と、を比較して、入れ替え後のオペレーティングシステム上で制御プログラムが正常に動作するかが判定される。正常に動作する場合には、入れ替え後のオペレーティングシステムに切り換えられるが、正常に動作しない場合には、インストールした新たなオペレーティングシステムが停止される。 Patent Document 1 discloses a process control device to which virtualization technology is applied for a control system for process control. Virtualization technology is a technology that runs software for existing systems on new hardware. The process control device described in Patent Document 1 has a virtualization unit that operates as a substitute for the hardware on the hardware. Further, in the process control device described in Patent Document 1, the replaced operating system is installed on the virtualization unit while the operating system in use is in an operable state. In addition, the same control program as the one in use is installed on the replaced operating system. Then, the operation of the control program on the operating system in use is compared with the operation of the control program on the replaced operating system to see if the control program operates normally on the replaced operating system. Is determined. If it works normally, it will be switched to the replaced operating system, but if it does not work properly, the new installed operating system will be stopped.
特開2015-5258号公報Japanese Unexamined Patent Publication No. 2015-5258
 プログラマブルコントローラの置き換えを考えた場合、置き換え後のプログラマブルコントローラで、置き換え前のプログラマブルコントローラで実行していた制御プログラムを変更しないで実行できることが望ましい。通常、プログラマブルコントローラの場合には、製品によって、ハードウェアアーキテクチャの種類および搭載されているシステムソフトウェアであるファームウェアの種類は多数存在する。そのため、置き換え前と置き換え後との間でプログラマブルコントローラのハードウェアアーキテクチャおよびファームウェアが異なることが多くなる。特許文献1に記載のプロセス制御装置を置き換え後のプログラマブルコントローラに適用した場合には、置き換え前のプログラマブルコントローラ毎に、ハードウェアを模擬する仮想化部の改変が必要となる。特に、模擬対象のプログラマブルコントローラの命令セットアーキテクチャと、仮想化部を実行するコントローラに搭載されるハードウェアの命令セットアーキテクチャと、が異なる場合には、命令セットレベルでのエミュレーションが不可欠となり、様々な種類の仮想化部を用意する必要がある。これに対応するためには、異なるハードウェアを模擬する仮想化部を搭載した複数種類のプログラマブルコントローラを用意する方法が考えられるが、この方法では、製品種別が莫大な数となってしまうという問題があった。 When considering the replacement of a programmable controller, it is desirable that the programmable controller after replacement can be executed without changing the control program that was being executed by the programmable controller before replacement. Generally, in the case of a programmable controller, there are many types of hardware architecture and types of firmware that is installed system software, depending on the product. Therefore, the hardware architecture and firmware of the programmable controller often differ between before and after replacement. When the process control device described in Patent Document 1 is applied to a programmable controller after replacement, it is necessary to modify a virtualization unit that simulates hardware for each programmable controller before replacement. In particular, when the instruction set architecture of the programmable controller to be simulated and the instruction set architecture of the hardware installed in the controller that executes the virtualization unit are different, emulation at the instruction set level is indispensable, and various types of emulation are required. It is necessary to prepare a kind of virtualization part. In order to deal with this, it is conceivable to prepare multiple types of programmable controllers equipped with virtualization units that simulate different hardware, but this method has the problem that the number of product types becomes enormous. was there.
 本発明は、上記に鑑みてなされたものであって、プログラマブルコントローラを置き換える際に、置き換え前のプログラマブルコントローラのハードウェアおよびファームウェアに依存することなく置き換え前の制御プログラムを変更せずに使用することができるプログラマブルコントローラを得ることを目的とする。 The present invention has been made in view of the above, and when replacing a programmable controller, the control program before replacement is used without being dependent on the hardware and firmware of the programmable controller before replacement. The purpose is to obtain a programmable controller that can be used.
 上述した課題を解決し、目的を達成するために、本発明のプログラマブルコントローラは、記憶部と、コントローラエミュレータ部と、を備える。記憶部は、模擬対象のプログラマブルコントローラで実行されるファームウェアおよび制御プログラムと、模擬対象のプログラマブルコントローラのハードウェアを模擬するのに必要なハードウェア情報と、を記憶する。コントローラエミュレータ部は、模擬対象のプログラマブルコントローラにおけるハードウェアの動作を、ハードウェア情報に基づいて模擬する。コントローラエミュレータ部は、模擬したハードウェア上で、ファームウェアおよび制御プログラムを実行する。記憶部中のファームウェアおよびハードウェア情報は、模擬対象のプログラマブルコントローラに応じて変更可能である。 The programmable controller of the present invention includes a storage unit and a controller emulator unit in order to solve the above-mentioned problems and achieve the object. The storage unit stores the firmware and control program executed by the programmable controller to be simulated, and the hardware information required to simulate the hardware of the programmable controller to be simulated. The controller emulator unit simulates the operation of the hardware in the programmable controller to be simulated based on the hardware information. The controller emulator section executes the firmware and the control program on the simulated hardware. The firmware and hardware information in the storage unit can be changed according to the programmable controller to be simulated.
 本発明にかかるプログラマブルコントローラは、プログラマブルコントローラを置き換える際に、置き換え前のプログラマブルコントローラのハードウェアおよびファームウェアに依存することなく置き換え前の制御プログラムを変更せずに使用することができるという効果を奏する。 The programmable controller according to the present invention has an effect that when replacing a programmable controller, the control program before replacement can be used without being dependent on the hardware and firmware of the programmable controller before replacement.
実施の形態1によるプログラマブルコントローラの構成の一例を模式的に示すブロック図A block diagram schematically showing an example of the configuration of the programmable controller according to the first embodiment. 実施の形態1における制御プログラムの実行に関わる各ブロックの関係の一例を模式的に示す図The figure which shows typically an example of the relationship of each block which concerns the execution of the control program in Embodiment 1. コントローラエミュレータ部とメモリ領域との間の関係の一例を示す図The figure which shows an example of the relationship between a controller emulator part and a memory area. 実施の形態1によるプログラマブルコントローラでのエミュレーション処理の手順の一例を示すフローチャートA flowchart showing an example of the procedure of emulation processing in the programmable controller according to the first embodiment. 実施の形態1によるプログラマブルコントローラでの仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図The figure which shows an example of the method of converting the virtual output in a programmable controller by Embodiment 1 into the real output in a programmable controller. 実施の形態2によるプログラマブルコントローラの構成の一例を模式的に示すブロック図A block diagram schematically showing an example of the configuration of the programmable controller according to the second embodiment. 実施の形態2による入出力リフレッシュのタイミングの調整の一例を模式的に示すタイムチャートA time chart schematically showing an example of adjusting the input / output refresh timing according to the second embodiment. 実施の形態2によるプログラマブルコントローラでのエミュレーション処理の手順の一例を示すフローチャートA flowchart showing an example of the procedure of emulation processing in the programmable controller according to the second embodiment. 実施の形態2によるエミュレーションによる仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図The figure which shows an example of the method of converting the virtual output by emulation by Embodiment 2 into the real output in a programmable controller. 実施の形態3によるプログラマブルコントローラの構成の一例を模式的に示すブロック図A block diagram schematically showing an example of the configuration of the programmable controller according to the third embodiment. 実施の形態3によるエミュレーションによる仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図The figure which shows an example of the method of converting the virtual output by emulation by Embodiment 3 into the real output in a programmable controller. 実施の形態4によるプログラマブルコントローラの構成の一例を模式的に示すブロック図A block diagram schematically showing an example of the configuration of the programmable controller according to the fourth embodiment. 同一演算部上で実行される複数のコントローラエミュレータ部の切り替えタイミングの一例を示す図The figure which shows an example of the switching timing of a plurality of controller emulator units executed on the same arithmetic unit.
 以下に、本発明の実施の形態にかかるプログラマブルコントローラを図面に基づいて詳細に説明する。なお、これらの実施の形態によりこの発明が限定されるものではない。 The programmable controller according to the embodiment of the present invention will be described in detail below with reference to the drawings. The present invention is not limited to these embodiments.
 以下の実施の形態では、プログラマブルコントローラを置き換える際に、置き換え前のプログラマブルコントローラの動作を、置き換え後のプログラマブルコントローラで模擬する場合を例に挙げて説明が行われる。すなわち、置き換え前のプログラマブルコントローラが、実施の形態によるプログラマブルコントローラで置き換えられる。以下では、実施の形態によるプログラマブルコントローラは、単に「プログラマブルコントローラ」と称され、置き換え対象となるプログラマブルコントローラは、「置き換え前のプログラマブルコントローラ」と称される。また、プログラマブルコントローラ上で「置き換え前のプログラマブルコントローラ」の動作が模擬されているときの仮想化された「置き換え前のプログラマブルコントローラ」は、「仮想コントローラ」と称される。また、「置き換え前のプログラマブルコントローラ」は、模擬対象のプログラマブルコントローラの1つである。 In the following embodiment, when the programmable controller is replaced, the operation of the programmable controller before the replacement is simulated by the programmable controller after the replacement as an example. That is, the programmable controller before replacement is replaced with the programmable controller according to the embodiment. In the following, the programmable controller according to the embodiment is simply referred to as a "programmable controller", and the programmable controller to be replaced is referred to as a "programmable controller before replacement". Further, the virtualized "programmable controller before replacement" when the operation of the "programmable controller before replacement" is simulated on the programmable controller is referred to as a "virtual controller". Further, the "programmable controller before replacement" is one of the programmable controllers to be simulated.
実施の形態1.
 図1は、実施の形態1によるプログラマブルコントローラの構成の一例を模式的に示すブロック図である。プログラマブルコントローラ1は、演算部10と、記憶部20と、通信インタフェース部30と、入出力インタフェース部40と、を備える。演算部10と、記憶部20と、通信インタフェース部30と、入出力インタフェース部40と、は、バス50を介して接続されている。
Embodiment 1.
FIG. 1 is a block diagram schematically showing an example of the configuration of the programmable controller according to the first embodiment. The programmable controller 1 includes a calculation unit 10, a storage unit 20, a communication interface unit 30, and an input / output interface unit 40. The calculation unit 10, the storage unit 20, the communication interface unit 30, and the input / output interface unit 40 are connected via the bus 50.
 演算部10は、予め定められたハードウェアアーキテクチャに従って構成されたマイクロプロセッサおよびチップセットである。演算部10は、マイクロコンピュータまたはマイコンとも称される。演算部10は、プログラマブルコントローラ1のハードウェア上で、別の種類のプログラマブルコントローラ1のハードウェアについての制御プログラムが実行される実行環境を模擬する機能部である仮想化部11を有する。 The arithmetic unit 10 is a microprocessor and a chipset configured according to a predetermined hardware architecture. The arithmetic unit 10 is also referred to as a microcomputer or a microcomputer. The calculation unit 10 has a virtualization unit 11 which is a functional unit that simulates an execution environment in which a control program for the hardware of another type of programmable controller 1 is executed on the hardware of the programmable controller 1.
 仮想化部11は、管理部12と、コントローラエミュレータ部13と、マッピング情報生成部15と、メモリマップドI/O(Input/Output)領域14と、を有する。 The virtualization unit 11 has a management unit 12, a controller emulator unit 13, a mapping information generation unit 15, and a memory-mapped I / O (Input / Output) area 14.
 管理部12は、演算部10で実行されるソフトウェアの管理を行う機能部である。実施の形態1では、管理部12は、複数のソフトウェアを並列して実行することを可能とするスケジューリング機能を有するオペレーティングシステム(Operating System:OS)である。 The management unit 12 is a functional unit that manages software executed by the calculation unit 10. In the first embodiment, the management unit 12 is an operating system (OS) having a scheduling function that enables a plurality of software to be executed in parallel.
 コントローラエミュレータ部13は、置き換え前のプログラマブルコントローラにおけるハードウェアの動作を模擬する機能部である。また、コントローラエミュレータ部13は、記憶部20から読み出した置き換え前のプログラマブルコントローラで使用されるファームウェアおよび制御プログラムを模擬したハードウェア上で実行する機能部である。コントローラエミュレータ部13が模擬している置き換え前のプログラマブルコントローラが仮想コントローラとなる。コントローラエミュレータ部13は、置き換え前のプログラマブルコントローラに関する後述するハードウェア情報を使用して、命令を実行し、また置き換え前のプログラマブルコントローラにおけるマイコンの周辺機器の動作を模擬して、ファームウェアを実行する。さらに、コントローラエミュレータ部13は、ファームウェア上で、制御プログラムを実行する。 The controller emulator unit 13 is a functional unit that simulates the operation of hardware in the programmable controller before replacement. Further, the controller emulator unit 13 is a functional unit that executes the firmware and the control program read from the storage unit 20 and used in the programmable controller before replacement on the hardware simulating the firmware and the control program. The programmable controller before replacement simulated by the controller emulator unit 13 becomes a virtual controller. The controller emulator unit 13 executes an instruction by using the hardware information described later regarding the programmable controller before replacement, and also simulates the operation of the peripheral device of the microcomputer in the programmable controller before replacement to execute the firmware. Further, the controller emulator unit 13 executes a control program on the firmware.
 メモリマップドI/O領域14は、コントローラエミュレータ部13によるファームウェアおよび制御プログラムの模擬時に発生するマイコンの周辺機器との間の入出力を仮想化する領域である。メモリマップドI/O領域14は、一例では、置き換え前のプログラマブルコントローラのマイコンが有する入出力制御レジスタを仮想化したものである。メモリマップドI/O領域14には、エミュレーションするメモリ領域としてアドレスが割り当てられている。 The memory-mapped I / O area 14 is an area for virtualizing the input / output between the controller emulator unit 13 and the peripheral devices of the microcomputer, which is generated when the firmware and the control program are simulated. In one example, the memory-mapped I / O area 14 is a virtualization of the input / output control registers of the microcomputer of the programmable controller before replacement. An address is assigned to the memory-mapped I / O area 14 as a memory area to be emulated.
 マッピング情報生成部15は、プログラマブルコントローラ1の入出力端子の入出力番号と、置き換え前のプログラマブルコントローラの入出力端子の入出力番号と、を対応付けた入出力マッピング情報を生成する機能部である。マッピング情報生成部15は、生成した入出力マッピング情報を記憶部20の入出力マッピング情報記憶部24に保存する。マッピング情報生成部15は、一例では、置き換え前のプログラマブルコントローラにおける入出力番号と、プログラマブルコントローラ1の入出力番号と、が同じになるように入出力マッピング情報を生成する。また、マッピング情報生成部15は、一例では、制御プログラム中の入出力番号を参照して、制御プログラムでの入出力番号、すなわち置き換え前のプログラマブルコントローラにおける入出力番号と、プログラマブルコントローラ1の入出力番号と、を対応付ける。 The mapping information generation unit 15 is a functional unit that generates input / output mapping information in which the input / output numbers of the input / output terminals of the programmable controller 1 and the input / output numbers of the input / output terminals of the programmable controller before replacement are associated with each other. .. The mapping information generation unit 15 stores the generated input / output mapping information in the input / output mapping information storage unit 24 of the storage unit 20. In one example, the mapping information generation unit 15 generates input / output mapping information so that the input / output number of the programmable controller before replacement and the input / output number of the programmable controller 1 are the same. Further, in one example, the mapping information generation unit 15 refers to the input / output numbers in the control program, the input / output numbers in the control program, that is, the input / output numbers in the programmable controller before replacement, and the input / output numbers in the programmable controller 1. Correspond with the number.
 記憶部20は、ファームウェア記憶部21と、制御プログラム記憶部22と、ハードウェア情報記憶部23と、入出力マッピング情報記憶部24と、を有する。記憶部20は、記憶されたデータを書き換え可能な記憶装置であり、一例では、ハードディスク装置またはSSD(Solid State Drive)などの不揮発性の記憶装置である。また、記憶部20は、演算部10での処理を実行する際にプログラムをロードしたり、データを一時的に保持したりするRAM(Random Access Memory)などの揮発性の記憶装置を有していてもよい。 The storage unit 20 includes a firmware storage unit 21, a control program storage unit 22, a hardware information storage unit 23, and an input / output mapping information storage unit 24. The storage unit 20 is a storage device that can rewrite the stored data, and for example, is a hard disk device or a non-volatile storage device such as an SSD (Solid State Drive). Further, the storage unit 20 has a volatile storage device such as a RAM (Random Access Memory) for loading a program or temporarily holding data when executing a process in the calculation unit 10. You may.
 ファームウェア記憶部21は、置き換え前のプログラマブルコントローラで実行されるファームウェアを記憶する機能部である。なお、置き換え前のプログラマブルコントローラは、模擬対象のプログラマブルコントローラの1つである。なお、ファームウェア記憶部21は、バイナリデータ形式のファームウェアを記憶する。制御プログラム記憶部22は、置き換え前のプログラマブルコントローラで実行される制御プログラムを記憶する機能部である。 The firmware storage unit 21 is a functional unit that stores the firmware executed by the programmable controller before replacement. The programmable controller before replacement is one of the programmable controllers to be simulated. The firmware storage unit 21 stores the firmware in the binary data format. The control program storage unit 22 is a functional unit that stores the control program executed by the programmable controller before replacement.
 ハードウェア情報記憶部23は、置き換え前のプログラマブルコントローラのハードウェアを模擬するのに必要なハードウェア情報を記憶する機能部である。ハードウェア情報は、コントローラエミュレータ部13が模擬する置き換え前のプログラマブルコントローラのハードウェアに依存するハードウェア構成情報を有する。ハードウェア構成情報は、メモリマップ、命令模擬処理、レジスタ構成、各レジスタ操作時の模擬処理などを含む。 The hardware information storage unit 23 is a functional unit that stores hardware information necessary for simulating the hardware of the programmable controller before replacement. The hardware information includes hardware configuration information that depends on the hardware of the programmable controller before replacement simulated by the controller emulator unit 13. The hardware configuration information includes a memory map, instruction simulation processing, register configuration, simulation processing at the time of each register operation, and the like.
 入出力マッピング情報記憶部24は、入出力マッピング情報を記憶する機能部である。入出力マッピング情報は、プログラマブルコントローラ1の入出力インタフェース部40における入出力端子に付された入出力番号と、仮想コントローラにおける入出力端子に付された入出力番号と、を対応付けた情報である。仮想コントローラにおける入出力端子に付された入出力番号は、置き換え前のプログラマブルコントローラにおける入出力端子に付された入出力番号に対応する。入出力マッピング情報は、コントローラエミュレータ部13がメモリマップドI/O領域14にアクセスした場合に、メモリマップドI/O領域14の入出力番号を実際の入出力インタフェース部40の入出力端子の入出力番号に変換する際に使用される。 The input / output mapping information storage unit 24 is a functional unit that stores input / output mapping information. The input / output mapping information is information in which the input / output numbers assigned to the input / output terminals in the input / output interface unit 40 of the programmable controller 1 are associated with the input / output numbers assigned to the input / output terminals in the virtual controller. .. The input / output numbers assigned to the input / output terminals in the virtual controller correspond to the input / output numbers assigned to the input / output terminals in the programmable controller before replacement. For the input / output mapping information, when the controller emulator unit 13 accesses the memory-mapped I / O area 14, the input / output number of the memory-mapped I / O area 14 is set to the actual input / output terminal of the input / output interface unit 40. Used when converting to input / output numbers.
 通信インタフェース部30は、プログラマブルコントローラ1の外部機器であるヒューマンインタフェース70に接続される。ヒューマンインタフェース70は、プログラマブルコントローラ1の記憶部20に対してアクセス可能な装置である。ヒューマンインタフェース70は、例えば、パーソナルコンピュータなどの情報処理装置である。ヒューマンインタフェース70は、記憶部20にファームウェア、制御プログラム、ハードウェア情報または入出力マッピング情報を記憶したり、既に記憶部20に記憶されているファームウェア、制御プログラム、ハードウェア情報または入出力マッピング情報を記憶部20から削除したりすることができる。また、ヒューマンインタフェース70は、入出力マッピング情報の自動割付けを行った結果を受け取り、ユーザによる結果の確認を行うことが可能な装置である。さらに、ヒューマンインタフェース70は、入出力マッピング情報の内容を修正することが可能な装置である。例えば、ユーザは、ヒューマンインタフェース70で入出力マッピング情報を見ながら、プログラマブルコントローラ1の入出力端子への配線を行うことができる。また、ユーザは、入出力端子への配線を変更した場合には、ヒューマンインタフェース70で入出力マッピング情報を変更することができる。 The communication interface unit 30 is connected to the human interface 70, which is an external device of the programmable controller 1. The human interface 70 is a device that can access the storage unit 20 of the programmable controller 1. The human interface 70 is, for example, an information processing device such as a personal computer. The human interface 70 stores firmware, control program, hardware information, or input / output mapping information in the storage unit 20, or stores firmware, control program, hardware information, or input / output mapping information already stored in the storage unit 20. It can be deleted from the storage unit 20. Further, the human interface 70 is a device capable of receiving the result of automatic allocation of input / output mapping information and confirming the result by the user. Further, the human interface 70 is a device capable of modifying the contents of the input / output mapping information. For example, the user can perform wiring to the input / output terminals of the programmable controller 1 while viewing the input / output mapping information on the human interface 70. Further, when the user changes the wiring to the input / output terminals, the user can change the input / output mapping information on the human interface 70.
 ハードウェア情報とファームウェアとは、置き換え前のプログラマブルコントローラの動作環境を規定するものである。そのため、模擬したい置き換え前のプログラマブルコントローラの動作環境であるハードウェア情報と、ファームウェアと、を、ヒューマンインタフェース70から記憶部20に書き込み、仮想化部11で実行されるようにすることで、置き換え前のプログラマブルコントローラの所望の動作を模擬することが可能となる。 Hardware information and firmware define the operating environment of the programmable controller before replacement. Therefore, the hardware information and the firmware, which are the operating environment of the programmable controller before the replacement to be simulated, are written from the human interface 70 to the storage unit 20 and executed by the virtualization unit 11 before the replacement. It is possible to simulate the desired operation of the programmable controller of.
 入出力インタフェース部40は、入力端子41と、出力端子42と、入出力制御部43と、を有する。入力端子41は、入力機器と配線を介して接続される。入力機器の一例は、スイッチ、センサまたはロータリエンコーダである。出力端子42は、出力機器と配線を介して接続される。出力機器の一例は、リレー、バルブまたはアクチュエータである。入力端子41には、順番に入力番号「0」から「N」(Nは任意の自然数)までの番号が付される。出力端子42には、順番に出力番号「0」から「N」までの番号が付される。なお、図1では、入力番号「i」は「Input i」(iは0からNまでの自然数)と表記され、出力番号「i」は「Output i」と表記される。また、図1では、入力番号「0」の入力端子41には、スイッチ81が取り付けられ、出力番号「0」の出力端子42には、ランプ91が取り付けられている。この明細書では、入力端子41と出力端子42とは、まとめて入出力端子とも称され、入力機器と出力機器とは、まとめて入出力機器とも称される。 The input / output interface unit 40 has an input terminal 41, an output terminal 42, and an input / output control unit 43. The input terminal 41 is connected to the input device via wiring. An example of an input device is a switch, sensor or rotary encoder. The output terminal 42 is connected to the output device via wiring. An example of an output device is a relay, valve or actuator. The input terminals 41 are sequentially numbered from the input numbers "0" to "N" (N is an arbitrary natural number). The output terminals 42 are sequentially numbered from output numbers "0" to "N". In FIG. 1, the input number "i" is expressed as "Input i" (i is a natural number from 0 to N), and the output number "i" is expressed as "Output i". Further, in FIG. 1, a switch 81 is attached to the input terminal 41 of the input number “0”, and a lamp 91 is attached to the output terminal 42 of the output number “0”. In this specification, the input terminal 41 and the output terminal 42 are collectively referred to as an input / output terminal, and the input device and the output device are collectively referred to as an input / output device.
 入出力制御部43は、メモリマップドI/O領域14と、入力端子41および出力端子42を介した入出力機器と、の間のデータの受け渡しを制御する機能部である。具体的には、入出力制御部43は、入力端子41または出力端子42へのアクセスが発生した場合には、コントローラエミュレータ部13と協働して、入出力リフレッシュ処理を実行する。入出力リフレッシュ処理は、算出した出力情報を出力端子42を介して出力機器に設定し、入力端子41を介して入力機器からの入力情報を受け取る処理である。 The input / output control unit 43 is a functional unit that controls the transfer of data between the memory-mapped I / O area 14 and the input / output device via the input terminal 41 and the output terminal 42. Specifically, when the input / output control unit 43 accesses the input terminal 41 or the output terminal 42, the input / output control unit 43 cooperates with the controller emulator unit 13 to execute the input / output refresh process. The input / output refresh process is a process of setting the calculated output information in the output device via the output terminal 42 and receiving the input information from the input device via the input terminal 41.
 図1では、1台の入力機器と1台の出力機器とがプログラマブルコントローラ1に接続される場合が示されているが、プログラマブルコントローラ1に接続される入力機器と出力機器の台数は、限定されない。すなわち、複数台の入力機器または複数台の出力機器がプログラマブルコントローラ1に接続されてもよい。 FIG. 1 shows a case where one input device and one output device are connected to the programmable controller 1, but the number of input devices and output devices connected to the programmable controller 1 is not limited. .. That is, a plurality of input devices or a plurality of output devices may be connected to the programmable controller 1.
 また、置き換え前のプログラマブルコントローラでの入出力端子に対する入出力機器の接続のされ方が、プログラマブルコントローラ1での入出力端子に対する入出力機器の接続のされ方と異なる場合がある。このような場合には、プログラマブルコントローラ1の入出力端子に付された入出力番号と、置き換え前のプログラマブルコントローラの入出力端子に付された入出力番号と、の間の関係を対応付けた入出力マッピング情報が使用される。すなわち、コントローラエミュレータ部13は、入出力マッピング情報を用いて、出力情報の出力先を、メモリマップドI/O領域14中の仮想化された出力先からプログラマブルコントローラ1の実際の出力先に変換する。また、コントローラエミュレータ部13は、メモリマップドI/O領域14中の仮想化された入力元をプログラマブルコントローラ1での実際の入力元に変換し、入力情報を受け取る。 Further, the way in which the input / output device is connected to the input / output terminal in the programmable controller before replacement may be different from the way in which the input / output device is connected to the input / output terminal in the programmable controller 1. In such a case, the input / output number assigned to the input / output terminal of the programmable controller 1 and the input / output number assigned to the input / output terminal of the programmable controller before replacement are associated with each other. Output mapping information is used. That is, the controller emulator unit 13 converts the output destination of the output information from the virtualized output destination in the memory-mapped I / O area 14 to the actual output destination of the programmable controller 1 by using the input / output mapping information. To do. Further, the controller emulator unit 13 converts the virtualized input source in the memory-mapped I / O area 14 into the actual input source in the programmable controller 1 and receives the input information.
 図2は、実施の形態1における制御プログラムの実行に関わる各ブロックの関係の一例を模式的に示す図である。ここでは、コントローラエミュレータ部13、ファームウェア211aおよび制御プログラム221aをブロックとして示している。 FIG. 2 is a diagram schematically showing an example of the relationship of each block related to the execution of the control program in the first embodiment. Here, the controller emulator unit 13, the firmware 211a, and the control program 221a are shown as blocks.
 ファームウェア211aは、置き換え前のプログラマブルコントローラに搭載されるマイコンで実行可能なバイナリデータ形式のファイルとして提供される。 Firmware 211a is provided as a binary data format file that can be executed by the microcomputer mounted on the programmable controller before replacement.
 コントローラエミュレータ部13は、ファームウェア211aを示すバイナリファイルをデコードし、ソフトウェアで解釈して実行可能な命令セットシミュレータ(Instruction Set Simulator:ISS)である。また、コントローラエミュレータ部13は、管理部12上の1プロセスとして構成される。なお、ここでは、命令セットアーキテクチャが異なるハードウェア向けのファームウェア211aを実行するために、コントローラエミュレータ部13が具体的にISSであるとして説明しているが、同等機能を持つハードウェア機能によってコントローラエミュレータ部13が代替されてもよい。また、命令セットアーキテクチャが同一であるハードウェア向けのファームウェア211aを実行する場合には、コントローラエミュレータ部13のプロセスで直接ファームウェア211aを実行するように構成してもよい。 The controller emulator unit 13 is an instruction set simulator (ISS) that can decode a binary file indicating firmware 211a, interpret it with software, and execute it. Further, the controller emulator unit 13 is configured as one process on the management unit 12. Here, in order to execute the firmware 211a for hardware having a different instruction set architecture, the controller emulator unit 13 is specifically described as an ISS, but the controller emulator is provided by a hardware function having an equivalent function. Part 13 may be substituted. Further, when executing the firmware 211a for hardware having the same instruction set architecture, the firmware 211a may be directly executed by the process of the controller emulator unit 13.
 制御プログラム221aは、置き換え前のプログラマブルコントローラが実行可能な形式に変換されたデータとして提供される。制御プログラム221aのデータ形式および実行方式は、プログラマブルコントローラごとに様々である。実行方式として、ファームウェア211aによってインタプリタ方式で実行される方式、制御プログラム221aを直接実行可能な専用ハードウェアを搭載する方式、あるいはこれらの両者を組み合わせた方式が想定される。実施の形態1では、ファームウェア211aが制御プログラム221aを直接解釈して実行するインタプリタ方式のものを対象とする。図2に示されるように、ファームウェア211aがコントローラエミュレータ部13上で実行されることで、制御プログラム221aを実行するためのロジックが実行され、その結果、制御プログラム221aの実行を実現することができる。 The control program 221a is provided as data converted into a format that can be executed by the programmable controller before replacement. The data format and execution method of the control program 221a vary from programmable controller to programmable controller. As the execution method, a method executed by the firmware 211a in an interpreter method, a method equipped with dedicated hardware capable of directly executing the control program 221a, or a method combining both of them is assumed. In the first embodiment, the firmware 211a directly interprets and executes the control program 221a in an interpreter system. As shown in FIG. 2, when the firmware 211a is executed on the controller emulator unit 13, the logic for executing the control program 221a is executed, and as a result, the execution of the control program 221a can be realized. ..
 図3は、コントローラエミュレータ部とメモリ領域との間の関係の一例を示す図である。図3には、コントローラエミュレータ部13と、コントローラエミュレータ部13がエミュレーションするメモリ領域310と、コントローラエミュレータ部13のプロセスに割り付けられたメモリ空間350と、が示されている。 FIG. 3 is a diagram showing an example of the relationship between the controller emulator unit and the memory area. FIG. 3 shows the controller emulator unit 13, the memory area 310 emulated by the controller emulator unit 13, and the memory space 350 allocated to the process of the controller emulator unit 13.
 メモリ領域310には、仮想コントローラに含まれるROM(Read Only Memory)、RAMおよびメモリマップドI/O領域14にメモリアドレスが割り当てられている。メモリマップドI/O領域14は、置き換え前のプログラマブルコントローラにおけるマイコンの周辺機器のレジスタ領域である。 A memory address is assigned to the ROM (Read Only Memory), RAM, and memory-mapped I / O area 14 included in the virtual controller in the memory area 310. The memory-mapped I / O area 14 is a register area of the peripheral device of the microcomputer in the programmable controller before replacement.
 コントローラエミュレータ部13のプロセスに割り付けられたメモリ空間350には、プログラマブルコントローラ1向けの実行コードに変換された制御プログラム221aと、バイナリデータ形式のファームウェア211aと、ハードウェア情報231と、入出力マッピング情報241と、が配置されている。 In the memory space 350 allocated to the process of the controller emulator unit 13, the control program 221a converted into the execution code for the programmable controller 1, the firmware 211a in the binary data format, the hardware information 231 and the input / output mapping information 241 and are arranged.
 置き換え前のプログラマブルコントローラについてのハードウェア情報231および入出力マッピング情報241と、模擬対象のプログラマブルコントローラで実行される制御プログラム221aおよびファームウェア211aと、は、コントローラエミュレータ部13のプロセスに割り付けられたメモリ空間350に展開される。制御プログラム221aは、メモリ領域310の制御プログラム221がプログラマブルコントローラ1向けの実行コードに変換されたものである。ファームウェア211aは、メモリ領域310のファームウェア211がバイナリデータ形式に変換されたものである。これらの制御プログラム221a、ファームウェア211a、ハードウェア情報231および入出力マッピング情報241は、必要に応じてコントローラエミュレータ部13から参照され、あるいは値の更新が行われる。 The hardware information 231 and input / output mapping information 241 of the programmable controller before replacement, and the control program 221a and firmware 211a executed by the programmable controller to be simulated are the memory spaces allocated to the process of the controller emulator unit 13. Expanded to 350. In the control program 221a, the control program 221 in the memory area 310 is converted into an execution code for the programmable controller 1. The firmware 211a is obtained by converting the firmware 211 of the memory area 310 into a binary data format. These control programs 221a, firmware 211a, hardware information 231 and input / output mapping information 241 are referred to by the controller emulator unit 13 as necessary, or their values are updated.
 入出力マッピング情報241では、プログラマブルコントローラ1の入力端子41に付された入力番号が仮想コントローラの入力端子の入力番号に割り付けられる。そのため、プログラマブルコントローラ1における入力端子41の入力番号と、割り付けられる仮想コントローラを識別する情報およびこの仮想コントローラにおける入力端子の入力番号と、が対応付けられている。また、入出力マッピング情報241では、プログラマブルコントローラ1の出力端子42に付された出力番号が仮想コントローラに割り付けられる。そのため、プログラマブルコントローラ1における出力端子42の出力番号と、割り付けられる仮想コントローラを識別する情報およびこの仮想コントローラにおける出力端子の出力番号と、が対応付けられている。 In the input / output mapping information 241, the input number assigned to the input terminal 41 of the programmable controller 1 is assigned to the input number of the input terminal of the virtual controller. Therefore, the input number of the input terminal 41 in the programmable controller 1 is associated with the information for identifying the virtual controller to be assigned and the input number of the input terminal in this virtual controller. Further, in the input / output mapping information 241, the output number assigned to the output terminal 42 of the programmable controller 1 is assigned to the virtual controller. Therefore, the output number of the output terminal 42 in the programmable controller 1 is associated with the information that identifies the virtual controller to be assigned and the output number of the output terminal in this virtual controller.
 コントローラエミュレータ部13は、CPU(Central Processing Unit)を含む演算部の動作を模擬するために、仮想プログラムカウンタ131と、仮想汎用レジスタ132と、を有する。仮想プログラムカウンタ131および仮想汎用レジスタ132の実体は、ともにコントローラエミュレータ部13のプロセス上の1データである。仮想汎用レジスタ132は、コントローラエミュレータ部13での演算処理の結果生じる任意のデータを格納する。 The controller emulator unit 13 has a virtual program counter 131 and a virtual general-purpose register 132 in order to simulate the operation of the arithmetic unit including the CPU (Central Processing Unit). The substance of the virtual program counter 131 and the virtual general-purpose register 132 are both one data on the process of the controller emulator unit 13. The virtual general-purpose register 132 stores arbitrary data generated as a result of arithmetic processing in the controller emulator unit 13.
 仮想プログラムカウンタ131は、コントローラエミュレータ部13が現在実行しているメモリ領域上、すなわちエミュレーションするメモリ領域310上のアドレスを示すためのデータである。コントローラエミュレータ部13は、仮想プログラムカウンタ131に保持されるアドレスのファームウェア211を解釈し、実行する。このファームウェア211の実体は、コントローラエミュレータ部13のプロセスに割り付けられたメモリ空間350上のファームウェア211aである。そのため、コントローラエミュレータ部13は、仮想プログラムカウンタ131に保存されたアドレスを、メモリ空間350のアドレスに変換して、メモリ空間350から実際のバイナリデータ形式のファームウェア211aのデータの読出しを行う。 The virtual program counter 131 is data for indicating an address on the memory area currently being executed by the controller emulator unit 13, that is, on the memory area 310 to be emulated. The controller emulator unit 13 interprets and executes the firmware 211 at the address held in the virtual program counter 131. The substance of the firmware 211 is the firmware 211a on the memory space 350 allocated to the process of the controller emulator unit 13. Therefore, the controller emulator unit 13 converts the address stored in the virtual program counter 131 into the address of the memory space 350, and reads the data of the firmware 211a in the actual binary data format from the memory space 350.
 バイナリデータ形式のファームウェア211aを命令として解釈し、実行する場合のロジック、およびその解釈した命令を模擬するための処理は、ハードウェア情報231に保存されている。そのため、コントローラエミュレータ部13は、このハードウェア情報231を基に命令の模擬を行う。 The logic for interpreting and executing the binary data format firmware 211a as an instruction and the process for simulating the interpreted instruction are stored in the hardware information 231. Therefore, the controller emulator unit 13 simulates the instruction based on the hardware information 231.
 ファームウェア211aの実行によって、エミュレーションするメモリ領域310のメモリマップドI/O領域14へのアクセスが発生した場合には、該当するハードウェア動作をソフトウェア的に模擬するための処理が実行される。マイコンの周辺機器の模擬処理は、ハードウェア情報231に保存されているので、このハードウェア情報231を基にコントローラエミュレータ部13はメモリマップドI/O領域14へのアクセスに関するハードウェア動作を模擬する。該当するハードウェア動作がプログラマブルコントローラ1の入出力を制御するためのものであった場合には、コントローラエミュレータ部13は、さらに入出力マッピング情報241を参照し、入出力マッピング情報241の割付けに従って、実際の入力端子41または出力端子42を介した情報の入出力を行う。例えば、コントローラエミュレータ部13は、アクセスする仮想的な入出力端子の入出力番号を実際の入出力端子の入出力番号に変換して、実際の入力端子41から入力情報を受け取り、あるいは実際の出力端子42へ出力情報を出力する。これは、コントローラエミュレータ部13で演算されたメモリマップドI/O領域14は、置き換え前のプログラマブルコントローラにおけるものであるため、プログラマブルコントローラ1における実際の入出力制御を行うレジスタの入出力番号へと変換が必要になるからである。 When the memory-mapped I / O area 14 of the memory area 310 to be emulated is accessed by the execution of the firmware 211a, a process for simulating the corresponding hardware operation by software is executed. Since the simulated processing of the peripheral device of the microcomputer is stored in the hardware information 231, the controller emulator unit 13 simulates the hardware operation related to the access to the memory-mapped I / O area 14 based on the hardware information 231. To do. When the corresponding hardware operation is for controlling the input / output of the programmable controller 1, the controller emulator unit 13 further refers to the input / output mapping information 241 and follows the allocation of the input / output mapping information 241. Information is input / output via the actual input terminal 41 or output terminal 42. For example, the controller emulator unit 13 converts the input / output numbers of the virtual input / output terminals to be accessed into the input / output numbers of the actual input / output terminals, receives the input information from the actual input terminals 41, or actually outputs the data. Output information is output to the terminal 42. This is because the memory-mapped I / O area 14 calculated by the controller emulator unit 13 is in the programmable controller before replacement, so that the input / output numbers of the registers that actually perform the input / output control in the programmable controller 1 are used. This is because conversion is required.
 つぎに、このような構成のプログラマブルコントローラ1における動作について説明する。図4は、実施の形態1によるプログラマブルコントローラでのエミュレーション処理の手順の一例を示すフローチャートである。 Next, the operation of the programmable controller 1 having such a configuration will be described. FIG. 4 is a flowchart showing an example of the procedure of the emulation process in the programmable controller according to the first embodiment.
 演算部10によって、コントローラエミュレータ部13が管理部12上のプロセスとして生成されると、コントローラエミュレータ部13は、置き換え前のプログラマブルコントローラについてのハードウェア情報231および入出力マッピング情報241と、置き換え前のプログラマブルコントローラで実行されるファームウェア211aおよび制御プログラム221aを記憶部20から読み出し、メモリ上にロードする(ステップS11)。 When the controller emulator unit 13 is generated as a process on the management unit 12 by the arithmetic unit 10, the controller emulator unit 13 includes the hardware information 231 and the input / output mapping information 241 about the programmable controller before the replacement, and the input / output mapping information 241 before the replacement. The firmware 211a and the control program 221a executed by the programmable controller are read from the storage unit 20 and loaded into the memory (step S11).
 次いで、コントローラエミュレータ部13は、仮想プログラムカウンタ131を、ファームウェア211を起動するアドレスであるファームウェア起動アドレスに設定する(ステップS12)。コントローラエミュレータ部13は、初期状態では命令フェッチを行うアドレスをエミュレーションするメモリ領域310上のファームウェア起動アドレスに設定する。 Next, the controller emulator unit 13 sets the virtual program counter 131 to the firmware startup address, which is the address for booting the firmware 211 (step S12). In the initial state, the controller emulator unit 13 sets the firmware startup address on the memory area 310 that emulates the address for fetching instructions.
 その後、コントローラエミュレータ部13は、仮想プログラムカウンタ131に設定されたファームウェア起動アドレスを、メモリにロードしたバイナリデータ形式のファームウェア211aのアドレスに変換し、該当するアドレスの1命令分のファームウェア211aをデコードし、実行する(ステップS13)。この処理は、マイコン命令デコード処理と称される。ここで、マイコンの命令には、通常演算、論理演算、浮動小数点演算、ジャンプ、比較、メモリ転送、NOP(no operation)、特権命令の様々な種別があるが、コントローラエミュレータ部13は、これらの命令を模擬するための処理を実行する。なお、特権命令には、制御レジスタ操作、割込みレベル変更、スーパバイザコール等がある。 After that, the controller emulator unit 13 converts the firmware startup address set in the virtual program counter 131 to the address of the firmware 211a in the binary data format loaded in the memory, and decodes the firmware 211a for one instruction at the corresponding address. , Execute (step S13). This process is called a microcomputer instruction decoding process. Here, there are various types of microcomputer instructions such as normal operation, logical operation, floating point operation, jump, comparison, memory transfer, NOP (no operation), and privileged instruction. Execute the process to simulate the instruction. The privileged instructions include control register operation, interrupt level change, supervisor call, and the like.
 例えば置き換え前のプログラマブルコントローラのマイコンが「ADD R1, R2, #100」という命令を持っているものとする。この命令は、「R1レジスタにR2レジスタの値と即値100とを加算した結果を格納する」という処理を実現するものである。仮想化部11のコントローラエミュレータ部13は、この命令に従って同等の処理を実行し、仮想汎用レジスタ132にその結果を格納する。 For example, it is assumed that the microcomputer of the programmable controller before replacement has the instruction "ADD R1, R2, # 100". This instruction realizes the process of "storing the result of adding the value of the R2 register and the immediate value 100 to the R1 register". The controller emulator unit 13 of the virtualization unit 11 executes equivalent processing according to this instruction, and stores the result in the virtual general-purpose register 132.
 次いで、コントローラエミュレータ部13は、実行対象の命令がメモリにアクセスする命令であるかを判定する(ステップS14)。実行対象の命令がメモリにアクセスする命令ではない場合(ステップS14でNoの場合)には、コントローラエミュレータ部13は、ハードウェア情報231を参照して、実行対象の命令処理を実行する(ステップS15)。この処理は、マイコン命令模擬処理と称される。 Next, the controller emulator unit 13 determines whether the instruction to be executed is an instruction to access the memory (step S14). When the instruction to be executed is not an instruction to access the memory (No in step S14), the controller emulator unit 13 refers to the hardware information 231 and executes the instruction process to be executed (step S15). ). This process is called a microcomputer instruction simulation process.
 また、実行対象の命令がメモリにアクセスする命令である場合(ステップS14でYesの場合)には、コントローラエミュレータ部13は、アクセス先のアドレスがメモリマップドI/O領域14であるかを判定する(ステップS16)。アクセス先のアドレスがメモリマップドI/O領域14ではない場合(ステップS16でNoの場合)には、ステップS15のマイコン命令模擬処理が実行される。また、アクセス先のアドレスがメモリマップドI/O領域14である場合(ステップS16でYesの場合)には、コントローラエミュレータ部13は、ハードウェア情報231を参照して、実行対象の命令処理に対応する周辺機器についてのハードウェア模擬処理を実行する(ステップS17)。この処理は、マイコン周辺機器模擬処理と称される。ここでは、コントローラエミュレータ部13は、ハードウェア情報231にしたがってハードウェア動作を模擬する。また、コントローラエミュレータ部13は、アクセス対象がプログラマブルコントローラ1の入出力制御を行うレジスタにアクセスする場合には、入出力マッピング情報241にしたがって、実際の入出力端子を介した入力情報または出力情報の反映を行う。具体的には、コントローラエミュレータ部13は、入出力マッピング情報241を参照し、入出力制御部43を介して入出力マッピング情報241に割り付けられた出力機器への出力情報の出力または入力機器からの入力情報の取り込みを行う。 If the instruction to be executed is an instruction to access the memory (Yes in step S14), the controller emulator unit 13 determines whether the access destination address is the memory-mapped I / O area 14. (Step S16). When the access destination address is not the memory-mapped I / O area 14 (No in step S16), the microcomputer instruction simulation process in step S15 is executed. When the access destination address is the memory-mapped I / O area 14 (Yes in step S16), the controller emulator unit 13 refers to the hardware information 231 and performs instruction processing to be executed. The hardware simulation process for the corresponding peripheral device is executed (step S17). This process is called a microcomputer peripheral device simulation process. Here, the controller emulator unit 13 simulates the hardware operation according to the hardware information 231. Further, when the access target accesses the register that controls the input / output of the programmable controller 1, the controller emulator unit 13 obtains the input information or the output information via the actual input / output terminals according to the input / output mapping information 241. Reflect. Specifically, the controller emulator unit 13 refers to the input / output mapping information 241 and outputs the output information to the output device assigned to the input / output mapping information 241 via the input / output control unit 43 or from the input device. Import the input information.
 その後またはステップS15の後、コントローラエミュレータ部13は、仮想プログラムカウンタ131をファームウェア211のつぎの命令に対応するアドレスに設定し(ステップS18)、処理がステップS13に戻る。 After that or after step S15, the controller emulator unit 13 sets the virtual program counter 131 to the address corresponding to the next instruction of the firmware 211 (step S18), and the process returns to step S13.
 図5は、実施の形態1によるプログラマブルコントローラでの仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図である。ここでは、置き換え前のプログラマブルコントローラにおける出力制御が、出力制御レジスタ341を用いて制御される仕様であるものとする。また、出力制御レジスタ341は、エミュレーションするメモリ領域310のアドレス「0x10001000」にマッピングされているレジスタであり、各ビット「b0」から「b15」が置き換え前のプログラマブルコントローラの各出力番号の出力端子に対応しているものとする。 FIG. 5 is a diagram showing an example of a method of converting the virtual output of the programmable controller according to the first embodiment into the actual output of the programmable controller. Here, it is assumed that the output control in the programmable controller before replacement is controlled by using the output control register 341. Further, the output control register 341 is a register mapped to the address "0x10001000" of the memory area 310 to be emulated, and each bit "b0" to "b15" is used as an output terminal of each output number of the programmable controller before replacement. It shall be supported.
 置き換え前のプログラマブルコントローラにおいて、例えば出力番号「1」の出力端子を「ON」にしたい場合には、出力制御レジスタ341の1ビット目を「1」に設定すればよい。 In the programmable controller before replacement, for example, when it is desired to set the output terminal of the output number "1" to "ON", the first bit of the output control register 341 may be set to "1".
 仮に、コントローラエミュレータ部13上のファームウェアで、すなわち仮想コントローラで、出力番号「1」,「2」の出力端子を「ON」にするための処理が実行された場合には、コントローラエミュレータ部13は、出力制御レジスタ341のハードウェア模擬処理を実行する。すなわち、コントローラエミュレータ部13は、出力制御レジスタ341に対応するメモリマップドI/O領域14中の仮想レジスタ141に仮想出力を行う。このとき、仮想レジスタ141の1ビット目の「X1」および2ビット目の「X2」のビットが「ON」にされる。この出力制御レジスタ341は、プログラマブルコントローラ1の入出力を制御するためのレジスタであるため、入出力マッピング情報241を参照した上で、プログラマブルコントローラ1の実際の入出力制御レジスタ441にハードウェア模擬処理の結果が出力される。つまり、入出力制御部43は、入出力制御レジスタ441の内容に基づいて、入力端子41または出力端子42の「ON」または「OFF」の制御を行う。 If the firmware on the controller emulator unit 13, that is, the virtual controller, executes a process for turning the output terminals of the output numbers "1" and "2" to "ON", the controller emulator unit 13 will perform the process. , The hardware simulation process of the output control register 341 is executed. That is, the controller emulator unit 13 performs virtual output to the virtual register 141 in the memory-mapped I / O area 14 corresponding to the output control register 341. At this time, the first bit "X1" and the second bit "X2" of the virtual register 141 are set to "ON". Since this output control register 341 is a register for controlling the input / output of the programmable controller 1, hardware simulation processing is performed on the actual input / output control register 441 of the programmable controller 1 with reference to the input / output mapping information 241. The result of is output. That is, the input / output control unit 43 controls "ON" or "OFF" of the input terminal 41 or the output terminal 42 based on the contents of the input / output control register 441.
 図5の入出力マッピング情報241では、プログラマブルコントローラ1の出力番号「0」,「1」,「2」は、それぞれコントローラエミュレータ部13で模擬される仮想コントローラ上の出力番号「2」,「1」,「0」に対応付けられている。そのため、仮想コントローラ上の出力番号「0」,「1」,「2」の値がそれぞれ「0」,「1」,「1」である場合には、出力端子42の出力番号「0」,「1」,「2」の値はそれぞれ「1」,「1」,「0」に設定される。仮想コントローラ上の出力番号「3」以降の出力端子の値についても同様に、入出力マッピング情報241を参照して、対応付けられたプログラマブルコントローラ1の出力番号の出力端子42に設定される。図5の例では、仮想コントローラ上の出力番号「3」以降の値はすべて「0」である。 In the input / output mapping information 241 of FIG. 5, the output numbers “0”, “1”, and “2” of the programmable controller 1 are the output numbers “2” and “1” on the virtual controller simulated by the controller emulator unit 13, respectively. , "0". Therefore, when the values of the output numbers "0", "1", and "2" on the virtual controller are "0", "1", and "1", respectively, the output number "0" of the output terminal 42, The values of "1" and "2" are set to "1", "1", and "0", respectively. Similarly, the values of the output terminals after the output number "3" on the virtual controller are set to the output terminal 42 of the associated programmable controller 1 output number with reference to the input / output mapping information 241. In the example of FIG. 5, all the values after the output number “3” on the virtual controller are “0”.
 実施の形態1では、コントローラエミュレータ部13は、ファームウェア211aの1命令分をデコードしながら実行し、同命令の模擬を行う。また命令のアクセス先がメモリマップドI/O領域14である場合にはハードウェアの模擬も同時に行う。コントローラエミュレータ部13は、1命令分の模擬が完了すると、次の命令を実行しながら模擬を行う処理を継続する。ここで、ファームウェア211aの実行時に参照する各命令の模擬処理およびメモリマップドI/O領域14にアクセスした場合のハードウェアの模擬処理は、ハードウェア情報231に保持されており、かつファームウェア211およびハードウェア情報231は通信インタフェース部30を通じて変更することが可能である。そのため、これらを入れ替えることによって、模擬対象のプログラマブルコントローラを自由に入れ替えることが可能となる。また、ハードウェアの模擬処理でプログラマブルコントローラ1の入出力端子にアクセスする際に参照する入出力マッピング情報241は、ユーザによって手動で変更できるため、コントローラエミュレータ部13上で模擬される仮想コントローラにおける仮想入出力と、プログラマブルコントローラ1の実際の入出力と、の対応付けを自由に変更することが可能となる。 In the first embodiment, the controller emulator unit 13 executes while decoding one instruction of the firmware 211a, and simulates the instruction. If the instruction access destination is the memory-mapped I / O area 14, the hardware is simulated at the same time. When the simulation for one instruction is completed, the controller emulator unit 13 continues the process of performing the simulation while executing the next instruction. Here, the simulated processing of each instruction referred to when the firmware 211a is executed and the simulated processing of the hardware when the memory-mapped I / O area 14 is accessed are held in the hardware information 231 and the firmware 211 and The hardware information 231 can be changed through the communication interface unit 30. Therefore, by exchanging these, it is possible to freely exchange the programmable controller to be simulated. Further, since the input / output mapping information 241 referred to when accessing the input / output terminals of the programmable controller 1 in the hardware simulation process can be manually changed by the user, the virtual in the virtual controller simulated on the controller emulator unit 13 It is possible to freely change the correspondence between the input / output and the actual input / output of the programmable controller 1.
 なお、実施の形態1では、置き換え前のプログラマブルコントローラが、制御プログラムをファームウェアが直接解釈して実行する方式として説明したが、制御プログラム実行用の専用ハードウェアを搭載するプログラマブルコントローラを模擬する場合であっても、この専用ハードウェアを模擬するためのハードウェア情報を用意することで同様に制御プログラムの実行を模擬することができる。 In the first embodiment, the programmable controller before replacement has been described as a method in which the firmware directly interprets and executes the control program. However, in the case of simulating a programmable controller equipped with dedicated hardware for executing the control program. Even if there is, the execution of the control program can be simulated in the same manner by preparing the hardware information for simulating this dedicated hardware.
 また、実施の形態1では、通信インタフェース部30を介して、ファームウェア211、制御プログラム221およびハードウェア情報231が入れ替えられたり、あるいは入出力マッピング情報241の内容が変更されたりした。しかし、プログラマブルコントローラ1が、これらの情報を保存した記憶媒体を取り付けるためのインタフェースを有し、プログラマブルコントローラ1が、このインタフェースを経由して記憶媒体からデータを読み出して模擬動作を行うように構成してもよい。記憶媒体の一例は、SDメモリカード、CD(Compact Disc)-ROM、DVD(Digital Versatile DiscまたはDigital Video Disc)-ROM、BD(Blu-ray(登録商標) Disc)-ROM、コンパクトフラッシュ(登録商標)、フロッピー(登録商標)ディスクなどである。 Further, in the first embodiment, the firmware 211, the control program 221 and the hardware information 231 are replaced, or the contents of the input / output mapping information 241 are changed via the communication interface unit 30. However, the programmable controller 1 has an interface for attaching a storage medium in which such information is stored, and the programmable controller 1 is configured to read data from the storage medium via this interface and perform a simulated operation. You may. Examples of storage media are SD memory cards, CD (Compact Disc) -ROM, DVD (Digital Versatile Disc or Digital Video Disc) -ROM, BD (Blu-ray (registered trademark) Disc) -ROM, CompactFlash (registered trademark). ), Blu-ray (registered trademark) discs, etc.
実施の形態2.
 図6は、実施の形態2によるプログラマブルコントローラの構成の一例を模式的に示すブロック図である。以下では、実施の形態1と異なる部分について説明する。また、実施の形態1と同一の構成要素には、同一の符号を付して、その説明を省略する。
Embodiment 2.
FIG. 6 is a block diagram schematically showing an example of the configuration of the programmable controller according to the second embodiment. Hereinafter, a part different from the first embodiment will be described. Further, the same components as those in the first embodiment are designated by the same reference numerals, and the description thereof will be omitted.
 実施の形態2では、コントローラエミュレータ部13は、置き換え前のプログラマブルコントローラでファームウェアの命令を実行するのに要する時間を見積もり、置き換え前のプログラマブルコントローラにおける入出力リフレッシュ処理の開始時刻を算出し、その結果を後述する入出力タイミング調整部431に通知する機能をさらに有する。具体的には、コントローラエミュレータ部13は、ファームウェア211aを1命令文デコードし、実行するたびに、置き換え前のプログラマブルコントローラで実際に命令が実行される時間である命令実行時間を見積もる。また、コントローラエミュレータ部13は、前回の入出力リフレッシュ処理が終了したときからの命令実行時間を積算した積算命令実行時間を算出する。そして、コントローラエミュレータ部13は、入出力リフレッシュ用のレジスタへのアクセスがあると、その時点における積算命令実行時間を用いて、置き換え前のプログラマブルコントローラで制御プログラムを実行するスキャン処理が終了する時刻、すなわち実際に入出力リフレッシュ処理が開始される時刻を見積もる。コントローラエミュレータ部13は、見積もった入出力リフレッシュ処理の開始時刻を入出力タイミング調整部431に出力する。 In the second embodiment, the controller emulator unit 13 estimates the time required to execute the firmware instruction in the programmable controller before replacement, calculates the start time of the input / output refresh process in the programmable controller before replacement, and obtains the result. Further has a function of notifying the input / output timing adjusting unit 431 described later. Specifically, the controller emulator unit 13 decodes one instruction statement of the firmware 211a and estimates the instruction execution time, which is the time when the instruction is actually executed by the programmable controller before replacement, each time the firmware 211a is executed. Further, the controller emulator unit 13 calculates the integrated instruction execution time by integrating the instruction execution time from the time when the previous input / output refresh process is completed. Then, when the controller emulator unit 13 accesses the register for input / output refresh, the time when the scan process for executing the control program on the programmable controller before replacement is completed by using the integrated instruction execution time at that time. That is, the time when the input / output refresh process actually starts is estimated. The controller emulator unit 13 outputs the estimated start time of the input / output refresh process to the input / output timing adjustment unit 431.
 プログラマブルコントローラ1の入出力制御部43は、入出力タイミング調整部431をさらに有する。入出力タイミング調整部431は、プログラマブルコントローラ1における入出力リフレッシュを実施するタイミングを、置き換え前のプログラマブルコントローラにおける入出力リフレッシュを実施するタイミングと同等にする機能を有する。入出力タイミング調整部431は、コントローラエミュレータ部13が見積もった入出力リフレッシュ処理の開始時刻になるまで、入出力制御部43を待機状態にし、入出力リフレッシュ処理の開始時刻になると、入出力制御部43による入出力リフレッシュ処理の実行を可能にする。 The input / output control unit 43 of the programmable controller 1 further includes an input / output timing adjusting unit 431. The input / output timing adjusting unit 431 has a function of making the timing of performing input / output refresh in the programmable controller 1 equal to the timing of performing input / output refresh in the programmable controller before replacement. The input / output timing adjustment unit 431 puts the input / output control unit 43 in the standby state until the start time of the input / output refresh process estimated by the controller emulator unit 13, and when the start time of the input / output refresh process is reached, the input / output control unit 431. The input / output refresh process by 43 can be executed.
 図7は、実施の形態2による入出力リフレッシュのタイミングの調整の一例を模式的に示すタイムチャートである。図7では、上段に置き換え前のプログラマブルコントローラでの動作が示され、下段にコントローラエミュレータ部13上での動作が示されている。置き換え前のプログラマブルコントローラでの動作に示されるように、一般的に、プログラマブルコントローラは、制御プログラムを実行するスキャン511と、外部の入力機器の入力情報の取り込みまたは外部の出力機器への演算結果である出力情報の出力を行う入出力リフレッシュ521と、を繰り返し実行している。そして、これによって、装置等の制御が実現される。 FIG. 7 is a time chart schematically showing an example of adjusting the input / output refresh timing according to the second embodiment. In FIG. 7, the operation on the programmable controller before replacement is shown in the upper row, and the operation on the controller emulator unit 13 is shown in the lower row. As shown in the operation of the programmable controller before replacement, the programmable controller generally has a scan 511 that executes a control program and captures input information of an external input device or a calculation result to an external output device. I / O refresh 521, which outputs certain output information, is repeatedly executed. As a result, control of the device and the like is realized.
 ここで、置き換え前のプログラマブルコントローラが旧式で演算速度が遅い場合を考える。このような場合には、置き換え前のプログラマブルコントローラ上でのスキャン511の実行に比して、コントローラエミュレータ部13上でのスキャン512の実行の方が早く終了する。そこで、実施の形態2では、このような場合において、コントローラエミュレータ部13上でのスキャン512の後に、入出力タイミング調整部431は、図7に示されるタイミング調整532の時間を設ける。これによって、置き換え前のプログラマブルコントローラにおける入出力リフレッシュ521と、コントローラエミュレータ部13上での入出力リフレッシュ522と、が、同じ時刻に開始されるように調整される。その結果、制御対象の機器からの入力と、同機器への出力タイミングが実機動作と同等になる。 Here, consider the case where the programmable controller before replacement is old and the calculation speed is slow. In such a case, the execution of the scan 512 on the controller emulator unit 13 ends earlier than the execution of the scan 511 on the programmable controller before the replacement. Therefore, in the second embodiment, in such a case, after the scan 512 on the controller emulator unit 13, the input / output timing adjustment unit 431 provides the time for the timing adjustment 532 shown in FIG. 7. As a result, the input / output refresh 521 in the programmable controller before replacement and the input / output refresh 522 on the controller emulator unit 13 are adjusted so as to start at the same time. As a result, the input from the device to be controlled and the output timing to the device are the same as the operation of the actual device.
 図8は、実施の形態2によるプログラマブルコントローラでのエミュレーション処理の手順の一例を示すフローチャートである。なお、以下では、実施の形態1の図4と異なる部分について説明する。 FIG. 8 is a flowchart showing an example of the procedure of emulation processing in the programmable controller according to the second embodiment. In the following, a part different from FIG. 4 of the first embodiment will be described.
 ステップS11の後に、コントローラエミュレータ部13は、積算命令実行時間を初期化する(ステップS31)。その後、ステップS12に処理が移る。 After step S11, the controller emulator unit 13 initializes the integration instruction execution time (step S31). After that, the process moves to step S12.
 ステップS15の後に、コントローラエミュレータ部13は、エミュレートした命令の置き換え前のプログラマブルコントローラにおける命令実行時間を見積もり、その時点における積算命令実行時間に加算する(ステップS32)。命令実行時間が加算された積算命令実行時間が新たな積算命令実行時間となる。その後、処理がステップS18に移る。 After step S15, the controller emulator unit 13 estimates the instruction execution time in the programmable controller before the replacement of the emulated instruction and adds it to the integrated instruction execution time at that time (step S32). The integrated instruction execution time to which the instruction execution time is added becomes the new integrated instruction execution time. After that, the process proceeds to step S18.
 ステップS16でアクセス先アドレスがメモリマップドI/O領域14である場合(ステップS16でYesの場合)には、コントローラエミュレータ部13は、アクセス先アドレスが入出力リフレッシュ用のレジスタであるかを判定する(ステップS33)。アクセス先アドレスが入出力リフレッシュ用のレジスタではない場合(ステップS33でNoの場合)には、コントローラエミュレータ部13は、該当するレジスタにハードウェア模擬処理を実行する(ステップS34)。その後、処理がステップS32へと移る。 When the access destination address is the memory-mapped I / O area 14 in step S16 (Yes in step S16), the controller emulator unit 13 determines whether the access destination address is an I / O refresh register. (Step S33). If the access destination address is not an I / O refresh register (No in step S33), the controller emulator unit 13 executes hardware simulation processing on the corresponding register (step S34). After that, the process proceeds to step S32.
 また、アクセス先アドレスが入出力リフレッシュ用のレジスタである場合(ステップS33でYesの場合)には、コントローラエミュレータ部13は、その時点の積算命令実行時間を取得し、積算命令実行時間から模擬対象である実機のプログラマブルコントローラにおける入出力リフレッシュ処理の開始時刻を見積もる(ステップS35)。次いで、コントローラエミュレータ部13は、見積もった入出力リフレッシュ処理の開始時刻を入出力タイミング調整部431に出力する(ステップS36)。その後、コントローラエミュレータ部13は、入出力タイミング調整部431から入出力リフレッシュの実行完了の通知を受け取るまで、待機状態となる(ステップS37)。 When the access destination address is a register for input / output refresh (Yes in step S33), the controller emulator unit 13 acquires the integration instruction execution time at that time and simulates from the integration instruction execution time. The start time of the input / output refresh process in the programmable controller of the actual machine is estimated (step S35). Next, the controller emulator unit 13 outputs the estimated start time of the input / output refresh process to the input / output timing adjusting unit 431 (step S36). After that, the controller emulator unit 13 goes into a standby state until it receives a notification from the input / output timing adjusting unit 431 that the execution of the input / output refresh has been completed (step S37).
 入出力タイミング調整部431は、入出力リフレッシュ処理の開始時刻を受け取ると、入出力リフレッシュ処理の開始時刻を設定する(ステップS38)。そして、入出力タイミング調整部431は、現在の時刻が入出力リフレッシュ処理の開始時刻になったかを判定し(ステップS39)、現在の時刻が入出力リフレッシュ処理の開始時刻になっていない場合(ステップS39でNoの場合)には、待機状態となる。 Upon receiving the start time of the input / output refresh process, the input / output timing adjustment unit 431 sets the start time of the input / output refresh process (step S38). Then, the input / output timing adjustment unit 431 determines whether the current time has reached the start time of the input / output refresh process (step S39), and when the current time has not become the start time of the input / output refresh process (step). In the case of No in S39), the standby state is set.
 また、現在の時刻が入出力リフレッシュ処理の開始時刻になった場合(ステップS39でYesの場合)には、入出力タイミング調整部431は、入出力制御部43による入出力リフレッシュ処理の実行を許可する。すなわち、入出力制御部43は、入力情報の取り込みまたは出力情報の設定を行う入出力リフレッシュ処理を実行する(ステップS40)。その後、入出力タイミング調整部431は、入出力リフレッシュ処理の実行完了をコントローラエミュレータ部13に通知する(ステップS41)。 When the current time becomes the start time of the input / output refresh process (Yes in step S39), the input / output timing adjustment unit 431 permits the input / output control unit 43 to execute the input / output refresh process. To do. That is, the input / output control unit 43 executes an input / output refresh process for capturing input information or setting output information (step S40). After that, the input / output timing adjustment unit 431 notifies the controller emulator unit 13 of the completion of the execution of the input / output refresh process (step S41).
 コントローラエミュレータ部13は、入出力タイミング調整部431から入出力リフレッシュ処理の実行完了の通知を受けると(ステップS42)、ステップS31に処理が移る。 When the controller emulator unit 13 receives a notification from the input / output timing adjustment unit 431 that the execution of the input / output refresh process is completed (step S42), the process shifts to step S31.
 なお、ここでは、コントローラエミュレータ部13が、マイコンの命令実行を行う度に実機での同命令の命令実行時間を見積もり、その積算命令実行時間で実機でのスキャン時間を見積もる方式を説明したが、これ以外の時間見積もりの方法を用いてもよい。例えば、制御プログラム221の1命令単位で命令実行時間を見積もり、その積算命令実行時間で実機でのスキャン時間を見積もってもよい。 Here, a method has been described in which the controller emulator unit 13 estimates the instruction execution time of the same instruction on the actual machine each time the instruction of the microcomputer is executed, and estimates the scan time on the actual machine based on the integrated instruction execution time. Other time estimation methods may be used. For example, the instruction execution time may be estimated for each instruction of the control program 221 and the scan time on the actual machine may be estimated based on the integrated instruction execution time.
 図9は、実施の形態2によるエミュレーションによる仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図である。ここでは、実施の形態1で説明した出力制御レジスタ341に対応する仮想レジスタ141に値を設定し、それを実出力に反映する場合における出力時の動作を説明する。 FIG. 9 is a diagram showing an example of a method of converting the virtual output by emulation according to the second embodiment into the actual output in the programmable controller. Here, the operation at the time of output when a value is set in the virtual register 141 corresponding to the output control register 341 described in the first embodiment and reflected in the actual output will be described.
 コントローラエミュレータ部13が実行するファームウェア211a上で出力制御レジスタ341へのアクセスが発生した場合には、置き換え前のプログラマブルコントローラにおける出力制御レジスタ341への出力と同じように、仮想レジスタ141に仮想出力が出力される。仮想出力は、置き換え前のプログラマブルコントローラにおける入出力機器の接続およびハードウェア構成を前提としたものである。そのため、実際のプログラマブルコントローラ1の入出力端子に対して入出力を行う場合には、プログラマブルコントローラ1における入出力機器の接続およびハードウェア構成に合わせて出力が変換される。すなわち、入出力マッピング情報241を参照して、仮想出力における出力番号が実際の出力番号に変換される。実施の形態2では、このときに、コントローラエミュレータ部13は、積算命令実行時間435を参照して入出力リフレッシュの開始時刻「A」を算出する。つまり、この場合には、実際の出力端子42からの出力情報の出力時刻が算出される。ここで得られた、実際の出力番号と入出力リフレッシュの開始時刻「A」とは、入出力タイミング調整部431に保持される。そして、入出力タイミング調整部431は、開始時刻「A」になると、入出力制御部43に入出力リフレッシュ処理の開始時刻になったことを通知し、入出力制御部43は、各出力情報の出力を行う。 When the output control register 341 is accessed on the firmware 211a executed by the controller emulator unit 13, a virtual output is output to the virtual register 141 in the same manner as the output to the output control register 341 in the programmable controller before replacement. It is output. The virtual output is premised on the connection of input / output devices and the hardware configuration in the programmable controller before replacement. Therefore, when input / output is performed to the input / output terminals of the actual programmable controller 1, the output is converted according to the connection of the input / output devices in the programmable controller 1 and the hardware configuration. That is, the output number in the virtual output is converted into the actual output number by referring to the input / output mapping information 241. In the second embodiment, at this time, the controller emulator unit 13 calculates the input / output refresh start time “A” with reference to the integration instruction execution time 435. That is, in this case, the output time of the output information from the actual output terminal 42 is calculated. The actual output number and the input / output refresh start time "A" obtained here are held in the input / output timing adjusting unit 431. Then, when the start time "A" is reached, the input / output timing adjustment unit 431 notifies the input / output control unit 43 that the start time of the input / output refresh process has been reached, and the input / output control unit 43 informs the input / output control unit 43 of each output information. Output.
 実施の形態2では、コントローラエミュレータ部13が、コントローラエミュレータ部13で実行する命令が実際の模擬対象のプログラマブルコントローラで実行されたときに要する命令実行時間を見積もり、さらに積算命令実行時間を見積もる。そして、実行対象の命令のアクセス先アドレスが入出力リフレッシュ用のレジスタである場合に、コントローラエミュレータ部13は、積算命令実行時間を用いて、実際の模擬対象のプログラマブルコントローラにおける入出力リフレッシュ処理の開始時刻を見積もる。入出力タイミング調整部431は、この入出力リフレッシュ処理の開始時刻を用いて、プログラマブルコントローラ1での入出力リフレッシュ処理を行うタイミングを調整する。これによって、プログラマブルコントローラ1における入出力リフレッシュを行うタイミングを、模擬対象の実際のプログラマブルコントローラと同等にすることができるという効果を有する。 In the second embodiment, the controller emulator unit 13 estimates the instruction execution time required when the instruction executed by the controller emulator unit 13 is executed by the programmable controller to be simulated, and further estimates the integrated instruction execution time. Then, when the access destination address of the instruction to be executed is a register for input / output refresh, the controller emulator unit 13 starts the input / output refresh process in the programmable controller to be simulated by using the integrated instruction execution time. Estimate the time. The input / output timing adjustment unit 431 adjusts the timing of performing the input / output refresh process in the programmable controller 1 by using the start time of the input / output refresh process. This has the effect that the timing of input / output refresh in the programmable controller 1 can be made equal to that of the actual programmable controller to be simulated.
実施の形態3.
 図10は、実施の形態3によるプログラマブルコントローラの構成の一例を模式的に示すブロック図である。以下では、実施の形態1と異なる部分について説明する。また、実施の形態1と同一の構成要素には、同一の符号を付して、その説明を省略する。
Embodiment 3.
FIG. 10 is a block diagram schematically showing an example of the configuration of the programmable controller according to the third embodiment. Hereinafter, a part different from the first embodiment will be described. Further, the same components as those in the first embodiment are designated by the same reference numerals, and the description thereof will be omitted.
 実施の形態3では、プログラマブルコントローラ1は、複数の演算部10A,10Bを有する。演算部10A,10Bのそれぞれは、実施の形態1で説明したものと同様に、仮想化部11A,11Bを有する。すなわち、プログラマブルコントローラ1には、複数の仮想化部11A,11Bが設けられる。仮想化部11Aは、実施の形態1の演算部10と同様に、管理部12A、コントローラエミュレータ部13A、メモリマップドI/O領域14Aおよびマッピング情報生成部15Aを有する。同様に、仮想化部11Bは、管理部12B、コントローラエミュレータ部13B、メモリマップドI/O領域14Bおよびマッピング情報生成部15Bを有する。これによって、プログラマブルコントローラ1は、複数の置き換え前のプログラマブルコントローラを模擬することができる。すなわち、仮想化部11A上でファームウェア211aが実行され、ファームウェア211a上で制御プログラム221aが実行される。仮想化部11B上でファームウェア212aが実行され、ファームウェア212a上で制御プログラム222aが実行される。なお、図10では、2つの演算部10A,10Bが設けられる場合を示しているが、3以上の演算部が設けられてもよい。 In the third embodiment, the programmable controller 1 has a plurality of arithmetic units 10A and 10B. Each of the calculation units 10A and 10B has virtualization units 11A and 11B as described in the first embodiment. That is, the programmable controller 1 is provided with a plurality of virtualization units 11A and 11B. The virtualization unit 11A has a management unit 12A, a controller emulator unit 13A, a memory-mapped I / O area 14A, and a mapping information generation unit 15A, similarly to the calculation unit 10 of the first embodiment. Similarly, the virtualization unit 11B includes a management unit 12B, a controller emulator unit 13B, a memory-mapped I / O area 14B, and a mapping information generation unit 15B. Thereby, the programmable controller 1 can simulate a plurality of programmable controllers before replacement. That is, the firmware 211a is executed on the virtualization unit 11A, and the control program 221a is executed on the firmware 211a. The firmware 212a is executed on the virtualization unit 11B, and the control program 222a is executed on the firmware 212a. Although FIG. 10 shows a case where two calculation units 10A and 10B are provided, three or more calculation units may be provided.
 このような構成によって、ハードウェア情報記憶部23は、仮想化部11A,11Bに設けられるコントローラエミュレータ部13A,13Bの数のハードウェア情報を記憶する。また、ファームウェア記憶部21は、仮想化部11A,11Bに設けられるコントローラエミュレータ部13A,13Bの数のファームウェア211a,212aを記憶し、制御プログラム記憶部22は、仮想化部11A,11Bに設けられるコントローラエミュレータ部13A,13Bの数の制御プログラム221a,222aを記憶する。入出力マッピング情報記憶部24は、複数のコントローラエミュレータ部13で共通の一つの入出力マッピング情報を記憶する。 With such a configuration, the hardware information storage unit 23 stores the number of hardware information of the controller emulator units 13A and 13B provided in the virtualization units 11A and 11B. Further, the firmware storage unit 21 stores the number of firmwares 211a and 212a of the controller emulator units 13A and 13B provided in the virtualization units 11A and 11B, and the control program storage unit 22 is provided in the virtualization units 11A and 11B. Stores the number of control programs 221a and 222a of the controller emulator units 13A and 13B. The input / output mapping information storage unit 24 stores one input / output mapping information common to the plurality of controller emulator units 13.
 図10では、入力番号「60」の入力端子41にスイッチ82がさらに接続され、出力番号「60」の出力端子42にマグネットスイッチ92がさらに接続されている。 In FIG. 10, the switch 82 is further connected to the input terminal 41 of the input number “60”, and the magnet switch 92 is further connected to the output terminal 42 of the output number “60”.
 図10に示されるプログラマブルコントローラ1では、演算部10Aで制御プログラム221aが実行され、演算部10Bで制御プログラム222aが実行されており、これらの制御プログラム221a,222aによって、外部の入力機器および出力機器が制御される。 In the programmable controller 1 shown in FIG. 10, the control program 221a is executed by the calculation unit 10A, the control program 222a is executed by the calculation unit 10B, and the external input devices and output devices are executed by these control programs 221a and 222a. Is controlled.
 図10の例では、入力番号「0」から「59」までの入力端子41と出力番号「0」から「59」までの出力端子42とが制御プログラム221aで制御される。また、入力番号「60」から「139」までの入力端子41と出力番号「60」から「139」までの出力端子42とが制御プログラム222aで制御される。 In the example of FIG. 10, the input terminal 41 from the input numbers "0" to "59" and the output terminal 42 from the output numbers "0" to "59" are controlled by the control program 221a. Further, the input terminals 41 from the input numbers "60" to "139" and the output terminals 42 from the output numbers "60" to "139" are controlled by the control program 222a.
 各コントローラエミュレータ部13A,13Bの動作は、実施の形態1の図4のフローチャートで説明したものと同様であり、それぞれのコントローラエミュレータ部13A,13Bが独立に動作する。ここでは、プログラマブルコントローラ1のハードウェアが複数の演算部10A,10Bを有しており、各演算部10A,10B上で異なるコントローラエミュレータ部13A,13Bが並列に実行される場合が示されている。しかし、プログラマブルコントローラ1のハードウェアが1つの演算部10を有する場合で、時分割で動作を切り替えることによって仮想化部11が複数のコントローラエミュレータ部13A,13Bを有するようにしてもよい。この場合には、時分割で動作を切り替えながら、それぞれのコントローラエミュレータ部13A,13Bでの処理が実行される。 The operations of the controller emulator units 13A and 13B are the same as those described in the flowchart of FIG. 4 of the first embodiment, and the respective controller emulator units 13A and 13B operate independently. Here, a case is shown in which the hardware of the programmable controller 1 has a plurality of arithmetic units 10A and 10B, and different controller emulator units 13A and 13B are executed in parallel on the respective arithmetic units 10A and 10B. .. However, when the hardware of the programmable controller 1 has one arithmetic unit 10, the virtualization unit 11 may have a plurality of controller emulator units 13A and 13B by switching the operation in a time division manner. In this case, the processes in the controller emulator units 13A and 13B are executed while switching the operation in a time division manner.
 図11は、実施の形態3によるエミュレーションによる仮想出力をプログラマブルコントローラにおける実出力に変換する方法の一例を示す図である。コントローラエミュレータ部13Aが、入出力インタフェース部40にアクセスする場合、すなわち図4のステップS17での処理のように、入出力制御を行うハードウェアへのアクセスをファームウェアが行った場合には、入出力マッピング情報241を参照し、該当する実際の出力番号の出力端子42への出力を行う。 FIG. 11 is a diagram showing an example of a method of converting the virtual output by emulation according to the third embodiment into the actual output in the programmable controller. When the controller emulator unit 13A accesses the input / output interface unit 40, that is, when the firmware accesses the hardware for input / output control as in the process in step S17 of FIG. 4, the input / output is input / output. The mapping information 241 is referred to, and the corresponding actual output number is output to the output terminal 42.
 なお、図11では、図4とは入出力マッピング情報241の内容が異なっている。実施の形態1では、演算部10は1つの仮想コントローラを模擬していたが、実施の形態3では、演算部10A,10Bが2つの仮想コントローラを模擬している。そのため、入出力マッピング情報241の「仮想コントローラ割り付け」の欄には、演算部10Aで模擬される仮想コントローラAか、演算部10Bで模擬される仮想コントローラBかが入力される。 Note that, in FIG. 11, the content of the input / output mapping information 241 is different from that in FIG. In the first embodiment, the calculation unit 10 simulates one virtual controller, but in the third embodiment, the calculation units 10A and 10B simulate two virtual controllers. Therefore, in the "Virtual controller allocation" field of the input / output mapping information 241, either the virtual controller A simulated by the calculation unit 10A or the virtual controller B simulated by the calculation unit 10B is input.
 ここでは、コントローラエミュレータ部13A上で実行されるファームウェア211aが実際の入出力端子にアクセスした場合を例に挙げて説明する。出力制御レジスタ341は、実施の形態1で説明したものと同様であり、模擬対象の実際のプログラマブルコントローラが有する出力制御レジスタであり、各ビットがプログラマブルコントローラの各出力番号に対応する。 Here, the case where the firmware 211a executed on the controller emulator unit 13A accesses the actual input / output terminals will be described as an example. The output control register 341 is the same as that described in the first embodiment, is an output control register of the actual programmable controller to be simulated, and each bit corresponds to each output number of the programmable controller.
 コントローラエミュレータ部13A上で、この出力制御レジスタ341の1ビット目、2ビット目への書込みが行われる場合には、該当するハードウェア模擬処理が実行される。すなわち、コントローラエミュレータ部13Aは、出力制御レジスタ341に対応するメモリマップドI/O領域14の仮想レジスタ141の1ビット目と2ビット目への書き込みを行う。そして、コントローラエミュレータ部13Aは、入出力マッピング情報241を参照して、実際の出力端子42への反映を行う。入出力マッピング情報241では、出力番号「0」から「59」までがコントローラエミュレータ部13Aで模擬される「仮想コントローラA」に割り付けられており、かつプログラマブルコントローラ1の出力番号「0」,「1」,「2」はそれぞれコントローラエミュレータ部13A上の仮想レジスタの出力番号「2」,「1」,「0」に対応付けられている。そのため、コントローラエミュレータ部13Aは、出力端子42の出力番号「0」,「1」,「2」の値をそれぞれ「1」,「1」,「0」に設定し、実際の入出力制御レジスタ441に出力する。なお、コントローラエミュレータ部13Bから実際の入出力端子にアクセスした場合も、同様に、入出力マッピング情報241の割付けに基づいて実際の入出力端子へのアクセスが行われる。 When writing to the 1st bit and the 2nd bit of this output control register 341 is performed on the controller emulator unit 13A, the corresponding hardware simulation process is executed. That is, the controller emulator unit 13A writes to the first bit and the second bit of the virtual register 141 of the memory-mapped I / O area 14 corresponding to the output control register 341. Then, the controller emulator unit 13A refers to the input / output mapping information 241 and reflects the information on the actual output terminal 42. In the input / output mapping information 241, output numbers "0" to "59" are assigned to "virtual controller A" simulated by the controller emulator unit 13A, and output numbers "0" and "1" of the programmable controller 1 are assigned. , "2" are associated with the output numbers "2", "1", and "0" of the virtual register on the controller emulator unit 13A, respectively. Therefore, the controller emulator unit 13A sets the values of the output numbers "0", "1", and "2" of the output terminal 42 to "1", "1", and "0", respectively, and sets the actual input / output control register. Output to 441. When the actual input / output terminals are accessed from the controller emulator unit 13B, the actual input / output terminals are similarly accessed based on the allocation of the input / output mapping information 241.
 このように共通の入出力マッピング情報241を参照して、複数のコントローラエミュレータ部13A,13Bの入出力動作が模擬される。これによって、入力番号「0」から「59」までの入力端子41と出力番号「0」から「59」までの出力端子42とが制御プログラム221aで制御される。また、入力番号「60」から「139」までの入力端子41と出力番号「60」から「139」までの出力端子42とが制御プログラム222aで制御される動作が実現できる。そして、入出力マッピング情報241を変更することで、複数のコントローラエミュレータ部13A,13B間の実際の入力端子41および出力端子42への割り当て関係を変更することができる。 With reference to the common input / output mapping information 241 in this way, the input / output operations of the plurality of controller emulator units 13A and 13B are simulated. As a result, the input terminals 41 from the input numbers "0" to "59" and the output terminals 42 from the output numbers "0" to "59" are controlled by the control program 221a. Further, it is possible to realize an operation in which the input terminals 41 from the input numbers "60" to "139" and the output terminals 42 from the output numbers "60" to "139" are controlled by the control program 222a. Then, by changing the input / output mapping information 241 it is possible to change the actual allocation relationship between the plurality of controller emulator units 13A and 13B to the input terminal 41 and the output terminal 42.
 なお、上記の説明では、各コントローラエミュレータ部13A,13Bの入出力が、プログラマブルコントローラ1のいずれかの実際の入力端子41および出力端子42に割り当てられていた。しかし、コントローラエミュレータ部13A,13B間での入出力の接続が必要な場合には、コントローラエミュレータ部13A,13B間の入出力が内部で接続されるように構成されてもよい。この場合、例えば、入出力マッピング情報241においてコントローラエミュレータ部13A,13B間の入出力関係を記述しておき、一方のコントローラエミュレータ部が他のコントローラエミュレータ部に接続された出力にアクセスした場合に、その出力結果をプロセス間通信でもう一方のコントローラエミュレータ部の入力に反映する方法を利用することができる。 In the above description, the input / output of the controller emulator units 13A and 13B are assigned to the actual input terminal 41 and output terminal 42 of any one of the programmable controllers 1. However, when it is necessary to connect the input / output between the controller emulator units 13A and 13B, the input / output between the controller emulator units 13A and 13B may be internally connected. In this case, for example, when the input / output relationship between the controller emulator units 13A and 13B is described in the input / output mapping information 241 and one controller emulator unit accesses the output connected to the other controller emulator unit, for example, It is possible to use a method of reflecting the output result in the input of the other controller emulator unit by inter-process communication.
 実施の形態3では、プログラマブルコントローラ1は、複数のコントローラエミュレータ部13A,13Bを有し、それぞれのコントローラエミュレータ部13A,13Bで異なる置き換え前のプログラマブルコントローラの動作を模擬するようにした。これによって、複数の既存の制御プログラム221a,222aを一つのプログラマブルコントローラ1のハードウェア上に統合し、同時に実行することが可能となる。 In the third embodiment, the programmable controller 1 has a plurality of controller emulator units 13A and 13B, and the respective controller emulator units 13A and 13B simulate different operations of the programmable controller before replacement. This makes it possible to integrate a plurality of existing control programs 221a and 222a on the hardware of one programmable controller 1 and execute them at the same time.
実施の形態4.
 図12は、実施の形態4によるプログラマブルコントローラの構成の一例を模式的に示すブロック図である。以下では、実施の形態1,3と異なる部分について説明する。また、実施の形態1,3と同一の構成要素には、同一の符号を付して、その説明を省略する。
Embodiment 4.
FIG. 12 is a block diagram schematically showing an example of the configuration of the programmable controller according to the fourth embodiment. Hereinafter, the parts different from the first and third embodiments will be described. Further, the same components as those in the first and third embodiments are designated by the same reference numerals, and the description thereof will be omitted.
 実施の形態3の場合と同様に、プログラマブルコントローラ1は、複数のコントローラエミュレータ部13A,13Bを有する。ただし、実施の形態3では、プログラマブルコントローラ1は、物理的に異なる複数の演算部10A,10Bを有し、それぞれの演算部10A,10Bがコントローラエミュレータ部13A,13Bを有する構成であったが、実施の形態4では、プログラマブルコントローラ1は、1つの演算部10を有し、演算部10中の仮想化部11が複数のコントローラエミュレータ部13A,13Bを有する構成である。上記したように、このような場合には、演算部10は、複数のコントローラエミュレータ部13A,13Bを時分割で切り替えながら動作させる。 As in the case of the third embodiment, the programmable controller 1 has a plurality of controller emulator units 13A and 13B. However, in the third embodiment, the programmable controller 1 has a plurality of physically different arithmetic units 10A and 10B, and the respective arithmetic units 10A and 10B have the controller emulator units 13A and 13B. In the fourth embodiment, the programmable controller 1 has one calculation unit 10, and the virtualization unit 11 in the calculation unit 10 has a plurality of controller emulator units 13A and 13B. As described above, in such a case, the arithmetic unit 10 operates while switching the plurality of controller emulator units 13A and 13B in a time division manner.
 図12では、入力番号「0」の入力端子41にロータリエンコーダ83が接続され、入力番号「60」の入力端子41にスイッチ82が接続されている。また、出力番号「0」の出力端子42にランプ91が接続され、出力番号「60」の出力端子42にマグネットスイッチ92が接続されている。 In FIG. 12, the rotary encoder 83 is connected to the input terminal 41 of the input number “0”, and the switch 82 is connected to the input terminal 41 of the input number “60”. Further, the lamp 91 is connected to the output terminal 42 of the output number “0”, and the magnet switch 92 is connected to the output terminal 42 of the output number “60”.
 プログラマブルコントローラ1の入出力制御部43は、優先イベント検知部432をさらに有する。優先イベント検知部432は、複数のコントローラエミュレータ部13A,13Bで模擬動作処理中に、優先的に処理すべき割込みプログラムに対応付けられたイベントの発生を検知し、イベントが発生したことを示すイベント通知を演算部10に通知する機能を有する。以下では、優先的に処理すべき割込みプログラムに対応付けられたイベントは、優先イベントと称される。 The input / output control unit 43 of the programmable controller 1 further includes a priority event detection unit 432. The priority event detection unit 432 detects the occurrence of an event associated with the interrupt program to be preferentially processed during the simulated operation processing by the plurality of controller emulator units 13A and 13B, and indicates that an event has occurred. It has a function of notifying the calculation unit 10 of the notification. In the following, the event associated with the interrupt program to be processed preferentially is referred to as a priority event.
 演算部10の管理部12は、切替部121をさらに有する。切替部121は、優先イベント検知部432からイベント通知が通知されると、優先イベントの発生によって割込みプログラムを実行するコントローラエミュレータ部とは別のコントローラエミュレータ部が動作していても、割込みプログラムを実行するコントローラエミュレータ部に処理を切替える機能部である。 The management unit 12 of the calculation unit 10 further has a switching unit 121. When the priority event detection unit 432 notifies the switching unit 121, the switching unit 121 executes the interrupt program even if a controller emulator unit other than the controller emulator unit that executes the interrupt program due to the occurrence of the priority event is operating. This is a functional unit that switches processing to the controller emulator unit.
 プログラマブルコントローラ1は、一般的に、特定のイベントを契機に高速に動作する割込みプログラムの実行機能を有する。イベントは、入力信号の立上りまたは立下り、パルスカウンタの値の変動、内部タイマのカウントアップなどである。これらのイベントをトリガとして動作する割込みプログラムは、実行中の制御プログラムより高優先度で動作し、高速な応答性が求められる。 The programmable controller 1 generally has an interrupt program execution function that operates at high speed triggered by a specific event. Events include rising or falling edges of input signals, fluctuations in pulse counter values, and internal timer count-ups. An interrupt program that operates with these events as a trigger operates with a higher priority than a running control program, and is required to have high-speed responsiveness.
 2つのコントローラエミュレータ部13A,13Bが、同一の演算部10上で実行されている場合で、コントローラエミュレータ部13Aが実行中にコントローラエミュレータ部13Bが処理すべき優先イベントが発生する場合がある。この場合には、コントローラエミュレータ部13Aに割り当てられた時間が経過するまで、コントローラエミュレータ部13Bは優先イベントに対応する割込み処理を実行できないため、割込みプログラムの応答性が悪化してしまう。 When two controller emulator units 13A and 13B are executed on the same arithmetic unit 10, a priority event to be processed by the controller emulator unit 13B may occur while the controller emulator unit 13A is executing. In this case, the controller emulator unit 13B cannot execute the interrupt processing corresponding to the priority event until the time allotted to the controller emulator unit 13A elapses, so that the responsiveness of the interrupt program deteriorates.
 そこで、実施の形態4では、優先イベント発生時の応答性能を高めるために、入出力制御部43に優先イベント検知部432が設けられ、管理部12に切替部121が設けられる。 Therefore, in the fourth embodiment, the input / output control unit 43 is provided with the priority event detection unit 432, and the management unit 12 is provided with the switching unit 121 in order to improve the response performance when the priority event occurs.
 ここで、割り込みが発生する例について説明する。ロータリエンコーダ83のパルスカウントが予め定められた設定値に達した場合に、コントローラエミュレータ部13Bが割込みプログラムを実行するものとして説明する。 Here, an example in which an interrupt occurs will be described. It is assumed that the controller emulator unit 13B executes the interrupt program when the pulse count of the rotary encoder 83 reaches a predetermined set value.
 優先イベント検知部432には、優先イベントとして通知が必要な条件が設定される。優先イベントは、イベントが発生すると、優先的に割り込みプログラムを実行させなければならないイベントである。ここでは、「入力番号「0」の入力端子41に対するパルス数が予め定められた設定値となった場合」が条件に設定される。コントローラエミュレータ部13A,13B上で模擬されるファームウェア211a,212aがどのようにしてこの設定を行うかは、コントローラエミュレータ部13A,13Bの模擬対象となるプログラマブルコントローラのハードウェア仕様によって異なる。ここでは、パルスカウントを行う専用ハードウェアを搭載したプログラマブルコントローラを、コントローラエミュレータ部13Aが模擬するものと想定して説明する。専用ハードウェアを搭載しているプログラマブルコントローラ向けのファームウェアは、この専用ハードウェアのレジスタへアクセスする。このレジスタへのアクセスによって、コントローラエミュレータ部13Aによるハードウェア模擬処理が実行される。ハードウェア模擬処理において優先イベント検知部432に対してパルス監視が必要な入力番号「0」と、イベント条件となるパルス数と、が設定される。 The priority event detection unit 432 is set with conditions that require notification as a priority event. The priority event is an event in which the interrupt program must be executed preferentially when the event occurs. Here, "when the number of pulses for the input terminal 41 of the input number" 0 "is a predetermined set value" is set as a condition. How the firmwares 211a and 212a simulated on the controller emulator units 13A and 13B make this setting depends on the hardware specifications of the programmable controller to be simulated by the controller emulator units 13A and 13B. Here, it is assumed that the controller emulator unit 13A simulates a programmable controller equipped with dedicated hardware for performing pulse counting. Firmware for programmable controllers with dedicated hardware accesses the registers of this dedicated hardware. By accessing this register, hardware simulation processing by the controller emulator unit 13A is executed. In the hardware simulation process, the input number “0” that requires pulse monitoring for the priority event detection unit 432 and the number of pulses that are event conditions are set.
 設定された優先イベントの条件が成立した場合には、優先イベント検知部432は、切替部121へイベント発生を通知する。切替部121は、優先イベントを処理すべきコントローラエミュレータ部13B上の仮想汎用レジスタ132に記憶されたハードウェアレジスタ情報をイベント発生時の状態とするとともに、優先イベントを処理すべきコントローラエミュレータ部13Bが実行されていなければ、演算部10上で実行されるコントローラエミュレータ部13A,13Bの切り替えを行う。 When the set priority event condition is satisfied, the priority event detection unit 432 notifies the switching unit 121 of the event occurrence. The switching unit 121 sets the hardware register information stored in the virtual general-purpose register 132 on the controller emulator unit 13B that should process the priority event to the state at the time of the event, and the controller emulator unit 13B that should process the priority event. If it is not executed, the controller emulator units 13A and 13B executed on the arithmetic unit 10 are switched.
 図13は、同一演算部上で実行される複数のコントローラエミュレータ部の切り替えタイミングの一例を示す図である。この図で、上段はコントローラエミュレータ部13Aの動作の状態を示し、下段は、コントローラエミュレータ部13Bの動作の状態を示す。また、横軸は、時間である。 FIG. 13 is a diagram showing an example of switching timing of a plurality of controller emulator units executed on the same arithmetic unit. In this figure, the upper part shows the operating state of the controller emulator unit 13A, and the lower part shows the operating state of the controller emulator unit 13B. The horizontal axis is time.
 優先イベントが発生していない場合には、コントローラエミュレータ部13A,13Bは、特定の実行周期に基づいて時分割で切り替えられながら、処理を実行する。図13では、まず、実行周期551でコントローラエミュレータ部13Aが処理を実行し、その後の実行周期552でコントローラエミュレータ部13Bが処理を実行する。次の実行周期553では、コントローラエミュレータ部13Aが処理を実行するが、この実行周期553中の時刻t1に、優先イベント560が発生したものとする。ここでは、優先イベント560は、ロータリエンコーダ83によるパルスカウンタ数が設定値に達することである。優先イベント検知部432は、優先イベント560の発生を検知し、優先イベントの発生を示すイベント通知を切替部121に通知する。切替部121は、イベント通知を受けると、コントローラエミュレータ部13Aが動作している実行周期553の途中であっても、コントローラエミュレータ部13Aからコントローラエミュレータ部13Bへと処理を切り替え、コントローラエミュレータ部13Bが動作可能な状態とする。その後、コントローラエミュレータ部13Bは、優先イベントに対応する割込みプログラムを実行する。 When the priority event has not occurred, the controller emulator units 13A and 13B execute the process while being switched in a time division based on a specific execution cycle. In FIG. 13, first, the controller emulator unit 13A executes the process in the execution cycle 551, and then the controller emulator unit 13B executes the process in the execution cycle 552. In the next execution cycle 553, the controller emulator unit 13A executes the process, and it is assumed that the priority event 560 occurs at time t1 in the execution cycle 553. Here, the priority event 560 is that the number of pulse counters by the rotary encoder 83 reaches the set value. The priority event detection unit 432 detects the occurrence of the priority event 560 and notifies the switching unit 121 of an event notification indicating the occurrence of the priority event. Upon receiving the event notification, the switching unit 121 switches the process from the controller emulator unit 13A to the controller emulator unit 13B even during the execution cycle 553 in which the controller emulator unit 13A is operating, and the controller emulator unit 13B switches the process. Make it operational. After that, the controller emulator unit 13B executes the interrupt program corresponding to the priority event.
 ここで、割込みプログラムを実行する時間である割込みプログラム実行用割り当て時間570は、特定のアルゴリズムに基づいて算出される。あるいは、割込みプログラム実行用割り当て時間570は、ファームウェア212aそのものを変更して、割込みプログラム完了時にフック処理を追加し、これにより割込みプログラムの実行完了を検出すようにしてもよい。フック処理を追加する方式の場合には、割込みプログラムの実行完了時刻を予想する必要がないため、割込みプログラム実行用割り当て時間570の計算は不要である。割込みプログラム実行用割り当て時間570が経過すると、切替部121は、コントローラエミュレータ部13Aへと処理を切替える。そして、実行周期554で、ハードウェアレジスタ情報が優先イベント560の発生時の状態に戻され、コントローラエミュレータ部13Aが処理を行う。 Here, the interrupt program execution allocation time 570, which is the time for executing the interrupt program, is calculated based on a specific algorithm. Alternatively, the interrupt program execution allocation time 570 may change the firmware 212a itself and add a hook process when the interrupt program is completed, thereby detecting the completion of the interrupt program execution. In the case of the method of adding the hook processing, it is not necessary to predict the execution completion time of the interrupt program, so that the calculation of the interrupt program execution allocation time 570 is unnecessary. When the interrupt program execution allocation time 570 elapses, the switching unit 121 switches the process to the controller emulator unit 13A. Then, in the execution cycle 554, the hardware register information is returned to the state at the time of the occurrence of the priority event 560, and the controller emulator unit 13A performs processing.
 なお、上記した説明では、優先イベント検知部432はパルスカウントの機能を有する機能ブロックであるものとして説明したが、実施の形態がこれに限定されるものではない。例えば、優先イベント検知部432は、入力信号の立上りまたは立下りなどの他のイベント検出機能を複数有するように構成されてもよい。 In the above description, the priority event detection unit 432 has been described as a functional block having a pulse counting function, but the embodiment is not limited to this. For example, the priority event detection unit 432 may be configured to have a plurality of other event detection functions such as rising or falling edges of an input signal.
 実施の形態4では、プログラマブルコントローラ1は、優先イベントを検知する優先イベント検知部432と、優先イベントが検知された場合に割込み処理を行うべきコントローラエミュレータ部13A,13Bに処理を切り替える切替部121と、を備える。これによって、優先イベント発生時に割込みプログラムを実行するコントローラエミュレータ部13A,13Bへと強制的に切り替えられ、同一の演算部10上で複数のコントローラエミュレータ部13A,13Bを実行する場合において、優先イベントに対する応答性を高めることができる。 In the fourth embodiment, the programmable controller 1 includes a priority event detection unit 432 that detects a priority event, and a switching unit 121 that switches processing to controller emulator units 13A and 13B that should perform interrupt processing when a priority event is detected. , Equipped with. As a result, it is forcibly switched to the controller emulator units 13A and 13B that execute the interrupt program when the priority event occurs, and when a plurality of controller emulator units 13A and 13B are executed on the same arithmetic unit 10, the priority event is dealt with. The responsiveness can be enhanced.
 また、上記した実施の形態2を実施の形態3,4と組み合わせてもよい。これによって、プログラマブルコントローラ1における入出力リフレッシュを行うタイミングを、模擬対象の実際のプログラマブルコントローラと同等にすることができる。 Further, the above-described second embodiment may be combined with the third and fourth embodiments. As a result, the timing of input / output refresh in the programmable controller 1 can be made equivalent to that of the actual programmable controller to be simulated.
 以上の実施の形態に示した構成は、本発明の内容の一例を示すものであり、別の公知の技術と組み合わせることも可能であるし、本発明の要旨を逸脱しない範囲で、構成の一部を省略、変更することも可能である。 The configuration shown in the above-described embodiment shows an example of the content of the present invention, can be combined with another known technique, and is one of the configurations without departing from the gist of the present invention. It is also possible to omit or change the part.
 1 プログラマブルコントローラ、10,10A,10B 演算部、11,11A,11B 仮想化部、12,12A,12B 管理部、13,13A,13B コントローラエミュレータ部、14,14A,14B メモリマップドI/O領域、15,15A,15B マッピング情報生成部、20 記憶部、21 ファームウェア記憶部、22 制御プログラム記憶部、23 ハードウェア情報記憶部、24 入出力マッピング情報記憶部、30 通信インタフェース部、40 入出力インタフェース部、41 入力端子、42 出力端子、43 入出力制御部、50 バス、70 ヒューマンインタフェース、81,82 スイッチ、83 ロータリエンコーダ、91 ランプ、92 マグネットスイッチ、121 切替部、131 仮想プログラムカウンタ、132 仮想汎用レジスタ、211,211a,212a ファームウェア、221,221a,222a 制御プログラム、231 ハードウェア情報、241 入出力マッピング情報、431 入出力タイミング調整部、432 優先イベント検知部。 1 Programmable controller, 10,10A, 10B calculation unit, 11,11A, 11B virtualization unit, 12,12A, 12B management unit, 13,13A, 13B controller emulator unit, 14,14A, 14B memory-mapped I / O area , 15, 15A, 15B Mapping information generation unit, 20 storage unit, 21 firmware storage unit, 22 control program storage unit, 23 hardware information storage unit, 24 input / output mapping information storage unit, 30 communication interface unit, 40 input / output interface Unit, 41 input terminal, 42 output terminal, 43 input / output control unit, 50 bus, 70 human interface, 81, 82 switch, 83 rotary encoder, 91 lamp, 92 magnet switch, 121 switching unit, 131 virtual program counter, 132 virtual General-purpose registers, 211,211a, 212a firmware, 211,221a, 222a control program, 231 hardware information, 241 input / output mapping information, 431 input / output timing adjustment unit, 432 priority event detection unit.

Claims (6)

  1.  模擬対象のプログラマブルコントローラで実行されるファームウェアおよび制御プログラムと、前記模擬対象のプログラマブルコントローラのハードウェアを模擬するのに必要なハードウェア情報と、を記憶する記憶部と、
     前記模擬対象のプログラマブルコントローラにおける前記ハードウェアの動作を、前記ハードウェア情報に基づいて模擬するコントローラエミュレータ部と、
     を備え、
     前記コントローラエミュレータ部は、模擬した前記ハードウェア上で、前記ファームウェアおよび前記制御プログラムを実行し、
     前記記憶部中の前記ファームウェアおよび前記ハードウェア情報は、前記模擬対象のプログラマブルコントローラに応じて変更可能であることを特徴とするプログラマブルコントローラ。
    A storage unit that stores the firmware and control program executed by the programmable controller to be simulated, and the hardware information required to simulate the hardware of the programmable controller to be simulated.
    A controller emulator unit that simulates the operation of the hardware in the programmable controller to be simulated based on the hardware information.
    With
    The controller emulator unit executes the firmware and the control program on the simulated hardware.
    A programmable controller, characterized in that the firmware and the hardware information in the storage unit can be changed according to the programmable controller to be simulated.
  2.  入力機器および出力端子と接続される入出力端子と、
     前記入出力端子への情報の入出力を制御する入出力制御部と、
     をさらに備え、
     前記記憶部は、前記入出力端子への入出力と、前記コントローラエミュレータ部で前記ファームウェアおよび前記制御プログラムを実行したときの仮想的な入出力と、の間の対応関係を規定した入出力マッピング情報をさらに記憶し、
     前記コントローラエミュレータ部は、前記ファームウェアおよび前記制御プログラムを実行したときの前記仮想的な入出力を、前記入出力マッピング情報を参照して、前記入出力端子への入出力に変換することを特徴とする請求項1に記載のプログラマブルコントローラ。
    Input / output terminals connected to input devices and output terminals,
    An input / output control unit that controls the input / output of information to the input / output terminals,
    With more
    The storage unit defines input / output mapping information that defines a correspondence relationship between input / output to the input / output terminal and virtual input / output when the firmware and the control program are executed by the controller emulator unit. Memorize further,
    The controller emulator unit is characterized in that the virtual input / output when the firmware and the control program are executed are converted into input / output to the input / output terminal with reference to the input / output mapping information. The programmable controller according to claim 1.
  3.  前記入出力マッピング情報の前記入出力端子への入出力と前記仮想的な入出力との間の関係を変更可能な外部機器と接続する通信インタフェース部をさらに備えることを特徴とする請求項2に記載のプログラマブルコントローラ。 The second aspect of the present invention is characterized in that a communication interface unit for connecting to an external device capable of changing the relationship between the input / output of the input / output mapping information to the input / output terminal and the virtual input / output is further provided. Described programmable controller.
  4.  前記入出力制御部による前記仮想的な入出力から前記入出力端子への実際の入出力のタイミングを調整する入出力タイミング調整部をさらに備え、
     前記コントローラエミュレータ部は、前記模擬対象のプログラマブルコントローラを前記ファームウェアおよび前記制御プログラムにしたがって模擬するときに、実際の前記模擬対象のプログラマブルコントローラが前記制御プログラムを実行する際の実行時間を見積もり、前記実行時間に基づいて、実際の前記模擬対象のプログラマブルコントローラによる入出力の開始時刻を見積もり、
     前記入出力タイミング調整部は、前記開始時刻になるまで、前記入出力制御部による制御を待機させ、前記開始時刻になると、前記入出力制御部による前記入出力端子への入出力の制御を許可することを特徴とする請求項2または3に記載のプログラマブルコントローラ。
    An input / output timing adjusting unit for adjusting the actual input / output timing from the virtual input / output to the input / output terminal by the input / output control unit is further provided.
    When the programmable controller to be simulated is simulated according to the firmware and the control program, the controller emulator unit estimates the execution time when the programmable controller to be simulated actually executes the control program, and executes the execution. Based on the time, estimate the start time of input / output by the actual programmable controller to be simulated.
    The input / output timing adjusting unit waits for control by the input / output control unit until the start time, and at the start time, permits the input / output control unit to control input / output to the input / output terminal. The programmable controller according to claim 2 or 3.
  5.  複数の前記コントローラエミュレータ部を備え、
     前記記憶部は、それぞれの前記コントローラエミュレータ部で実行される前記ファームウェア、前記制御プログラムおよび前記ハードウェア情報を有することを特徴とする請求項1から4のいずれか1つに記載のプログラマブルコントローラ。
    It is equipped with a plurality of the controller emulator units.
    The programmable controller according to any one of claims 1 to 4, wherein the storage unit has the firmware, the control program, and the hardware information executed by the respective controller emulator units.
  6.  複数の前記コントローラエミュレータ部による前記模擬対象のプログラマブルコントローラにおける前記ハードウェアの模擬処理を切り替える切替部と、
     割込み処理に対応付けられたイベントを検知する優先イベント検知部と、
     をさらに備え、
     前記優先イベント検知部は、前記割込み処理を優先的に実行するイベントである優先イベントの発生を検知すると、前記切替部に前記優先イベントの発生を通知し、
     前記切替部は、前記優先イベントに対応付けられる前記割込み処理が実行されるように複数の前記コントローラエミュレータ部の切り替えを制御することを特徴とする請求項5に記載のプログラマブルコントローラ。
    A switching unit that switches the simulation processing of the hardware in the programmable controller to be simulated by the plurality of controller emulator units, and
    A priority event detector that detects events associated with interrupt processing,
    With more
    When the priority event detection unit detects the occurrence of a priority event, which is an event that preferentially executes the interrupt processing, the priority event detection unit notifies the switching unit of the occurrence of the priority event.
    The programmable controller according to claim 5, wherein the switching unit controls switching of a plurality of the controller emulator units so that the interrupt processing associated with the priority event is executed.
PCT/JP2019/046114 2019-11-26 2019-11-26 Programmable controller WO2021106064A1 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201980102404.2A CN114730168B (en) 2019-11-26 2019-11-26 Programmable controller
PCT/JP2019/046114 WO2021106064A1 (en) 2019-11-26 2019-11-26 Programmable controller
DE112019007840.2T DE112019007840T5 (en) 2019-11-26 2019-11-26 Programmable controller
JP2020519811A JP6739689B1 (en) 2019-11-26 2019-11-26 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2019/046114 WO2021106064A1 (en) 2019-11-26 2019-11-26 Programmable controller

Publications (1)

Publication Number Publication Date
WO2021106064A1 true WO2021106064A1 (en) 2021-06-03

Family

ID=71949438

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/046114 WO2021106064A1 (en) 2019-11-26 2019-11-26 Programmable controller

Country Status (4)

Country Link
JP (1) JP6739689B1 (en)
CN (1) CN114730168B (en)
DE (1) DE112019007840T5 (en)
WO (1) WO2021106064A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58200363A (en) * 1982-05-14 1983-11-21 Nec Corp Input and output control system of virtual system
JP2015026279A (en) * 2013-07-26 2015-02-05 株式会社東芝 Plant monitoring control device and program
US20150356220A1 (en) * 2013-01-16 2015-12-10 Siemens Aktiengesellschaft Automated input simulation for simulated programmable logic controller
JP2016031658A (en) * 2014-07-29 2016-03-07 株式会社東芝 Plant control device and plant control method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4894961B1 (en) * 2011-03-15 2012-03-14 オムロン株式会社 PLC CPU unit, PLC system program, and recording medium storing PLC system program
JP5713056B2 (en) 2013-06-24 2015-05-07 横河電機株式会社 Process control apparatus and system and update method thereof
JP6915441B2 (en) * 2017-08-10 2021-08-04 オムロン株式会社 Information processing equipment, information processing methods, and information processing programs

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS58200363A (en) * 1982-05-14 1983-11-21 Nec Corp Input and output control system of virtual system
US20150356220A1 (en) * 2013-01-16 2015-12-10 Siemens Aktiengesellschaft Automated input simulation for simulated programmable logic controller
JP2015026279A (en) * 2013-07-26 2015-02-05 株式会社東芝 Plant monitoring control device and program
JP2016031658A (en) * 2014-07-29 2016-03-07 株式会社東芝 Plant control device and plant control method

Also Published As

Publication number Publication date
DE112019007840T5 (en) 2022-08-04
CN114730168A (en) 2022-07-08
JPWO2021106064A1 (en) 2021-12-02
CN114730168B (en) 2023-06-06
JP6739689B1 (en) 2020-08-12

Similar Documents

Publication Publication Date Title
CA1304166C (en) Software emulation of bank-switched memory using a virtual dos monitorand paged memory management
CN102207886B (en) Virtual machine high-speed simulation is assisted
TW594493B (en) New processor mode for limiting the operation of guest software running on a virtual machine supported by a virtual machine monitor
JP5658197B2 (en) Computer system, virtualization mechanism, and computer system control method
CN101714091B (en) Methods and systems to display platform graphics during operating system initialization
US20130290778A1 (en) Restoring from a legacy os environment to a uefi pre-boot environment
WO2003025721A2 (en) Microcontroller with configurable onboard boot-ram
MXPA04010030A (en) Systems and methods for using synthetic instructions in a virtual machine.
US8457944B2 (en) Method and device for determining requirement parameters of at least one physical hardware unit
TWI777491B (en) Apparatus for virtualized registers and method and computer program product for accessing to the apparatus
KR20070108410A (en) A method and apparatus for independent and concurrent data transfer on host controllers
JP2021520548A (en) Exception handling in transactions
CN110597597B (en) Method, system, device and storage medium for virtualization of hardware
US20090144733A1 (en) Virtual machine system and control method of virtual machine system
JPH0517577B2 (en)
WO2021106064A1 (en) Programmable controller
US20120110298A1 (en) Memory access control device and computer
US6182207B1 (en) Microcontroller with register system for the indirect accessing of internal memory via auxiliary register
CA1081855A (en) Initializing means for a bus-oriented data processing system employing firmware-configured modules
KR102581576B1 (en) Vector operand bit size control
JP2019179284A (en) Simulation system and simulation program
US20140215467A1 (en) Method and Virtualization Controller for Managing a Computer Resource With at Least Two Virtual Machines
JP6803957B2 (en) Memory control device and memory control method
JP6948039B2 (en) Computer system
JPH05282160A (en) Real time simulation development mechanism

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2020519811

Country of ref document: JP

Kind code of ref document: A

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

Ref document number: 19953811

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19953811

Country of ref document: EP

Kind code of ref document: A1