WO2022079800A1 - Programmable controller, program execution device, and communication method - Google Patents

Programmable controller, program execution device, and communication method Download PDF

Info

Publication number
WO2022079800A1
WO2022079800A1 PCT/JP2020/038620 JP2020038620W WO2022079800A1 WO 2022079800 A1 WO2022079800 A1 WO 2022079800A1 JP 2020038620 W JP2020038620 W JP 2020038620W WO 2022079800 A1 WO2022079800 A1 WO 2022079800A1
Authority
WO
WIPO (PCT)
Prior art keywords
execution device
reception
processing unit
function
program
Prior art date
Application number
PCT/JP2020/038620
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 PCT/JP2020/038620 priority Critical patent/WO2022079800A1/en
Priority to JP2022556723A priority patent/JP7325658B2/en
Publication of WO2022079800A1 publication Critical patent/WO2022079800A1/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

  • This disclosure relates to a programmable controller, a program execution device, and a communication method.
  • Patent Document 1 a means for executing a controller scan including solving ladder logic and a web server for collecting data related to a control function are provided, and the web server is data from a remote computer. It has a function to answer the request of.
  • the controller has a function of collecting data in the controller, but does not have a function of collecting data from an external web server. Therefore, it was necessary to add a function for communicating with the web server to the controller.
  • the controller executes the ladder program and FB to use the service of the web server, in order to exchange data with the web server asynchronously with the scan cycle, the service is called and the completion notification is given within the processing of the FB. You need to wait and do.
  • the controller uses the service of the web server, there is a problem that the load on the controller becomes large.
  • the present disclosure has been made in view of the above-mentioned problems, and an object thereof is to provide a technique capable of keeping the execution time of a ladder program and a program including FB constant.
  • the programmable controller is a programmable controller capable of communicating with a service execution device that provides a service, and is a scan processing unit that periodically executes a program including a ladder program and a function block, and execution of the scan processing unit.
  • the refresh processing unit that performs data processing for exchanging data with the input / output device based on the execution result of the scan processing unit, and the scan processing unit and the refresh processing unit are asynchronous with the service.
  • asynchronously with the transmission function for transmitting a command to the execution device and the scan processing unit and the refresh processing unit is provided with an asynchronous external communication processing unit having a receiving function stored in a memory area.
  • the transmission function that sends a command to the service execution device asynchronously with the scan process and the refresh process, and the data received from the service execution device as received data asynchronously with the scan process and the refresh process, Moreover, it has a receiving function of storing the received data in a memory area in order to set it in the device. As a result, the execution time of the ladder program and the program including the FB can be kept constant.
  • FIG. It is a block diagram which shows the whole structure of the program execution apparatus which concerns on Embodiment 1.
  • FIG. It is a flowchart which shows the procedure of the offline processing in the program generation apparatus which concerns on Embodiment 1.
  • FIG. It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 1.
  • FIG. It is a flowchart which shows the procedure of the online processing in the programmable controller which concerns on Embodiment 1.
  • FIG. It is a timing chart which shows the online processing in the programmable controller which concerns on Embodiment 1.
  • FIG. It is a flowchart which shows the external communication processing which concerns on Embodiment 1.
  • It is a flowchart which shows the procedure of the online processing in the programmable controller which concerns on Embodiment 2.
  • FIG. It is a figure which shows an example of the user-defined program generated by the program generation apparatus which concerns on Embodiment 3.
  • FIG. It is a flowchart which shows the external communication processing which concerns on Embodiment 3.
  • FIG. It is a figure which shows an example of the user-defined program generated by the program generation apparatus which concerns on Embodiment 4.
  • FIG. It is a figure which shows an example of the asynchronous reception FB which concerns on Embodiment 4.
  • It is a flowchart which shows the external communication processing which concerns on Embodiment 5.
  • FIG. 1 is a block diagram showing an overall configuration of a program execution device according to the first embodiment.
  • the overall configuration of the program execution device according to another embodiment described later is the same as the overall configuration of the program execution device of FIG.
  • the program execution device of FIG. 1 includes a programmable controller 1, a program generation device 51, and a service execution device 61 that provides services, and is communicably connected to the input / output device 41.
  • the programmable controller 1 can communicate with the service execution device 61, and exchanges data with the input / output device 41 while using the service of the service execution device 61.
  • the programmable controller 1 includes a scan processing unit 11, a refresh processing unit 12, an asynchronous external communication processing unit 13, an input / output control unit 14, a memory 15, and a communication function unit 16.
  • the processor 2 executes various programs stored in the memory 15 or the like, the scan processing unit 11, the refresh processing unit 12, and the asynchronous external communication processing unit 13 are realized.
  • the scan processing unit 11 periodically executes a program including a ladder program and an FB (function block).
  • a program including a ladder program and an FB (function block).
  • the process performed by the scan process unit 11 may be referred to as "scan process”.
  • the refresh processing unit 12 alternately performs data processing for exchanging data with the input / output device 41 based on the execution result of the scan processing unit 11.
  • This data processing may include, for example, a process of exchanging data with the memory 15.
  • the process performed by the refresh process unit 12 may be referred to as "refresh process”.
  • the asynchronous external communication processing unit 13 has a transmission function 13a and a reception function 13b.
  • the transmission function 13a is asynchronous with the scan processing unit 11 and the refresh processing unit 12, and transmits a command to the service execution device 61 based on a request to the service execution device 61.
  • the request is obtained from, for example, the refresh processing unit 12.
  • requests and commands are substantially the same and will be described without distinguishing between them.
  • the reception function 13b is asynchronous with the scan processing unit 11 and the refresh processing unit 12, receives data from the service execution device 61 as received data, and is designated in the memory 15 or the like in order to set the received data in the device. Store in the memory area.
  • This device includes, for example, a completion notification device, an input / output device 41, and the like.
  • the processing performed by the asynchronous external communication processing unit 13 may be referred to as "external communication processing".
  • the input / output control unit 14 sets data in the input / output device 41 and exchanges data with the input / output device 41 based on the processing result of the refresh processing unit 12.
  • the memory 15 stores the program and the data acquired from the service execution device 61.
  • the communication function unit 16 communicates with the program generation device 51 and the service execution device 61.
  • the program generation device 51 includes a program generation function unit 52 and a communication function unit 53.
  • the program generation function unit 52 generates a program including a ladder program and FB.
  • the communication function unit 53 transmits the program generated by the program generation function unit 52 to the programmable controller 1.
  • the program generation device 51 configured as described above can communicate with the programmable controller 1 and generates a program including the ladder program and the FB used in the programmable controller 1.
  • the service execution device 61 is, for example, an external server, and includes a communication function unit 62 and a service processing execution unit 63.
  • the communication function unit 62 receives a request (command) from the programmable controller 1 and transmits the data generated by the service processing execution unit 63 to the programmable controller 1.
  • the service processing execution unit 63 generates data according to the command received by the communication function unit 62.
  • the service execution device 61 configured as described above provides a service for transmitting data to the programmable controller 1 in response to a request (command) from the programmable controller 1.
  • the service provided by the service execution device 61 may be referred to as an "external service".
  • the program execution device has two phases, that is, offline processing performed before the execution of the program including the ladder program and the FB, and online processing during the execution of the program.
  • FIG. 2 is a flowchart showing a procedure of offline processing in which the program generation device 51 according to the first embodiment generates a program including a ladder program and an FB.
  • step S1 the program generation function unit 52 describes a program including a ladder program and FB by using an engineering tool.
  • FIG. 3 is a diagram showing an example of a program including the ladder program and the FB according to the first embodiment, and specifically, is a diagram showing an example of a program including the ladder program and the FB and keeping the execution time constant.
  • the program of FIG. 3 has an input contact (X0, X1, X2) that can execute the processing of the subsequent block when the input / output value is true, and a device value (M0, M1, M2,) that holds the execution result of the FB. It is composed of D10), an asynchronous transmission FB (Send FB) related to the transmission function 13a, and an asynchronous reception FB (Recv FB) related to the reception function 13b.
  • Send FB asynchronous transmission FB
  • Recv FB asynchronous reception FB
  • the asynchronous transmission FB of FIG. 3 has four inputs of "enable”, “trigger”, “URL”, and “start flag”, and one output of "enout”.
  • the asynchronous transmission FB is allowed to be in the executable state.
  • the asynchronous transmission FB is executed.
  • the "URL” indicates an access destination (access point) for the programmable controller 1 to access the service execution device 61.
  • the asynchronous reception FB of FIG. 3 has two inputs of "enable” and “completion flag” and three outputs of "enout", "ready", and “data”.
  • "Enout” is true when execution is complete.
  • Ready is true when there is a response from the service execution device 61.
  • the data received from the service execution device 61 is set in "data”.
  • step S2 the program generation function unit 52 converts the program into a machine language for execution by the programmable controller 1.
  • the program generation function unit 52 acquires the "URL" and the "start flag” from the asynchronous transmission FB, saves them as asynchronous transmission FB parameters, and acquires the "completion flag” and "data” from the asynchronous reception FB. And save it as an asynchronous reception FB parameter.
  • FIG. 4 is a diagram showing an example of an asynchronous transmission FB parameter according to the first embodiment.
  • the asynchronous transmission FB parameter is a transmission parameter used in the asynchronous transmission FB and the transmission function 13a.
  • the asynchronous transmission FB parameter of FIG. 4 includes a parameter of “URL” and a parameter (M10) of “start flag”.
  • FIG. 5 is a diagram showing an example of asynchronous reception FB parameters according to the first embodiment.
  • the asynchronous reception FB parameter is a reception parameter used in the asynchronous reception FB and the reception function 13b.
  • the asynchronous reception FB parameter of FIG. 5 includes a parameter (M11) of the “completion flag” and a parameter (D10) of the “data”.
  • step S3 the program generation function unit 52 converts the program converted into the machine language, the asynchronous transmission FB parameter, and the asynchronous reception FB parameter into a programmable controller. Download to send to 1.
  • FIG. 6 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the first embodiment executes a program including a ladder program and an FB.
  • FIG. 7 is a timing chart showing online processing in which the programmable controller 1 according to the first embodiment executes a program including a ladder program and an FB.
  • ⁇ Scan processing and refresh processing> As shown in FIGS. 6 and 7, the programmable controller 1 alternately repeats the scan process and the refresh process.
  • the scan process unit 11 executes a program including the ladder program and the FB as shown in FIG. 3 based on the machine language generated by the program generation device 51.
  • the refresh process unit 12 cooperates with the input / output control unit 14 to output the execution result of the scan processing unit 11 to the input / output device 41, and acquires the value detected by the sensor or the like from the input / output device 41. do.
  • the programmable controller 1 performs external communication processing in parallel with the scan processing and the refresh processing, asynchronously with the scan processing and the refresh processing.
  • the asynchronous external communication processing unit 13 exchanges data with the service execution device 61 using the transmission function 13a and the reception function 13b.
  • the transmission function 13a is asynchronous with the scan processing unit 11
  • the asynchronous transmission FB parameter of FIG. 4 used in the asynchronous transmission FB executed by the scan processing unit 11 is shared with the scan processing unit 11.
  • the reception function 13b is asynchronous with the scan processing unit 11
  • the asynchronous reception FB parameter of FIG. 5 used in the asynchronous reception FB executed by the scan processing unit 11 is shared with the scan processing unit 11.
  • Thread [0] and thread [1] may be executed logically in parallel on the same processor, or may be physically executed in parallel on a multi-core processor.
  • FIG. 8 is a flowchart showing an external communication process performed by the asynchronous external communication processing unit 13 according to the first embodiment.
  • the external communication process of FIG. 8 corresponds to the execution of the external communication process of FIG.
  • step S11 the asynchronous external communication processing unit 13 refers to the asynchronous transmission FB parameter related to the "start flag”, checks the "start flag” of the device, and checks whether the "start flag” is true or not. judge. If it is determined that the "start flag” is true, the process proceeds to step S12, and if it is determined that the "start flag” is false, the process of step S11 is performed again.
  • the transmission function 13a of the asynchronous external communication processing unit 13 refers to the asynchronous transmission FB parameter related to the "URL”, accesses the service execution device 61 based on the parameter, and requests data. Further, the asynchronous external communication processing unit 13 sets the asynchronous transmission FB parameter related to the "start flag" to be false.
  • step S13 the asynchronous external communication processing unit 13 determines whether or not the reception function 13b has received the response from the service execution device 61. If it is determined that the response has been received, the process proceeds to step S14, and if it is determined that the response has not been received, the process of step S13 is performed again. For the response wait, polling may be used, or the thread may be transitioned to the wait state and started by the response from the service execution device 61 as a trigger.
  • step S14 the reception function 13b of the asynchronous external communication processing unit 13 sets true to the asynchronous reception FB parameter related to the "completion flag" of the device of the completion notification. Further, the reception function 13b of the asynchronous external communication processing unit 13 sets the reception data from the service execution device 61 in the asynchronous reception FB parameter related to the device "data" of the completion notification. After that, the process returns to step S11.
  • the transmission function 13a transmits a command to the service execution device 61 asynchronously with the scan processing unit 11 and the refresh processing unit 12. Then, the reception function 13b receives the received data from the service execution device 61 asynchronously with the scan processing unit 11 and the refresh processing unit 12, and stores the received data in the memory area in order to set the received data in the device. According to such a configuration, even if the time from the access to the service execution device 61 to the response is not constant, the execution time of the ladder program and the program including the FB can be kept constant. Therefore, the load on the programmable controller 1 can be reduced.
  • FIG. 9 is a diagram showing an example of a program including a ladder program and FB according to the second embodiment.
  • the program of FIG. 9 includes a plurality of asynchronous transmission FBs (first and second asynchronous transmission FBs) and a plurality of asynchronous reception FBs (first and second asynchronous reception FBs).
  • Each of the first and second asynchronous transmission FBs is substantially the same as the FB in which the input of the "related ID” is added to the asynchronous transmission FB (FIG. 3) according to the first embodiment.
  • each of the first and second asynchronous reception FBs is substantially the same as the FB to which the input of the "related ID” is added to the asynchronous reception FB (FIG. 3) according to the first embodiment.
  • FIG. 10 is a diagram showing an example of an asynchronous transmission FB parameter according to the second embodiment
  • FIG. 11 is a diagram showing an example of an asynchronous reception FB parameter according to the second embodiment.
  • each of the asynchronous transmission FB parameter and the asynchronous reception FB parameter includes an "related ID" that associates the asynchronous transmission FB parameter and the asynchronous reception FB parameter with each other. ..
  • the first asynchronous transmission FB parameter on the upper side of FIG. 10 used in the first asynchronous transmission FB and the first asynchronous reception FB parameter on the upper side in FIG. 11 used in the first asynchronous reception FB are "related IDs". They are associated with each other by the parameter "123".
  • the lower second asynchronous transmission FB parameter of FIG. 10 used in the second asynchronous transmission FB and the lower second asynchronous reception FB parameter of FIG. 11 used in the second asynchronous reception FB are They are associated with each other by the parameter "121" of the "association ID".
  • the reception function 13b is associated with the one asynchronous transmission FB by "related ID". It is possible to receive a response for the received FB.
  • FIG. 12 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the second embodiment executes a program including a ladder program and an FB.
  • the external communication process in which the asynchronous external communication processing unit 13 uses the first asynchronous transmission FB parameter and the first asynchronous reception FB parameter is described as the first external communication process.
  • the external communication processing in which the asynchronous external communication processing unit 13 uses the second asynchronous transmission FB parameter and the second asynchronous reception FB parameter is described as the second external communication processing.
  • FIG. 13 is a timing chart showing an online process in which the programmable controller 1 according to the second embodiment executes a program including a ladder program and an FB.
  • the timing at which the transmission function 13a transmits using the first asynchronous transmission FB parameter is described as the first transmission function
  • the timing at which the reception function 13b performs reception using the first asynchronous reception FB parameter is described as the first reception function.
  • the timing at which the transmission function 13a transmits using the second asynchronous transmission FB parameter is described as the second transmission function
  • the timing at which the reception function 13b receives using the second asynchronous reception FB parameter is the second. 2 It is described as a reception function.
  • threads that perform external communication processing are used as many as the number of sets of asynchronous transmission FB parameters.
  • one external communication process using one set of asynchronous transmission FB parameters is assigned to thread [1]
  • another set of asynchronous transmission FB parameters is assigned.
  • Another external communication process to be used is assigned to thread [2].
  • Threads [0] to [2] may be executed logically in parallel on the same processor, or may be physically executed in parallel on a multi-core processor.
  • the same processing as the first asynchronous transmission FB parameter and the first asynchronous reception FB parameter is performed for the second asynchronous transmission FB parameter and the second asynchronous reception FB parameter.
  • the program execution device even when one program includes a plurality of asynchronous transmission FBs and a plurality of asynchronous reception FBs, the asynchronous transmission FB and the asynchronous reception FB Processing can be performed for each group. Therefore, it is possible to acquire a plurality of types of data from one service execution device 61, or to acquire data from a plurality of service execution devices 61.
  • FIG. 14 is a diagram showing an example of a user-defined program generated by the program generation device 51 according to the third embodiment.
  • the user-defined program defines the processing of the asynchronous external communication processing unit 13, that is, the external communication processing.
  • the user-defined program of FIG. 14 stipulates that the asynchronous external communication processing unit 13 executes external communication processing as follows when the "start flag" is true.
  • the transmission function 13a transmits the data in the subuf to the service execution device 61 in 1024 bytes.
  • the reception function 13b waits for a response from the service execution device 61, sets 1024 bytes of data in rbuf if there is a response, and sets true in the "completion flag".
  • the user-defined program is transmitted to the programmable controller 1 by downloading in step S3 of FIG. 2, and the programmable controller 1 loads the user-defined program into the memory 15.
  • FIG. 15 is a flowchart showing an external communication process performed by the asynchronous external communication processing unit 13 according to the third embodiment.
  • user-defined program execution is added before the external communication processing execution of FIG. This user-defined program execution is executed at system startup.
  • the user-defined program is executed and a thread for external communication processing is created.
  • the external communication process of FIG. 8 is performed in the execution of the external communication process.
  • the external communication process can be changed by changing the user-defined program.
  • FIG. 16 is a diagram showing an example of a user-defined program generated by the program generation device 51 according to the fourth embodiment.
  • the user-defined program of FIG. 16 is substantially the same as the user-defined program of FIG. 14, but the asynchronous external communication processing unit 13 may divide the received data according to a plurality of devices and set a plurality of received data. It is stipulated.
  • the received data of 32 bytes from the beginning of the receive buffer is set in the parameter (D10)
  • the received data of the 33rd byte to the 32 bytes of the receive buffer is set as a parameter. It is stipulated that the data should be set to (D100), and that the reception data of 128 bytes from the 65th byte of the reception buffer should be set to the parameter (D200) in the 8th line. That is, in FIG. 16, the parameters (D10, D100, D200) of the three received data divided corresponding to the three devices are defined.
  • FIG. 17 is a diagram showing an example of an asynchronous reception FB according to the fourth embodiment.
  • the asynchronous reception FB of FIG. 17 has outputs of “data1”, “data2”, and “data3” in which three divided reception data are set, respectively, instead of the “data” of the asynchronous reception FB of FIG.
  • FIG. 18 is a diagram showing an example of asynchronous reception FB parameters according to the fourth embodiment.
  • the asynchronous reception FB parameter of FIG. 18 includes the parameters (D10, D100, D200) of “data1”, “data2”, and “data3” instead of the “data” of the asynchronous reception FB parameter of FIG.
  • the received data from the service execution device 61 can be divided and set corresponding to a plurality of devices. As a result, it can be expected that the data size will be reduced, the data from the ladder program will be reduced, and the data access time will be shortened accordingly.
  • FIG. 19 is a diagram showing an example of an asynchronous reception FB parameter according to the fifth embodiment.
  • an "error flag" indicating the presence or absence of a communication error of the received data by the reception function 13b is added to the asynchronous reception FB parameter of FIG. 5 described in the first embodiment, and communication is performed. The presence or absence of an error is set on the device.
  • FIG. 20 is a flowchart of the external communication process according to the fifth embodiment.
  • the flowchart of FIG. 20 is the same as the flowchart in which steps S21 and S22 are added to the flowchart of FIG. 8 described in the first embodiment. Therefore, in the following, steps S21 and S22 will be mainly described.
  • step S13 if it is determined that the response has been received, the process proceeds to step S21, and if it is determined that the response has not been received, the process of step S13 is performed again.
  • step S21 in the function of waiting for the received data to be received together with the response from the service execution device 61, the asynchronous external communication processing unit 13 has an error in the return value or the reception status, that is, whether there is a communication error. Judge whether or not. If it is determined that there is a communication error, the process proceeds to step S22, and if it is determined that there is no received communication error, the process proceeds to step S14.
  • step S22 the asynchronous reception FB parameter related to the "error flag" is truly set. After that, the process returns to step S11.
  • the scan processing unit 11 that executes the program including the ladder program and the FB can detect the communication error of the received data in the next scan process. .. Therefore, it is possible to handle the error.
  • FIG. 21 is a diagram showing an example of asynchronous reception FB parameters according to the sixth embodiment.
  • the asynchronous reception FB parameter of FIG. 21 indicates the threshold time of the time from the start of transmission of the command by the transmission function 13a to the reception of the reception data by the reception function 13b in the asynchronous reception FB parameter of FIG. 19 described in the fifth embodiment.
  • “Timeout time” has been added. The timeout time is set numerically.
  • FIG. 22 is a flowchart of the external communication process according to the sixth embodiment.
  • the flowchart of FIG. 22 is the same as the flowchart in which steps S26, S27, and S28 are added to the flowchart of FIG. 20 described in the fifth embodiment. Therefore, in the following, steps S26 to S28 will be mainly described.
  • step S11 If it is determined in step S11 that the "start flag” is true, the process proceeds to step S26, and if it is determined that the "start flag” is false, the process of step S11 is performed again. ..
  • step S26 the asynchronous external communication processing unit 13 acquires the time at that time as the start time. After that, the process proceeds to step S12.
  • step S28 the asynchronous external communication processing unit 13 determines whether or not the difference between the start time and the current time is equal to or less than the timeout time. If it is determined that the difference is less than or equal to the time-out time, the process proceeds to step S13, and if it is determined that the difference is larger than the time-out time, the process proceeds to step S22.
  • step S13 if it is determined that the response has been received, the process proceeds to step S21, and if it is determined that the response has not been received, the process returns to step S27.
  • the scan processing unit 11 that executes the program including the ladder program and the FB may detect a timeout in receiving the received data in the next scan process. can. Therefore, it is possible to handle the error.
  • FIG. 23 is a flowchart of the external communication process according to the seventh embodiment.
  • step S14 of the external communication processing (FIG. 8) of the first embodiment, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the “completion flag” and the “data” for the device of the completion notification of the asynchronous reception FB parameters. bottom. That is, in step S14, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the "completion flag” and "data” for the area read / written in the scan process. On the other hand, in step S14 of FIG. 23, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the “completion flag” and “data” to the temporary device that is not read / written in the scan process.
  • FIG. 24 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the seventh embodiment executes a program including a ladder program and an FB.
  • the scan process was performed using the "completion flag" and the "data" set in the device by the external communication process.
  • the "completion flag" and "data" which are temporary device values set in the primary device by the external communication processing unit, are scanned before the fresh processing is executed.
  • the programmable controller 1 may learn the "URL" which is the access destination in the background based on the reception history of the received data from the service execution device 61. For example, the programmable controller 1 may learn the "URL" based on the reception history such as the reception time and reception frequency of the reception data from the service execution device 61. Further, for example, AI (artificial intelligence) learning may be used for learning.
  • AI artificial intelligence
  • the scan processing unit 11, the refresh processing unit 12, and the asynchronous external communication processing unit 13 of FIG. 1 described above are hereinafter referred to as “scan processing unit 11 and the like”.
  • the scan processing unit 11 and the like are realized by the processing circuit 81 shown in FIG. That is, the processing circuit 81 is a scan processing unit 11 that periodically executes a program including a ladder program and a function block, and an input / output device based on the execution result of the scan processing unit, alternating with the execution of the scan processing unit.
  • the refresh processing unit 12 that performs data processing for exchanging data, the transmission function 13a that sends commands to the service execution device asynchronously with the scan processing unit and the refresh processing unit, and the scan processing unit and the refresh processing unit
  • Asynchronous external communication processing unit 13 having a receiving function 13b that receives data as received data from a service execution device and stores the received data in a memory area in order to set the received data in the device.
  • Dedicated hardware may be applied to the processing circuit 81, or a processor that executes a program stored in the memory may be applied to the processing circuit 81.
  • the processor corresponds to, for example, a central processing unit, a processing unit, an arithmetic unit, a microprocessor, a microcomputer, a DSP (Digital Signal Processor), and the like.
  • the processing circuit 81 may be, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC (Application Specific Integrated Circuit), or an FPGA (Field Programmable Gate). Array), or a combination of these.
  • Each of the functions of each part such as the scan processing unit 11 may be realized by a circuit in which the processing circuits are dispersed, or the functions of each part may be collectively realized by one processing circuit.
  • the processing circuit 81 When the processing circuit 81 is a processor, the functions of the scan processing unit 11 and the like are realized by combining with software and the like.
  • the software or the like corresponds to, for example, software, firmware, or software and firmware.
  • Software and the like are described as programs and stored in memory.
  • the processor 82 applied to the processing circuit 81 realizes the functions of each part by reading and executing the program stored in the memory 83. That is, the programmable controller 1 has a scan process for periodically executing a program including a ladder program and a function block when executed by the processing circuit 81, and a refresh process for performing data processing based on the execution result of the scan process.
  • the step of alternately performing the scan process and the refresh process are asynchronous, and the transmission function that sends a command to the service execution device is asynchronous, and the scan process and the refresh process are asynchronous, and data is received from the service execution device as received data.
  • a step of performing an external communication process having a receiving function of storing the received data in a memory area for setting the received data in the device, and a memory 83 for storing a program to be executed as a result are provided. Be prepared. In other words, it can be said that this program causes the computer to execute the procedure or method of the scan processing unit 11 or the like.
  • the memory 83 is a non-volatile or non-volatile memory such as a RAM (RandomAccessMemory), a ROM (ReadOnlyMemory), a flash memory, an EPROM (ErasableProgrammableReadOnlyMemory), and an EPROM (ElectricallyErasableProgrammableReadOnlyMemory).
  • Volatile semiconductor memory HDD (Hard Disk Drive), magnetic disk, flexible disk, optical disk, compact disk, mini disk, DVD (DigitalVersatileDisc), its drive device, etc., or any storage medium that will be used in the future. You may.
  • each function of the scan processing unit 11 and the like is realized by either hardware or software has been described above.
  • the present invention is not limited to this, and a configuration may be configured in which a part of the scan processing unit 11 or the like is realized by dedicated hardware and another part is realized by software or the like.
  • the scan processing unit 11 realizes its function by a processing circuit 81 as dedicated hardware and an interface, and other than that, the processing circuit 81 as a processor 82 reads a program stored in the memory 83. It is possible to realize the function by executing it.
  • the processing circuit 81 can realize each of the above-mentioned functions by hardware, software, or a combination thereof. Further, each function or each component of the programmable controller 1 described above may be distributed to each device or may be centrally arranged to any device.
  • 1 programmable controller 11 scan processing unit, 12 refresh processing unit, 13 asynchronous external communication processing unit, 13a transmission function, 13b reception function, 41 input / output device, 51 program generation device, 61 service execution device.

