Programmable logic controller
The programmable logic controller employs separate cores for control logic and motion control, along with synchronization mechanisms, to improve the management and execution of user programs and motion control, addressing data exchange complexities in multi-core PLCs.
Patent Information
- Application Number
- JP2024024317
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-02-21
- Publication Date
- 2025-09-02
AI Technical Summary
The use of multi-core processors in programmable logic controllers (PLCs) complicates data exchange between ladder programs and motion control, making it difficult to manage the execution of user programs and motion control effectively.
A programmable logic controller with a first core for control logic calculations and a second core for motion control, along with a memory and synchronization control units to manage variable sets and synchronize data between the cores, facilitating the execution of user programs and motion control.
Enhances the management of user programs and motion control execution, ensuring consistency and responsiveness by minimizing data exchange delays and maintaining synchronization between variable sets.
Smart Images

Figure 2025127553000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a programmable logic controller. [Background technology]
[0002] In factory automation, programmable logic controllers (PLCs) are the core controllers that control industrial machinery. The technology of controlling the position of a workpiece by driving a motor using a motor drive device (motion unit) connected to a PLC is called motion control (Patent Documents 1 and 2). When a ladder program is executed in the PLC, motion command values are generated according to the ladder program, and the motion command values are sent to motors, etc. at predetermined timings. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2006-107312 [Patent Document 2] Japanese Patent Application Laid-Open No. 2006-178818 Summary of the Invention [Problem to be solved by the invention]
[0004] Incidentally, with the advancement of processor technology, there are cases where multi-core processors are used in PLCs. By using a multi-core processor and dividing the processing of ladder programs and motion among the cores, performance is improved and there is less interference between the processes. On the other hand, the exchange of data read and written by the execution of ladder programs and data read and written by motion control becomes complicated.
[0005] Therefore, an object of the present invention is to facilitate management of the execution of user programs such as ladder programs and motion control. [Means for solving the problem]
[0006] The present invention is, for example, a processor having a first core that executes control logic calculations based on a user program and a second core that executes motion control based on the user program; a memory that stores a first set of variables accessed by the first core when executing the control logic operation, and a second set of variables accessed by the second core when executing the motion control; a management unit that manages the sequential execution of a control logic operation executed by the first core and a refresh process of the first variable set stored in the memory; a synchronization control unit that synchronizes the variables related to the motion control in the first variable group with the corresponding variables in the second variable group through the refresh process; The present invention provides a programmable logic controller comprising: [Effects of the Invention]
[0007] According to the present invention, it becomes easy to manage the execution of a user program such as a ladder program and motion control. [Brief explanation of the drawings]
[0008] [Figure 1] Diagram explaining a PLC system [Figure 2] Diagram explaining the basic unit [Figure 3] FIG. 1 is a diagram illustrating a process executed by a first core. [Figure 4] FIG. 10 is a diagram illustrating a process executed by a second core. [Figure 5] Diagram explaining the synchronization process of input variables [Figure 6] A diagram illustrating a user interface for selecting a synchronization method. [Figure 7] Diagram explaining function blocks [Figure 8] Diagram explaining variable groups [Figure 9] A diagram explaining how to synchronize operation commands [Figure 10] Diagram explaining how to synchronize output variables [Figure 11] A diagram explaining the synchronous processing that is executed at the execution timing of the function block. DETAILED DESCRIPTION OF THE INVENTION
[0009] Hereinafter, the embodiments will be described in detail with reference to the accompanying drawings. Note that the following embodiments do not limit the scope of the invention as claimed, and not all combinations of features described in the embodiments are necessarily essential to the invention. Two or more of the features described in the embodiments may be arbitrarily combined. Furthermore, the same reference numerals are used for the same or similar components, and redundant explanations will be omitted.
[0010] (1) PLC system FIG. 1 shows an example of the configuration of a programmable logic controller system (hereinafter referred to as PLC system 1) according to an embodiment of the present invention. As shown in FIG. 1, this PLC system 1 includes a PC, which is a setting support device for editing user programs such as ladder programs; a basic unit 3, which is a PLC (programmable logic controller) for comprehensively controlling various control devices installed in a factory or the like; multiple expansion units 13-15 connected via an expansion bus 500; and multiple motor drivers 4a-4c. Examples of the multiple expansion units 13-15 include various units such as a motion unit, an input unit, an output unit, an input / output unit (I / O unit), an analog conversion unit, and a communication unit. The multiple motor drivers 4a-4c drive motors 10a, 10b, and 10c, respectively.
[0011] The user program created by PC2, which is a setting support device, may be created using a graphical programming language such as a ladder language or a flowchart-format motion program, or may be created using a high-level programming language such as C language.
[0012] In the PLC system 1, as described above, one or more expansion units 13 to 15 (e.g., I / O unit, analog input unit, analog output unit) are connected to the basic unit 3. The basic unit 3 may also be called a CPU unit or a main unit. The motor drivers 4a to 4c may also be called slave devices or peripherals.
[0013] The basic unit 3 has a display unit 5 and an operation unit 6. The display unit 5 can display the operating status of the motor drivers 4a to 4c, etc. The display unit 5 may switch the display content depending on the operation of the operation unit 6. The display unit 5 usually displays the current values (device values) of devices in the PLC system 1 and error information (presence or absence of alarms or warnings) that has occurred in the PLC system 1. A device is a memory area provided for storing device values (device data) and may also be called a device memory. A device value is information that indicates the input status from input devices, the output status to output devices, and the status of internal relays (auxiliary relays), timers, counters, data memories, etc. that are set in a user program. Device values are classified into bit and word types. A bit device stores a 1-bit device value. A word device stores a 1-word device value.
[0014] The motor drivers 4a to 4c are provided to extend the functions of the PLC system 1. The motors 10a to 10c are controlled by the motor drivers 4a to 4c, respectively. The motor drivers 4a to 4c supply power to the motors 10a to 10c and control the amount of rotation and the like in accordance with commands from the basic unit 3. The motors 10a to 10c are, for example, servo motors or stepping motors.
[0015] The PC2 is a computer that provides a development environment for the PLC system 1. The PC2 is, for example, a portable notebook or tablet personal computer, and is equipped with a display unit 7 and an operation unit 8. A ladder program, which is an example of a user program for controlling the PLC system 1, is created using the PC2. The created ladder program is converted into mnemonic code within the PC2. The PC2 is connected to the basic unit 3 of the PLC system 1 via a communication cable 9a such as a universal serial bus (USB) and sends the ladder program converted into mnemonic code to the basic unit 3. The basic unit 3 converts the ladder program into machine code and stores it in a memory provided in the basic unit 3. Note that, although the mnemonic code is transmitted to the basic unit 3 in this example, the present invention is not limited to this. For example, the PC2 may convert the mnemonic code into intermediate code and transmit the intermediate code to the basic unit 3.
[0016] Although not shown in FIG. 1, the operation unit 8 of the PC 2 may include a pointing device such as a mouse connected to the PC 2. The PC 2 may also be configured to be detachably connected to the basic unit 3 via a communication cable 9a other than USB. The PC 2 may also be connected to the basic unit 3 wirelessly, without using the communication cable 9a. In this case, the communication cable 9a may be understood to represent a wireless link.
[0017] The basic unit 3 and motor driver 4a are connected by a communication cable 9b, and can communicate with each other (e.g., cyclic communication, message communication) via the communication cable 9b. The motor drivers 4a and 4b are connected by a communication cable 9c, and can communicate with each other via the communication cable 9c. The motor driver 4b can communicate with the basic unit 3 via the communication cables 9b and 9c. The motor drivers 4b and 4c are connected by a communication cable 9d, and can communicate with each other via the communication cable 9d. Furthermore, the motor driver 4c can communicate with the basic unit 3 via the communication cables 9b, 9c, and 9d.
[0018] In the following, when common matters are described for the motor drivers 4a to 4c, they will be referred to as the motor driver 4. Similarly, when common matters are described for the motors 10a to 10c, they will be referred to as the motor 10.
[0019] The basic unit 3 may receive a detection signal from a sensor 11 connected to the basic unit 3, or may control a load 12 (e.g., an air cylinder, a hydraulic cylinder) connected to the basic unit 3. The motor driver 4 and the motor 10 may also be an air cylinder, a hydraulic cylinder, or the like.
[0020] (2) Basic unit 2 shows the hardware configuration of the basic unit 3. The processor 21 includes multiple CPU cores (e.g., a first core 31 and a second core 32). The ROM 22 is a non-volatile memory and stores a control program 29. The non-volatile RAM 23 stores user programs (a sequence program 24 and a motion program 25) created by the PC 2. The communication circuit 26 includes various communication circuits (e.g., a serial communication circuit, a parallel communication circuit, a wired network communication circuit, and a wireless communication network circuit) for communicating with the PC 2, the motor driver 4, etc. The input / output circuit 27 includes an input circuit that receives a signal input from an input device (sensor 11) and an output circuit that outputs a control signal to the load 12.
[0021] The first core 31 is a CPU core that executes sequence control according to the sequence program 24. The sequence program 24 is, for example, a ladder program written in a ladder language or a program written in an ST language. ST is an abbreviation for structured text. Sequence control consists of interlocks and stepping. An interlock prohibits a certain step when a certain condition is met (or not met). For example, prohibiting the operation of a robot arm when a safety fence door is open. Stepping refers to executing multiple steps in a predetermined order. The second core 32 is a CPU core that executes motion control according to the motion program 25. The control target of motion control is, for example, a linear stage or a robot (e.g., motor 10). Furthermore, motion control is driven by sequence control. As one step of sequence control, motion control receives an operation command as sequence control, executes an operation according to the operation command, and outputs a completion signal to the sequence control. Motion control exposes position (distance), speed, torque, etc., as well as the status of signals involved in motion control, to sequence control. Sequence control uses these to determine the next operation command. Motion control executes a predetermined operation using, for example, travel distance, speed, acceleration, jerk, etc. When interpolation of position data is performed, information indicating the trajectory is required. When torque control is performed, a torque command value is required. These may be transferred as parameters in advance, or passed from sequence control to motion control together with the operation command.
[0022] The basic unit 3 has the function of executing a sequence control program written in LD (ladder) language or ST language. Furthermore, the basic unit 3 of this embodiment may also have a communication function and a motion control function. The communication function and the motion control function of the basic unit 3 are treated as an expansion unit built into the basic unit 3.
[0023] The PLC's basic unit 3 and each of the expansion units 13 to 15 each execute a repetitive process. The timing at which the basic unit 3 executes a program and the timing at which the expansion units 13 to 15 execute a repetitive process can be synchronized, and data exchange can be synchronized. This function may be called an "inter-unit synchronization function." The motion control function and sequence control function included in the basic unit 3 can also synchronize the execution timing of processes and synchronize data exchange using the "inter-unit synchronization function."
[0024] Both sequence control and motion control are executed repeatedly (loops). The sequence control cycle, called the scan, scan period, or scan time, is variable. The first core 31 executes the sequence program 24 for each scan, updating the interlock and process step status. The control content of the sequence program 24 is diverse, including motion control as well as external communication, product data collection, and temperature control. As a result, the scale of the sequence program 24 tends to be large, and the scan period (scan time) tends to be long. The scan time ranges from several tens of microseconds to several tens of milliseconds, depending on the scale and content of the PLC system 1. The scan time varies for each scan and may change depending on the state of the PLC system 1 (immediately after startup, during product manufacturing, if an error occurs during manufacturing, etc.).
[0025] The execution cycle of motion control is called the "control cycle." The second core 32 executes the motion program 25 at each control cycle, monitors activation signals from the outside (e.g., sequence control), updates commands to the motor driver 4, and updates the status exposed to the sequence control. It is desirable that commands to the motor driver 4 be issued at regular intervals to ensure the stability of the feedback commands. Therefore, the control cycle is generally a regular cycle. A wiring-saving system (servo wiring-saving system) may be used as a communication system between the basic unit 3 and the motor driver 4. In this case, in the servo wiring-saving system, the basic unit 3 serves as the master and the motor driver 4 serves as the slave. The master and slave then work together to transmit commands at regular intervals. For this reason, the control cycle is also a regular interval.
[0026] The RAM 28 has a first memory area 36 in which a set of variables for sequence control is stored, and a second memory area 37 in which a set of variables for motion control is stored. The first memory area 36 stores, for example, a first set of variables A used by sequence control. The second memory area stores a second set of variables B used by motion control. In other words, the first memory area 36 stores input variables and output variables that are read and written by sequence control. The second memory area 37 stores variables that are read and written by motion control.
[0027] Note that there is a correspondence (association, linkage) between variables A1, A2, A3, etc. included in the first variable set A and variables B1, B2, B3, etc. included in the second variable set B. For example, a variable B1 corresponding to a certain variable A1 included in the first variable set A is included in the second variable set B. Therefore, variables A1 and B1 have a correspondence relationship and need to be synchronized. Conversely, a variable A2 corresponding to a certain variable B2 included in the second variable set is included in the first variable set A. Therefore, variables A2 and B2 have a correspondence relationship and need to be synchronized.
[0028] The first core 31 updates the variables stored in the first storage area 36 for each scan time according to sequence control. The second core 32 updates the variables stored in the second storage area 37 for each control cycle according to motion control.
[0029] First core 31 also functions as management unit 34, first synchronization control unit 35a, and second synchronization control unit 38a. Second core 32 also functions as first synchronization control unit 35b and second synchronization control unit 38b. Management unit 34 manages the sequential execution of the control logic calculations executed by first core 31 and the refresh process of the first variable set stored in the first storage area of RAM 28.
[0030] The first synchronization control unit 35a and the first synchronization control unit 35b operate in cooperation with each other to synchronize the input variables. For example, the first synchronization control unit 35a and the first synchronization control unit 35b synchronize the input variables stored in the second storage area 37 and copy them to the first storage area 36. The first synchronization control unit 35a and the first synchronization control unit 35b may communicate with each other to notify each other of the timing to copy the variables. Alternatively, the first synchronization control unit 35a and the first synchronization control unit 35b may communicate with each other via the management unit 34 to notify each other of the timing to copy the variables. Alternatively, the first synchronization control unit 35a and the first synchronization control unit 35b may copy the variables based on the timing notified by the management unit 34.
[0031] The second synchronization control unit 38a and the second synchronization control unit 38b work in cooperation with each other to synchronize the output variables. The second synchronization control unit 38a and the second synchronization control unit 38b synchronize the output variables stored in the first storage area 36 and copy them to the second storage area 37. The second synchronization control unit 38a and the second synchronization control unit 38b may communicate with each other to notify each other of the timing to copy the variables. Alternatively, the second synchronization control unit 38a and the second synchronization control unit 38b may communicate with each other via the management unit 34 to notify each other of the timing to copy the variables. Alternatively, the second synchronization control unit 38a and the second synchronization control unit 38b may copy the variables based on the timing notified by the management unit 34.
[0032] These synchronized copy processes are called refresh processes. By the synchronized copy processes, the input variables stored in the first storage area 36 are updated in synchronization with the execution of sequence control. The output variables stored in the first storage area 36 are output in synchronization with the execution of sequence control.
[0033] Sequence control may have multiple tasks. When sequence control has multiple tasks, the user can select which task to synchronize with to copy the storage area. For example, copying may be performed at the end of the task with the lowest priority, or at the end of inter-unit synchronization that is executed as an interrupt synchronized with motion control. These are selectable by the user.
[0034] The second synchronization control units 38a and 38b synchronize the variables related to motion control (e.g., operation commands, command values, and status) in the first variable group with the corresponding variables in the second variable group through a refresh process. For example, variables that store operation commands issued by sequence control are copied to variables on the motion control side. Also, variables that store current values (travel distances) and statuses in motion control are copied to variables on the sequence control side.
[0035] More specifically, the first synchronization control unit 35a and the first synchronization control unit 35b copy input variables of the variable set stored in the second storage area 37 to corresponding input variables of the variable set stored in the first storage area 36. The second synchronization control unit 38b and the second synchronization control unit 38b copy output variables of the variable set stored in the first storage area 36 to corresponding output variables of the variable set stored in the second storage area 37. There are two types of synchronization processing: a refresh that is performed before or after the start or execution (END processing) of the lowest-priority sequence control, and a refresh that is performed at the timing of inter-unit synchronization processing that is executed as an interrupt during sequence control. Which synchronization processing is applied is specified by setting information that is set in advance by the PC2. Different settings may be adopted for each variable and each node.
[0036] The first synchronization control units 35a and 35b control the spinlock or semaphore for the first storage area 36. The second synchronization control units 38a and 38b control the spinlock or semaphore for the second storage area 37.
[0037] The processor 21 is connected to the PC 2 via the communication circuit 26, and is also connected to the motor driver 4 via the communication circuit 26 to communicate with it. The communication circuit 26 may have, for example, a serial communication circuit compatible with USB. The communication circuit 26 may have a communication circuit capable of executing communication compatible with industrial Ethernet protocols (e.g., EtherCAT, EtherNet / IP, PROFINET, MECHATROLINK-III). The communication circuit 26 may execute cyclic communication and message communication.
[0038] (3) Multi-core processor In this embodiment, the processor 21 is a multi-core processor. Here, the reason for separating the core that executes sequence control from the core that executes motion control will be explained.
[0039] As described above, motion control requires updating the commands to the motor driver 4 for each control period. Therefore, it is necessary to maintain a constant control period. On the other hand, the control period of motion control is relatively less dependent on the control content. Therefore, it is easy to maintain a constant control period of motion control.
[0040] Sequence control covers a wide range of control content. For example, sequence control can include loops with heavy loads or processes whose processing time depends on the external environment. In addition, the processing time can vary significantly depending on how the sequence program 24 is written and the external environment, which can cause significant changes in scan time. However, in sequence control, changes in scan time are often tolerated compared to motion control.
[0041] Conventionally, sequence control and motion control are executed on a single core. As mentioned above, the repetition period (scan time) of sequence control is variable, while the execution period (control period) of motion control is constant. Although sequence control tasks and motion control tasks are executed in a time-sharing manner, if the sequence control task takes a long time, the motion control is affected. In other words, the execution period (control period) of motion control becomes inconsistent, which may result in a control error. For example, assume that a motion command for a first axis and a motion command for a second axis are issued during the i-th scan time. The sequence control side assumes that the motion command for the first axis and the motion command for the second axis are executed simultaneously in parallel. In this case, the motion control side may execute the motion command for the first axis during the j-th control period and the motion command for the second axis during the j+1-th control period. As mentioned above, the sequence control side assumes that the motion command for the first axis and the motion command for the second axis are executed simultaneously in parallel during the same control period. Therefore, if a motion command for the first axis is executed in the jth control cycle and a motion command for the second axis is executed in the j+1th control cycle, problems may occur, such as the timing of control execution differing depending on the axis or control errors.
[0042] If the processor 21 is a multi-core processor, it is advantageous to assign the sequence control and the motion control to different cores, so that the motion control and the sequence control are executed independently and are less likely to interfere with each other.
[0043] However, allocating different cores to sequence control and motion control creates the following problems: Commands output from sequence control must be quickly transmitted to motion control. Motion control must quickly notify sequence control that it has completed a specified operation. For this reason, it is desirable to minimize the delay in transmitting information (reducing delay).
[0044] Sequence control may combine multiple pieces of data to perform some kind of processing. In such cases, it is desirable to always maintain consistency between the multiple pieces of data. The same data is updated repeatedly during a single scan, and the data is finalized at the end of the scan. In this case, it is desirable that the data not be referenced during the scan. For this reason, it is desirable that "a group of data is read and written together" (ensuring synchronicity between multiple pieces of data).
[0045] Alternatively, the sequence control may be divided into a first sequence control that is involved in motion control and a second sequence control that is not involved in motion control. The first core 31 then executes the second sequence control, and the second core 32 executes both the first sequence control and the motion control. In this case, the scan time of the first sequence control matches the control period of the motion control, thereby reducing delays and ensuring synchronism. However, the user must appropriately adjust the size of the program for the first sequence control so that the scan time of the first sequence control matches the control period of the motion control, which can be a very difficult task for the user. Furthermore, it is necessary to reduce delays and ensure synchronism between the first sequence control and the second sequence control.
[0046] (3) Solution (3-1) Synchronization of input variables In this embodiment, a first memory area 36, which is a memory area for sequence control, and a second memory area 37, which is a memory area for motion control, are secured independently and separately in RAM 28. A variable set A referenced by sequence control is stored in first memory area 36. A variable set B updated by motion control is stored in second memory area 37. First core 31 sequentially executes sequence control and refreshes variable set A. Here, first synchronization control units 35a and 35b copy variable set B, which has been updated by motion control, to variable set A referenced by sequence control as a refresh.
[0047] FIG. 3 shows the process executed by the first core 31 for each scan.
[0048] In S1, the first core 31 executes sequence control in accordance with the sequence program 24. The first core 31 refers to the variable set A stored in the first storage area 36 for each scan.
[0049] In S2, the first core 31 executes a refresh. As described above, the first core 31 (first synchronization control units 35a and 35b) copies the variable set B updated by the motion control to the variable set A referenced by the sequence control.
[0050] FIG. 4 shows the process executed by the second core 32 for each control period.
[0051] In S11, the second core 32 executes motion control in accordance with the motion program 25. Here, the second core 32 can update the variable set B for each control cycle. For example, the second core 32 may rewrite the variable set B multiple times within one control cycle.
[0052] In S12, the second core 32 notifies the management unit 34 that it has updated variable set B. When the management unit 34 is notified that variable set B has been updated, it instructs the first synchronization control units 35a and 35b to copy (synchronize) variable B to variable set A at the timing of the next refresh.
[0053] FIG. 5 shows the timing at which variable set B is reflected in variable set A by a refresh. As described above, the execution period (scan time) of sequence control is variable, but the execution period (control period) of motion control is fixed. When the first sequence control is completed, first synchronization control units 35a and 35b execute a refresh. That is, at that time, variable set B stored in second storage area 37 is copied to the corresponding variable set A. Note that the timing at which the values of multiple variables included in variable set B are changed by motion control varies, but the values of multiple variables included in variable set B are determined all at once at the end of the control period. Furthermore, because variable set B is copied all at once to variable set A, synchronicity between multiple variables is ensured.
[0054] (3-2) Setting the timing of refresh The sequence control has multiple tasks. Each task includes multiple processes that are executed sequentially (serially). The multiple tasks are executed in parallel. However, the multiple tasks of the sequence control are executed by the first core 31. Therefore, in reality, the tasks are executed in a time-sharing manner according to the priority of each task. In other words, a task with a higher priority is always executed before a task with a lower priority.
[0055] Simple sequence control involves a single task. If the sequence control has few processing tasks, the scan time will be short. If the sequence control has many processing tasks, the scan time will be long or will vary.
[0056] Complex sequence control involves multiple tasks. Processing that needs to be executed in short cycles is written in a task with a short execution cycle.
[0057] Two or more priorities may be provided. For example, there may be four levels of priority. (i) Priority: High Highest priority. Interrupt. (ii) Priority: Medium An interrupt that is executed when a high priority interrupt is not being executed. (iii) Priority: Low This is the process that is executed when no interrupts with high or medium priority are being executed. (iv) Scanning: A process that is executed when no interrupts of any priority are running.
[0058] Priority is set for each task (program module) in the PC 2 and written to the non-volatile RAM 23 as setting information that forms part of the project. Of the multiple tasks included in sequence control, the priority of a task involved in motion control may be set higher than the priority of a task not involved in motion control. This improves the responsiveness of the group of variables involved in motion control to sequence control and maintains simultaneity among the multiple variables included in the group of variables.
[0059] Specifically, the refresh of the variables involved in motion control is executed by linking it to one of the tasks. In the sequence control of the linked task, the motion control variable group B can be referenced with a delay of one cycle while maintaining simultaneity.
[0060] FIG. 6 shows a UI 60 for setting the refresh timing, which is displayed on the display unit 7 by the PC 2. UI is an abbreviation for user interface. In this example, the UI 60 has a pull-down list 61 that displays multiple refresh timings (refresh methods) as options. The user selects one of the options from the pull-down list 61 via the operation unit 8.
[0061] When inter-unit synchronization is selected, the synchronization process for the variable group is executed at the timing of execution of inter-unit synchronization. Inter-unit synchronization is one of the tasks. A priority may also be assigned to inter-unit synchronization.
[0062] As mentioned above, the inter-unit synchronization function synchronizes the execution timing of the task (sequence program) of the basic unit 3 with the execution timing of the repetitive processing of the expansion units 13 to 15. By synchronizing the variable refresh timing between units, the execution of the task of the basic unit 3, the repetitive processing of the expansion units 13 to 15, and the synchronization processing of the motion input / output variables of the basic unit 3 can all be executed in synchronization. Furthermore, by making the motion control function built into the basic unit 3 the target of inter-unit synchronization, the repetitive processing of the built-in motion control function can also be the target of the above-mentioned synchronization.
[0063] When batch (END processing) is selected, synchronization processing of the variable group is executed at the timing of refresh execution. Within one scan time, execution of the sequence program 24 and END processing (data exchange with various peripheral functions) are executed sequentially. Refresh related to motion control is also executed at the timing of END processing.
[0064] Also, here, only "inter-unit synchronization" and "batch (END processing)" are shown as timing options. However, program execution by interrupt from the expansion units 13 to 15 or program execution at a fixed cycle within the basic unit 3 may also be selectable as timing.
[0065] The basic unit 3 has a direct communication function. Figure 7 shows a function block 70 for executing direct communication. The function block 70 is written in the sequence program 24. There are cases where it is necessary to obtain the latest variable values at the exact timing required by the sequence program 24. In such cases, when the function block 70 is executed, the status is updated on the spot. In this example, the variable to be updated is specified as the Target to be updated by direct communication. In this way, by using the function block 70, it is possible to synchronize some variables without waiting for a refresh.
[0066] (3-3) Variable mechanism for realizing refresh FIG. 8 shows the mechanism of variables for realizing refresh. Refresh and sequence control are executed sequentially. In refresh, first synchronization control units 35a and 35b cooperate to copy variable set B (input variables) for motion control stored in second storage area 37 to variable set A (input variables) for sequence control stored in first storage area 36. Motion control is still being executed during copying. In order to ensure simultaneity among the multiple variables included in variable set B, some ingenuity is required for refresh.
[0067] According to FIG. 8, the variable set B for motion control has three entities B-1, B-2, and B-3. In the initial state, entity B-1 is the entity referenced as a copy source by sequence control. Entity B-2 is the entity to which motion control writes. Entity B-3 is the entity to be referenced next. In other words, entity B-3 is the next write target from motion control and the next reference area from sequence control. The areas (roles) to which entities B-1, B-2, and B-3 are assigned may be stored in RAM 28.
[0068] The motion control (first synchronization control units 35a, 35b) swaps the entity B-2 to be written with the entity B-3, which is the next reference area, before updating the variable set B. In other words, the entity B-2 is changed to the next reference area, and the entity B-3 is changed to the write target area.
[0069] Before the sequence control reads the values of variable set B from entity B-1, the first synchronization control units 35a and 35b determine whether entity B-2, which has been changed from the write target area to the next reference area, has been updated. If entity B-2 has been updated, the first synchronization control units 35a and 35b swap the roles of entity B-1, the copy source area, and entity B-2, the next reference area. In other words, the role of entity B-2 is changed to the copy source area, and the role of entity B-1 is changed to the next reference area. As a result, the latest value written by motion control is read from entity B-2, which holds the value, and copied to variable set A.
[0070] By the way, sequence control and motion control need to have exclusive access to the variable area (so that the other cannot operate it while one is writing to it), but they only need to have exclusive access to the second memory area 37 for a very short time to switch the roles of the entities.
[0071] In this way, by preparing three entities B-1, B-2, and B-3 for variable set B, the motion control can always write the latest value to variable set B. Furthermore, the sequence control can always refer to the "latest value" that the motion control has updated.
[0072] Similarly, entities A-1, A-2, and A-3 may be prepared for variable set A, and the roles of entities A-1, A-2, and A-3 may be switched.
[0073] (3-4) Update output variables, etc. (3-4-1) Operation command The above explanation has been about input variables, but it also applies to output variables.
[0074] FIG. 9 is a diagram illustrating the update process for output variables. Here, a command buffer A is allocated in the first storage area 36, and a command buffer B is allocated in the second storage area 37. Operation commands and output variables are written to command buffer A by sequence control. Note that the operation commands may also be understood as part of the output variables. Command buffer B is updated by second synchronization control units 38a, 38b at the end of the control period that follows the timing at which command buffer A is updated.
[0075] 9, during the second scan time, the first core 31 issues operation commands i and ii in accordance with the sequence program 24, issues operation commands i and ii to the first storage area 36 functioning as command buffer A, and stores operation commands i and ii in the first storage area 36 functioning as command buffer A. Then, at the refresh timing at the end of the second scan time, the second synchronization control units 38a and 38b copy operation commands i and ii from command buffer A to command buffer B.
[0076] In the first control cycle after the refresh is executed, the second core 32 executes the operation commands i and ii stored in the second storage area 37, which functions as the command buffer B, in accordance with the motion program 25. As a result, the operation commands i and ii, which are intended to be executed in parallel on the sequence control side, are also executed in parallel on the motion control side.
[0077] (3-4-2) Output variables 10 shows how variable set A (e.g., torque command and speed limit) generated by first core 31 during a certain scan time is transmitted to second core 32. First core 31 generates variable set A (e.g., torque command and speed limit) during a second scan time in accordance with sequence program 24 and stores it in first memory area 36. Second synchronization control units 38a and 38b copy variable set A (e.g., torque command and speed limit) stored in first memory area 36 to variable set B in second memory area 37 at the refresh timing at the end of the second scan time.
[0078] In the first control cycle after the refresh is executed, the second core 32 executes the motion program 25 using the variable set B (e.g., torque command and speed limit) stored in the second storage area 37. This ensures synchronicity between the variable sets A and B (e.g., torque command and speed limit).
[0079] (3-5) Prioritizing responsiveness Compared to variable groups, there are cases where responsiveness should take priority over simultaneity when it comes to operation commands. For example, synchronization processing of command buffers A and B may be performed when the above-described function block 70 is executed.
[0080] 11 shows an example of synchronization of command buffers A and B in accordance with the execution timing of function block 70. In this example, when function block 70 is executed at the second scan time, operation command i is issued and stored in command buffer A in first storage area 36. At the end of the control period following this timing, second synchronization control units 38a and 38b store operation command i stored in command buffer A in command buffer B secured in second storage area 37. Second core 32 executes operation command i in the next control period.
[0081] Similarly, when the function block 70 is executed at the second scan time, an operation command ii is issued and stored in the command buffer A of the first storage area 36. At the end of the control period following this timing, the second synchronization control units 38a, 38b store the operation command ii stored in the command buffer A in the command buffer B secured in the second storage area 37. The second core 32 executes the operation command ii in the next control period.
[0082] In this way, with respect to a plurality of operation commands, responsiveness may be prioritized over simultaneity.
[0083] (3-6) Cases where the synchronization timing of input variables and output variables differ For input variables, simultaneity is generally prioritized over responsiveness. Therefore, the update process (synchronization process) of the input variables is executed at the breakpoint of sequence control (refresh timing). On the other hand, for output variables, responsiveness is prioritized over simultaneity. Therefore, the output variables may be updated at the timing when the function block 70 is executed. In this way, the update timing of the input variables may differ from the update timing of the output variables and the operation commands.
[0084] (4) Technical concepts derived from the embodiments (Point 1) The processor 21 includes a first core 31 that executes control logic calculations (e.g., sequence control) based on a user program (e.g., sequence program 24) and a second core 32 that executes motion control based on the user program. RAM 28 stores a first variable set accessed by the first core 31 when executing the control logic calculations and a second variable set accessed by the second core 32 when executing motion control. A management unit 34 manages the sequential execution of the control logic calculations executed by the first core 31 and the refresh process of the first variable set stored in RAM 28. First synchronization control units 35a and 35b and second synchronization control units 38a and 38b synchronize variables related to motion control in the first variable set (e.g., operation commands i and ii, torque command, speed limit) with corresponding variables in the second variable set through the refresh process. According to the embodiment, the execution of a user program (sequence program 24) such as a ladder program and the management of motion control are facilitated.
[0085] (Point 2) The first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may synchronize variables related to motion control in the first variable group with corresponding variables in the second variable group at a pre-specified timing of the refresh process.
[0086] (Point 3) The user may specify in advance the timing of the END process as the timing of the refresh process. In this case, the first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may synchronize the variables related to motion control in the first variable set with the corresponding variables in the second variable set at the timing of the END process.
[0087] (Point 4) The user may specify in advance the timing of inter-unit synchronization as the timing of the refresh process. In this case, the first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may synchronize the variables related to motion control in the first variable set with the corresponding variables in the second variable set at the timing of inter-unit synchronization.
[0088] (Point 5) The user may specify in advance the timing of execution of a predetermined task as the timing of the refresh process. The predetermined task is also selected in advance by the user. In this case, the first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may synchronize the variables related to motion control in the first variable set with the corresponding variables in the second variable set at the timing of execution of the predetermined task.
[0089] (Point 6) In some cases, the variables related to motion control in the first variable group are input variables (input variables) to the control logic calculation. In this case, the first synchronization control units 35a and 35b may synchronize the variables related to motion control in the first variable group with the corresponding variables in the second variable group through a refresh process.
[0090] (Point 7) In some cases, the variables related to motion control in the first variable group are variables (output variables or commands) output from the control logic calculation. In this case, the second synchronization control units 38a and 38b may synchronize the variables related to motion control in the first variable group with the corresponding variables in the second variable group in response to the execution of the control logic calculation. As described above, the synchronization process (update process) of the output variables may be performed at the timing of the execution of the function block 70 in the sequence control.
[0091] (Point 8) The RAM 28 may have a first storage area 36 used by the control logic operations executed by the first core 31 to store a first set of variables, and a second storage area 37 used by the motion control executed by the second core 32 to store a second set of variables.
[0092] (Point 9) The first set of variables may be updated along a variable scan period of the user program, and the second set of variables may be updated along a fixed control period of the motion control.
[0093] (Point 10) In some cases, inter-unit synchronization processing is selected instead of refresh processing as processing for synchronizing variables related to motion control in the first variable set with corresponding variables in the second variable set. In this case, the first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may synchronize the variables related to motion control in the first variable set with corresponding variables in the second variable set through the inter-unit synchronization processing.
[0094] (Point 11) The user program may include a command (e.g., function block 70) for synchronizing a predetermined variable related to motion control in the first variable set with a predetermined corresponding variable in the second variable set. In this case, the first synchronization control units 35a, 35b and the second synchronization control units 38a, 38b may immediately synchronize the predetermined variable related to motion control in the first variable set with the predetermined corresponding variable in the second variable set in accordance with the command.
[0095] (Point 12) The first variable group may include multiple output variables for transmitting multiple operation commands issued by executing the user program. The second variable group may include multiple variables corresponding to the multiple output variables for transmitting the multiple operation commands. The second synchronization control units 38a and 38b update the multiple output variables in the same scan cycle among multiple consecutive scan cycles, which are the repeated execution cycles of the user program. The second synchronization control units 38a and 38b update the multiple variables in the second variable group corresponding to the multiple output variables for transmitting the multiple operation commands at the same timing. The motion control executes multiple operation commands by referring to the multiple variables in the same control cycle among multiple consecutive control cycles, which are the execution cycles of the motion control. This may ensure synchronicity for the multiple operation commands.
[0096] The invention is not limited to the above-described embodiment, and various modifications and variations are possible within the scope of the gist of the invention.
Claims
1. a processor having a first core that executes control logic calculations based on a user program and a second core that executes motion control based on the user program; a memory that stores a first set of variables accessed by the first core when executing the control logic operation, and a second set of variables accessed by the second core when executing the motion control; a management unit that manages the sequential execution of a control logic operation executed by the first core and a refresh process of the first variable set stored in the memory; a synchronization control unit that synchronizes the variables related to the motion control in the first variable group with the corresponding variables in the second variable group; A programmable logic controller comprising:
2. 2. The programmable logic controller according to claim 1, wherein the synchronization control unit synchronizes the variables related to motion control in the first group of variables with the corresponding variables in the second group of variables at a predetermined timing of a refresh process.
3. 3. The programmable logic controller of claim 2, wherein the synchronization control unit synchronizes the variables related to motion control in the first variable group with the corresponding variables in the second variable group at the timing of an END process that is pre-specified as the timing of the refresh process.
4. 3. The programmable logic controller according to claim 2, wherein the synchronization control unit synchronizes the variables related to motion control in the first variable group with the corresponding variables in the second variable group at an execution timing of inter-unit synchronization that is pre-specified as the timing of the refresh process.
5. 3. The programmable logic controller according to claim 2, wherein the synchronization control unit synchronizes the variables related to motion control in the first variable group with the corresponding variables in the second variable group at a task execution timing that is pre-specified as the timing of the refresh processing.
6. 2. The programmable logic controller of claim 1, wherein the synchronization control unit synchronizes the motion control-related variable in the first variable group with the corresponding variable in the second variable group through the refresh process when the motion control-related variable in the first variable group is a variable input to the control logic calculation.
7. 2. The programmable logic controller of claim 1, wherein when the variable related to motion control in the first variable group is a variable output from the control logic calculation, the synchronization control unit synchronizes the variable related to motion control in the first variable group with the corresponding variable in the second variable group in accordance with the execution of the control logic calculation.
8. The memory includes: a first storage area used by the control logic operation executed by the first core and storing the first set of variables; a second storage area used by the motion control executed by the second core and storing the second set of variables; 2. The programmable logic controller of claim 1, further comprising:
9. the first set of variables is updated along a scan period of the user program, the scan period being a variable period; 2. The programmable logic controller according to claim 1, wherein the second group of variables is updated along a constant control period, which is a control period of the motion control.
10. 4. The programmable logic controller of claim 3, wherein when inter-unit synchronization processing is selected instead of END processing as the timing for synchronizing the variables related to motion control in the first variable group with the corresponding variables in the second variable group, the synchronization control unit synchronizes the variables related to motion control in the first variable group with the corresponding variables in the second variable group at the timing of inter-unit synchronization.
11. 2. The programmable logic controller of claim 1, wherein when the user program includes an instruction word for synchronizing a predetermined variable related to the motion control in the first variable group with a predetermined corresponding variable in the second variable group, the synchronization control unit immediately synchronizes the predetermined variable related to the motion control in the first variable group with the predetermined corresponding variable in the second variable group in accordance with the instruction word.
12. the first variable group includes a plurality of output variables for transmitting a plurality of operation commands issued by executing the user program; the second variable group includes a plurality of variables corresponding to the plurality of output variables for transmitting the plurality of operation commands; the plurality of output variables are updated in the same scan cycle among a plurality of consecutive scan cycles which are repeated execution cycles of the user program, Among the second variable group, the plurality of variables corresponding to the plurality of output variables for transmitting the plurality of operation commands are updated at the same timing; 2. The programmable logic controller according to claim 1, wherein the motion control executes the plurality of operation commands by referring to the plurality of variables in the same control period among a plurality of consecutive control periods that are execution periods of the motion control.
Citation Information
Patent Citations
Motion controller
JP2006107312A
Motion controller, engineering tool, and c language execution system
JP2006178818A