Sei sulla pagina 1di 6

PLC Standard Programming Languages: IEC 1131-3

Mark Maslar Rockwell Software Inc.


Today, if you use programmablecontrollers from more than one vendor, you bear the burden of learning more than one method of programming and troubleshooting. If a programmingstandard provided greater uniformity between programmable controllers, you could reuse work and potentially reduce the amount of retraining. Yet the problem for the would-be developer of standards is this: how to offer relevance to todays market and still afford migration to future technologies. IEC 1131-3 - the international standard for programmable controller languages - has achieved this by applying modern software engineering principles to the best existing practices and, at the same time, providing for extensibility, i.e., further enhancements by vendors. Historical background The development of IEC 1131 can be traced to 1978, when a French standard, AFCET, was developed for documenting industrial processes. The following year saw the introduction of GRAFCET, which provided for simple constructs known as steps and transitions. These make it possible to organize a process by breaking it down into simpler elements and defining sequential relationshipsbetween elements. Scope of the standard Developed with the input of vendors, endusers and academics, IEC 1131 consists of five parts: 1. General information 2. Equipment and test requirements 3. PLC programming languages 4. User guidelines 5 . Communications
IEC 1131-3 is the standard for programming languages: as such, it specifies the syntax, semantics and display for the following suite of PLC programming languages: 0 Ladder diagram (RLL) Sequential Function Charts (SFC) Function Block Diagram (FBD) Structured Text (ST) Instruction List (IL)

Benefits In addition to providing for a choice of programming languages, the standard also enables programmers to integrate multiple languages within the same application. This allows the programmer to select the language best suited to the particular task. The standard also provides for common elements, such as data types, variables, and program organization. As a result, standard-compliant programs look similar and are easier to transport between systems which reduces training time and engineering effort. At the same time, the instruction set is not limited by the standard; vendors are free to develop new instructions to meet customer needs as they arise. Language overview
Two of these languages - Ladder Diagram

It wasnt until 1982 that European control vendors began implementing GRAFCET as a means of both organizing and controlling sequential processes. Disparate implementationsof GRAFCET soon proliferated, however, causing users and vendors to identify the need for international standards. In 1987, the IEC (International ElectrotechnicalCommission) announced a general standard for all control systems. IEC 848, Preparation of Function Charts for Control Systems. In March, 1994, a standard specific to programmable controllers, IEC 1131-3, reached standard status.

(LD) and Function Block Diagram (FBD) are graphical; Instruction List (IL) and Structured Text (ST) are textual. Sequential Function Charts (SFC) may be thought of as building blocks controlling program flow.

0-7803-3148-6-5/96 $4.00 0 1996 lEE

26

Sequential Function Chart programming SFC programmingoffers a graphical method of organizing the program, with programming in other languages nested within the SFC. The three main components of an SFC are steps, transitions, and actions. Steps are merely chunks of logic, i.e., a unit of programming logic that accomplishes a particular control task. Actions are the individual aspects of that task. Transitions are the mechanisms used P o move from one task to another. For example, filling a tank might be a step which could be further broken down into actions such as opening ingredient valves A,B, and C. A transition - measuring fluid level - would lead to the next step, blending.

programming is used, the actions will be written in oine of the four programming languages described below. Figure 3 shows a sample net weight calculation as it would be performed in each of these languages. In each example, net weight is calculated by subtracting tare weight from the gross weight. Ladlder Diagram Chart programming For people who understand relay controls, LD continues to be an advantage in terms of usalbility. Although it is possible to program ail control logic in LD, supplementing LD with other languages allows users access to the language best suited for a particular control task. The standards implementation of LD appears in Figure 3. Function Block Diagram Programming Like SFC, FBD is a graphical language that allows programming in other languages (ladder, instruction list, or structured text) to be nested within the FBD. In FBD, program elernents appear as blocks which are wired together in a manner resembling a circuit diagram (Fig. 3). FBD is most useful in those applications involving a high degree of information/dataflow between control components. lnsltruction Llst programming This low-level language is similar to Assembly language and is useful in cases where small functions are repeated often. IL allows thiese functions to be written once, and then to simply issue calls in latter instances in the control program (Fig. 3). Structured Text Programming This high-level language resembles Pascal or Egasic, and, in fact, people trained in computer programming languages often find it the easiest languages to use for pro!grammingcontrol logic. When symbolic addlressing is used, ST programs resemble sentences, making it highly intelligible to the novice user as well (Fig. 3). Two key advantage?;of structured text over ladder diagram are its ability to perform complex math algorithm in ST can fit on a single pagie.
As another example of the standards extensibility, Rockwell Software augments ST with a feature called PowerTextTM,