Landscapes

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

Abstract

The purpose of the present invention is to provide a technique which makes it possible to keep constant the execution time of a program which includes a ladder program and a FB. The programmable controller is provided with an asynchronous external communication processing unit which has: a transmission function for transmitting commands to a service execution device asynchronously with a scan processing unit and a refresh processing unit; and a receiving function for receiving, as receiving data, data from the service execution device asynchronously with the scan processing unit and the refresh processing unit, and for storing said received data in a memory region in order to set the same in a device.

Description

プログラマブルコントローラ、プログラム実行装置、及び、通信方法Programmable controller, program execution device, and communication method
 本開示は、プログラマブルコントローラ、プログラム実行装置、及び、通信方法に関する。 This disclosure relates to a programmable controller, a program execution device, and a communication method.
 事前に序列付けられた手順を機械に実行させるPLC(Programmable Logic Controller)を制御するプログラムには、IEC61131-3で定義されたLD、FBD、ST、IL、SFCを含む5言語が存在している。その中でもFBDでは、入力パラメータと、出力パラメータと、入力パラメータに基づく演算結果を出力パラメータに出力するファンクションとを有するブロックが、FB(ファンクションブロック)としてグラフィカルに定義される。任意の機能を組み合わせて複数の処理が部品化されたファンクションブロックは、1コマンドのように表示される。 There are five languages including LD, FBD, ST, IL, and SFC defined in IEC61131-3 in the program that controls the PLC (Programmable Logic Controller) that causes the machine to execute the procedure ordered in advance. .. Among them, in the FBD, a block having an input parameter, an output parameter, and a function for outputting a calculation result based on the input parameter to the output parameter is graphically defined as an FB (function block). A function block in which a plurality of processes are made into parts by combining arbitrary functions is displayed as one command.
 このようなプログラムに対して様々な技術が提案されている。例えば、特許文献1の技術では、ラダーロジックを解くことを含むコントローラ走査を実行する手段と、制御機能に関係するデータを収集するウェブサーバとが備えられ、ウェブサーバは、遠隔地のコンピュータからデータのリクエストに回答する機能を有する。 Various techniques have been proposed for such programs. For example, in the technique of Patent Document 1, a means for executing a controller scan including solving ladder logic and a web server for collecting data related to a control function are provided, and the web server is data from a remote computer. It has a function to answer the request of.
