The present invention relates to programming programmable logic controllers (PLCs), and in particular relates to programming PLCs using different languages with comments.
A PLC is a solid-state, microprocessor based, real-time computing system that may be used, via a network, to automatically monitor the status of field-connected sensor inputs, and automatically control devices of a controlled industrial system (e.g., actuators, solenoids, relays, switches, motor starters, speed drives (e.g., variable frequency drives, silicon-controlled rectifiers, etc.), pilot lights, igniters, tape drives, speakers, printers, monitors, displays, etc.). A PLC may operate according to a user-created set of values and user-created logic and/or instructions stored in memory. The sensor inputs may reflect measurements and/or status information related to the controlled industrial system.
A PLC can replace thousands of relays and cam timers due to its precise and real-time timing and sequencing capabilities. PLC hardware often has good redundancy and fail-over capabilities. A PLC may use a Human-Machine Interface (HMI) for interacting with users for configuration, alarm reporting, and/or control.
Programmable controllers in general, and PLCs in particular, can execute program code in a repetitive process referred to as a scan. A scan can start with the CPU reading a status of inputs. The application program can be executed using the status of inputs. Once the program is complete, the CPU can perform internal diagnostics and/or communication tasks. The scan cycle can end by updating the outputs, then start over. The cycle time can depend on the size of the program, the number of I/O's, and/or the amount of communication required.
A PLC may be programmed using ladder logic or some form of structured programming language, for instance as specified in IEC 61131-3, namely, LD (Ladder Diagram), FBD (Function Block Diagram), ST (Structured Text), IL (Instruction List), SFC (Sequential Function Chart). LAD and FBD are graphic-oriented programming languages, and STL is a text-oriented programming language. Each of these programming languages can be used in STEP 7, which is programming software that can be used to program PLCs, such as the SIEMENS SIMATIC S7-300 and SIMATIC S7-400. Generally, SIMATIC is an automation system that can be used for implementing industrial control systems, such as for machines, manufacturing plants, and/or industrial processes.
LAD may use graphical symbols that resemble electromechanical elements used in a relay logic diagram format to describe hard-wired control. The left vertical line of a typical Ladder Logic Diagram may represent a power or energized conductor. A right vertical line may represent a return path of a hard-wired control line diagram, and may be omitted. Ladder Logic Diagrams may read from left to right, and from top to bottom. Rungs may be referred to as networks, and a network may have several input and output instructions. Input instructions may be represented by a series of contacts, in one or more parallel branches. Input instructions may perform comparisons and/or tests, and may be normally left justified on the rung. Output instructions may be represented by coils, for which there may only be one in each output branch. Output instructions may execute some operations and/or functions, and/or may be right justified on the rung.
To write programming instructions, generate configuration data, and/or download the code and configuration data to a programmable controller, several tools can be used. A programming device, such as a soft real-time device, for instance a personal computer (PC), can be interfaced with a PLC. Typically, a proprietary cable, such as SIEMENS PCIPPI, may connect a PCs RS 232 port with the PLC. Engineering software tools, such as SIEMENS STEP 7, may be installed on the PC so that the PC can be used to write programming instructions for the PLC.
A method of annotating a specification of a programmable logic controller is provided that includes displaying a graphical element in a first graphical language for programming the programmable logic controller, and displaying a comment associated with the graphical element.
In the method, the graphical element represents at least one of an input, an output, an operation, an operand, a function, an instruction, a comparison, a test, a wire, a network, a branch, a rung, and a code. The comment explains at least one of an identity, a purpose, a task, an activity, a status, data, and an arrangement of the graphical element. The comment may be arranged in a bubble attached by an anchor line to the graphical element.
The method may also include displaying a second comment with one of the graphical element and a second graphical element. The second comment may be in a second bubble attached by a second anchor line to the one of the graphical element and the second graphical element.
A method for converting a specification for a programmable logic controller in a first language to a second language is provided that includes converting a first instruction in the first language to a second instruction in the second language, and converting a first comment associated with the first instruction to a second comment associated with the second instruction.
The converting of the first comment to the second comment may include identifying a graphic equivalent of the first instruction and displaying a bubble for the second comment. The bubble may be visually associated with the graphic equivalent.
The converting of the first comment to the second comment may include identifying a text equivalent of the first instruction and displaying the second comment on a line immediately following the text equivalent.
A computer-readable recording medium is provided having recorded thereon an executable program. The program when executed causes a processor to perform any of the methods described herein.
When writing instructions in a graphic-oriented PLC programming language, it may be beneficial to add comments (also referred to herein as annotations) to those instructions to, for example, explain the identity, location, purpose, task, activity, status, data, and/or arrangement, etc., of any one or more elements of the instructions, such as one or more inputs, outputs, operations, operands, functions, instructions, comparisons, tests, wires, networks, branches, rungs, and/or code, etc.
Certain exemplary embodiments of the instant invention allow a user to enter free form comments (that is, essentially any text desired by the user) in graphic-oriented PLC programming languages, such as LAD and/or FBD, directed to a specific element of the program. The comment can be attached to any element of the diagram, such as an instruction, operand, and/or wire. In certain exemplary embodiments, the user can specify and/or adjust the properties and/or format (e.g., font, style, size, color, effects, spacing, and/or transparency, etc.) of the text of the comment as desired.
The user may edit a comment simply by, for example, single-clicking within the comment “box” and/or by right-clicking on the attached element and selecting “Edit Comment” from a pop-up contextual menu. While in edit mode, the comment can be edited. Moving and resizing may occur when the comment is not being edited.
One or more potentially user-adjustable and/or configurable “anchor lines” (e.g., one or more curves and/or line segments) can attach a comment to its associated element(s). A comment's location can default to a particular location, such as to the right and/or below the element to which it is attached. In certain exemplary embodiments, a comment may be connected to an element, detached from an element, re-attached to an element, and/or attached to one or more new elements.
After a comment has been added, it may be adapted to receive input from a user. This can allow the user to immediately begin inputting the text of the comment without additional user actions.
The user may position the comment anywhere within the network and/or adjust the size of the comment as needed and/or desired. For example, the user may move the comment by, for example, clicking on its border. The user may resize the comment by, for example, clicking on one of its handles. When a comment is moved and/or resized, its anchor line may be automatically re-oriented and/or re-routed as needed to maintain the anchor line's connection to the element(s).
In certain exemplary embodiments, properties such as the text formatting, shape, text set-off, background color, border color, and/or border thickness, etc., of the default and/or a specific comment box and/or anchor line can be user-defined and/or adjustable.
A comment box can be automatically re-sized to accommodate added text. Since the size of the comment box can be user-adjustable, it can be possible for only part of its text to be visible. If the comment is resized, the text of a comment can be restructured and/or reformatted to fit within the resized box. If the entire text of the comment is not visible, then an ellipsis can be appended and/or displayed as a visual indication of the hidden text.
Because comments can overlap, the Z order (also referred to as a virtual depth in a screen image) and/or position of a comment can configurable. By using, for example, the comment's contextual menu, the user can, for example, bring a comment associated with an Add instruction forward and/or to the front, and/or send a comment associated with a coil backwards and/or to the back.
A comment can be positioned anywhere within an image of the graphical instructions. The transparency of the comment can be adjustable. For example, via a comment's contextual menu, a user can adjust the transparency of the comment.
When the user converts from one programming language to another, the comments can be automatically mapped and/or converted to the new language. For example, when switching between LAD and FBD, comments can be converted directly to a corresponding instruction. When switching languages, the positions of the comments can be automatically adjusted as needed. Any unattached comments can be positioned at a default location, such as at the top or bottom of the network.
As another example, when converting from a graphic-oriented PLC programming language, such as LAD or FBD, to a text-oriented PLC programming language, such as STL, the free form comments may become line comments, which may be located beside the corresponding instruction. For example, in the case of an ADD _I instruction, four STL instructions can be provided. The comment may be mapped to and/or associated with the instruction that most closely represents the original instruction.
When moving from a graphical language to a text-based language, the main AWL instruction may receive the box comment. The comments on wires may be put to L and T instructions (also referred to herein as load and transfer instructions). In a conversion from a text-based language to a graphical language, L and T line comments may be put on wires, and a main instruction may be put to the box. Comments on an ENO (enable output) handling instructions may be merged to the box.
In certain exemplary embodiments, to the extent permitted by the programming language into which the comment is converted, properties of the comment box, anchor line, and/or comment text (e.g., font, style, size, color, effects, spacing, and/or transparency, etc.) can be preserved during the conversion.
In certain exemplary embodiments, via one or more user interfaces, such as a graphical user interface, a user can view a rendering of information related to specifying, editing, revising, converting, compiling, executing, implementing, outputting, and/or communicating a programming instruction and/or comment.
Specification 100 of
Specification 900 is a translation of specification 100 into a text-based language. Element 905 includes a “DoAdd” instruction. Element 910 includes a JNB001. JNB is a jump instruction in which, if the result of the logical operation is 0, JNB interrupts the linear program scan and jumps to the designated label. In other words, if the “DoAdd” contact is “off” then the program jumps to the 001 label. The user may only want to perform the add operation when the contact is “on”, otherwise the logic is skipped.
Elements 915 and 920 of
The foregoing Detailed Description is to be understood as being in every respect illustrative and exemplary, but not restrictive, and the scope of the invention disclosed herein is not to be determined from the Detailed Description, but rather from the claims as interpreted according to the full breadth permitted by the patent laws. It is to be understood that the embodiments shown and described herein are only illustrative of the principles of the present invention and that various modifications may be implemented by those skilled in the art without departing from the scope and spirit of the invention.
This application claims the benefit of U.S. Provisional Application No. 61/056,500, filed May 28, 2008, the disclosure of which is herein incorporated by reference.