The present invention relates to a sequence program creating apparatus that creates a program of a programmable logic controller by editing a sequential function chart (SFC).
There is known a sequential function chart (SFC) as a description method of a program used for creating a sequential program executed by a programmable logic controller. The SFC is a method of representing a processing flow similar to a flowchart by figurative elements and a connecting state thereof. The SFC has features such that, for example, a workflow is easy to understand.
Essentially, the SFC is a chart that represents a relation of a connection between steps and transitions by a drawing. In the IEC standard, a text representation that directly describes a relation of a connection is defined in parallel with a graphical representation.
Conventionally, graphical constituent elements such as connection lines of steps, transitions, branches, and convergences are arranged on a grid to create a program. An operation of arranging these constituent elements requires time and labor, because a plurality of parts are necessary to be arranged to represent a simple relation, and even graphical representations that make no sense as the SFC is made, thereby degrading the efficiency of production.
In Patent Literature 1, a transition is automatically inserted between steps by using such a code that steps and transitions appear alternately.
In Patent Literature 2, wrong inputs are rejected by using “insertion judgment matrix that limits insertable functional parts in advance” preset at the time of an input operation.
However, in the technique of Patent Literature 1, when steps are continuously inserted, insertion of transitions can be omitted; however, effective cases for this operation are limited. For example, at the time of inserting a step after a parallel branch, it cannot be determined whether to insert a transition. Furthermore, when a step is newly arranged after a selective branch, which has not been converged, it cannot be determined whether to connect the new step by inserting a transition between the last step at one branching point and the new step or to connect it as a selective convergence by inserting a transition between the last steps at all branching points and the new step.
In the technique of Patent Literature 2, when a restriction by an SFC code is expressed as “insertion judgment matrix”, a similar function can be realized by the SFC, and it is possible to prevent performing of wrong editing that makes no sense as the SFC. However, there is a problem that editing man-hours cannot be reduced.
The present invention has been achieved in view of the above problems, and an object of the present invention is to provide a sequence program creating apparatus that can create a sequence program by editing an SFC in which elements are arranged according to a code with less man-hours.
In order to solve the above problem and in order to attain the above object, in a sequence program creating apparatus that creates a sequence program to be executed by a programmable logic controller by causing a user to perform an operation of editing a sequential function chart (SFC) expressed by a plurality of elements and a connecting state thereof on an editing screen, the sequence program creating apparatus of the present invention, includes: a rule storage unit that stores therein a code of the SFC; and an editing control unit that, when a new-element inserting operation for newly inserting the element into the SFC is performed on the editing screen, adds data corresponding to the new element to data of the sequence program, based on a type of the already-arranged element specified as a new-element insertion target element by the new-element inserting operation, a position with respect to the new-element insertion target element, and a code of the SFC stored in the rule storage unit.
The sequence program creating apparatus according to the present invention can create a sequence program by arranging elements in an SFC according to a code with less man-hours.
Exemplary embodiments of a sequence program creating apparatus according to the present invention will be explained below in detail with reference to the accompanying drawings. The present invention is not limited to the embodiments.
Before explaining operations of the sequence program creating apparatus 10, an SFC code required for explaining these operations is explained. The SFC code is stored in the rule storage unit 5, and the editing control unit 22 determines the processing contents to be added to the edit data according to the SFC code.
Elements that constitute an SFC are steps and transitions. Steps and transitions include an inlet and an outlet, and an outlet of a step is connected to an inlet of a transition and an outlet of a transition is connected to an inlet of a step, respectively, by a connection line. Therefore, steps and transitions appear alternately, and thus steps are not connected with each other and transitions are not connected with each other. In each diagram used for the following explanations, a step is expressed by a rectangular sign and a transition is expressed by a crossbar-shaped sign.
The step is accompanied with a process written in another language (such as a ladder language). As an example, such a process that “if a device M0 is on, turn on a device M1” is accompanied with the step. Because an object of an SFC is to control an FA device, in many cases, the process is a reference to a device value (reading of a sensor value) and a change (turning on or off of a switch).
Steps have two states of active and inactive. The accompanying process is performed during an active state. Furthermore, there is a step automatically performed at the time of starting a system, and this step is referred to as “initial step”.
The transition is accompanied with a transition condition written in another language. As an example, there is such a transition condition that “when a device M2 is on and a device M3 is on, the condition is established”.
There is a case where a plurality of transitions follow one step, which is referred to as “selective branch”. Furthermore, there is a case where a plurality of transitions precede one step, which is referred to as “selective convergence”. The selective branch and the selective convergence are expressed as one horizontal line connecting the inlet and outlet of the transitions on the SFC.
When a step is active, the condition of a subsequent transition is evaluated. However, the conditions of the subsequent transitions in the selective branch are evaluated on the SFC sequentially from the left, and only a step following a transition with the condition thereof being established becomes active. Therefore, there is an order in the transitions following a certain step. In the following explanations, this order is referred to as “subsequent transition order”. In the selective convergence, a step subsequent thereto is only one, and thus when the preceding step is active and the condition is established, a transition to the subsequent step occurs.
Contrary to the case of the selective branch, there is a case where a plurality of steps follow one transition, which is referred to as “parallel branch”. Contrary to the case of the selective convergence, there is a case where a plurality of steps precede one transition, which is referred to as “parallel convergence”. The parallel branch and the parallel convergence are expressed by a horizontal double line connecting an inlet and an outlet of steps on an SFC.
In the parallel branch, when the transition condition of a transition is established, all subsequent steps become active. In the parallel convergence, a transition occurs only when all the preceding steps are active and the transition condition of a subsequent transition is established.
An operation of the display control unit 23 is explained next. The display control unit 23 creates an SFC based on a relation of a connection between steps and transitions. First, the display control unit 23 arranges an initial step, and then arranges transitions connected to an outlet of the initial step below (after) the initial step from left to right according to the subsequent transition order. When there are a plurality of transitions, these transitions are horizontally connected by a selective branch. Subsequently, the display control unit 23 arranges a step connected an outlet of each of the transitions below the transition. When there are a plurality of steps connected to each of the transitions, steps are arranged from left to right and connected by a parallel branch. The display control unit 23 repeats this process to arrange all elements in a tree structure. When a grid is used, it suffices that each of subtrees has a required width.
By using selective convergence and parallel convergence, steps or transitions including a plurality of preceding elements can appear in an SFC several times. In this case, the display control unit 23 needs only to draw a subtree including a subsequent element for only one of the elements appearing several times. For other parts, the display control unit 23 draws only the element and indicates that others are omitted, or draws a connection line with the drawn element.
When one preceding step includes a plurality of transitions, if these transitions are arranged adjacent to each other, the display control unit 23 draws an SFC by using the selective convergence, and if not, the display control unit 23 draws the SFC by an abbreviated drawing. Even in these cases, the relation of the connection is the same. As for the parallel convergence, the display control unit 23 can determine whether to make an abbreviated drawing based on the same basis.
As described above, it is assumed that an SFC is mechanically created by the display control unit 23 based on the relation of the connection. That is, an editing operation using the input unit 1 is performed with respect to the SFC; however, an editing process is performed by the editing control unit 22 with respect to the relation of the connection, and the display control unit 23 creates the SFC based on the relation of the connection.
To create a tree structure, it is only necessary to specify an element to be processed and add an element subsequent thereto, and to specify an order of a plurality of subsequent elements (a horizontal alignment order).
An operation of the editing control unit 22 is explained next. The editing control unit 22 determines what process should be performed based on an operation performed via the input unit 1 and a relatively strong restriction held by a relation of a connection (a code stored in the rule storage unit 5). The restriction on a relation of a connection used here is as follows. (1) Steps and transitions appear alternately, and steps are not connected with each other and transitions are not connected with each other. (2) There is a case where a plurality of transitions follow one step. This is expressed as “selective branch” on an SFC. Furthermore, when a plurality of transitions precede one step, this is expressed as “selective convergence”. (3) There is a case where a plurality of steps follow one transition. This is referred to as “parallel branch”. When a plurality of steps precede one transition, this is expressed as “parallel convergence”.
From (1) described above, the editing control unit 22 can automatically determine that an element following a step is a transition, and an element following a transition is a step. From (2) and (3) described above, the editing control unit 22 can automatically determine that when a plurality of steps follow a transition, these are parallel branches, and when a plurality of transitions follow a step, these are selective branches.
Operations performed via the input unit 1 include an operation of specifying a certain element (a step or a transition) arranged on an SFC and inserting it into a relevant position, and an operation of specifying a certain element (a step or a transition) arranged on the SFC and deleting the element.
Furthermore, as the “relevant position” in operations, the editing control unit 22 defines “same position”, “anterior position”, “posterior position”, “right position”, and “left position”.
A case where an insertion of a new element is performed without specifying an element type is explained. As shown in
As a method of specifying a relevant position, it is possible to employ an input method by a mouse gesture.
When the relevant position specified by the new-element inserting operation using the input unit 1 is the same position (Step S104/same position), the editing control unit 22 replaces the step 700 in edit data by another step (Step S105). The display control unit 23 changes the step 700 on an SFC to another step (Step S106), and displays the step on the display unit 3 (Step S115).
When the relevant position specified by the new-element inserting operation using the input unit 1 is the posterior position (the next position) (Step S104/posterior position), the editing control unit 22 newly inserts a transition in a subsequent stage of (next to) the step 700 in edit data (Step S107). The display control unit 23 newly adds a transition below the step 700 in an SFC (Step S108), and displays the transition on the display unit 3 (Step S115).
When the relevant position specified by the new-element inserting operation using the input unit 1 is the anterior position (Step S104/anterior position), the editing control unit 22 inserts a new step and a new transition between the transition 701 and the step 700 in edit data (Step S109). The display control unit 23 newly adds a new step and a new transition between the transition 701 and the step 700 in an SFC (Step S110), and displays them on the display unit 3 (Step S115).
When the relevant position specified by the new-element inserting operation using the input unit 1 is the left position (Step S104/left position), the editing control unit 22 inserts a new step as a subsequent step of the transition 701 in the edit data, so that the subsequent transition order becomes immediately before the step 700 (Step S111). The display control unit 23 shifts the step 700 in an SFC to a right cell, adds a step to be newly inserted to the cell in which the step 700 has been arranged, connects the step 700, the newly inserted step, and the transition 701 with each other by a parallel branch (Step S112), and displays them on the display unit 3 (Step S115).
When the relevant position specified by the new-element inserting operation using the input unit 1 is the right position (Step S104/right position), the editing control unit 22 inserts a new step as a subsequent step of the transition 701 in the edit data, so that the subsequent transition order becomes immediately after the step 700 (Step S113). The display control unit 23 adds a step to be newly inserted to the right cell of the step 700, connects the transition 701, the step 700, and the newly inserted step with each other by a parallel branch (Step S114), and displays them on the display unit 3 (Step S115).
As described above, insertion of a transition following steps and insertion of a parallel branch become possible. While a case where a specified element is a step is explained here as an example, the same is true for a case where a transition is specified, and insertion of a step following a transition and insertion of a parallel branch are possible.
As for deletion, the editing control unit 22 deletes a connection with an element preceding a new-element insertion target element. The reason for the element itself not being deleted is that, when there are a plurality of preceding elements, the relation with these elements should be maintained. When there is no preceding element, the editing control unit 22 can delete the element itself.
In the new-element inserting operation described above, it is not specified “what” is to be inserted in the operation using the input unit 1, and the editing control unit 22 automatically determines an element to be inserted. However, by additionally specifying a portion corresponding to “what”, a process to be performed by a single operation can be added to form an already-arranged element connecting operation. As an example of this operation, a similar operation with respect to an already-arranged element is defined first. As a specific example of the operation using the input unit 1, drag and drop of a second already-arranged element to a position relevant to a first already-arranged element can be mentioned.
By specifying a certain element (a step or a transition) arranged on an SFC by the operation using the input unit 1, the editing control unit 22 inserts an “already arrange element” into a relevant position. A process performed in practice is equivalent to a process in which a process corresponding to “generation of a new step or transition” described above is omitted, and only a connection to the already-arranged element is performed.
In the present embodiment, because it is not required to specify “what” in the operation using the input unit 1, additional information can be held by this portion.
For example, while a step has a process, as a typical example of this process, there is a process in which the value of a certain device is only set according to an activation state (“Boolean action” referred to in the IEC standard). Furthermore, transition conditions of the transition include a condition in which if the value of a certain device is true, the condition is established, and if not, it is not established. In each case, only by specifying a device to be processed to a portion corresponding to “what” by using the input unit 1, the editing control unit 22 can insert and connect an element including processes or transition conditions.
Similarly to the insertion of a new element or an already-arranged element, an element and a process or transition condition in this element can be input by a single operation, by inserting a device to a corresponding relevant position by an operation using the input unit 1.
In simple operation examples such as those shown in
The SFC created by the sequence program creating apparatus according to the present embodiment is constituted only by elements arranged according to a code, and thus creation of an inexecutable sequence program (conversion to an inexecutable code) can be prevented.
As described above, according to the present embodiment, the number of operations required for editing an SFC can be reduced, and it is possible to prevent an arrangement of elements, which does not follow the code.
In the first embodiment, a “relevant position” is specified by using a cell in which a specified element is arranged and a cell adjacent thereto. However, when another element has been already arranged in the cell adjacent to the cell in which a specified element is arranged, the meaning of the operation becomes ambiguous, and thus an arrangement needs to be made in order to vacate the arrangement position.
Therefore, in a second embodiment of the present invention, the editing control unit 22 divides a cell into a plurality of areas and defines a relevant position in a cell in which the specified element is arranged.
In the present embodiment, because a relevant position can be specified by an operation in the cell in which the specified element is arranged, even when a part has been already arranged in an adjacent cell, the meaning of the operation does not become ambiguous. However, by dividing the cell into a plurality of areas, the operability of the operation of specifying the relevant position is degraded, and a processing load of the control unit 2 increases with the division of the cell. Therefore, it is preferable to apply either one of the first and second embodiments as appropriate, based on which one of the operability or the processing load of or unambiguity of the operation of the control unit 2 is given a priority. In addition, the first and second embodiments can be used together so that cell division is made effective at all times and the specification of the relevant position by using an adjacent cell can be made effective only when the cell is available.
Furthermore, as for the specification of the relevant position by using the adjacent cell, the relevant position can be allocated to an adjacent cell unsymmetrically according to the usage frequency thereof.
As described above, the sequence program creating apparatus according to the present invention is suitable to create a sequence program that can be executed by arranging elements according to a code.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP11/71207 | 9/16/2011 | WO | 00 | 6/26/2012 |