特表2004-511845号公報Japanese Patent Publication No. 2004-511845
 特許文献1の技術では、コントローラが、コントローラ内のデータを収集する機能を有するが、外部のウェブサーバからデータを収集する機能を有していない。このため、ウェブサーバと通信するための機能を、コントローラに追加する必要があった。また、コントローラが、ラダープログラム及びFBを実行してウェブサーバのサービスを利用する場合、スキャン周期と非同期で、ウェブサーバとデータをやり取りするためには、FBの処理内でサービスの呼び出しと完了通知の待機とを行う必要がある。この結果、コントローラがウェブサーバのサービスを利用する場合には、コントローラの負荷が大きくなってしまうという問題があった。 In the technique of Patent Document 1, the controller has a function of collecting data in the controller, but does not have a function of collecting data from an external web server. Therefore, it was necessary to add a function for communicating with the web server to the controller. In addition, when the controller executes the ladder program and FB to use the service of the web server, in order to exchange data with the web server asynchronously with the scan cycle, the service is called and the completion notification is given within the processing of the FB. You need to wait and do. As a result, when the controller uses the service of the web server, there is a problem that the load on the controller becomes large.
 そこで、本開示は、上記のような問題点を鑑みてなされたものであり、ラダープログラム及びFBを含むプログラムの実行時間を一定に保つことが可能な技術を提供することを目的とする。 Therefore, the present disclosure has been made in view of the above-mentioned problems, and an object thereof is to provide a technique capable of keeping the execution time of a ladder program and a program including FB constant.
 本開示に係るプログラマブルコントローラは、サービスを提供するサービス実行装置と通信可能なプログラマブルコントローラであって、ラダープログラム及びファンクションブロックを含むプログラムを定期的に実行するスキャン処理部と、前記スキャン処理部の実行と交互に、前記スキャン処理部の実行結果に基づいて、入出力機器とデータをやり取りするためのデータ処理を行うリフレッシュ処理部と、前記スキャン処理部及び前記リフレッシュ処理部とは非同期で、前記サービス実行装置へコマンドを送信する送信機能と、前記スキャン処理部及び前記リフレッシュ処理部とは非同期で、前記サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能とを有する非同期外部通信処理部とを備える。 The programmable controller according to the present disclosure is a programmable controller capable of communicating with a service execution device that provides a service, and is a scan processing unit that periodically executes a program including a ladder program and a function block, and execution of the scan processing unit. Alternately, the refresh processing unit that performs data processing for exchanging data with the input / output device based on the execution result of the scan processing unit, and the scan processing unit and the refresh processing unit are asynchronous with the service. In order to receive data from the service execution device as received data and set the received data in the device, asynchronously with the transmission function for transmitting a command to the execution device and the scan processing unit and the refresh processing unit. It is provided with an asynchronous external communication processing unit having a receiving function stored in a memory area.
 本開示によれば、スキャン処理及びリフレッシュ処理とは非同期で、サービス実行装置へコマンドを送信する送信機能と、スキャン処理及びリフレッシュ処理とは非同期で、サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能とを有する。これにより、ラダープログラム及びFBを含むプログラムの実行時間を一定に保つことができる。 According to the present disclosure, the transmission function that sends a command to the service execution device asynchronously with the scan process and the refresh process, and the data received from the service execution device as received data asynchronously with the scan process and the refresh process, Moreover, it has a receiving function of storing the received data in a memory area in order to set it in the device. As a result, the execution time of the ladder program and the program including the FB can be kept constant.
 本開示の目的、特徴、局面及び利点は、以下の詳細な説明と添付図面とによって、より明白となる。 The purposes, features, aspects and advantages of this disclosure will be made clearer by the following detailed description and accompanying drawings.
実施の形態1に係るプログラム実行装置の全体構成を示すブロック図である。It is a block diagram which shows the whole structure of the program execution apparatus which concerns on Embodiment 1. FIG. 実施の形態1に係るプログラム生成装置でのオフライン処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the offline processing in the program generation apparatus which concerns on Embodiment 1. 実施の形態1に係るラダープログラム及びFBを含むプログラムの一例を示す図である。It is a figure which shows an example of the ladder program which concerns on Embodiment 1 and the program which includes FB. 実施の形態1に係る非同期送信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous transmission FB parameter which concerns on Embodiment 1. FIG. 実施の形態1に係る非同期受信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 1. FIG. 実施の形態1に係るプログラマブルコントローラでのオンライン処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the online processing in the programmable controller which concerns on Embodiment 1. 実施の形態1に係るプログラマブルコントローラでのオンライン処理を示すタイミングチャートである。It is a timing chart which shows the online processing in the programmable controller which concerns on Embodiment 1. FIG. 実施の形態1に係る外部通信処理を示すフローチャートである。It is a flowchart which shows the external communication processing which concerns on Embodiment 1. 実施の形態2に係るラダープログラム及びFBを含むプログラムの一例を示す図である。It is a figure which shows an example of the ladder program which concerns on Embodiment 2, and the program which includes FB. 実施の形態2に係る非同期送信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous transmission FB parameter which concerns on Embodiment 2. 実施の形態2に係る非同期受信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 2. 実施の形態2に係るプログラマブルコントローラでのオンライン処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the online processing in the programmable controller which concerns on Embodiment 2. 実施の形態2に係るプログラマブルコントローラでのオンライン処理を示すタイミングチャートである。It is a timing chart which shows the online processing in the programmable controller which concerns on Embodiment 2. 実施の形態3に係るプログラム生成装置で生成されるユーザ定義プログラムの一例を示す図である。It is a figure which shows an example of the user-defined program generated by the program generation apparatus which concerns on Embodiment 3. FIG. 実施の形態3に係る外部通信処理を示すフローチャートである。It is a flowchart which shows the external communication processing which concerns on Embodiment 3. 実施の形態4に係るプログラム生成装置で生成されるユーザ定義プログラムの一例を示す図である。It is a figure which shows an example of the user-defined program generated by the program generation apparatus which concerns on Embodiment 4. FIG. 実施の形態4に係る非同期受信FBの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB which concerns on Embodiment 4. 実施の形態4に係る非同期受信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 4. 実施の形態5に係る非同期受信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 5. 実施の形態5に係る外部通信処理を示すフローチャートである。It is a flowchart which shows the external communication processing which concerns on Embodiment 5. 実施の形態6に係る非同期受信FBパラメータの一例を示す図である。It is a figure which shows an example of the asynchronous reception FB parameter which concerns on Embodiment 6. 実施の形態6に係る外部通信処理を示すフローチャートである。It is a flowchart which shows the external communication processing which concerns on Embodiment 6. 実施の形態7に係る外部通信処理を示すフローチャートである。It is a flowchart which shows the external communication processing which concerns on Embodiment 7. 実施の形態7に係るプログラマブルコントローラでのオンライン処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the online processing in the programmable controller which concerns on Embodiment 7. その他の変形例に係るプログラマブルコントローラのハードウェア構成を示すブロック図である。It is a block diagram which shows the hardware composition of the programmable controller which concerns on other modification. その他の変形例に係るプログラマブルコントローラのハードウェア構成を示すブロック図である。It is a block diagram which shows the hardware composition of the programmable controller which concerns on other modification.
 <実施の形態1>
 図1は、本実施の形態1に係るプログラム実行装置の全体構成を示すブロック図である。なお、後述される他の実施の形態に係るプログラム実行装置の全体構成も図1のプログラム実行装置の全体構成と同様である。
