The present disclosure relates to a production system, a program creation device, and an information storage medium.
Hitherto, there has been known a technology for creating a ladder program which indicates operations of an industrial machine such as a programmable logic controller (PLC). For example, in JP 2012-194678 A, there is described a technology which uses a program development support device to create a ladder program indicating operations of a PLC.
According to one aspect of the present disclosure, there is provided a production system, comprising circuitry configured to: associate a plurality of rungs included in a ladder program with one of a plurality of scan groups each having an execution cycle that is specifiable; allocate each of the plurality of scan groups to one of a plurality of processor cores of a controller so that each of the plurality of scan groups is distributed; and execute one or more rungs associated with one or more scan groups allocated to each of the plurality of processor cores in parallel in each of the execution cycles.
A first embodiment of the present disclosure, which is an example of an embodiment of a production system according to the present disclosure, is now described.
The program creation device 10 is a device which creates a program for the controller 20 to control the motor control devices 30. In the first embodiment, there is described a case in which a personal computer operated by a user corresponds to the program creation device 10, but the program creation device may be another device. For example, the program creation device 10 may be a tablet terminal, a smartphone, or a server computer.
For example, the program creation device 10 includes a CPU 11, a storage unit 12, a communication unit 13, an operation unit 14, and a display unit 15. The CPU 11 is a processor including one or more processor cores. The storage unit 12 includes at least one of a volatile memory or a nonvolatile memory. The communication unit 13 includes at least one of a communication interface for wired communication or a communication interface for wireless communication. The operation unit 14 is an input device, such as a mouse or a keyboard. The display unit 15 is a liquid crystal display or an organic EL display.
The controller 20 is a device which controls one or more motor control devices 30. For example, the controller 20 is a machine controller. The controller 20 may be any device which can directly or indirectly control a physical mechanism, such as a motor or a belt, and is not limited to a machine controller. For example, the controller 20 may be a PLC, a robot controller, a line controller which manages a line, or a cell controller which manages a unit referred to as a cell that is smaller than a line. The motor control device 30 may correspond to the controller in the present disclosure.
For example, the controller 20 includes a CPU 21A, a CPU 21B, a storage unit 22, and a communication unit 23. In the first embodiment, an example in which the CPUs 21A and 21B are single-core processors (processors including one processor core) is given. Thus, the controller 20 in the first embodiment includes a total of two processor cores. When the CPUs 21A and 21B are not distinguished, those CPUs are hereinafter simply referred to as “CPU 21.” The CPU 21 is a type of circuitry. The physical configurations of the storage unit 22 and the communication unit 23 may be the same as the physical configurations of the storage unit 12 and the communication unit 13, respectively.
It is sufficient for the controller 20 to include two or more processor cores, and the controller 20 may include three or more processor cores. It is sufficient for each CPU 21 to include one or more processor cores, and each CPU 21 may be a multi-core processor (processor including two or more processor cores). It is sufficient for the controller 20 to include one or more CPUs 21, and the controller 20 may include only one multi-core CPU 21, or may include three or more CPUs 21. That is, the two or more processor cores included in the controller are not required to be separated into separate circuits.
When the controller 20 includes a plurality of CPUs 21, the numbers of processor cores of the plurality of CPUs 21 may be different from each other. For example, one CPU 21 may include one core, and another CPU 21 may include three cores. The controller 20 may include both a single-core CPU 21 and a multi-core CPU 21. The processor core may be included in a processor referred to by a name other than CPU (for example, MPU).
Each of the motor control devices 30 is a device which controls a voltage to be applied to the motor 40 connected via a power line. The motor control device 30 is sometimes referred to as “servopack” (trademark) or “servo amplifier.” The motor control device 30 is capable of communicating to and from the controller 20. Communication between the controller 20 and the motor control device 30 may be periodic communication or non-periodic communication. A sensor, such as a motor encoder or a torque sensor, may be connected to the motor control device 30. The sensor may be connected to the controller 20.
At least one of the programs or data stored in each device may be supplied through the network. Moreover, the hardware configuration of each device is not limited to the above-mentioned example, and various types of hardware can be applied. For example, a reading unit (for example, memory card slot) for reading a computer-readable information storage medium and an input/output unit (for example, USB terminal) for connecting to an external device may be included. In this case, at least one of programs or data stored in the information storage medium may be supplied through the reading unit or the input/output unit. Moreover, a circuit called “FPGA” or “ASIC” may be included.
In the first embodiment, the controller 20 can be operated based on a ladder program. A ladder program is a program created in a ladder language. For example, the user creates a ladder program by using an engineering tool installed in the program creation device 10. In the first embodiment, a program before compilation (a ladder diagram that the user can understand visually) is called a ladder program, but a program after compilation (a program converted into a machine language) may also be referred to as a ladder program.
For example, the ladder program P1 includes processing to be performed on a register of the controller 20. Thus, each rung may include processing to be performed on the register of the controller 20. The register is a storage area of the controller 20. The processing to be performed on the register includes write processing of writing to the register and reference processing of referring to the register. Write processing is processing of writing a value to the register. Reference processing is processing of referring to a value held in the register. The processing itself to be performed on the register may be expressed by graphics and commands defined in a publicly known ladder language.
When all the processing of a ladder program P1 is executed by only the CPU 21A in order, it takes a long time for the processing to be executed because all the processing is executed by one processor core. However, by distributing the processing between the CPUs 21A and 21B, the time required for the processing can be reduced. Thus, in the first embodiment, the user performs programming for executing distributed processing. For example, when an engineering tool installed in the program creation device 10 is started, a program creation screen is displayed on the display unit 15.
For example, the user selects “system configuration” in the navigation window W10, and creates a module configuration. The module configuration is the physical configurations in the production system S. For example, the user inputs information on the physical configurations including the controller 20, the motor control device 30, the motor 40, I/O devices, and other peripheral devices. The motor 40 may be hereinafter referred to as “axis.” The user inputs the name of the CPU 21 and the name of the processor core as the module configuration.
For example, the user selects “scan group” from the “Program” tree in the navigation window W10, and creates a scan group. A scan group is a set of programs (applications) which are executed in a predetermined execution cycle. For example, one or more ladder programs P1 are associated with the scan group. Programs other than the ladder program P1 may be associated with the scan group. For example, when the user starts Procedure 2, a new creation screen for creating a scan group is displayed on the display unit 15.
In the first embodiment, separately from the scan group, the user can specify a control group. A control group is a set of physical configurations that are synchronized with each other. In the first embodiment, there is described a case in which a set of mutually synchronized axes corresponds to a control group, but the control group may also be a set of other configurations such as I/O devices. For example, when the user performs an operation to define a control group from the program creation screen SC1, a control group definition screen is displayed on the display unit 15.
For example, the user inputs the number of axes belonging to the control group into an input form F33. A list of axes belonging to the control group is displayed in the display area A32. The user inputs, into the display area A32, axis information (in the example of
For example, the user selects “Set variables and comments” from the “Program” tree in the navigation window W10, and sets variables and comments. Variables are pieces of information on which the write processing or the reference processing by the ladder program P1 are executed. For example, the user sets various variables, such as a variable for controlling an axis or a variable indicating a physical quantity detected by a torque sensor or the like. As the method of setting the variables and the comments itself, publicly known method can be used.
For example, the user creates the ladder program P1 from the work window W11. As the method of creating the ladder program P1 itself, a publicly known method can be used. For example, the user creates one or more rungs on the work window W11. The user arranges elements, for example, graphics such as coils and comments for each rung. The user can create a ladder program P1 having a hierarchical structure.
For example, the user sets the details of the scan group from the navigation window W10 of the program creation screen SC1. In Procedure 5, the user performs various settings, such as specification of the execution cycle of the scan group, specification of an association between the scan group and the control group, specification of an association between the scan group and the ladder program P1, and specification of the allocation of the scan group and the processor cores. In the first embodiment, a processing time screen and an associated rung screen are prepared as support for Procedure 5.
For example, the user specifies, from the display area A40, the processor core to which each scan group is to be allocated. As used herein, “allocate” means specifying the processor core which executes the ladder program(s) P1 associated with the scan group. The user specifies the processor core to which a scan group is to be allocated from among the processor cores defined in the module configuration of Procedure 1. The user can also change the type of the scan group from the display area A40. For example, the user can change a fixed-cycle scan group to a non-fixed-cycle scan group.
In the example of
For example, a predicted value of the processing time of the scan group is displayed in the display area A40. When a plurality of ladder programs P1 are associated with a scan group, a predicted value of the overall processing time of the plurality of ladder programs P1 is displayed in the display area A40. For example, when the user selects a button B400, the display in the display area A40 changes to a display showing the processing time for each ladder program P1 associated with the scan group.
In the example of
As illustrated in
For example, in a scan group, at the start of an execution cycle, data copy processing for copying data between scan groups is executed. After that, the ladder programs P1 associated with the scan group are executed. Thus, as illustrated in
For example, when a plurality of scan groups are allocated to one processor core, the ladder programs P1 of the scan groups are executed in ascending order of the execution cycle. In the example of
For example, the user sets the scan groups by referring to the processing time screen SC4. When there is a scan group for which there is not enough time, the user may be required to significantly change the ladder program P1. In this case, it is very time-consuming for the user to recreate the ladder program P1 from the beginning. Thus, in the first embodiment, the user can divide a part of the ladder program P1. Further, the division of the ladder program P1 can be supported by using an associated rung screen, which is described below.
In
For example, the rungs B and D include output processing for the same table data. Thus, the rungs B and D are identified as associated rungs having an association with each other. The rungs E and F have no association with other rungs. In the display area A50, the rungs A to D that have some sort of association with other rungs are displayed. When the user selects a rung from the display area A50, other rungs that have an association with the selected rung are displayed in display areas A51 to A53.
For example, when the user selects the rung B from the display area A50, the rung A, which includes write processing to be performed on the same register as the rung B, is displayed as an associated rung of the rung B in the display area A51. The rung C, which includes reference processing of the register written by the write processing of the rung B, is displayed as an associated rung of the rung B in the display area A52. The rung D, which includes output processing to be performed on the same table data as the rung B, is displayed in the display area A53. The user divides the “Drawing A01.01” by referring to the associated rung screen SC5.
For example, the user allocates the scan group D to the processor core of the CPU 21B. As a result, a part of the rungs A to D of the “Drawing A01.01,” which took a long time to process, can be allocated to another processor core. The processing time of the “Drawing A01.01” is shortened, and hence the processing of the scan group A can be reliably completed within the execution time. Further, by having the same processor core perform the processing for the rungs A to D, which have an association with each other, the processing of the rungs A to D can be executed accurately.
For example, for scan groups B and C as well, the user can similarly divide the ladder programs P1 as required. The user can also divide a ladder program P1 that is not associated with a scan group and associate the divided ladder program P1 with a scan group. In the first embodiment, when a ladder program P1 is to be divided, the register is automatically replaced based on a replacement setting specified by the user so that the register of the division source corresponds to the division destination.
In the first embodiment, the user can create not only the ladder program P1 but also a motion program from the engineering tool. A motion program is a program created in a language other than the ladder language. The motion program may be associated with a scan group. For example, when the user performs an operation for creating a motion program from the program creation screen SC1, an associated portion screen for displaying an associated portion of the motion program is displayed on the display unit 15.
As described above, the production system S of the first embodiment uses an engineering tool to effectively support programming by the user so as to be capable of reducing the time and effort required for programming. Details of the production system S of the first embodiment are described below.
The program creation device 10 includes a data storage unit 100, a program creation module 101, a first identification module 102, an associated rung screen control module 103, a prediction module 104, a processing time screen control module 105, a second identification module 106, an associated portion display control module 107, an association module 108, a replacement module 109, and an allocation module 110. The data storage unit 100 is implemented by the storage unit 12. The other functions are implemented by the CPU 11.
[Data Storage Unit]
The data storage unit 100 stores data required for program creation. For example, the data storage unit 100 stores an engineering tool T, ladder programs P1, motion programs P2, control group data D1, processing time data D2, and scan group data D3. Details of the engineering tool T, ladder programs P1, and motion programs P2 are as described above.
In the first embodiment, there is described a case in which the user specifies the axes to be synchronized from the engineering tool T, but it is not required that the axes to be synchronized be specified by the user. For example, the axes to be synchronized may be automatically set based on a control cycle set for each axis so that axes having the same control cycle belong to the same control group. Further, for example, a person other than the user operating the engineering tool T may specify the axes to be synchronized.
In the example of
The information included in the control group data D1 is not limited to the example of
For example, when the user creates a new scan group by using the engineering tool T, the data of the newly created scan group is added to the scan group data D3. When the user changes the type or the execution cycle of a scan group, the changed type or execution cycle is stored in the scan group data D3. When the motion program P2 is associated with a scan group, the name of the motion program P2 is stored in the scan group data D3.
In the first embodiment, to simplify the description, there is described a case in which one control group belongs to one scan group, but a plurality of control groups may belong to one scan group. Conversely, one control group may belong to a plurality of scan groups. Further, the concept of a “control group” may not particularly exist, and only the concept of a “scan group” may exist.
The data stored in the data storage unit 100 is not limited to the above-mentioned example. For example, the data storage unit 100 may store other data, such as register definition data indicating the definition of the register of the controller 20 and communication setting data indicating a communication setting between the controller 20 and the motor control device 30. The configurational relationship between the axis outputs and other registers is assumed to be defined in the register definition data. The user can also define the register and configure the communication setting by using the engineering tool.
[Program Creation Module]
The program creation module 101 creates the programs to be executed by the controller 20. For example, the program creation module 101 creates a ladder program P1. The program creation module 101 creates a ladder program P1 based on graphics such as coils input to the work window W11 of the program creation screen SC1, and records the created ladder program P1 in the data storage unit 100. The program creation module 101 may compile a ladder program P1, and record the compiled ladder program P1 in the data storage unit 100. The program creation module 101 also creates other programs, for example, the motion programs P2, in addition to the ladder programs P1.
[First Identification Module]
The first identification module 102 identifies a plurality of associated rungs having an association with each other by analyzing a ladder program P1. A rung includes one or more types of processing. For example, each element such as a coil described in the rank corresponds to a type of processing. The first identification module 102 analyzes at least a part of the processing in the rung. The first identification module 102 analyzes the elements included in each rung, and identifies associated rungs.
As used herein, “relation” means that the processing of a certain rung and the processing of another rung are related to each other. For example, when the completion of the execution of the processing of another rung is required in order to execute the processing of a certain rung, those rungs have a relation. For example, when the processing of a certain rung refers to the result of the execution of the processing of another rung, those rungs have a relation. For example, when it is more efficient to use the same processor core to execute the processing of a certain rung and the processing of another rung, those rungs have a relation.
In the example of
In the first embodiment, the first identification module 102 identifies a plurality of rungs in which processing on the same register occurs as a plurality of associated rungs having an association with each other. For example, when a certain first rung includes processing to be performed on a certain register and another second rung includes processing to be performed on the same register, the first identification module 102 identifies that the first rung and the second rung have an association with each other. The first identification module 102 identifies the first rung and the second rung as a plurality of associated rungs.
For example, the first identification module 102 may identify, as a plurality of associated rungs, a plurality of rungs in which write processing on the same register occurs. In the example of
For example, the first identification module 102 may identify, as a plurality of associated rungs, a plurality of rungs in which write processing and reference processing on the same register occur. In the example of
For example, the first identification module 102 may identify, as a plurality of associated rungs, a plurality of rungs in which processing on the same data occurs. In the example of
For example, the first identification module 102 may identify a plurality of associated rungs that have an association with one or more axes selected by the user from among a plurality of axes controlled by the controller 20. In the example of
For example, the first identification module 102 may identify, as the plurality of associated rungs, rungs including, as an association, at least write processing which can be traced back to write processing on a register leading to an output to the one or more axes. In the example of
For example, the first identification module 102 may further identify, for one associated rung among the plurality of identified associated rungs, one or more associated rungs having a register or data to be processed in common with the one associated rung. The rung B of
The first identification module 102 may identify a relation between rungs by using information other than processing to be performed on the register or data. It is sufficient that the relation between rungs be determined based on a method determined in advance. For example, the first identification module 102 may determine that rungs have a relation with each other when a certain rung includes a command to call another rung or drawing.
[Associated Rung Screen Control Module]
The associated rung screen control module 103 displays the associated rung screen SC5 showing a plurality of associated rungs. For example, the associated rung screen control module 103 displays associated rungs having some sort of association in the display area A50. In the example of
In the first embodiment, there are three types of association, namely, an association indicating that write processing on the same register is to occur, an association indicating that write processing and reference processing on the same register are to occur, and an association indicating that processing on the same data is to occur. Thus, the associated rung screen control module 103 controls the display of the display areas A51 to A53 for each type of association.
For example, when the user selects an associated rung from the display area A50, the associated rung screen control module 103 displays in the display area A51 the other associated rungs that include write processing on the same register as the selected associated rung. In the example of
For example, when the user selects an associated rung from the display area A50, the associated rung screen control module 103 displays in the display area A52 the other associated rungs that include reference processing on the register of the write processing included in the selected associated rung and the other associated rungs that include write processing on the register of the reference processing included in the selected associated rung. In the example of
For example, when the user selects an associated rung from the display area A50, the associated rung screen control module 103 displays in the display area A53 the other associated rungs that include processing on the same data as the selected associated rung. In the example of
[Prediction Module]
The prediction module 104 predicts a processing time relating to the scan group allocated to each of the plurality of processor cores. For example, the prediction module 104 predicts at least one of the overall processing time of the scan groups or the processing time of the ladder programs P1 associated with the scan groups. In the first embodiment, there is described a case in which the prediction module 104 predicts both of those processing times, but the prediction module 104 may predict only one of those processing times.
For example, the prediction module 104 predicts the processing time based on the processing time data D2 and the scan group data D3. The prediction module 104 refers to the scan group data D3, and identifies the ladder programs P1 associated with each scan group. The prediction module 104 refers to the processing time data D2, and acquires a predicted value of the processing time associated with the elements in the ladder programs P1. The prediction module 104 predicts the processing time of the ladder programs P1 by calculating the total of the predicted values of the processing times. The prediction module 104 predicts the processing time of the scan group by calculating the total of the processing times of the ladder programs P1 associated with the scan group.
The method of predicting the processing time is not limited to the above-mentioned example. For example, the prediction module 104 may predict the processing time by executing a simulation of the ladder programs P1 associated with the scan group based on a simulator. As the simulator itself, a publicly known simulator can be used. For example, the prediction module 104 may predict the processing time by arranging a virtual controller 20 in a virtual space and operating the virtual controller 20 on a simulator.
For example, the prediction module 104 may identify, from among elements included in one scan group, an element that requires more processing time than the other elements. The element may be the ladder program P1 itself, or may be a rung unit. In addition, the element may be a part of the rung. The prediction module 104 identifies an element that requires a relatively more processing time from within a certain scan group. For example, the prediction module 104 may identify an element having a processing time which is equal to or more than a threshold value. The prediction module 104 may sort the elements in descending order of the processing time and identify the elements up to a predetermined rank. In the example of
[Processing Time Screen Control Module]
The processing time screen control module 105 displays the processing time screen SC4 showing a relationship between the execution cycle and the processing time of each of the plurality of scan groups. In the example of
For example, the processing time screen control module 105 may display the processing time screen SC4 representing the element identified by the prediction module 104. The processing time screen SC4 of
In addition, in the example of
[Second Identification Module]
The second identification module 106 identifies a plurality of associated portions having an association with each other by analyzing a motion program for causing the controller to control an axis. For example, the second identification module 106 identifies an axis command for controlling an axis selected by the user from the motion program. The second identification module 106 identifies the identified axis command and other commands having an association with the axis command as the plurality of associated portions. It is assumed that the combination of the commands having an association is stored in advance in the data storage unit 100. When this combination of commands is included in the motion program, the second identification module 106 identifies the combination as associated portions.
In the example of
[Associated Portion Display Control Module]
The associated portion display control module 107 displays the associated portion screen SC7 showing the plurality of associated portions. For example, the associated portion display control module 107 displays the associated portion screen SC7 in which a plurality of associated portions of the motion program can be identified. In the example of
[Association Module]
The association module 108 associates a plurality of rungs included in a ladder program P1 with one of a plurality of scan groups each having a specifiable execution cycle. In the first embodiment, there is described a case in which the association module 108 associates the plurality of rungs associated with one of the scan groups with another scan group, but the association module 108 may associate a plurality of rungs included in a ladder program P1 which is not associated with a scan group with a scan group.
Associating a rung with a scan group means setting such that the rung can be executed in the execution cycle of the scan group. In the first embodiment, storing a scan group and a ladder program P1 including a rung in the scan group data D3 corresponds to associating a rung with a scan group. That is, setting such that a ladder program P1 including a rung belongs to a scan group corresponds to associating a rung with a scan group.
In the example of
For example, the association module 108 associates a plurality of rungs selected after the associated rung screen SC5 is displayed with one of a plurality of scan groups. In the first embodiment, after the associated rung SC5 is displayed, a plurality of rungs are selected from the window W11 of the program creation screen SC1. The association module 108 associates the selected plurality of rungs with a scan group. The rungs may be associated with the scan group before the associated rung screen SC5 is displayed.
[Replacement Module]
The replacement module 109 replaces a register in which processing occurs in a plurality of rungs with a register corresponding to the scan group of a destination of the association by the association module 108. For example, the replacement module 109 converts a certain register into another register based on a replacement setting specified by the user in the replacement setting screen SC6. The replacement setting shows a register conversion rule. This conversion rule may be a rule for converting a register address into a variable name, or may be a rule for converting a register address.
For example, the replacement setting may be recorded in the data storage unit 100, or may be specified at the time when the user divides a rung. The replacement setting indicates the relationship between the register before conversion and the register after conversion, and hence the replacement module 109 sets the register information included in the ladder program P1 of the pasting destination so that the reference processing or the write processing to be performed on the register after conversion which is associated with the register before conversion is executed.
In the example of
[Allocation Module]
The allocation module 110 allocates each of the plurality of scan groups to one of the plurality of processor cores included in the controller 20 so that each of the plurality of scan groups is distributed. In the first embodiment, the allocation is performed manually by the user, and hence the allocation module 110 allocates the scan group specified by the user to the processor core specified by the user. However, as in a second embodiment of the present disclosure, automatic allocation may be executed by analyzing the ladder program P1. For example, the allocation module 110 allocates the ladder program(s) P1 specified by the user to the scan group specified by the user. In the first embodiment, storing the name(s) of the ladder program(s) P1 and the name of the scan group in the scan group data D3 corresponds to allocating. Those allocations are performed from the program creation screen SC1 or another screen. For example, when the user specifies one of the created ladder programs P1 and one of the created scan groups, the allocation module 110 allocates the specified ladder program P1 to the specified scan group.
For example, the allocation module 110 allocates a first scan group to a first processor core, and allocates a second scan group to a second processor core. In the example of
For example, the controller 20 includes a data storage unit 200 and an execution module 201. The data storage unit 200 is implemented by the storage unit 22. The execution module 201 is implemented by the CPU 21.
[Data Storage Unit]
The data storage unit 200 stores data required to control the motor control device 30. For example, the data storage unit 200 stores ladder programs P1 and motion programs P2. The data storage unit 200 also stores a relationship between processor cores and scan groups. For example, the data storage unit 200 may store data similar to the scan group data D3. The data stored in the data storage unit 200 is not limited to the above-mentioned example. For example, the data storage unit 200 stores a plurality of variables which are at least one of referenceable or writable by the controller 20 or another device. The register in which the individual variables are stored is determined in advance.
[Execution Module]
The execution module 201 executes one or more rungs associated with one or more scan groups allocated to each of the plurality of processor cores in parallel in each execution cycle. For example, the execution module 201 executes, for each processor core included in the controller 20, the ladder programs P1 of the scan group allocated to the processor core. That is, two or more processor cores allocated by the allocation module 110 execute the ladder programs P1 of the scan group allocated to those processor cores.
In the example of
The program creation device 10 displays a new creation screen SC2 on the display unit 15, and creates a scan group based on an operation by the user (Step S3). The program creation device 10 displays the control group definition screen SC3 on the display unit 15, and creates a control group (Step S4). The program creation device 10 sets variables and comments (Step S5). The program creation device 10 creates a ladder program P1 (Step S6).
The program creation device 10 displays the processing time screen SC4 on the display unit 15, and sets a scan group (Step S7). In Step S7, the program creation device 10 associates a ladder program P1 specified by the user with the scan group specified by the user. The program creation device 10 allocates the scan group specified by the user to the processor core specified by the user. In addition, settings such as specification of the execution cycle are performed. The program creation device 10 analyzes the ladder program P1 to identify the associated rungs, and displays the associated rung screen SC5 on the display unit 15 (Step S8). In Step S8, an associated rung having an association with an axis selected by the user may be identified, or an associated rung may be identified in the scan group or a ladder program P1 specified by the user.
The program creation device 10 displays the replacement setting screen SC6 on the display unit 15, and receives specification by the user of the replacement setting (Step S9). The program creation device 10 analyzes the motion program P2, identifies the associated portion, and displays the associated portion screen SC7 on the display unit 15 (Step S10). The processing steps of Step S9 and Step S10 are executed as required. The program creation device 10 divides a ladder program P1 based on an operation by the user (Step S11). In Step S11, the program creation device 10 associates a plurality of rungs selected from the ladder program P1 with a new scan group.
The program creation device 10 compiles a ladder program P1 associated with the scan group, and records the compiled ladder program P1 in the controller 20 (Step S12). The controller 20 executes the compiled ladder program P1 (Step S13). In Step S13, the controller 20 periodically executes the ladder programs P1 associated with the scan group for each processor core of the CPU 21 based on the execution cycle of the scan group allocated to the processor core.
The production system S of the first embodiment associates the plurality of rungs included in a ladder program P1 with one of a plurality of scan groups each having a specifiable execution cycle. The production system S allocates each of the plurality of scan groups to one of the plurality of processor cores included in the controller so that each of the plurality of scan groups is distributed. The production system S executes one or more rungs associated with one or more scan groups allocated to each of the plurality of processor cores in parallel in each execution cycle. As a result, the time and effort required for programming when parallel processing is implemented with a plurality of processor cores can be reduced. For example, when the user wants to extract a part of the rungs included in a certain ladder program P1, the rungs to be extracted can be associated with a new scan group, and it is thus possible to save the time and effort of creating a new ladder program P1 and associating the new ladder program P1 with the new scan group. The execution cycle can be specified for each scan group, and thus flexibility in the processing to be executed by the controller 20 is increased. Through execution of parallel scan processing by using a plurality of processor cores, it is possible to improve processing speed and distribute the processing load.
Further, the production system S identifies a plurality of associated rungs having an association with each other by analyzing a ladder program P1. As a result, it is possible to identify a plurality of associated rungs having an association with each other. For example, the time and effort required for programming can be reduced because a plurality of associated rungs can be displayed or a plurality of associated rungs can be allocated all at once.
Further, the production system S displays an associated rung screen showing a plurality of associated rungs. The production system S associates a plurality of rungs selected after the associated rung screen is displayed with one of the plurality of scan groups. As a result, the user can confirm the associated rungs and then select the plurality of rungs to be associated with the scan group, and hence it is easier for the user to perform determinations such as selecting a plurality of associated rungs all at once.
Further, the production system S identifies a plurality of associated rungs having an association with one or more axes selected by the user from the plurality of axes controlled by the controller. As a result, the user can confirm the plurality of associated rungs having an association with the axis selected by the user. This makes it easier for the user to perform determinations such as selecting a plurality of associated rungs having an association with a certain axis all at once.
Further, the production system S identifies, as the plurality of associated rungs, rungs including, as an association, at least write processing which can be traced back to write processing on a register leading to an output to the one or more axes. As a result, a plurality of associated rungs having an association regarding write processing on a register leading to an output to one or more axes selected by the user can be identified. For example, it becomes easier for the user to determine whether or not to divide rungs relating to an output to a certain specific axis all at once.
Further, the production system S further identifies, for one associated rung among the plurality of identified associated rungs, one or more associated rungs having a register or data to be processed in common with the one associated rung. Through identification of one or more associated rungs having a register or data to be processed in common, the time and effort required for programming can be reduced.
Further, the production system S predicts the processing time for the scan groups allocated to each of the plurality of processor cores. The production system S displays the processing time screen SC4 showing the relationship between the execution cycle and processing time of each of a plurality of scan groups. As a result, the user can first confirm the predicted result of the processing time of the scan group in which rungs have been allocated, and then select a plurality of rungs to be associated with the scan group.
Further, the production system S identifies, from among elements included in one scan group, an element that requires more processing time than the other elements. The production system S displays the identified element. As a result, the user can confirm elements which require more processing time than other elements, and hence it is possible to effectively support programming.
Further, the production system S identifies a plurality of associated portions having an association with each other by analyzing a motion program for causing the controller to control an axis. The production system S displays the associated portion screen SC7 indicating the plurality of associated portions. As a result, the user can confirm the portions of the motion program that have an association with each other, and hence the time and effort required for programming can be reduced.
Further, the production system S associates the plurality of rungs associated with one of the scan groups with another scan group. As a result, rungs can be moved between scan groups, and hence the time and effort required for programming can be reduced. For example, it becomes possible to create a new scan group by extracting only a part of the rungs associated with a certain scan group.
Further, the production system S replaces a register in which processing occurs in a plurality of rungs with a register corresponding to the scan group of an association destination. As a result, the register is automatically replaced, and hence user convenience is increased. Through use of the scan group of the association destination, it is possible to prevent the occurrence of processing on an incorrect register.
Next, description is given of a second embodiment of the present disclosure, which is another embodiment of the production system S. In the second embodiment, as an example, there is described a case in which distributed processing is implemented in the production system S without using the concept of scan groups. In the second embodiment, description of the same parts as in the first embodiment is omitted.
As described in the first embodiment, when all the processing of a ladder program P1 is executed by only the CPU 21A in order, it takes a long time for the processing to be executed because all the processing is executed by one processor core. When the processing between the CPUs 21A and 21B, the time required for the processing can be reduced. However, it takes a lot of time and effort for the user to create the ladder programs P1 for the CPU 21A and the ladder programs P1 for the CPU 21B separately. For example, even when the user has already created the ladder programs P1 on the premise of a single core, it is required to again create the ladder programs P1 for distributed processing.
Thus, the production system S of the second embodiment divides a ladder program P1 into rung units, and distributes the processing to be executed by at least a part of the plurality of rungs between the CPUs 21A and 21B, thereby shortening the time required for processing. For example, even when the user has already created the ladder programs P1 on the premise of a single core, the user can implement distributed processing by reusing the existing ladder programs P1, thereby reducing the time and effort required by the user. Details of the second embodiment are described below.
The program creation device 10 of the second embodiment includes the data storage unit, a synchronization target setting module 111, an acquisition module 112, and a division module 113. The synchronization target setting module 111, the acquisition module 112, and the division module 113 are mainly implemented by the CPU 11.
[Data Storage Unit]
The data storage unit 100 stores data required to implement distributed processing by the plurality of processor cores of the controller 20. For example, the data storage unit 100 stores an engineering tool T, control group data D1, and processing time data D2. The engineering tool T is a program for the user to set the controller 20 and the motor control device 30. In the second embodiment, there is described a case in which the division of the ladder programs P1 is executed as a function of the engineering tool T, but the division of the ladder programs P1 may be implemented by a tool other than the engineering tool T.
In the second embodiment, there is described a case in which the user specifies the axes to be synchronized from the engineering tool T, but it is not required that the axes to be synchronized be specified by the user. For example, the axes to be synchronized may be automatically set based on a control cycle set for each axis so that axes having the same control cycle belong to the same control group. Further, for example, a person other than the user operating the engineering tool T may specify the axes to be synchronized.
In the example of
For example, axes 1 to 6 belong to the control group 1. Axes 7 to 10 belong to the control group 2. The control group data D1 includes register identification information that can identify the axis outputs of the axes 1 to 6 belonging to the control group 1 and register identification information that can identify the axis outputs of the axes 7 to 10 belonging to the control group 2. In the second embodiment, there is described a case in which the register address (register number) corresponds to the register identification information, but the register identification information may be any information that can identify the register. For example, the register identification information may be the name of the register, or may be a combination of the starting address of the register and an offset therefrom.
The information included in the control group data D1 is not limited to the example of
The data stored in the data storage unit 100 is not limited to the above-mentioned example. For example, the data storage unit 100 stores a ladder program P1 before division and a ladder program P11 after division. The data structure of the ladder program P1 before division is as described with reference to
The divided program p1 is created by the division module 113, which is described later. A plurality of divided programs p1 are created from one ladder program P1. In the second embodiment, a divided program p1 for the CPU 21A and a divided program p1 for the CPU 21B are created. Each divided program p1 is compiled and converted into a machine language to create a compiled divided program p2. The data storage unit 100 may store the compiled divided program p2. In the second embodiment, a compiled divided program p2 for the CPU 21A and a compiled divided program p2 for the CPU 21B are created.
In addition, for example, the data storage unit 100 may store other data, such as register definition data indicating the definition of the register of the controller 20 and communication setting data indicating a communication setting between the controller 20 and the motor control device 30. The configurational relationship between the axis outputs and other registers is assumed to be defined in the register definition data. The user can also define the register and configure the communication setting by using the engineering tool.
[Synchronization Target Setting Module]
The synchronization target setting module 111 sets a plurality of axes of the controller 20 as synchronization targets. The axes of the controller 20 are the axes to be controlled by the controller 20. Those axes include not only the axes directly controlled by the controller 20, but also the axes indirectly controlled by the controller 20 through another device (in the second embodiment, the motor control device 30). In the second embodiment, the synchronization target setting module 111 sets a plurality of axes specified by the user as the synchronization targets, but as described above, the axes to be synchronized may be automatically set instead of being specified by the user. The synchronization target setting module 111 sets the axes to be synchronized by recording control group data D1 indicating the axes to be synchronized in the data storage unit 100.
[Acquisition Module]
The acquisition module 112 acquires a ladder program P1 indicating operations of the controller 20. For example, the acquisition module 112 acquires the ladder program P1 from the data storage unit 100. The acquisition module 112 may acquire the ladder program P1 from the data storage unit 200 of the controller 20, another device, or an external information storage medium. When a plurality of ladder programs P1 exist, the acquisition module 112 may acquire a plurality of ladder programs P1. In this case, a divided program p1 is created for each ladder program P1.
[Division Module]
The division module 113 divides the ladder program P1 into a plurality of rungs, and allocates one or more rungs to two or more processor cores so that the processing to be executed by at least a part of the plurality of rungs is distributed to two or more different processor cores among the plurality of processor cores.
In the second embodiment, the division module 113 divides the ladder program P1 by rung units. A rung is an example of a program portion. Thus, “rung” as used herein can be read as “program portion.” When the number of rungs included in the ladder program P1 is “n” (“n” is an integer of 2 or more), the division module 113 divides the ladder program P1 into “n” program portions. In the following description, an example is given in which the division module 113 divides the ladder program P1, which includes a total of 14 rungs, namely, rungs A to N, into 14 program portions.
The division module 113 may divide the ladder program P1 so that the number of rungs included in one program portion is different from the number of rungs included in another program portion. For example, the division module 113 may divide the ladder program P1 such that one program portion includes two rungs and another program portion includes only one rung. It is assumed that the plurality of rungs included in one program portion have a relation which is described later. The division module 113 may identify the relation between the rungs by using, for example, graphics or commands included in the ladder program P1, and divide the plurality of rungs having a relation as one program portion.
Further, the unit of division of the ladder program P1 is not limited to rungs. For example, the division module 113 may divide the ladder program P1 in the middle of a rung so that up to the middle of the rung is included in the program portion. For example, the division module 113 may divide the ladder program P1 into graphic units such as coils, or may divide the ladder program P1 into portions in which specific graphics are arranged. For example, when comments by the user are included in the ladder program P1, the division module 113 may divide the ladder program P1 so that a portion from a certain comment up to the next comment becomes one program portion. It is sufficient that the division module 113 divide the ladder program P1 based on a predetermined division method.
The division module 113 determines rungs to be allocated to the processor core of the CPU 21A and rungs to be allocated to the processor core of the CPU 21B from among the plurality of rungs divided from the ladder program P1. In the second embodiment, there is described a case in which the individual rungs are allocated to only one of the processor core of the CPU 21A and the processor core of the CPU 21B, but there may be rungs which are allocated to both processor cores (for example, rungs A to D in Modification Example 2-1 described later). That is, the above-mentioned “processing to be executed by at least a part of the plurality of rungs” includes not only processing of all of the rungs but also processing of only a part of the rungs.
Further, in the second embodiment, there is described a case in which the division module 113 allocates at least one rung to all processor cores included in the controller 20, but there may be processor cores to which a rung is not allocated. That is, the number of the “plurality of processor cores” and the number of the “two or more [different] processor cores” in the above description “two or more different processor cores among the plurality of processor cores” are not required to match. For example, when the controller 20 includes another processor core different from the processor core of the CPU 21A and the processor core of the CPU 21B, a rung is not required to be allocated to the another processor core. For example, the another processor core is used for another purpose, such as communication to and from the outside, rather than execution of a ladder program P1. Moreover, there may be a rung that is not allocated to the processor core of the CPU 21A or to the processor core of the CPU 21B.
Allocating a rung to a processor core means determining the processor core to act as the main executioner of the processing of the rung. In other words, determining the rung to be processed by each processor core corresponds to allocating the rung to a processor core. The number of rungs to be allocated to each processor core may be any number. When a control cycle is defined as in the second embodiment, the number of rungs to be allocated to the processor core is set to be a number that is sufficient to complete the processing in each control cycle.
In the second embodiment, the division module 113 allocates one or more rungs to the processor core of the CPU 21A and the processor core of the CPU 21B by executing three types of processing, namely, relation identification processing, grouping processing, and allocation processing. The details of those three types of processing are described below.
[Relation Identification Processing]
The relation identification processing is processing of analyzing the processing of the rung and identifying a relation between rungs. The processing of the rung is processing indicated by elements such as coils included in the rung. A rung includes one or more types of processing. The processing of at least a part of the rung becomes an analysis target in the relation identification processing. In the relation identification processing, the elements included in each rung are analyzed, and rungs having a relation with each other are identified.
The relation between rungs is based on whether or not the content of the processing of a certain rung and the content of the processing of another rung are related to each other. For example, when the completion of the execution of the processing of another rung is required in order to execute the processing of a certain rung, those rungs have a relation. Stated in another way, when the processing of a certain rung refers to the result of the execution of the processing of another rung, those rungs have a relation. For example, when it is more efficient to use the same processor core to execute the processing of a certain rung and the processing of another rung, those rungs have a relation.
In the second embodiment, the division module 113 identifies a relation among a plurality of rungs based on write processing and reference processing performed on the register of the controller 20. The division module 113 identifies rungs which perform at least one of write processing or reference processing on the same register as rungs having a relation. The division module 113 identifies rungs which include write processing on a certain register and rungs which include reference processing on the certain register as rungs having a relation.
For example, the rung A includes write processing to be performed on the register reg1. More specifically, the rung A includes processing identification information indicating write processing and register identification information indicating the register reg1 which is the target of the write processing. The processing identification information is information that can identify the processing content. For example, the processing identification information is a graphic indicating the processing, or a character string indicating a command. The register identification information is information that can identify the register. For example, the register identification information is the address of the register or the name of the register. The values to be written in the write processing may be specified within the rung, or may be acquired through by some sort of calculation.
The rung B includes reference processing to be performed on the register reg1 and write processing to be performed on the register reg2. More specifically, the rung B includes processing identification information indicating reference processing, register identification information indicating the register reg1 which is the target of the reference processing, processing identification information indicating write processing, and register identification information indicating the register reg2 which is the target of the write processing. The division module 113 identifies that rungs A and B have a relation with each other because the register identification information of the rung A and the register identification information of the rung B both indicate the register reg1. Further, the division module 113 identifies that the rung A comes before the rung B in the execution order because the processing identification information of the rung A indicates write processing and the processing identification information of the rung B indicates reference processing.
The division module 113 similarly compares the processing identification information and the register identification information included in each rung with the other rungs C to N to identify relations among the rungs. For example, when the register identification information of a certain rung and the register identification information of another rung both indicate the same register, the division module 113 identifies that there is a relation between those rungs. Among those rungs, the division module 113 identifies rungs having processing identification information indicating write processing as having an execution order before that of rungs having processing identification information indicating reference information.
When the time for a certain control cycle arrives, data synchronization is executed, and then the processing of the individual rung is executed. In
For example, the rung J includes reference processing on the register reg9 on which the write processing of rung I has been executed, and hence an arrow extends from the rung I to the rung J in
In
The register reg6, on which the write processing of the rung F has been executed, is referenced in the reference processing of the rungs K, L, and N, and hence an arrow extends from the rung F to the rungs K, L, and N. Similarly, the registers on which the write processing of the rungs B and D has been executed are referenced in the reference processing of the rungs L and M, and hence arrows extend from the rungs B and D to the rungs L and M. The register on which the write processing of the rung H has been executed is referenced in the reference processing of the rung M, and hence an arrow extends from the rung H to the rung M.
In the example of
Meanwhile, the execution of the reference processing of the rungs K, L, and N requires completion of the write processing of the rung F. The execution of the reference processing of the rungs L and M requires completion of the write processing of the rung B. The execution of the reference processing of the rung M requires completion of the write processing of the rungs B, D, and H. In this way, there are rungs for which execution is based on the completion of the write processing of one or more other rungs. Such rungs cannot be processed in parallel, and there are also restrictions on the processing order.
In the second embodiment, “having a relation” includes not only cases in which the write processing and the reference processing on the register are directly related, but also cases in which the write processing and the reference processing on the register are indirectly related. In the example of
The division module 113 may identify a relation between rungs by using information other than processing to be performed on the register. It is sufficient that the relation between rungs be determined based on a method determined in advance. For example, the division module 113 may determine that rungs have a relation with each other when a certain rung includes a command to call another rung or drawing. As another example, the division module 113 may identify a relation between rungs by using information on processing to be performed on a predetermined file instead of the register. This processing is write processing or reference processing to be performed on the file. For example, when the file to be processed by a certain rung is the same as the file to be processed by another rung, the division module 113 determines that those rungs have a relation.
[Grouping Processing]
Grouping processing is processing for grouping rungs. A set of rungs having the relation identified in the relation processing means that those rungs are some sort of group, but “group” in grouping processing means a classification of specific processing content. A plurality of rungs belonging to the same group are, in principle, allocated to the same processor core. It is not the case that only one group can be allocated to one processor core, and a certain group and another group may be allocated to the same processor core.
In the second embodiment, as an example, there is described a case in which the following five groups exist. The rungs belong to one or more of the five groups. In the following description, when the five groups are not distinguished, those groups are simply referred to as “groups.”
In the second embodiment, two control groups 1 and 2 are defined in the control group data D1 of
First, like in Step ST1 of
Next, like in Step ST2, the division module 113 performs grouping such that the rungs L and N which include the processing corresponding to the axis output Gr1 and the rungs A, B, C, D, E, and F which have a relation with the rungs L and N belong to the same control group 1. The division module 113 performs groupings so that the rung M which includes the processing corresponding to the axis output Gr2 of the control group 2 and the rungs A, B, C, D, G, and H which have a relation with the rung M belong to the same control group 2.
The final step ST3 includes Step ST3-1 to Step ST3-4. Like in Step ST3-1, the division module 113 sets the rungs which include the processing specific to the control groups 1 and 2 to the specific groups 1 and 2. For example, the division module 113 performs grouping such that the rungs E, F, L, and N that do not have a relation with the rung M which includes the processing corresponding to the axis output Gr2 of the control group 2, which is different from the control group 1, belong to the specific group 1 corresponding to the control group 1. Similarly, the division module 113 performs grouping such that the rungs G, H, and M that do not have a relation with the rungs L and N which include the processing corresponding to the axis output Gr1 of the control group 1, which is different from the control group 2, belong to the specific group 2 corresponding to the control group 2.
Like in Step ST3-2, the division module 113 groups rungs which include common processing between control groups into a common group. For example, the division module 113 performs grouping such that the rungs A, B, C, and D which belong to a plurality of control groups 1 and 2 belong to a common group corresponding to the plurality of control groups 1 and 2. The rungs A and B and the rungs C and D do not have a relation therebetween, and hence the division module 113 may perform grouping such that the rungs A and B belong to a first common group, and perform grouping such that the rungs C and D belong to a second common group.
Like in Step ST3-3, the division module 113 groups the rungs which include processing derived from the specific groups 1 and 2 into a derived group. For example, as a derived group, the division module 113 groups the rung K, which has a relation with the rung F that belongs to the specific group 1 corresponding to the control group 1, but does not belong to any one of the control groups 1 and 2. The control group 2 has no corresponding rung, and hence does not have a derived group. The rung K may be treated as belonging to the specific group 1 rather than as a derived group. The division module 113 may group the rungs including processing derived from a common group into a derived group.
Like in Step ST3-4, the division module 113 groups rungs which include other processing that does not belong to the control groups 1 or 2 into the other group. For example, the division module 113 performs grouping such that the rungs I and J, which do not belong to the control groups 1 or 2, belong to the other group. The rung K may also be classified into the other group, but in the second embodiment, the other group is assumed to be the rungs I and J, which do not belong to any derived group.
In this way, the division module 113 groups a plurality of rungs based on the processing to be performed on the register of the controller 20. In the second embodiment, relations are identified based on the processing to be performed on the register, and hence the division module 113 performs grouping such that the rungs having a relation to each other belong to the same group. The division module 113 may use the relations identified in the relation identification processing as a group without further change. In this case, the relation identification processing also serves as the grouping processing.
The processing in which the division module 113 groups a plurality of rungs into a plurality of groups is not limited to the example described above. The division module 113 may analyze a plurality of rungs and group the analyzed rungs such that the rungs to be allocated to the same processor core belong to the same group. For example, the division module 113 may directly treat the relations illustrated in
[Allocation Processing]
The allocation processing is processing of allocating one or more rungs to the processor core of the CPU 21A and the processor core of the CPU 21B. The division module 113 performs allocation so that at least a portion of the plurality of groups is distributed to two or more processor cores. In the second embodiment, there is described a case in which the two or more processor cores to which rungs are to be allocated are all of the plurality of processor cores included in the controller 20. That is, both of the two processor cores (the processor core of the CPU 21A and the processor core of the CPU 21B) included in the controller 20 correspond to the two or more processor cores to which rungs are to be allocated.
The two or more processor cores to which rungs are to be allocated may be only a part of a plurality of processor cores included in the controller 20. For example, when the controller includes three processor cores, allocation may be performed on only two of the three processor cores. In this case, the processor core to which rungs are not allocated may be used for the execution of another ladder program P1 different from the ladder program P1 which includes the rungs A to N, or may be used for a purpose other than controlling the motor control device 30, for example, for external communication.
The division module 113 performs allocation such that the plurality of specific groups 1 and 2 are distributed to the processor cores of the CPUs 21A and 21B. For example, the division module 113 allocates the rungs E, F, L, and N which belong to the specific group 1 to the processor core of the CPU 21A. The division module 113 allocates the rungs G, H, and M which belong to the specific group 2 to the processor core of the CPU 21B.
For example, the division module 113 performs allocation so that the execution order corresponding to the processing to be performed on the register of the controller 20 is maintained. In the case of the processor core of the CPU 21A, the division module 113 performs allocation so that the rungs N and L are executed after the rungs E and F so as to maintain the execution order of the write processing and the reference processing to be performed on the register illustrated in
Similarly, in the case of the processor core of the CPU 21B, the division module 113 performs allocation so that the rung M is executed after the rungs G and H. In the example of
The division module 113 performs allocation so that the rung K belonging to the derived group is allocated to the same processor core as that of the specific group 1 from which the derived group is derived. In the example of
The division module 113 allocates the rungs I and J belonging to the other group to any one of the processor cores of the CPUs 21A and 21B. For example, the division module 113 allocates the rungs I and J to the processor core which is relatively more free between the processor cores of the CPUs 21A and 21B. As used herein, “relatively more free” means that the processor core has a relatively lower estimated total processing time, a smaller number of allocated rungs, or a smaller number of allocated groups. The division module 113 may randomly determine the processor cores to which the rungs I and J are to be allocated. The processor core to which the rungs belonging to the other group are to be allocated may be fixed in advance, or the processor core having a higher performance may be automatically selected.
When write processing and reference processing on a common register of the controller 20 occur in each of the two rungs distributed to the two processor cores, the division module 113 may insert communication processing between processor cores after the rung of the write processing of the processor core which performs the write processing and before the rung of the reference processing of the processor core which performs the reference processing. As the communication processing, the division module 113 can insert communication processing which uses a bus connection or communication processing which uses a network connection. Various publicly known methods can be applied to the communication processing itself between the processor cores.
In the example of
Further, the division module 113 may perform allocation so that the execution of the processing of one or more rungs allocated to two or more processor cores is all completed within a predetermined control cycle. The division module 113 refers to the control group data D1, and acquires the control cycles of the control groups 1 and 2. The division module 113 estimates the processing time required for each rung based on the processing time data D2. The division module 113 allocates the rungs to the processor cores so that the total processing time of the rungs to be executed by one processor core does not exceed the control cycle.
In the example of
The division module 113 creates a divided program p1 based on the rungs allocated to the processor core. For example, the division module 113 creates a divided program p1 including the rungs A, B, E, F, K, N, and L allocated to the CPU 21A. In this divided program p1, the rungs are arranged in order of rungs A, B, E, F, K, N, and L, and the divided program p1 also includes the communication processing described above. The division module 113 creates a divided program p1 including rungs C, D, G, H, I, J, and M allocated to the CPU 21A. In this divided program p1, the rungs are arranged in order of rungs C, D, G, H, I, J, and M, and the divided program p1 also includes the communication processing described above.
The division module 113 compiles the divided program p1 for each processor core, and creates a divided program p2 converted into machine language. For example, the division module 113 compiles the divided program p1 of the CPU 21A, and creates a divided program p2 to be executed by the CPU 21A. The division module 113 compiles the divided program p1 of the CPU 21B, and creates a divided program p2 to be executed by the CPU 21B. The division module 113 records the compiled divided programs p2 in the data storage unit 100 and the controller 20. Various publicly known compilers can be used as the compiler itself. A compiler that executes the above-mentioned relation processing, grouping processing, and allocation processing may be prepared, and those types of processing may be executed by the compiler.
The data storage unit 200 is mainly implemented by the storage unit 22. The data storage unit 200 stores data required to control the motor control device 30. For example, the data storage unit 200 stores programs in which the ladder program P1, the divided program p1, and the compiled divided program p2 have been compiled and converted into machine language. It is not required that the data storage unit 200 store the ladder program P1 and the divided program p1. Two or more processor cores to which rungs have been allocated by the division module 113 execute the processing of one or more of the rungs allocated to those processor cores. That is, two or more processor cores execute the compiled divided program p2.
The data stored in the data storage unit 200 is not limited to the above-mentioned example. For example, the data storage unit 200 stores a plurality of variables which are at least one of referenceable or writable by the controller 20 or another device. The register in which the individual variables are stored is determined in advance. For example, the user uses the engineering tool T of the program creation device 10 to define the register used to control the motor control device 30. The user can perform various settings by using the engineering tool T, for example, a setting of the motor control device 30 to be controlled and a network communication setting. The data storage unit 200 may store a file indicating the settings performed by using the engineering tool T.
The program creation device 10 acquires the ladder program P1 stored in the controller 20 (Step S101). In Step S101, the program creation device 10 displays the ladder program P1 on the display unit 15. The program creation device 10 divides the ladder program P1 into a plurality of rungs when the user performs a predetermined operation (Step S102). The program creation device 10 executes the above-mentioned relation identification processing, grouping processing, and allocation processing (Step S103 to Step S105). The program creation device creates and compiles a divided program p1 based on the allocation processing (Step S106), and records a compiled divided program p2 in the controller 20 (Step S107).
The controller 20 executes the compiled divided program p2, and controls the motor 40 by communicating to and from the motor control device 30 (Step S108). In Step S108, the processor core of the CPU 21A executes the divided program p2 corresponding to itself, and executes the processing of the rungs allocated to itself. The processor core of the CPU 21B executes the divided program p2 corresponding to itself, and executes the processing of the rung allocated to itself. The controller 20 transmits commands to the motor control device 30 based on the processing results obtained by the processor cores of the CPUs 21A and 21B. The motor control device 30 controls the motor 40 by executing the processing corresponding to the commands. The motor control device 30 transmits a response based on the processing result to the controller 20.
The production system S of the second embodiment shortens the time required for processing by distributing and executing the processing by at least part of a plurality of rungs to two or more different processor cores among a plurality of processor cores. The amount of processing executed by each processor core is reduced, and hence the processing load on the processor cores can be reduced. As a result, it is possible to prevent abnormalities from occurring in the production system S due to processing delays. Through prevention of the occurrence of abnormalities, production efficiency in the production system S also increases. Moreover, the time required for processing is shortened by the controller 20 storing the ladder program P1 itself while also storing and executing a divided program p2, which is obtained by dividing and compiling the ladder program P1. Meanwhile, the ladder program P1 and the divided program p2 can be called as one program, which enables the user to perform checking and editing without misidentifying the programs.
Further, in the production system S, the execution of the one or more rungs allocated to two or more processor cores is all completed within a predetermined control cycle, and hence the occurrence of abnormalities in the production system S due to the processing not being completed within the control cycle can be prevented. Through prevention of the occurrence of abnormalities, production efficiency in the production system S also increases. For example, even when the control cycle differs between processor cores, the processing can be completed within the control cycle corresponding to each processor core.
Further, the production system S performs allocation so that the execution order corresponding to the processing to be performed on the register of the controller 20 is maintained, and hence it is possible to execute the processing in the execution order intended by the creator of the ladder program P1. As a result, the occurrence of abnormalities in the production system S is prevented, and hence production efficiency is increased.
Further, the production system S groups each of a plurality of rungs into a plurality of groups, and performs allocation so that each of the plurality of groups is distributed to one of the plurality of processor cores. As a result, efficient distributed processing becomes possible. For example, it becomes possible to cause a processor core X to execute the processing of a group 1 and a processor core Y to execute the processing of a group 2, and hence the processing can be performed efficiently by separating the processor cores that are to execute the processing for each group. For example, when a certain group is to be executed with a plurality of processor cores, communication between the processor cores occurs, but by executing a certain group with one processor core, it is possible to prevent communication between processor cores, and hence the processing can be speeded up.
Further, by performing grouping based on the processing to be performed on the register of the controller 20, the production system S can accurately perform grouping in consideration of a relation of the processing on the registers. Accurate grouping enables the distributed processing to be more efficient.
Further, the production system S can more accurately identify relations between rungs by identifying relations among a plurality of rungs based on the write processing and reference processing to be performed on the register. Grouping such that rungs having an accurately identified relation belong to the same group enables the grouping to be performed accurately. Accurate grouping enables the distributed processing to be more efficient.
Further, the production system S can perform grouping accurately in consideration of an axis output by grouping such that a rung which includes processing corresponding to an axis output and another rung having a relation with that rung belong to the same control group. Accurate grouping enables the distributed processing to be more efficient.
Further, the production system S can perform grouping accurately by grouping such that rungs that do not have a relation with a rung which includes processing corresponding to an axis output of another control group belong to a specific control group. Accurate grouping enables the distributed processing to be more efficient.
Further, by performing grouping such that rungs belonging to a plurality of control groups belong to a common group, the production system S can classify rungs related to a plurality of axis outputs into another group, which enables the distributed processing to be more efficient.
Further, by grouping rungs that do not belong to a control group such that the rungs belong to another group, the production system S can efficiently process the rungs belonging to the other group by allocating those rungs to a free processor core.
Further, the production system S can implement efficient distributed processing when synchronizing a plurality of axes set as synchronization targets by performing grouping such that the rungs corresponding to each of the plurality of axes set as synchronization targets belong to the same group.
Further, the production system S can be operated so as to synchronize a plurality of axes specified by the user by setting the plurality of axes specified by the user as synchronization targets.
Further, when write processing and reference processing on the register of the controller 20 occur in each of two rungs distributed to two processor cores, the production system S can execute communication processing between the processor cores and implement distributed processing of the plurality of processor cores by inserting communication processing between the processor cores after the write processing rung and before the reference processing rung.
Further, the production system S can, for example, display the content of the ladder program P1 when the engineering tool T is connected to the controller 20, and execute division of the ladder program P1, by storing the ladder program P1 in the controller 20.
The present disclosure is not limited to the embodiments described above, and can be modified suitably without departing from the spirit of the present disclosure.
For example, the first embodiment and the second embodiment may be combined. That is, in the first embodiment as well, the production system S may further include the division module 113 which divides the ladder program P1 into a plurality of rungs, and allocates each of the plurality of rungs to one of the plurality of processor cores so that the plurality of rungs are distributed. The processing of the division module 113 is as described in the second embodiment. As a result, as described in the second embodiment, the time required for the processing of the ladder program P1 is shortened.
Next, modification examples of the second embodiment are described.
For example, the division module 113 may perform allocation so that the rungs A, B, C, and D belonging to a common group are executed in parallel by two or more processor cores to which each of the plurality of control groups 1 and 2 are allocated. Similarly to the embodiment, there is described a case in which the two or more processor cores are both the processor core of the CPU 21A and the processor core of the CPU 21B.
Further, in Modification Example 2-1, there is no waiting for the completion of the rungs B and D, and hence the division module 113 may perform allocation so that the rung L comes before the rung N. Similarly, in the example of the second embodiment, the rung K belonging to the derived group is placed before the rung L because there is a possibility that a wait for completion of the rung D occurs before the rung L, but in Modification Example 2-1, there is no waiting for the completion of the rung D, and hence the division module 113 may perform allocation such that the rung K comes after the rungs L and N.
The division module 113 may allocate a virtual register of the controller 20 to, at least, the registers used by the rungs A, B, C, and D belonging to the common group, and two or more processor cores may execute in parallel the rungs A, B, C, and D belonging to the common group based on the virtual register. A virtual register is a register different from the register originally allocated to the controller 20. The register originally allocated to the controller 20 is hereinafter referred to as “real register.”
In Modification Example 2-1, there is described a case in which the division module 113 allocates a virtual register to the real registers relating to the processing of all rungs, but the division module 113 may allocate a virtual register to only the real registers relating to the processing of the rungs A, B, C, and D belonging to the common group. Further, for example, the division module 113 may allocate a virtual register to the real registers relating to the processing of the rungs A, B, C, and D belonging to the common group and allocate a virtual register to the real registers relating to the processing of a part of the other rungs. In the example of the registers in
For example, the rungs A, B, C, D, E, F, K, L, and N allocated to the CPU 21A use the real registers reg1, reg2, reg3, reg4, reg5, reg6, reg11, and Gr1. Thus, the division module 113 sets corresponding virtual registers reg1A, reg2A, reg3A, reg4A, reg5A, reg6A, reg11A, and Gr1A as virtual registers for the CPU 21A. The division module 113 records the relationship between those real registers and virtual registers in the data storage unit 100.
For example, the rungs A, B, C, D, G, H, M, I, and J allocated to the CPU 21B use the real registers reg1, reg2, reg3, reg4, reg7, reg8, reg9, reg10, reg13, and Gr2. Thus, the division module 113 sets corresponding virtual registers reg1B, reg2B, reg3B, reg4B, reg7B, reg8B, reg9B, reg10B, reg13B, and Gr2B as virtual registers for the CPU 21B. The division module 113 records the relationship between those real registers and virtual registers in the data storage unit 100.
The ladder program P1 before division includes register identification information on the real register, and hence when the division module 113 creates the divided program p1, the division module 113 replaces the register identification information on each real register with register identification information on the corresponding virtual register. As a result, write processing and reference processing can be performed on the virtual registers. The other processing by the division module 113 is the same as in the embodiment.
For example, the division module 113 allocates the virtual registers so that the values of the virtual register of one of two or more processor cores is written to the axis outputs Gr1 and Gr2, which are the real registers of the controller 20, and the one of two or more processor cores writes the value of the virtual register in the register. That is, because the values relating to the final outputs are required to be written to the real registers Gr1 and Gr2, the value of a virtual register Gr1A is written to the axis output Gr1, which is the real register, and the value of a virtual register Gr2B is written to the axis output Gr2, which is the real register. The division module 113 may change the content of the rungs N, L, and M so that such writing is performed.
In Modification Example 2-1 described above, by performing allocation such that the rungs A, B, C, and D belonging to a common group are executed in parallel by a plurality of processor cores, it is possible to prevent a certain processor core from waiting for the processing of another processor core, and hence the time required for processing is shortened.
Further, by executing the rungs A, B, C, and D belonging to the common group in parallel based on virtual registers allocated to the registers used by the rungs A, B, C, and D belonging to the common group, parallel processing can be reliably executed by a plurality of processor cores. For example, in a case in which a certain processor core A tries to write to a certain register and another processor core B is in the midst of writing to that register, the processor core A may not be able to write to the register, but by using a virtual register, a situation in which it is not possible to write to the register can be prevented.
Further, by using one of two or more processor cores to write the value of the virtual register to the register, the value of the virtual register can be returned to the actual register.
For example, the division module 113 may perform grouping such that rungs having different control cycles belong to different groups. In Modification Example 2-2, it is assumed that the control cycle of a control group 1 and the control cycle of a control group 2 are different. A control cycle may be specified for each rung. Through execution of grouping in the same way as in the embodiment, the division module 113 can perform the grouping such that rungs having different control cycles belong to control groups 1 and 2 which are different from each other. For example, when the control cycle of the control group 1 is 1 ms and the control cycle of the control group 2 is 2 ms, the division module 113 performs grouping such that the rungs having a control cycle of 1 ms belong to the control group 1 and the rungs having a control cycle of 2 ms belong to the control group 2.
The division module 113 may perform allocation so that, when allocating a rung which also relates to a processor core corresponding to a group having a relatively early control cycle to a processor core corresponding to a group having a relatively late control cycle, the rung is executed relatively early. For example, the common group relates to the control group 1 having a control cycle of 1 ms as well as to the control group 2 having a control cycle of 2 ms. In this case, the division module 113 performs allocation so that the execution order of the rungs belonging to the common group is earlier than the execution order of other rungs (for example, so that those rungs are executed first).
In Modification Example 2-2, by performing grouping such that rungs having different control cycles belong to different groups from each other, control with different control cycles can be executed.
Further, when allocating a rung which also relates to a processor core corresponding to a group having a relatively early control cycle to a processor core corresponding to a group having a relatively late control cycle, by performing allocation such that rungs which are common among processor cores are executed early, it is possible to execute those rungs at an early stage, thereby preventing those rungs from waiting for execution.
For example, the controller 20 may include a processor core which has not been allocated rungs by the division module 113. For example, the controller 20 may include three CPUs 21, and of those CPUs 21, the division module 113 may allocate rungs to two of the CPUs 21 and not allocate rungs to the remaining one CPU 21. Each of the plurality of processor cores executes the one or more rungs allocated to itself.
For example, each function may be implemented by any device in the production system S. A part or all of the functions described as being implemented by the program creation device 10 may be shared among a plurality of devices. A part or all of the functions described as being implemented by the controller may be implemented by the program creation device 10, the motor control device 30, or another device.
While there have been described what are at present considered to be certain embodiments of the invention, it will be understood that various modifications may be made thereto, and it is intended that the appended claims cover all such modifications as fall within the true spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2021-114276 | Jul 2021 | JP | national |
The present disclosure contains subject matter related to that disclosed in International Patent Application PCT/JP2022/026845 filed in the Japan Patent Office on Jul. 6, 2022, the entire contents of which are hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/JP2022/026845 | Jul 2022 | US |
Child | 18403118 | US |