The present invention relates generally to modules for relay ladder logic, and more particularly to storing relay ladder logic modules and elements in a relational database to perform automated and semi-automated updates
Many automated processes are controlled using industrial control systems that use special purpose processors. Many of the control systems rely on a variety of actuators, drive devices, and sensors to perform a variety of tasks. For example, a factory may use the control systems in an automated assembly line to move, manipulate, and test the product being assembled. The control systems often are required to handle large amounts of input and output data. The control systems may also be required to be robust and reliable. The control systems may also be required to react rapidly in a real-time environment.
The processors may require specifically designed programming languages. These programming languages are often more structured based on the above requirements of the processor and control system. Relay ladder logic is an example of a programming language designed for control systems. The structure of relay ladder logic may limit the tools and techniques used by the programmer. Relay ladder logic often requires software programmers with specific skills unique to these languages.
The software programmers develop code that performs various tasks when executed by a controller. As the tasks become more complex, the code used to perform these tasks also becomes increasingly more complex. During the programming process, software programmers often develop multiple programs using portions of code in a repetitive structure or copying portions of code from previously designed programs. These programs or portions of code may be referred to as modules. These modules may have variables, rungs, coils, contacts, or other elements that may need to be modified within the modules. The software programmer may have made several programs that require a single element to be changed for each program.
Accordingly, an efficient and effective system and method is needed for storing and modifying modules and elements of modules for relay ladder logic.
It is, therefore, an objective of the present invention to provide devices, systems, and methods for providing and editing modules and elements of the modules for relay ladder logic. An exemplary method may store a template module and one or more template elements associated with relay ladder logic instructions in a relational database. The method may replicate the template module and the template elements. The method may store the replicated template module and the template elements as modules and module elements in the relational database.
Alternative aspects of the system may have the following features. A general purpose processor may be used to store the template module and one or more template elements, replicate the template module and the template elements, and store the replicated template module and the template elements as instance modules and module elements. The elements may be rungs, coils, constants, contacts, or variables. The template elements may be template module defining elements and the general purpose processor edits one or more template defining elements in the relational database and automatically causes edits to respective elements of the instance modules in the relational database. The template elements may be non-template defining elements and a general purpose processor edits one or more non-template defining elements of the template module in the relational database. The method may access one or more module elements in the relational database by a controller or via a general purpose processor. The method may provide direct editing of the instance modules.
The above and other objectives and advantages of the present invention will be apparent upon consideration of the following detailed description, taken in conjunction with the accompanying drawings, in which like reference numbers refer to like parts throughout, and in which:
Referring to
In the design process, the programmer may select and/or create template modules from a variety of sources, for example, but not limited to, a library or previously designed instance modules. The programmer may manipulate elements of the template module based on the needs of the design process. For example, variables, rungs, contacts, coils, or constants of the module may be modified. The instance module and respective elements are stored in a relational database, or any other suitable storage means.
A relational database is a collection of data items organized as a set of structured tables from which data can be accessed, searched or reassembled in many different ways without having to reorganize the database tables. Each table (which is sometimes referred to as a relation) contains one or more data categories in columns. Each row contains a unique instance of data for the categories defined by the columns. The relational database may be extended after the database is created; a new data category can be added without requiring modification of all existing applications.
Control system 100 may provide the programmer with tools to make the design process easier and similar to tools offered in other programming paradigms. Control system 100 downloads the relay ladder logic instance module from general purpose computer 102 to controller 106 and memory 108 via bus 104 or other suitable communications network. The relay ladder logic instance module are stored in the memory 108.
Controller 102 may be coupled to a variety of control devices via control bus 110, or any other suitable coupling means. Control system 100 may include sensor 112, actuator 114, and conveyor belt 116. Control system 100 is not limited to these exemplary devices and may include any other suitable device or devices. Each device 112, 114, 116, or other suitable device or devices may have input and output parameters associated with such device. The input and output parameters are communicated to controller 106 via control bus 110.
For example, sensor 112 may have an active and an inactive state. In operation, sensor 112 normally may be in an inactive state and activated when a package passes in front of the sensor. Actuator 114 and conveyor belt 116 may also have an active and an inactive state.
Controller 106 executes the relay ladder logic instance module. The instance module may cause controller 106 to activate actuator 114 and conveyor belt 116 when sensor 112 is activated. Thus, when a package is observed, controller 106 retrieves the instructions for carrying out certain predefined tasks from memory 108. Controller 106 executes the instance module causing actuator 114 and conveyor belt 116 to be activated. Actuator 114 pushes the package onto conveyor belt 116. Conveyor belt 116 moves the object to the next stage in the manufacturing process.
The above example is a simple example and is provided for merely illustrative purposes. Those skilled in the art will appreciate that other control process may be used and that control system 100 may include a large quantity of devices that are activated in rapid succession. Moreover, relay ladder logic instance modules may include a large quantity of instructions that carry out various and perform a variety of complex tasks.
Architecturally in terms of hardware, controller 106 may include one or more input and output interface devices. The local interface may have additional elements, which are omitted for simplicity, such as controllers, buffers (caches), drivers, repeaters, and receivers, or any other suitable device or devices to enable communications. Further, the local interface may include address, control, and/or data connections to enable appropriate communications among the components of the device network. General purpose computer 102 may also include additional hardware omitted for the convenience of illustrative purposes. General purpose computer 102 may be, for example, a server or any other suitable device. In the case where general purpose computer 102 is a server, it may be coupled to multiple workstations and allow multiple programmers to modify the relay ladder logic modules.
The systems and methods may also be incorporated in software used with a computer or other suitable operating device of the control system. The software stored or loaded in the memory may include one or more separate programs, each of which comprises an ordered listing of executable instructions for implementing the methods and systems of the invention. The software may work in conjunction with an operating system. The operating system essentially controls the execution of the computer programs, such as the software stored within the memory, and provides scheduling, input-output control, memory management, and communication control and related services.
Referring to
Referring to
Referring to
These instance modules may be viewed as on-line instance modules 504. The on-line instance modules 504 are composed of executable code (arrow 503). On-line instance module 504 may run within controller 502. The on-line instance module representation may be viewed differently based on the type of controller under consideration. On-line instance module 504 may consist of entirely executable code 506. Executable code 506 forms a list of instructions which can be executed by controller 502
This may be different from what makes up off-line instance module 508. Off-line instance module 508 may be viewed as a representation of a relay ladder logic module. Off-line instance module 508 is composed of relay ladder logic module elements 516 (arrow 505). Off-line instance module 508 is a collection of relay ladder logic module primitive elements organized as tables according to schema 510 within a relational database 512. Elements 516 make up the off-line instance module 508. Examples of elements 516 may be rungs, contacts, coils, constant references and variable references. Elements 516 are small-grained enough so that the queries operating upon the relational database 512 can be effective in adding, deleting, or changing elements 516 that make up individual modules. Off-line instance modules 508 may be specializations of off-line template module 514 (arrow 507). Off-line instance modules 508 may have a relationship with a corresponding off-line template module 514. Off-line template module 514 may be modified by the programmer. The programmer may then trigger the propagation of changes to the respective off-line instance modules 508. Off-line instance module 508 may be edited individually without breaking the relation to the parent off-line template module 514. Off-line template module 514 may be composed of relay ladder logic module elements 516 (arrow 509). Elements of off-line instance module 508 which match those of the parent off-line template module 514 are template defining elements. Elements that may be edited (added, deleted or changed) without impacting the form of the parent template are not template defining elements.
Off-line instance modules 508 may come into existence either by direct editing or by instantiation (specialization) from off-line template module 514. Within Relational Database 512 modules are represented as a collection of fine-grained elements 516 organized according to the database schema 510. The relational database 512 may persist and manipulate the off-line instance module 508 (arrow 511). The relational database 512 may also persist and manipulate the off-line template module 514 (arrow 513). The relational database 512 may also be organized according to the database schema 510 (arrow 515). Elements 516 encoded within the schema and stored within the table structure of relational database 512 may be viewed as relay ladder logic module elements. Each module may have elements 516 that have some features which are common and some that are distinct. Among the features which elements 516 may have in common is a declaration of whether the element is considered to be template defining or not template defining. Elements 516 which are declared template defining may change if and when the programmer modifies the parent off-line template module 514 template and commands that the parent off-line template module 514 changes be propagated to children. Elements 516 which are declared not template defining may be edited independent of characteristics of the parent template and are not impacted by propagation of changes from the parent template.
As previously discussed, there are various different kinds of relay ladder logic module elements 516. These different types of elements persist within the relational database 512. The relations between them within the relational database 512 encode the order and flow of execution that will be realized by the module when it is transformed from the off-line instance module 508 form to an executable on-line instance module 504 or program. Each element 516 may have common features which allow it to be stored within the schema and handled by queries but also has unique features which may distinguish the elements, for example, the nature of a rung from the nature of a constant reference.
Within the relational database 512, off-line instance modules 508 may have a relationship with off-line template modules 514. When this relationship exists the template may be viewed as the “parent” that “spawned” the instance and that manages those primitives of child off-line instances modules 508 which have been declared template defining. Elements 516 of the off-line template module 514 may be declared template defining or not template defining.
For example, suppose Template A has rung RungA1, RungA1 may have been declared as template defining, and InstanceA1 and InstanceA2 may have been created as children of Template Module A. The programmer may choose to delete RungA1 from Template A. The programmer may command propagation of the change made to Template Module A to the children of Template Module A. This will cause RungA1 to be automatically be deleted from InstanceA1 and InstanceA2.
According to a second example, Template B may contain a rung which triggers execution of a function block, the function block may have a constant valued input parameter of value 50.0, the constant value may be declared a template defining element, and three instances of Template B called InstanceB1, InstanceB2 and InstanceB3 may be provided. The programmer may edit Template B by changing the constant from 50.0 to 73.9. The programmer may then command propagation of the change to the children of Template B.
Relational Database 512 may be structured into a set of tables, each with its own fields and rows. The structure (schema) may be set up so that the database can effectively and efficiently support query operation needed in connection with the storage, editing and manipulation of the off-line modules.
The design of the schema allows for operations such as but not limited to the following. The association of a set of relay ladder logic module elements may provide a cohesive module. The ordering of relay ladder logic module elements may be in positions within an associated relay ladder logic rung. The ordering of rungs may be in order of their execution position within the module. The export of all relay ladder logic module elements may be combined into a textual module representation corresponding to a program that may be compiled.
Module edit and build system 518 may be a subsystem which works with relational database 512 to persist, manipulate, export and import modules. Module edit and build system 518 may direct program loads of the controller 502 (arrow 517). Module edit and build system 518 may direct program edits and loads of the relational database 512 (arrow 519). Module edit and build system 518 may be capable of exporting modules, rendering them into a textual representation susceptible to compilation and compiling the modules into executable form. Module edit and build system 518 may also be a subsystem that works with controller 502 to load the executable modules to controller 502 and cause them to be executed. Module edit and build system 518 may also provide a user-friendly graphical user interface to the programmer so that the modules may be edited and perused without knowledge of the intricacies of how modules are persisted or loaded. Module edit and build system 518 allows the programmer to, for example, edit template modules, edit instance modules, propagate template changes to instance modules, export instance modules for loading, and load instance modules to the controller 106. Module edit and build system 518 may also be considered one of the software subsystems hosted and executed by controller 106
It will be understood that the foregoing is only illustrative of the principles of the invention and that various modifications can be made by those skilled in the art without departing from the scope and spirit of the invention. Persons skilled in the art will appreciate that the present invention can be practiced by other than the described embodiments, which are presented for purposes of illustration rather than of limitation and that the present invention is limited only by the claims that follow.