<Embodiment 1>
FIG. 1 is a block diagram showing an overall configuration of a program execution device according to the first embodiment. The overall configuration of the program execution device according to another embodiment described later is the same as the overall configuration of the program execution device of FIG.
 図1のプログラム実行装置は、プログラマブルコントローラ1と、プログラム生成装置51と、サービスを提供するサービス実行装置61とを備えており、入出力機器41と通信可能に接続されている。 The program execution device of FIG. 1 includes a programmable controller 1, a program generation device 51, and a service execution device 61 that provides services, and is communicably connected to the input / output device 41.
 プログラマブルコントローラ1は、サービス実行装置61と通信可能であり、サービス実行装置61のサービスを利用しながら、入出力機器41とデータをやり取りする。プログラマブルコントローラ1は、スキャン処理部11と、リフレッシュ処理部12と、非同期外部通信処理部13と、入出力制御部14、メモリ15と、通信機能部16とを備える。プロセッサ2がメモリ15などに格納された各種プログラムを実行することにより、スキャン処理部11、リフレッシュ処理部12、及び、非同期外部通信処理部13が実現される。 The programmable controller 1 can communicate with the service execution device 61, and exchanges data with the input / output device 41 while using the service of the service execution device 61. The programmable controller 1 includes a scan processing unit 11, a refresh processing unit 12, an asynchronous external communication processing unit 13, an input / output control unit 14, a memory 15, and a communication function unit 16. When the processor 2 executes various programs stored in the memory 15 or the like, the scan processing unit 11, the refresh processing unit 12, and the asynchronous external communication processing unit 13 are realized.
 スキャン処理部11は、ラダープログラム及びFB(ファンクションブロック)を含むプログラムを定期的に実行する。以下の説明では、スキャン処理部11によって行われる処理を「スキャン処理」と記すこともある。 The scan processing unit 11 periodically executes a program including a ladder program and an FB (function block). In the following description, the process performed by the scan process unit 11 may be referred to as "scan process".
 リフレッシュ処理部12は、スキャン処理部11の実行と交互に、スキャン処理部11の実行結果に基づいて、入出力機器41とデータをやり取りするためのデータ処理を行う。このデータ処理は、例えば、メモリ15とデータをやり取りする処理を含んでもよい。以下の説明では、リフレッシュ処理部12によって行われる処理を「リフレッシュ処理」と記すこともある。 The refresh processing unit 12 alternately performs data processing for exchanging data with the input / output device 41 based on the execution result of the scan processing unit 11. This data processing may include, for example, a process of exchanging data with the memory 15. In the following description, the process performed by the refresh process unit 12 may be referred to as "refresh process".
 非同期外部通信処理部13は、送信機能13aと受信機能13bとを有する。 The asynchronous external communication processing unit 13 has a transmission function 13a and a reception function 13b.
 送信機能13aは、スキャン処理部11及びリフレッシュ処理部12とは非同期で、サービス実行装置61へのリクエストに基づいてサービス実行装置61へコマンドを送信する。リクエストは、例えばリフレッシュ処理部12から取得される。以下では、リクエストとコマンドとは実質的に同じであり、両者を区別せずに説明する。 The transmission function 13a is asynchronous with the scan processing unit 11 and the refresh processing unit 12, and transmits a command to the service execution device 61 based on a request to the service execution device 61. The request is obtained from, for example, the refresh processing unit 12. In the following, requests and commands are substantially the same and will be described without distinguishing between them.
 受信機能13bは、スキャン処理部11及びリフレッシュ処理部12とは非同期で、サービス実行装置61からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ15などに指定されたメモリ領域に格納する。このデバイスには、例えば完了通知のデバイス、入出力機器41などが含まれる。 The reception function 13b is asynchronous with the scan processing unit 11 and the refresh processing unit 12, receives data from the service execution device 61 as received data, and is designated in the memory 15 or the like in order to set the received data in the device. Store in the memory area. This device includes, for example, a completion notification device, an input / output device 41, and the like.
 以下の説明では、非同期外部通信処理部13によって行われる処理を「外部通信処理」と記すこともある。 In the following description, the processing performed by the asynchronous external communication processing unit 13 may be referred to as "external communication processing".
 入出力制御部14は、リフレッシュ処理部12の処理結果に基づいて入出力機器41へデータをセットしたり、入出力機器41とデータをやり取りしたりする。メモリ15には、プログラムと、サービス実行装置61から取得したデータとが格納される。通信機能部16は、プログラム生成装置51と、サービス実行装置61と通信する。 The input / output control unit 14 sets data in the input / output device 41 and exchanges data with the input / output device 41 based on the processing result of the refresh processing unit 12. The memory 15 stores the program and the data acquired from the service execution device 61. The communication function unit 16 communicates with the program generation device 51 and the service execution device 61.
 プログラム生成装置51は、プログラム生成機能部52と通信機能部53とを備える。プログラム生成機能部52は、ラダープログラム及びFBを含むプログラムを生成する。通信機能部53は、プログラム生成機能部52で生成されたプログラムをプログラマブルコントローラ1へ送信する。以上のように構成されたプログラム生成装置51は、プログラマブルコントローラ1と通信可能であり、プログラマブルコントローラ1で用いられるラダープログラム及びFBを含むプログラムを生成する。 The program generation device 51 includes a program generation function unit 52 and a communication function unit 53. The program generation function unit 52 generates a program including a ladder program and FB. The communication function unit 53 transmits the program generated by the program generation function unit 52 to the programmable controller 1. The program generation device 51 configured as described above can communicate with the programmable controller 1 and generates a program including the ladder program and the FB used in the programmable controller 1.
 サービス実行装置61は、例えば外部のサーバであり、通信機能部62とサービス処理実行部63とを備える。通信機能部62は、プログラマブルコントローラ1からのリクエスト(コマンド)を受信し、サービス処理実行部63で生成されたデータをプログラマブルコントローラ1に送信する。サービス処理実行部63は、通信機能部62で受信されたコマンドに応じてデータを生成する。以上のように構成されたサービス実行装置61は、プログラマブルコントローラ1からのリクエスト(コマンド)に応じてプログラマブルコントローラ1にデータを送信するサービスを提供する。以下の説明では、サービス実行装置61が提供するサービスを「外部サービス」と記すこともある。 The service execution device 61 is, for example, an external server, and includes a communication function unit 62 and a service processing execution unit 63. The communication function unit 62 receives a request (command) from the programmable controller 1 and transmits the data generated by the service processing execution unit 63 to the programmable controller 1. The service processing execution unit 63 generates data according to the command received by the communication function unit 62. The service execution device 61 configured as described above provides a service for transmitting data to the programmable controller 1 in response to a request (command) from the programmable controller 1. In the following description, the service provided by the service execution device 61 may be referred to as an "external service".
 本実施の形態1に係るプログラム実行装置は、ラダープログラム及びFBを含むプログラムの実行前に行うオフライン処理と、当該プログラムの実行中のオンライン処理とからなる2つのフェーズを有する。 The program execution device according to the first embodiment has two phases, that is, offline processing performed before the execution of the program including the ladder program and the FB, and online processing during the execution of the program.
 図2は、本実施の形態1に係るプログラム生成装置51がラダープログラム及びFBを含むプログラムを生成するオフライン処理の手順を示すフローチャートである。 FIG. 2 is a flowchart showing a procedure of offline processing in which the program generation device 51 according to the first embodiment generates a program including a ladder program and an FB.
 ステップS1にて、プログラム生成機能部52は、エンジニアリングツールを用いて、ラダープログラム及びFBを含むプログラムを記述する。 In step S1, the program generation function unit 52 describes a program including a ladder program and FB by using an engineering tool.
 図3は、本実施の形態1に係るラダープログラム及びFBを含むプログラムの一例を示す図であり、具体的には、ラダープログラム及びFBを含み、実行時間を一定に保つプログラムの一例を示す図である。図3のプログラムは、入出力の値が真のときに後段のブロックの処理を実行できる入力接点(X0、X1、X2)と、FBの実行結果を保持するデバイス値(M0、M1、M2、D10)と、送信機能13aに関連する非同期送信FB(Send FB)と、受信機能13bに関連する非同期受信FB(Recv FB)とから構成される。 FIG. 3 is a diagram showing an example of a program including the ladder program and the FB according to the first embodiment, and specifically, is a diagram showing an example of a program including the ladder program and the FB and keeping the execution time constant. Is. The program of FIG. 3 has an input contact (X0, X1, X2) that can execute the processing of the subsequent block when the input / output value is true, and a device value (M0, M1, M2,) that holds the execution result of the FB. It is composed of D10), an asynchronous transmission FB (Send FB) related to the transmission function 13a, and an asynchronous reception FB (Recv FB) related to the reception function 13b.
 図3の非同期送信FBは、「enable」、「trigger」、「URL」、及び、「開始フラグ」の4つの入力と、「enout」の1つの出力とを有する。「enable」の値が真のときに、非同期送信FBが実行可能状態に許可される。「trigger」の値が真のときに、非同期送信FBが実行される。「URL」は、プログラマブルコントローラ1がサービス実行装置61にアクセスするためのアクセス先(アクセスポイント)を示す。「開始フラグ」は、非同期外部通信処理部13の送信機能13aの起動の有無を示すフラグであり、このフラグには、送信機能13aの起動を示す真(=1)及び停止を示す偽(=0)が選択的にセットされる。「開始フラグ」には任意のデバイスが割り当てられる。「enout」は実行完了時に真となる。 The asynchronous transmission FB of FIG. 3 has four inputs of "enable", "trigger", "URL", and "start flag", and one output of "enout". When the value of "enable" is true, the asynchronous transmission FB is allowed to be in the executable state. When the value of "trigger" is true, the asynchronous transmission FB is executed. The "URL" indicates an access destination (access point) for the programmable controller 1 to access the service execution device 61. The "start flag" is a flag indicating whether or not the transmission function 13a of the asynchronous external communication processing unit 13 is activated, and this flag includes true (= 1) indicating activation of the transmission function 13a and false (=) indicating stop. 0) is selectively set. Any device is assigned to the "start flag". "Enout" is true when execution is complete.
 図3の非同期受信FBは、「enable」、及び、「完了フラグ」の2つの入力と、「enout」、「ready」、及び、「data」の3つの出力とを有する。「enable」の値が真のときに、非同期受信FBが実行可能状態に許可される。「完了フラグ」は、サービス実行装置61からのレスポンス(回答)の有無を示すフラグであり、このフラグには、レスポンスありを示す真(=1)及びレスポンスなしを示す偽(=0)が選択的にセットされる。「完了フラグ」には、任意のデバイスが割り当てられる。「enout」は実行完了時に真となる。「ready」は、サービス実行装置61からのレスポンスがあった場合に真となる。「data」には、サービス実行装置61からの受信データがセットされる。 The asynchronous reception FB of FIG. 3 has two inputs of "enable" and "completion flag" and three outputs of "enout", "ready", and "data". When the value of "enable" is true, the asynchronous receive FB is allowed to be in the executable state. The "completion flag" is a flag indicating whether or not there is a response (answer) from the service execution device 61, and true (= 1) indicating that there is a response and false (= 0) indicating that there is no response are selected for this flag. Is set. Any device is assigned to the "completion flag". "Enout" is true when execution is complete. "Ready" is true when there is a response from the service execution device 61. The data received from the service execution device 61 is set in "data".
 図2のステップS1のプログラムの記述が完了すると、ステップS2にて、プログラム生成機能部52は、当該プログラムをプログラマブルコントローラ1が実行するための機械語に変換する。このとき、プログラム生成機能部52は、非同期送信FBから「URL」と「開始フラグ」とを取得して非同期送信FBパラメータとして保存し、非同期受信FBから「完了フラグ」と「data」とを取得して非同期受信FBパラメータとして保存する。 When the description of the program in step S1 of FIG. 2 is completed, in step S2, the program generation function unit 52 converts the program into a machine language for execution by the programmable controller 1. At this time, the program generation function unit 52 acquires the "URL" and the "start flag" from the asynchronous transmission FB, saves them as asynchronous transmission FB parameters, and acquires the "completion flag" and "data" from the asynchronous reception FB. And save it as an asynchronous reception FB parameter.
 図4は、本実施の形態1に係る非同期送信FBパラメータの一例を示す図である。非同期送信FBパラメータは、非同期送信FB及び送信機能13aで用いられる送信パラメータである。図4の非同期送信FBパラメータは、「URL」のパラメータと、「開始フラグ」のパラメータ(M10)とを含む。 FIG. 4 is a diagram showing an example of an asynchronous transmission FB parameter according to the first embodiment. The asynchronous transmission FB parameter is a transmission parameter used in the asynchronous transmission FB and the transmission function 13a. The asynchronous transmission FB parameter of FIG. 4 includes a parameter of “URL” and a parameter (M10) of “start flag”.
 図5は、本実施の形態1に係る非同期受信FBパラメータの一例を示す図である。非同期受信FBパラメータは、非同期受信FB及び受信機能13bで用いられる受信パラメータである。図5の非同期受信FBパラメータは、「完了フラグ」のパラメータ(M11)と、「data」のパラメータ(D10)とを含む。 FIG. 5 is a diagram showing an example of asynchronous reception FB parameters according to the first embodiment. The asynchronous reception FB parameter is a reception parameter used in the asynchronous reception FB and the reception function 13b. The asynchronous reception FB parameter of FIG. 5 includes a parameter (M11) of the “completion flag” and a parameter (D10) of the “data”.
 図2のステップS2の機械語への変換が完了すると、ステップS3にて、プログラム生成機能部52は、機械語に変換したプログラムと、非同期送信FBパラメータと、非同期受信FBパラメータとを、プログラマブルコントローラ1へ送信するダウンロードを行う。 When the conversion of step S2 in FIG. 2 to the machine language is completed, in step S3, the program generation function unit 52 converts the program converted into the machine language, the asynchronous transmission FB parameter, and the asynchronous reception FB parameter into a programmable controller. Download to send to 1.
 図6は、本実施の形態1に係るプログラマブルコントローラ1がラダープログラム及びFBを含むプログラムを実行するオンライン処理の手順を示すフローチャートである。図7は、本実施の形態1に係るプログラマブルコントローラ1がラダープログラム及びFBを含むプログラムを実行するオンライン処理を示すタイミングチャートである。 FIG. 6 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the first embodiment executes a program including a ladder program and an FB. FIG. 7 is a timing chart showing online processing in which the programmable controller 1 according to the first embodiment executes a program including a ladder program and an FB.
 <スキャン処理及びリフレッシュ処理>
 図6及び図7に示すように、プログラマブルコントローラ1は、スキャン処理とリフレッシュ処理とを交互に繰り返して行う。
<Scan processing and refresh processing>
As shown in FIGS. 6 and 7, the programmable controller 1 alternately repeats the scan process and the refresh process.
 スキャン処理では、スキャン処理部11が、プログラム生成装置51で生成された機械語に基づいて、図3のようなラダープログラム及びFBを含むプログラムを実行する。 In the scan process, the scan process unit 11 executes a program including the ladder program and the FB as shown in FIG. 3 based on the machine language generated by the program generation device 51.
 スキャン処理では、「trigger」が真である(「trigger」=1)場合、非同期送信FBが実行され、「開始フラグ」に関する非同期送信FBパラメータが真になる(M10=1)。 In the scan process, if "trigger" is true ("trigger" = 1), the asynchronous transmission FB is executed, and the asynchronous transmission FB parameter related to the "start flag" becomes true (M10 = 1).
 スキャン処理では、「完了フラグ」に関する非同期受信FBパラメータが真である(M11=1)場合、非同期受信FBが実行され、「ready」が真にセットされ(「ready」=1)、「data」が受信データにセットされる(「data」=受信データ)。図示しないが、これらがセットされた後には、「完了フラグ」に関する非同期受信FBパラメータが偽になる(M11=0)。 In the scan process, if the asynchronous receive FB parameter for the "completion flag" is true (M11 = 1), the asynchronous receive FB is executed, "ready" is set to true ("ready" = 1), and "data". Is set in the received data ("data" = received data). Although not shown, after these are set, the asynchronous receive FB parameter regarding the "completion flag" becomes false (M11 = 0).
 リフレッシュ処理では、リフレッシュ処理部12が入出力制御部14と協働して、スキャン処理部11の実行結果を入出力機器41に出力し、入出力機器41からセンサなどで検出された値を取得する。 In the refresh process, the refresh process unit 12 cooperates with the input / output control unit 14 to output the execution result of the scan processing unit 11 to the input / output device 41, and acquires the value detected by the sensor or the like from the input / output device 41. do.
 <外部通信処理>
 図6及び図7に示すように、プログラマブルコントローラ1は、スキャン処理及びリフレッシュ処理と非同期で、スキャン処理及びリフレッシュ処理と並列に外部通信処理を行う。