As a graphical language, SFC programming offers the users several choices for executing a program, each depicted in a visually distinct way (Fig. 1). In a sequential configuration, the processor simply executes the actions in step 1 repeauedly, until the transition logic becomes true. The processor then proceeds to step 2. In a selection branch, only one branch is executed depending on which transition is active. In a simultaneous branch, all branches are executed until the transition becomes active. In addition to various types of branches, the operation of individual actions within a step can be varied with the use of action qualifiers.
Qualifiers (Fig. 2) determine how the action is scanned and allow actions to be controlled without additional logic. For example, one could use the L qualifier to limit the time that ingredient valve B is opened. In practice, an active step is highlighted to signal to the programmer which part of the program is executing - a useful feature for troubleshooting. This highlighting is an example of the standards extensibility - the ability of a vendor to add a feature not specified in the standard. Note that the standard offers SFC
programming as an organizing tool. The

user chooses whether to use it or not, based on whether the process being controlled is sequential in nature. And even if SFC

27

which supplements standard ST with realtime display of discrete, forced, analog, and floating-point values.
Compliance/compatlbillty With the choice of five standard programming languages, users have gained considerable new programming flexibility. Yet, it is important to point out what the new standard does not do. The standard does not, for example, specify the physical I/O and memory address mapping, allowing this to vary with the hardware being used. And the standard does not define a common machine-level software interface something that would make it possible to exchange applicationsbetween programmable controllers from multiple vendors.

PLCopen is to allow users to move between programmable controllers with very little training and to exchange applications between PLCs.
Conclusion The 1131-3 standard benefits vendors and users alike. For users, the standard promises to reduce the amount of rewriting of applications and the retraining required with each new control system. For vendors, the standard holds the promise of reducing development time (no need to reinvent the wheel) and, subsequently, increasingtime spent to meet specific customer or industry needs.

A separate organization has been created with that goal in mind. PLCopen is a worldwide association that maintains vendor- and product-independence, as well as independence from IEC. Founded in June 1992, the group has adopted the IEC 1131 standard; its members are committed to supply or use IEC 1131-compatible systems and, in general, promote the 11313 standard. The association develops common implementationconcepts, appoints laboratories for compliance testing, and defines test criteria. The long-term goal of

For a copy of IEC 1 131-3, contact: American National Standards Institute, Inc., Customer Service Dept., I 1 W. 4FdSt., New York, NY 10036; Tel: (212) 642-4900; Fax: (212) 3021486
For additional information about PLCopen, contact: PLCopen, PO Box 2077,5300 CN Zaltbommel, The Netherlands; Tel: +3 1 4 180 41 139

28

Figure 1: Sellectlon Branch, SlmuUtaneous Branch, and Sequential Configuration SFC ~rogram~ing

Selection Branch

lmultaneous Branch

~e~~entia~ Conflguratlon

tAction 1 Action 2 Action 3

29

Figure 2: 8FC Action Qualifiers

SFC Action Qualifiers

N
S

Nonstored Set (stored) Reset

Terminate when the step becomes inactive. Continue after the step is deactivated, until the action is reset. Terminate the execution of an action previously started with the S, SD, SL, or DS qualifier. Start when step becomes active and continue until the step goes inactive or a set time passes. Start a delay timer when the step becomes active. If the step is still active after the time delay, the action starts and continues until deactivated. Start when the step becomes ActiveiDeactive and execute the action only once.

R
L

time Limited

time Delayed

P
SD

Pulse
Stored and time Delayed Delayed & Stored

Action starts after time delay, continues until reset. If step is still active, action starts after time delay, continues until reset.

DS

SL

Stored & time Limited

Action starts when step becomes active, continues for a set time or

30

Figure 3: Weight Calculation - Textual Languages

Instruction List (IL)

LD JMPC ST FiET LD SUB

Weight-Command WEIGH-NOIN EN0 gross-weight tare-weight

Structured Text (ST)

IF WEIGH-COM MAND THEIN NET-WEIGHT :=: GROSS-WEIGHT END-IF;

- TARE-WEIGHT;

Weight Calculation -Textual Languages Function Block Diagram (FBD) WEIGH


Weigh-Command gross-weight tare-weight

Net-Weight

LIMITS ALARM
High limit Variable value Lower Limit High flag A,arm output

Ladder Diagram (RLL)

gross-weight tare-weigh

31

Potrebbero piacerti anche