<External communication processing>
As shown in FIGS. 6 and 7, the programmable controller 1 performs external communication processing in parallel with the scan processing and the refresh processing, asynchronously with the scan processing and the refresh processing.
 外部通信処理では、非同期外部通信処理部13が、送信機能13a及び受信機能13bを用いてサービス実行装置61とデータのやり取りを行う。なお、送信機能13aは、スキャン処理部11と非同期であるが、スキャン処理部11で実行される非同期送信FBで用いられる図4の非同期送信FBパラメータを、スキャン処理部11と共用する。同様に、受信機能13bは、スキャン処理部11と非同期であるが、スキャン処理部11で実行される非同期受信FBで用いられる図5の非同期受信FBパラメータを、スキャン処理部11と共用する。 In the external communication processing, the asynchronous external communication processing unit 13 exchanges data with the service execution device 61 using the transmission function 13a and the reception function 13b. Although the transmission function 13a is asynchronous with the scan processing unit 11, the asynchronous transmission FB parameter of FIG. 4 used in the asynchronous transmission FB executed by the scan processing unit 11 is shared with the scan processing unit 11. Similarly, although the reception function 13b is asynchronous with the scan processing unit 11, the asynchronous reception FB parameter of FIG. 5 used in the asynchronous reception FB executed by the scan processing unit 11 is shared with the scan processing unit 11.
 図7のように、非同期外部通信処理部13は、「開始フラグ」に関する非同期送信FBパラメータが真になった(M10=1)場合に、サービス実行装置61へリクエストを送信機能13aによって送信する。図示しないが、このリクエストの送信と並行して、非同期外部通信処理部13は、「開始フラグ」に関する非同期送信FBパラメータを偽にする(M10=0)。 As shown in FIG. 7, when the asynchronous transmission FB parameter related to the "start flag" becomes true (M10 = 1), the asynchronous external communication processing unit 13 transmits a request to the service execution device 61 by the transmission function 13a. Although not shown, in parallel with the transmission of this request, the asynchronous external communication processing unit 13 sets the asynchronous transmission FB parameter related to the "start flag" to false (M10 = 0).
 また、非同期外部通信処理部13は、サービス実行装置61からのレスポンスを受信機能13bによって受信した場合に、デバイス値である「data」に関する非同期受信FBパラメータへ、サービス実行装置61からの受信データをセットする(D10=受信データ)。またこの場合に、非同期外部通信処理部13は、「完了フラグ」に関する非同期受信FBパラメータを真にする(M11=1)。 Further, when the asynchronous external communication processing unit 13 receives the response from the service execution device 61 by the reception function 13b, the asynchronous external communication processing unit 13 inputs the reception data from the service execution device 61 to the asynchronous reception FB parameter related to the device value "data". Set (D10 = received data). Further, in this case, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameter related to the "completion flag" to true (M11 = 1).
 なお図7の例では、スキャン処理及びリフレッシュ処理はスレッド[0]に割り当てられ、外部通信処理はスレッド[1]に割り当てられる。スレッド[0]とスレッド[1]とは、同一プロセッサ上で論理的に並列に実行されてもよいし、マルチコアプロセッサ上で物理的に並列に実行されてもよい。 In the example of FIG. 7, the scan process and the refresh process are assigned to the thread [0], and the external communication process is assigned to the thread [1]. Thread [0] and thread [1] may be executed logically in parallel on the same processor, or may be physically executed in parallel on a multi-core processor.
 図8は、本実施の形態1に係る非同期外部通信処理部13が行う外部通信処理を示すフローチャートである。なお、図8の外部通信処理は、図6の外部通信処理実行に対応している。 FIG. 8 is a flowchart showing an external communication process performed by the asynchronous external communication processing unit 13 according to the first embodiment. The external communication process of FIG. 8 corresponds to the execution of the external communication process of FIG.
 ステップS11にて、非同期外部通信処理部13は、「開始フラグ」に関する非同期送信FBパラメータを参照して、デバイスの「開始フラグ」のをチェックし、「開始フラグ」が真であるか否かを判定する。「開始フラグ」が真であると判定された場合には処理がステップS12に進み、「開始フラグ」が偽であると判定された場合にはステップS11の処理が再度行われる。 In step S11, the asynchronous external communication processing unit 13 refers to the asynchronous transmission FB parameter related to the "start flag", checks the "start flag" of the device, and checks whether the "start flag" is true or not. judge. If it is determined that the "start flag" is true, the process proceeds to step S12, and if it is determined that the "start flag" is false, the process of step S11 is performed again.
 ステップS12にて、非同期外部通信処理部13の送信機能13aは、「URL」に関する非同期送信FBパラメータを参照し、当該パラメータに基づいてサービス実行装置61にアクセスし、データをリクエストする。また、非同期外部通信処理部13は、「開始フラグ」に関する非同期送信FBパラメータを偽にする。 In step S12, the transmission function 13a of the asynchronous external communication processing unit 13 refers to the asynchronous transmission FB parameter related to the "URL", accesses the service execution device 61 based on the parameter, and requests data. Further, the asynchronous external communication processing unit 13 sets the asynchronous transmission FB parameter related to the "start flag" to be false.
 ステップS13にて、非同期外部通信処理部13は、受信機能13bがサービス実行装置61からのレスポンスを受信したか否かを判定する。レスポンスを受信したと判定された場合には処理がステップS14に進み、レスポンスを受信しなかったと判定された場合にはステップS13の処理が再度行われる。なお、レスポンス待ちには、ポーリングが用いられてもよいし、スレッドを待ち状態へ遷移させ、サービス実行装置61からのレスポンスをトリガにした起動を行うことが用いられてもよい。 In step S13, the asynchronous external communication processing unit 13 determines whether or not the reception function 13b has received the response from the service execution device 61. If it is determined that the response has been received, the process proceeds to step S14, and if it is determined that the response has not been received, the process of step S13 is performed again. For the response wait, polling may be used, or the thread may be transitioned to the wait state and started by the response from the service execution device 61 as a trigger.
 ステップS14にて、非同期外部通信処理部13の受信機能13bは、完了通知のデバイスの「完了フラグ」に関する非同期受信FBパラメータへ真をセットする。また、非同期外部通信処理部13の受信機能13bは、完了通知のデバイスの「data」に関する非同期受信FBパラメータへ、サービス実行装置61からの受信データをセットする。その後、処理がステップS11に戻る。 In step S14, the reception function 13b of the asynchronous external communication processing unit 13 sets true to the asynchronous reception FB parameter related to the "completion flag" of the device of the completion notification. Further, the reception function 13b of the asynchronous external communication processing unit 13 sets the reception data from the service execution device 61 in the asynchronous reception FB parameter related to the device "data" of the completion notification. After that, the process returns to step S11.
 ステップS14の後には、図7に示すように、「完了フラグ」に関する非同期受信FBパラメータが真であることに基づいて、次のスキャン処理で非同期受信FBが実行される。これにより、「ready」が真にセットされ(「ready」=1)、「data」が受信データにセットされる(「data」=受信データ)。 After step S14, as shown in FIG. 7, based on the fact that the asynchronous receive FB parameter related to the "completion flag" is true, the asynchronous receive FB is executed in the next scan process. As a result, "ready" is truly set ("ready" = 1) and "data" is set in the received data ("data" = received data).
 <実施の形態1のまとめ>
 以上のような本実施の形態1では、送信機能13aは、スキャン処理部11及びリフレッシュ処理部12とは非同期で、サービス実行装置61へコマンドを送信する。そして、受信機能13bは、スキャン処理部11及びリフレッシュ処理部12とは非同期で、サービス実行装置61から受信データを受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する。このような構成によれば、サービス実行装置61へのアクセスからレスポンスまでの時間が一定でなくても、ラダープログラム及びFBを含むプログラムの実行時間を一定に保つことができる。このため、プログラマブルコントローラ1の負荷を低減することができる。
<Summary of Embodiment 1>
In the first embodiment as described above, the transmission function 13a transmits a command to the service execution device 61 asynchronously with the scan processing unit 11 and the refresh processing unit 12. Then, the reception function 13b receives the received data from the service execution device 61 asynchronously with the scan processing unit 11 and the refresh processing unit 12, and stores the received data in the memory area in order to set the received data in the device. According to such a configuration, even if the time from the access to the service execution device 61 to the response is not constant, the execution time of the ladder program and the program including the FB can be kept constant. Therefore, the load on the programmable controller 1 can be reduced.
 <実施の形態2>
 図9は、本実施の形態2に係るラダープログラム及びFBを含むプログラムの一例を示す図である。図9のプログラムは、複数の非同期送信FB(第1及び第2非同期送信FB)と、複数の非同期受信FB(第1及び第2非同期受信FB)とを含む。
<Embodiment 2>
FIG. 9 is a diagram showing an example of a program including a ladder program and FB according to the second embodiment. The program of FIG. 9 includes a plurality of asynchronous transmission FBs (first and second asynchronous transmission FBs) and a plurality of asynchronous reception FBs (first and second asynchronous reception FBs).
 第1及び第2非同期送信FBのそれぞれは、実施の形態1に係る非同期送信FB(図3)に「関連ID」の入力が追加されたFBと概ね同じである。同様に、第1及び第2非同期受信FBのそれぞれは、実施の形態1に係る非同期受信FB(図3)に「関連ID」の入力が追加されたFBと概ね同じである。 Each of the first and second asynchronous transmission FBs is substantially the same as the FB in which the input of the "related ID" is added to the asynchronous transmission FB (FIG. 3) according to the first embodiment. Similarly, each of the first and second asynchronous reception FBs is substantially the same as the FB to which the input of the "related ID" is added to the asynchronous reception FB (FIG. 3) according to the first embodiment.
 図10は、本実施の形態2に係る非同期送信FBパラメータの一例を示す図であり、図11は、本実施の形態2に係る非同期受信FBパラメータの一例を示す図である。図10及び図11に示すように、本実施の形態2では、非同期送信FBパラメータと非同期受信FBパラメータとのそれぞれは、非同期送信FBパラメータと非同期受信FBパラメータとを互いに関連付ける「関連ID」を含む。 FIG. 10 is a diagram showing an example of an asynchronous transmission FB parameter according to the second embodiment, and FIG. 11 is a diagram showing an example of an asynchronous reception FB parameter according to the second embodiment. As shown in FIGS. 10 and 11, in the second embodiment, each of the asynchronous transmission FB parameter and the asynchronous reception FB parameter includes an "related ID" that associates the asynchronous transmission FB parameter and the asynchronous reception FB parameter with each other. ..
 第1非同期送信FBで用いられる、図10の上側の第1非同期送信FBパラメータと、第1非同期受信FBで用いられる、図11の上側の第1非同期受信FBパラメータとは、「関連ID」のパラメータである「123」によって互いに関連付けられている。同様に、第2非同期送信FBで用いられる、図10の下側の第2非同期送信FBパラメータと、第2非同期受信FBで用いられる、図11の下側の第2非同期受信FBパラメータとは、「関連ID」のパラメータである「121」によって互いに関連付けられている。 The first asynchronous transmission FB parameter on the upper side of FIG. 10 used in the first asynchronous transmission FB and the first asynchronous reception FB parameter on the upper side in FIG. 11 used in the first asynchronous reception FB are "related IDs". They are associated with each other by the parameter "123". Similarly, the lower second asynchronous transmission FB parameter of FIG. 10 used in the second asynchronous transmission FB and the lower second asynchronous reception FB parameter of FIG. 11 used in the second asynchronous reception FB are They are associated with each other by the parameter "121" of the "association ID".
 このような構成によれば、送信機能13aが、一の非同期送信FBについてリクエストの送信を行った後に、受信機能13bが、当該一の非同期送信FBと「関連ID」で関連付けられた一の非同期受信FBについてレスポンスの受信を行うことができる。 According to such a configuration, after the transmission function 13a transmits a request for one asynchronous transmission FB, the reception function 13b is associated with the one asynchronous transmission FB by "related ID". It is possible to receive a response for the received FB.
 図12は、本実施の形態2に係るプログラマブルコントローラ1がラダープログラム及びFBを含むプログラムを実行するオンライン処理の手順を示すフローチャートである。なお、図12では、非同期外部通信処理部13が第1非同期送信FBパラメータ及び第1非同期受信FBパラメータを用いる外部通信処理が、第1外部通信処理と記されている。非同期外部通信処理部13が第2非同期送信FBパラメータ及び第2非同期受信FBパラメータを用いる外部通信処理が、第2外部通信処理と記されている。 FIG. 12 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the second embodiment executes a program including a ladder program and an FB. In FIG. 12, the external communication process in which the asynchronous external communication processing unit 13 uses the first asynchronous transmission FB parameter and the first asynchronous reception FB parameter is described as the first external communication process. The external communication processing in which the asynchronous external communication processing unit 13 uses the second asynchronous transmission FB parameter and the second asynchronous reception FB parameter is described as the second external communication processing.
 図13は、本実施の形態2に係るプログラマブルコントローラ1がラダープログラム及びFBを含むプログラムを実行するオンライン処理を示すタイミングチャートである。なお、図13では、送信機能13aが第1非同期送信FBパラメータを用いて送信を行うタイミングが、第1送信機能と記され、受信機能13bが第1非同期受信FBパラメータを用いて受信を行うタイミングが、第1受信機能と記されている。同様に、送信機能13aが第2非同期送信FBパラメータを用いて送信を行うタイミングが、第2送信機能と記され、受信機能13bが第2非同期受信FBパラメータを用いて受信を行うタイミングが、第2受信機能と記されている。 FIG. 13 is a timing chart showing an online process in which the programmable controller 1 according to the second embodiment executes a program including a ladder program and an FB. In FIG. 13, the timing at which the transmission function 13a transmits using the first asynchronous transmission FB parameter is described as the first transmission function, and the timing at which the reception function 13b performs reception using the first asynchronous reception FB parameter. However, it is described as the first reception function. Similarly, the timing at which the transmission function 13a transmits using the second asynchronous transmission FB parameter is described as the second transmission function, and the timing at which the reception function 13b receives using the second asynchronous reception FB parameter is the second. 2 It is described as a reception function.
 図12及び図13に示すように、外部通信処理を行うスレッドは、非同期送信FBパラメータの組の数だけ用いられる。図10のように非同期送信FBパラメータの組が2つである場合、1組の非同期送信FBパラメータを用いる1つの外部通信処理はスレッド[1]に割り当てられ、別の組の非同期送信FBパラメータを用いる別の外部通信処理はスレッド[2]に割り当てられる。スレッド[0]~スレッド[2]は、同一プロセッサ上で論理的に並列に実行されてもよいし、マルチコアプロセッサ上で物理的に並列に実行されてもよい。 As shown in FIGS. 12 and 13, threads that perform external communication processing are used as many as the number of sets of asynchronous transmission FB parameters. When there are two sets of asynchronous transmission FB parameters as shown in FIG. 10, one external communication process using one set of asynchronous transmission FB parameters is assigned to thread [1], and another set of asynchronous transmission FB parameters is assigned. Another external communication process to be used is assigned to thread [2]. Threads [0] to [2] may be executed logically in parallel on the same processor, or may be physically executed in parallel on a multi-core processor.
 第1非同期受信FBの「trigger」が真である場合、スキャン処理で第1非同期送信FBが実行され、「開始フラグ」に関する第1非同期送信FBパラメータが真になる(M10=1)。第2非同期受信FBの「trigger」が真である場合、スキャン処理で第2非同期送信FBが実行され、「開始フラグ」に関する第2非同期送信FBパラメータが真になる(M20=1)。 When the "trigger" of the first asynchronous reception FB is true, the first asynchronous transmission FB is executed in the scan process, and the first asynchronous transmission FB parameter related to the "start flag" becomes true (M10 = 1). When the "trigger" of the second asynchronous reception FB is true, the second asynchronous transmission FB is executed in the scan process, and the second asynchronous transmission FB parameter regarding the "start flag" becomes true (M20 = 1).
 非同期外部通信処理部13は、「開始フラグ」に関する第1非同期送信FBパラメータが真になった(M10=1)場合に、サービス実行装置61へ第1リクエストを送信機能13aによって送信する。この第1リクエストの送信と並行して、非同期外部通信処理部13は、「開始フラグ」に関する第1非同期送信FBパラメータを偽にする(M10=0)。 When the first asynchronous transmission FB parameter related to the "start flag" becomes true (M10 = 1), the asynchronous external communication processing unit 13 transmits the first request to the service execution device 61 by the transmission function 13a. In parallel with the transmission of the first request, the asynchronous external communication processing unit 13 sets the first asynchronous transmission FB parameter related to the "start flag" to false (M10 = 0).
 また、非同期外部通信処理部13は、第1非同期受信FBパラメータと「関連ID」によって関連付けられた「URL」に関する第1非同期送信FBパラメータを読み出し、当該第1非同期送信FBパラメータが示すサービス実行装置61から第1レスポンスを受信機能13bによって受信したかを判定する。第1レスポンスを受信したと判定された場合、非同期外部通信処理部13は、デバイス値である「data」に関する第1非同期受信FBパラメータへ、サービス実行装置61からの受信データをセットする(D10=受信データ)。またこの場合に、非同期外部通信処理部13は、「完了フラグ」に関する第1非同期受信FBパラメータを真にする(M11=1)。 Further, the asynchronous external communication processing unit 13 reads out the first asynchronous transmission FB parameter related to the "URL" associated with the first asynchronous reception FB parameter by the "related ID", and the service execution device indicated by the first asynchronous transmission FB parameter. It is determined whether the first response from 61 is received by the reception function 13b. When it is determined that the first response has been received, the asynchronous external communication processing unit 13 sets the reception data from the service execution device 61 in the first asynchronous reception FB parameter related to the device value "data" (D10 =). received data). Further, in this case, the asynchronous external communication processing unit 13 sets the first asynchronous reception FB parameter regarding the "completion flag" to true (M11 = 1).
 第2非同期送信FBパラメータ及び第2非同期受信FBパラメータについても第1非同期送信FBパラメータ及び第1非同期受信FBパラメータと同様の処理が行われる。 The same processing as the first asynchronous transmission FB parameter and the first asynchronous reception FB parameter is performed for the second asynchronous transmission FB parameter and the second asynchronous reception FB parameter.
 すなわち、非同期外部通信処理部13は、「開始フラグ」に関する第2非同期送信FBパラメータが真になった(M20=1)場合に、サービス実行装置61へ第2リクエストを送信機能13aによって送信する。この第2リクエストの送信と並行して、非同期外部通信処理部13は、「開始フラグ」に関する第2非同期送信FBパラメータを偽にする(M20=0)。 That is, when the second asynchronous transmission FB parameter regarding the "start flag" becomes true (M20 = 1), the asynchronous external communication processing unit 13 transmits a second request to the service execution device 61 by the transmission function 13a. In parallel with the transmission of the second request, the asynchronous external communication processing unit 13 sets the second asynchronous transmission FB parameter related to the "start flag" to false (M20 = 0).
 また、非同期外部通信処理部13は、第2非同期受信FBパラメータと「関連ID」によって関連付けられた「URL」に関する第2非同期送信FBパラメータを読み出し、当該第2非同期送信FBパラメータが示すサービス実行装置61から第2レスポンスを受信機能13bによって受信したかを判定する。第2レスポンスを受信したと判定された場合、非同期外部通信処理部13は、デバイス値である「data」に関する第2非同期受信FBパラメータへ、サービス実行装置61からの受信データをセットする(D20=受信データ)。またこの場合に、非同期外部通信処理部13は、「完了フラグ」に関する第2非同期受信FBパラメータを真にする(M21=1)。 Further, the asynchronous external communication processing unit 13 reads out the second asynchronous transmission FB parameter related to the "URL" associated with the second asynchronous reception FB parameter by the "related ID", and the service execution device indicated by the second asynchronous transmission FB parameter. It is determined whether or not the second response from 61 has been received by the reception function 13b. When it is determined that the second response has been received, the asynchronous external communication processing unit 13 sets the reception data from the service execution device 61 in the second asynchronous reception FB parameter related to the device value "data" (D20 =). received data). Further, in this case, the asynchronous external communication processing unit 13 sets the second asynchronous reception FB parameter regarding the "completion flag" to true (M21 = 1).
 以上のような本実施の形態2に係るプログラム実行装置によれば、1つのプログラムに複数の非同期送信FB及び複数の非同期受信FBが含まれる場合であっても、非同期送信FB及び非同期受信FBの組ごとに処理を行うことができる。このため、1つのサービス実行装置61から複数種類のデータを取得したり、複数のサービス実行装置61からデータを取得したりすることができる。 According to the program execution device according to the second embodiment as described above, even when one program includes a plurality of asynchronous transmission FBs and a plurality of asynchronous reception FBs, the asynchronous transmission FB and the asynchronous reception FB Processing can be performed for each group. Therefore, it is possible to acquire a plurality of types of data from one service execution device 61, or to acquire data from a plurality of service execution devices 61.
 <実施の形態3>
 図14は、本実施の形態3に係るプログラム生成装置51で生成されるユーザ定義プログラムの一例を示す図である。ユーザ定義プログラムは、非同期外部通信処理部13の処理、つまり外部通信処理を規定する。図14のユーザ定義プログラムでは、「開始フラグ」が真であるときに、非同期外部通信処理部13が以下のように外部通信処理を実行することが規定されている。
<Embodiment 3>
FIG. 14 is a diagram showing an example of a user-defined program generated by the program generation device 51 according to the third embodiment. The user-defined program defines the processing of the asynchronous external communication processing unit 13, that is, the external communication processing. The user-defined program of FIG. 14 stipulates that the asynchronous external communication processing unit 13 executes external communication processing as follows when the "start flag" is true.
 最初に、送信機能13aは、サービス実行装置61へsbuf内のデータを1024バイトで送信する。次に、受信機能13bは、サービス実行装置61からのレスポンスを待ち、レスポンスがあれば1024バイトのデータをrbufへセットし、「完了フラグ」へ真をセットする。 First, the transmission function 13a transmits the data in the subuf to the service execution device 61 in 1024 bytes. Next, the reception function 13b waits for a response from the service execution device 61, sets 1024 bytes of data in rbuf if there is a response, and sets true in the "completion flag".
 ユーザ定義プログラムは、図2のステップS3のダウンロードによってプログラマブルコントローラ1へ送信され、プログラマブルコントローラ1は、当該ユーザ定義プログラムをメモリ15へロードする。 The user-defined program is transmitted to the programmable controller 1 by downloading in step S3 of FIG. 2, and the programmable controller 1 loads the user-defined program into the memory 15.
 図15は、本実施の形態3に係る非同期外部通信処理部13が行う外部通信処理を示すフローチャートである。この図15のフローチャートは、図6の外部通信処理実行の前に、ユーザ定義プログラム実行が追加されている。このユーザ定義プログラム実行は、システム起動時に実行される。この処理が行われると、ユーザ定義プログラムが実行され、外部通信処理のスレッドが生成される。その後、外部通信処理実行において図8の外部通信処理が行われる。 FIG. 15 is a flowchart showing an external communication process performed by the asynchronous external communication processing unit 13 according to the third embodiment. In the flowchart of FIG. 15, user-defined program execution is added before the external communication processing execution of FIG. This user-defined program execution is executed at system startup. When this processing is performed, the user-defined program is executed and a thread for external communication processing is created. After that, the external communication process of FIG. 8 is performed in the execution of the external communication process.
 以上のような本実施の形態3に係るプログラム実行装置によれば、ユーザ定義プログラムを変更することによって、外部通信処理を変更することができる。 According to the program execution device according to the third embodiment as described above, the external communication process can be changed by changing the user-defined program.
 <実施の形態4>
 図16は、本実施の形態4に係るプログラム生成装置51で生成されるユーザ定義プログラムの一例を示す図である。図16のユーザ定義プログラムは、図14のユーザ定義プログラムと概ね同じであるが、非同期外部通信処理部13が受信データを複数のデバイスに対応させて分割し、複数の受信データをセットすることが規定されている。
<Embodiment 4>
FIG. 16 is a diagram showing an example of a user-defined program generated by the program generation device 51 according to the fourth embodiment. The user-defined program of FIG. 16 is substantially the same as the user-defined program of FIG. 14, but the asynchronous external communication processing unit 13 may divide the received data according to a plurality of devices and set a plurality of received data. It is stipulated.
 具体的には図16において、6行目では受信バッファの先頭から32バイトの受信データをパラメータ(D10)へセットすること、7行目では受信バッファの33バイト目から32バイトの受信データをパラメータ(D100)へセットすること、8行目では受信バッファの65バイト目から128バイトの受信データをパラメータ(D200)へセットすることが規定されている。つまり図16では、3つのデバイスに対応させて分割された3つの受信データのパラメータ(D10,D100,D200)が規定されている。 Specifically, in FIG. 16, in the sixth line, the received data of 32 bytes from the beginning of the receive buffer is set in the parameter (D10), and in the seventh line, the received data of the 33rd byte to the 32 bytes of the receive buffer is set as a parameter. It is stipulated that the data should be set to (D100), and that the reception data of 128 bytes from the 65th byte of the reception buffer should be set to the parameter (D200) in the 8th line. That is, in FIG. 16, the parameters (D10, D100, D200) of the three received data divided corresponding to the three devices are defined.
 図17は、本実施の形態4に係る非同期受信FBの一例を示す図である。図17の非同期受信FBは、図3の非同期受信FBの「data」の代わりに、分割された3つの受信データがそれぞれセットされる「data1」、「data2」、「data3」の出力を有する。 FIG. 17 is a diagram showing an example of an asynchronous reception FB according to the fourth embodiment. The asynchronous reception FB of FIG. 17 has outputs of “data1”, “data2”, and “data3” in which three divided reception data are set, respectively, instead of the “data” of the asynchronous reception FB of FIG.
 図18は、本実施の形態4に係る非同期受信FBパラメータの一例を示す図である。図18の非同期受信FBパラメータは、図5の非同期受信FBパラメータの「data」の代わりに、「data1」、「data2」、「data3」のパラメータ(D10,D100,D200)を含む。 FIG. 18 is a diagram showing an example of asynchronous reception FB parameters according to the fourth embodiment. The asynchronous reception FB parameter of FIG. 18 includes the parameters (D10, D100, D200) of “data1”, “data2”, and “data3” instead of the “data” of the asynchronous reception FB parameter of FIG.
 以上のような本実施の形態4に係るプログラム実行装置によれば、サービス実行装置61からの受信データを、複数のデバイスに対応させて分割してセットすることができる。これにより、データサイズの低減化、ラダープログラムからのデータの低減化、及び、それに伴うデータアクセス時間の短縮化が期待できる。 According to the program execution device according to the fourth embodiment as described above, the received data from the service execution device 61 can be divided and set corresponding to a plurality of devices. As a result, it can be expected that the data size will be reduced, the data from the ladder program will be reduced, and the data access time will be shortened accordingly.
 <実施の形態5>
 図19は、本実施の形態5に係る非同期受信FBパラメータの一例を示す図である。図19の非同期受信FBパラメータは、実施の形態1で説明した図5の非同期受信FBパラメータに、受信機能13bでの受信データの通信エラーの有無を示す「エラーフラグ」が追加されており、通信エラーの有無がデバイスにセットされる。
<Embodiment 5>
FIG. 19 is a diagram showing an example of an asynchronous reception FB parameter according to the fifth embodiment. As for the asynchronous reception FB parameter of FIG. 19, an "error flag" indicating the presence or absence of a communication error of the received data by the reception function 13b is added to the asynchronous reception FB parameter of FIG. 5 described in the first embodiment, and communication is performed. The presence or absence of an error is set on the device.
 図20は、本実施の形態5に係る外部通信処理のフローチャートである。図20のフローチャートは、実施の形態1で説明した図8のフローチャートにステップS21及びステップS22を追加したフローチャートと同様である。このため、以下ではステップS21及びステップS22について主に説明する。 FIG. 20 is a flowchart of the external communication process according to the fifth embodiment. The flowchart of FIG. 20 is the same as the flowchart in which steps S21 and S22 are added to the flowchart of FIG. 8 described in the first embodiment. Therefore, in the following, steps S21 and S22 will be mainly described.
 ステップS13にて、レスポンスを受信したと判定された場合には処理がステップS21に進み、レスポンスを受信しなかったと判定された場合にはステップS13の処理が再度行われる。 In step S13, if it is determined that the response has been received, the process proceeds to step S21, and if it is determined that the response has not been received, the process of step S13 is performed again.
 ステップS21にて、非同期外部通信処理部13は、サービス実行装置61からレスポンスとともに受信されるべき受信データを待つ機能において、戻り値または受信ステータスにエラーがあるか否か、つまり通信エラーがあるか否かを判定する。通信エラーがあると判定された場合には処理がステップS22に進み、受信通信エラーがないと判定された場合には処理がステップS14に進む。 In step S21, in the function of waiting for the received data to be received together with the response from the service execution device 61, the asynchronous external communication processing unit 13 has an error in the return value or the reception status, that is, whether there is a communication error. Judge whether or not. If it is determined that there is a communication error, the process proceeds to step S22, and if it is determined that there is no received communication error, the process proceeds to step S14.
 ステップS22にて、「エラーフラグ」に関する非同期受信FBパラメータを真にセットする。その後、処理がステップS11に戻る。 In step S22, the asynchronous reception FB parameter related to the "error flag" is truly set. After that, the process returns to step S11.
 以上のような本実施の形態5に係るプログラム実行装置によれば、ラダープログラム及びFBを含むプログラムを実行するスキャン処理部11は、次のスキャン処理で受信データの通信エラーを検知することができる。したがって、エラーへの対応処理が可能となる。 According to the program execution device according to the fifth embodiment as described above, the scan processing unit 11 that executes the program including the ladder program and the FB can detect the communication error of the received data in the next scan process. .. Therefore, it is possible to handle the error.
 <実施の形態6>
 図21は、本実施の形態6に係る非同期受信FBパラメータの一例を示す図である。図21の非同期受信FBパラメータは、実施の形態5で説明した図19の非同期受信FBパラメータに、送信機能13aによるコマンドの送信開始から、受信機能13bによる受信データの受信までの時間の閾値を示す「タイムアウト時間」が追加されている。なお、タイムアウト時間は数値でセットされる。
<Embodiment 6>
FIG. 21 is a diagram showing an example of asynchronous reception FB parameters according to the sixth embodiment. The asynchronous reception FB parameter of FIG. 21 indicates the threshold time of the time from the start of transmission of the command by the transmission function 13a to the reception of the reception data by the reception function 13b in the asynchronous reception FB parameter of FIG. 19 described in the fifth embodiment. "Timeout time" has been added. The timeout time is set numerically.
 図22は、本実施の形態6に係る外部通信処理のフローチャートである。図22のフローチャートは、実施の形態5で説明した図20のフローチャートにステップS26、ステップS27及びステップS28を追加したフローチャートと同様である。このため、以下ではステップS26~ステップS28について主に説明する。 FIG. 22 is a flowchart of the external communication process according to the sixth embodiment. The flowchart of FIG. 22 is the same as the flowchart in which steps S26, S27, and S28 are added to the flowchart of FIG. 20 described in the fifth embodiment. Therefore, in the following, steps S26 to S28 will be mainly described.
 ステップS11にて、「開始フラグ」が真であると判定された場合には処理がステップS26に進み、「開始フラグ」が偽であると判定された場合にはステップS11の処理が再度行われる。 If it is determined in step S11 that the "start flag" is true, the process proceeds to step S26, and if it is determined that the "start flag" is false, the process of step S11 is performed again. ..
 ステップS26にて、非同期外部通信処理部13は、その時点の時刻を開始時刻として取得する。その後、処理がステップS12に進む。 In step S26, the asynchronous external communication processing unit 13 acquires the time at that time as the start time. After that, the process proceeds to step S12.
 ステップS12後のステップS27にて、非同期外部通信処理部13は、その時点の時刻を現在時刻として取得する。 In step S27 after step S12, the asynchronous external communication processing unit 13 acquires the time at that time as the current time.
 ステップS28にて、非同期外部通信処理部13は、開始時刻と現在時刻との差が、タイムアウト時間以下であるか否かを判定する。差がタイムアウト時間以下であると判定された場合には処理がステップS13に進み、差がタイムアウト時間よりも大きいと判定された場合には処理がステップS22に進む。 In step S28, the asynchronous external communication processing unit 13 determines whether or not the difference between the start time and the current time is equal to or less than the timeout time. If it is determined that the difference is less than or equal to the time-out time, the process proceeds to step S13, and if it is determined that the difference is larger than the time-out time, the process proceeds to step S22.
 ステップS13にて、レスポンスを受信したと判定された場合には処理がステップS21に進み、レスポンスを受信しなかったと判定された場合には処理がステップS27に戻る。 In step S13, if it is determined that the response has been received, the process proceeds to step S21, and if it is determined that the response has not been received, the process returns to step S27.
 以上のような本実施の形態6に係るプログラム実行装置によれば、ラダープログラム及びFBを含むプログラムを実行するスキャン処理部11は、次のスキャン処理で受信データの受信におけるタイムアウトを検知することができる。したがって、エラーへの対応処理が可能となる。 According to the program execution device according to the sixth embodiment as described above, the scan processing unit 11 that executes the program including the ladder program and the FB may detect a timeout in receiving the received data in the next scan process. can. Therefore, it is possible to handle the error.
 <実施の形態7>
 図23は、本実施の形態7に係る外部通信処理のフローチャートである。実施の形態1の外部通信処理(図8)のステップS14では、非同期外部通信処理部13は、非同期受信FBパラメータの完了通知のデバイスについて「完了フラグ」及び「data」に関する非同期受信FBパラメータをセットした。つまりステップS14にて、非同期外部通信処理部13は、スキャン処理で読み書きされる領域について「完了フラグ」及び「data」に関する非同期受信FBパラメータをセットした。これに対して、図23のステップS14では、非同期外部通信処理部13は、スキャン処理で読み書きされない一時的なデバイスに「完了フラグ」及び「data」に関する非同期受信FBパラメータをセットする。
<Embodiment 7>
FIG. 23 is a flowchart of the external communication process according to the seventh embodiment. In step S14 of the external communication processing (FIG. 8) of the first embodiment, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the “completion flag” and the “data” for the device of the completion notification of the asynchronous reception FB parameters. bottom. That is, in step S14, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the "completion flag" and "data" for the area read / written in the scan process. On the other hand, in step S14 of FIG. 23, the asynchronous external communication processing unit 13 sets the asynchronous reception FB parameters related to the “completion flag” and “data” to the temporary device that is not read / written in the scan process.
 図24は、本実施の形態7に係るプログラマブルコントローラ1がラダープログラム及びFBを含むプログラムを実行するオンライン処理の手順を示すフローチャートである。実施の形態1に係る図6のオンライン処理では、外部通信処理によってデバイスにセットされた「完了フラグ」及び「data」を用いてスキャン処理が行われた。これに対して、図24のオンライン処理では、フレッシュ処理実行前に、外部通信処理部によって一次的なデバイスにセットされた一時的なデバイス値である「完了フラグ」及び「data」が、スキャン処理で読み書きされるデバイスにセットされる。つまり、プログラマブルコントローラ1は、非同期外部通信処理部13によって一時的なデバイスにセットされた受信データを、スキャン処理部11で読み書きされるデバイスに、スキャン処理部11の実行が行われる期間以外の期間にセットする。 FIG. 24 is a flowchart showing a procedure of online processing in which the programmable controller 1 according to the seventh embodiment executes a program including a ladder program and an FB. In the online process of FIG. 6 according to the first embodiment, the scan process was performed using the "completion flag" and the "data" set in the device by the external communication process. On the other hand, in the online processing of FIG. 24, the "completion flag" and "data", which are temporary device values set in the primary device by the external communication processing unit, are scanned before the fresh processing is executed. Set on the device read / written by. That is, the programmable controller 1 has a period other than the period during which the scan processing unit 11 executes the received data set in the temporary device by the asynchronous external communication processing unit 13 to the device read / written by the scan processing unit 11. Set to.
 以上のような本実施の形態6に係るプログラム実行装置によれば、スキャン処理の途中に「完了フラグ」及び「data」が更新される可能性を低減することができる。これにより、スキャン処理で使用される「完了フラグ」及び「data」の原子性を高めることができる。 According to the program execution device according to the sixth embodiment as described above, it is possible to reduce the possibility that the "completion flag" and the "data" are updated during the scanning process. This makes it possible to enhance the atomicity of the "completion flag" and "data" used in the scanning process.
 <変形例>
 プログラマブルコントローラ1は、サービス実行装置61からの受信データの受信履歴に基づいてアクセス先である「URL」をバックグランドで学習してもよい。例えば、プログラマブルコントローラ1は、サービス実行装置61からの受信データの受信時期や受信頻度などの受信履歴に基づいて「URL」を学習してもよい。また例えば、学習には、AI(artificial intelligence)学習が用いられてもよい。
<Modification example>
The programmable controller 1 may learn the "URL" which is the access destination in the background based on the reception history of the received data from the service execution device 61. For example, the programmable controller 1 may learn the "URL" based on the reception history such as the reception time and reception frequency of the reception data from the service execution device 61. Further, for example, AI (artificial intelligence) learning may be used for learning.
 <その他の変形例>
 上述した図1のスキャン処理部11、リフレッシュ処理部12、及び、非同期外部通信処理部13を、以下「スキャン処理部11等」と記す。スキャン処理部11等は、図25に示す処理回路81により実現される。すなわち、処理回路81は、ラダープログラム及びファンクションブロックを含むプログラムを定期的に実行するスキャン処理部11と、スキャン処理部の実行と交互に、スキャン処理部の実行結果に基づいて、入出力機器とデータをやり取りするためのデータ処理を行うリフレッシュ処理部12と、スキャン処理部及びリフレッシュ処理部とは非同期で、サービス実行装置へコマンドを送信する送信機能13aと、スキャン処理部及びリフレッシュ処理部とは非同期で、サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能13bとを有する非同期外部通信処理部13と、を備える。処理回路81には、専用のハードウェアが適用されてもよいし、メモリに格納されるプログラムを実行するプロセッサが適用されてもよい。プロセッサには、例えば、中央処理装置、処理装置、演算装置、マイクロプロセッサ、マイクロコンピュータ、DSP(Digital Signal Processor)などが該当する。
<Other variants>
The scan processing unit 11, the refresh processing unit 12, and the asynchronous external communication processing unit 13 of FIG. 1 described above are hereinafter referred to as “scan processing unit 11 and the like”. The scan processing unit 11 and the like are realized by the processing circuit 81 shown in FIG. That is, the processing circuit 81 is a scan processing unit 11 that periodically executes a program including a ladder program and a function block, and an input / output device based on the execution result of the scan processing unit, alternating with the execution of the scan processing unit. The refresh processing unit 12 that performs data processing for exchanging data, the transmission function 13a that sends commands to the service execution device asynchronously with the scan processing unit and the refresh processing unit, and the scan processing unit and the refresh processing unit Asynchronous external communication processing unit 13 having a receiving function 13b that receives data as received data from a service execution device and stores the received data in a memory area in order to set the received data in the device. Dedicated hardware may be applied to the processing circuit 81, or a processor that executes a program stored in the memory may be applied to the processing circuit 81. The processor corresponds to, for example, a central processing unit, a processing unit, an arithmetic unit, a microprocessor, a microcomputer, a DSP (Digital Signal Processor), and the like.
 処理回路81が専用のハードウェアである場合、処理回路81は、例えば、単一回路、複合回路、プログラム化したプロセッサ、並列プログラム化したプロセッサ、ASIC(Application Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)、またはこれらを組み合わせたものが該当する。スキャン処理部11等の各部の機能それぞれは、処理回路を分散させた回路で実現されてもよいし、各部の機能をまとめて一つの処理回路で実現されてもよい。 When the processing circuit 81 is dedicated hardware, the processing circuit 81 may be, for example, a single circuit, a composite circuit, a programmed processor, a parallel programmed processor, an ASIC (Application Specific Integrated Circuit), or an FPGA (Field Programmable Gate). Array), or a combination of these. Each of the functions of each part such as the scan processing unit 11 may be realized by a circuit in which the processing circuits are dispersed, or the functions of each part may be collectively realized by one processing circuit.
 処理回路81がプロセッサである場合、スキャン処理部11等の機能は、ソフトウェア等との組み合わせにより実現される。なお、ソフトウェア等には、例えば、ソフトウェア、ファームウェア、または、ソフトウェア及びファームウェアが該当する。ソフトウェア等はプログラムとして記述され、メモリに格納される。図26に示すように、処理回路81に適用されるプロセッサ82は、メモリ83に記憶されたプログラムを読み出して実行することにより、各部の機能を実現する。すなわち、プログラマブルコントローラ1は、処理回路81により実行されるときに、ラダープログラム及びファンクションブロックを含むプログラムを定期的に実行するスキャン処理と、スキャン処理の実行結果に基づいてデータ処理を行うリフレッシュ処理とを交互に行うステップと、スキャン処理及びリフレッシュ処理とは非同期で、サービス実行装置へコマンドを送信する送信機能と、スキャン処理及びリフレッシュ処理とは非同期で、サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能とを有する外部通信処理を行うステップと、が結果的に実行されることになるプログラムを格納するためのメモリ83を備える。換言すれば、このプログラムは、スキャン処理部11等の手順や方法をコンピュータに実行させるものであるともいえる。ここで、メモリ83は、例えば、RAM(Random Access Memory)、ROM(Read Only Memory)、フラッシュメモリ、EPROM(Erasable Programmable Read Only Memory)、EEPROM(Electrically Erasable Programmable Read Only Memory)などの、不揮発性または揮発性の半導体メモリ、HDD(Hard Disk Drive)、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD(Digital Versatile Disc)、そのドライブ装置等、または、今後使用されるあらゆる記憶媒体であってもよい。 When the processing circuit 81 is a processor, the functions of the scan processing unit 11 and the like are realized by combining with software and the like. The software or the like corresponds to, for example, software, firmware, or software and firmware. Software and the like are described as programs and stored in memory. As shown in FIG. 26, the processor 82 applied to the processing circuit 81 realizes the functions of each part by reading and executing the program stored in the memory 83. That is, the programmable controller 1 has a scan process for periodically executing a program including a ladder program and a function block when executed by the processing circuit 81, and a refresh process for performing data processing based on the execution result of the scan process. The step of alternately performing the scan process and the refresh process are asynchronous, and the transmission function that sends a command to the service execution device is asynchronous, and the scan process and the refresh process are asynchronous, and data is received from the service execution device as received data. In addition, a step of performing an external communication process having a receiving function of storing the received data in a memory area for setting the received data in the device, and a memory 83 for storing a program to be executed as a result are provided. Be prepared. In other words, it can be said that this program causes the computer to execute the procedure or method of the scan processing unit 11 or the like. Here, the memory 83 is a non-volatile or non-volatile memory such as a RAM (RandomAccessMemory), a ROM (ReadOnlyMemory), a flash memory, an EPROM (ErasableProgrammableReadOnlyMemory), and an EPROM (ElectricallyErasableProgrammableReadOnlyMemory). Volatile semiconductor memory, HDD (Hard Disk Drive), magnetic disk, flexible disk, optical disk, compact disk, mini disk, DVD (DigitalVersatileDisc), its drive device, etc., or any storage medium that will be used in the future. You may.
 以上、スキャン処理部11等の各機能が、ハードウェア及びソフトウェア等のいずれか一方で実現される構成について説明した。しかしこれに限ったものではなく、スキャン処理部11等の一部を専用のハードウェアで実現し、別の一部をソフトウェア等で実現する構成であってもよい。例えば、スキャン処理部11については専用のハードウェアとしての処理回路81、及び、インターフェースなどでその機能を実現し、それ以外についてはプロセッサ82としての処理回路81がメモリ83に格納されたプログラムを読み出して実行することによってその機能を実現することが可能である。 The configuration in which each function of the scan processing unit 11 and the like is realized by either hardware or software has been described above. However, the present invention is not limited to this, and a configuration may be configured in which a part of the scan processing unit 11 or the like is realized by dedicated hardware and another part is realized by software or the like. For example, the scan processing unit 11 realizes its function by a processing circuit 81 as dedicated hardware and an interface, and other than that, the processing circuit 81 as a processor 82 reads a program stored in the memory 83. It is possible to realize the function by executing it.
 以上のように、処理回路81は、ハードウェア、ソフトウェア等、またはこれらの組み合わせによって、上述の各機能を実現することができる。また、以上で説明したプログラマブルコントローラ1の各機能あるいは各構成要素は、各機器に分散して配置されてもよいし、いずれかの機器に集中して配置されてもよい。 As described above, the processing circuit 81 can realize each of the above-mentioned functions by hardware, software, or a combination thereof. Further, each function or each component of the programmable controller 1 described above may be distributed to each device or may be centrally arranged to any device.
 なお、各実施の形態及び各変形例を自由に組み合わせたり、各実施の形態及び各変形例を適宜、変形、省略したりすることが可能である。 It is possible to freely combine each embodiment and each modification, and appropriately modify or omit each embodiment and each modification.
 上記した説明は、すべての局面において、例示であって、限定的なものではない。例示されていない無数の変形例が、想定され得るものと解される。 The above explanation is an example, not a limitation, in all aspects. A myriad of variants not illustrated are understood to be conceivable.
 1 プログラマブルコントローラ、11 スキャン処理部、12 リフレッシュ処理部、13 非同期外部通信処理部、13a 送信機能、13b 受信機能、41 入出力機器、51 プログラム生成装置、61 サービス実行装置。 1 programmable controller, 11 scan processing unit, 12 refresh processing unit, 13 asynchronous external communication processing unit, 13a transmission function, 13b reception function, 41 input / output device, 51 program generation device, 61 service execution device.

Claims (11)

  1.  サービスを提供するサービス実行装置と通信可能なプログラマブルコントローラであって、
     ラダープログラム及びファンクションブロックを含むプログラムを定期的に実行するスキャン処理部と、
     前記スキャン処理部の実行と交互に、前記スキャン処理部の実行結果に基づいて、入出力機器とデータをやり取りするためのデータ処理を行うリフレッシュ処理部と、
     前記スキャン処理部及び前記リフレッシュ処理部とは非同期で、前記サービス実行装置へコマンドを送信する送信機能と、前記スキャン処理部及び前記リフレッシュ処理部とは非同期で、前記サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能とを有する非同期外部通信処理部と
    を備える、プログラマブルコントローラ。
    A programmable controller that can communicate with the service execution device that provides the service.
    A scan processing unit that periodically executes programs including ladder programs and function blocks,
    A refresh processing unit that performs data processing for exchanging data with input / output devices based on the execution result of the scan processing unit, alternately with the execution of the scan processing unit.
    A transmission function that sends a command to the service execution device asynchronously with the scan processing unit and the refresh processing unit, and data received from the service execution device asynchronously with the scan processing unit and the refresh processing unit. A programmable controller including an asynchronous external communication processing unit having a receiving function of receiving data as a device and storing the received data in a memory area in order to set the data in the device.
  2.  請求項1に記載のプログラマブルコントローラと、
     前記サービス実行装置と、
     前記プログラマブルコントローラと通信可能であり、前記プログラマブルコントローラで用いられる前記プログラムを生成するプログラム生成装置と
    を備える、プログラム実行装置。
    The programmable controller according to claim 1 and
    With the service execution device
    A program execution device that can communicate with the programmable controller and includes a program generation device that generates the program used in the programmable controller.
  3.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記送信機能で用いられる送信パラメータは、前記サービス実行装置にアクセスするためのアクセス先と、前記送信機能の起動の有無を示す開始フラグとを含み、
     前記ファンクションブロック及び前記受信機能で用いられる受信パラメータは、前記サービス実行装置からのレスポンスの有無を示す完了フラグと、前記受信データとを含む、プログラム実行装置。
    The program execution device according to claim 2.
    The transmission parameters used in the function block and the transmission function include an access destination for accessing the service execution device and a start flag indicating whether or not the transmission function is activated.
    The reception parameter used in the function block and the reception function is a program execution device including a completion flag indicating the presence / absence of a response from the service execution device and the reception data.
  4.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記送信機能で用いられる送信パラメータと、前記ファンクションブロック及び前記受信機能で用いられる受信パラメータとのそれぞれは、前記送信パラメータと前記受信パラメータとを互いに関連付ける関連IDを含む、プログラム実行装置。
    The program execution device according to claim 2.
    Each of the transmission parameter used in the function block and the transmission function and the reception parameter used in the function block and the reception function includes a program execution device including a related ID for associating the transmission parameter and the reception parameter with each other. ..
  5.  請求項2に記載のプログラム実行装置であって、
     前記プログラム生成装置は、
     前記非同期外部通信処理部の処理を規定する定義プログラムを生成する、プログラム実行装置。
    The program execution device according to claim 2.
    The program generator is
    A program execution device that generates a definition program that defines the processing of the asynchronous external communication processing unit.
  6.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記受信機能で用いられる受信パラメータは、複数の前記受信データを含む、プログラム実行装置。
    The program execution device according to claim 2.
    The reception parameter used in the function block and the reception function is a program execution device including the plurality of reception data.
  7.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記受信機能で用いられる受信パラメータは、前記受信機能での前記受信データの通信エラーの有無を示すエラーフラグを含む、プログラム実行装置。
    The program execution device according to claim 2.
    The reception parameter used in the function block and the reception function is a program execution device including an error flag indicating the presence or absence of a communication error of the reception data in the reception function.
  8.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記受信機能で用いられる受信パラメータは、前記送信機能による前記コマンドの送信から、前記受信機能による前記受信データの受信までの時間の閾値を示すタイムアウト時間を含む、プログラム実行装置。
    The program execution device according to claim 2.
    The reception parameter used in the function block and the reception function is a program execution device including a timeout time indicating a threshold value of the time from the transmission of the command by the transmission function to the reception of the reception data by the reception function.
  9.  請求項2に記載のプログラム実行装置であって、
     前記プログラマブルコントローラは、
     前記スキャン処理部で読み書きされない一時的なデバイスにセットされた前記受信データを、前記スキャン処理部で読み書きされるデバイスに、前記スキャン処理部の実行が行われる期間以外の期間にセットする、プログラム実行装置。
    The program execution device according to claim 2.
    The programmable controller is
    Program execution that sets the received data set in the temporary device that is not read / written by the scan processing unit to the device that is read / written by the scan processing unit during a period other than the period in which the scan processing unit is executed. Device.
  10.  請求項2に記載のプログラム実行装置であって、
     前記ファンクションブロック及び前記送信機能で用いられる送信パラメータは、前記サービス実行装置にアクセスするためのアクセス先を含み、
     前記プログラマブルコントローラは、
     前記サービス実行装置からの受信データの受信履歴に基づいて前記アクセス先を学習する、プログラム実行装置。
    The program execution device according to claim 2.
    The transmission parameters used in the function block and the transmission function include an access destination for accessing the service execution device.
    The programmable controller is
    A program execution device that learns the access destination based on the reception history of data received from the service execution device.
  11.  サービスを提供するサービス実行装置と通信可能なプログラマブルコントローラの通信方法であって、
     ラダープログラム及びファンクションブロックを含むプログラムを定期的に実行するスキャン処理と、前記スキャン処理の実行結果に基づいてデータ処理を行うリフレッシュ処理とを交互に行い、
     前記スキャン処理及び前記リフレッシュ処理とは非同期で、前記サービス実行装置へコマンドを送信する送信機能と、前記スキャン処理及び前記リフレッシュ処理とは非同期で、前記サービス実行装置からデータを受信データとして受信し、かつ、当該受信データをデバイスにセットするためにメモリ領域に格納する受信機能とを有する外部通信処理を行う、通信方法。
    It is a communication method of a programmable controller that can communicate with a service execution device that provides a service.
    A scan process for periodically executing a program including a ladder program and a function block and a refresh process for performing data processing based on the execution result of the scan process are alternately performed.
    A transmission function for transmitting a command to the service execution device asynchronously with the scan process and the refresh process, and data received from the service execution device as received data asynchronously with the scan process and the refresh process. A communication method that performs external communication processing having a reception function of storing the received data in a memory area in order to set the received data in the device.
PCT/JP2020/038620 2020-10-13 2020-10-13 Programmable controller, program execution device, and communication method WO2022079800A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/JP2020/038620 WO2022079800A1 (en) 2020-10-13 2020-10-13 Programmable controller, program execution device, and communication method
JP2022556723A JP7325658B2 (en) 2020-10-13 2020-10-13 Program execution device and communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2020/038620 WO2022079800A1 (en) 2020-10-13 2020-10-13 Programmable controller, program execution device, and communication method

Publications (1)

Publication Number Publication Date
WO2022079800A1 true WO2022079800A1 (en) 2022-04-21

Family

ID=81207871

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2020/038620 WO2022079800A1 (en) 2020-10-13 2020-10-13 Programmable controller, program execution device, and communication method

Country Status (2)

Country Link
JP (1) JP7325658B2 (en)
WO (1) WO2022079800A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276508A (en) * 1999-03-26 2000-10-06 Omron Corp Tool device, method for constructing network system, and recording medium
JP2002006907A (en) * 2000-06-26 2002-01-11 Omron Corp I/o unit and programmable controller system
JP2005293310A (en) * 2004-03-31 2005-10-20 Omron Corp Node, tool, network system, and communication method for shared data
JP2011008578A (en) * 2009-06-26 2011-01-13 Mitsubishi Electric Corp Control device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276508A (en) * 1999-03-26 2000-10-06 Omron Corp Tool device, method for constructing network system, and recording medium
JP2002006907A (en) * 2000-06-26 2002-01-11 Omron Corp I/o unit and programmable controller system
JP2005293310A (en) * 2004-03-31 2005-10-20 Omron Corp Node, tool, network system, and communication method for shared data
JP2011008578A (en) * 2009-06-26 2011-01-13 Mitsubishi Electric Corp Control device

Also Published As

Publication number Publication date
JP7325658B2 (en) 2023-08-14
JPWO2022079800A1 (en) 2022-04-21

Similar Documents

Publication Publication Date Title
US10274936B2 (en) Control apparatus
US20190342396A1 (en) Data server unit and communication system
JP2010033435A (en) Control apparatus, control method, and computer program
WO2022079800A1 (en) Programmable controller, program execution device, and communication method
TWI461870B (en) Programmable controller
CN106528217B (en) on-site programmable gate array program loading system and method
CN111641669A (en) Dynamic load balancing in a network-centric process control system
CN113741166B (en) Industrial control logic redundancy implementation method based on multi-CPU industrial system controller
US10054926B2 (en) Programmable controller and control method of programmable controller
JP6419400B1 (en) PLC, network unit, CPU unit, and data transfer method
JP2010079355A (en) Cooperative control system between a plurality of plcs
JP2010231809A (en) Controller and computer program
KR101332726B1 (en) Controller-field bus data converter
US20220397880A1 (en) Control device
WO2020010521A1 (en) Positioning method, positioning device, positioning system and readable storage medium
US10768601B2 (en) Programmable controller
CN109154803B (en) Programmable logic controller
JP6356736B2 (en) Controller system and control method
JP5687171B2 (en) Controller, monitoring unit, and sequence program update method
KR102042737B1 (en) Monitoring system, device and engineering tool
WO2021145124A1 (en) Control device
JP5045168B2 (en) Peripheral device control apparatus and method
WO2020166131A1 (en) Remote i/o system
JP2017085831A (en) Motor controller
JP5330321B2 (en) Programmable display

Legal Events

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

Ref document number: 20957629

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022556723

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20957629

Country of ref document: EP

Kind code of ref document: A1