DME DMEIAU617 Webinar3 v1
DME DMEIAU617 Webinar3 v1
Engineering Technology
(DME - 52884WA
DMEIAU617: Industrial Automation
Webinar
Topic 3
Standard Programming Languages
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
IEC-61131 Standard Languages
• IEC-61131-3 defines standard languages
– Textual languages
▪ Structured text (ST)
▪ Instruction List (IL)
• Graphical languages
– Function Block Diagram (FBD)
– Ladder diagram (LD)
– Sequential Function charts
▪ represent the total flow of control system
▪ can use any of above languages
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Standard Relay Logic
Normally Open Contact (Examine if Closed)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Logical Functions
• AND
• OR
• XOR
• NOT (Complement or Invert)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Ladder Logic Basics
• The concept of PLC ladder-logic
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Ladder Logic Basics
• Ladder-logic start operation (& logic diagram)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Ladder Logic Basics
• Devices that indicate a stop operation for a particular item are normally
wired in series so that any of them can stop or switch the particular
items off .
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
TON (On Delay Timer)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
C-UP (Up Counter)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Ladder Diagram Language
Defined In IEC Standard 61131 Part-3
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
LD Basics
• Ladder Diagram (LD)
– second Graphical language described in IEC-61131-3
– Derived from earlier electrical circuit diagrams
▪ Power rails left and right
▪ Logic in between
– graphical representations of Boolean and other expressions
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
LD Components
• Power rails
– left power rail always
– right Power rail (optional)
• Data components
– contact (input state of a variable)
– coil (output a variable)
• Rows
– coil with associated contact network called “LADDER RUNG”
• Options
– semi-graphic and full-graphic representations permitted
• Evaluation
– Left-to-right, top to bottom
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Summary
• LD
– derived from earlier electrical circuit diagrams
– particularly suitable for combinatory logic encountered in process
interlocking
• functions and function blocks
– can be embedded in a LD + can have EN/ENO type inputs and outputs
– EN/ENO can be used to sequentially control execution of functions and
function blocks
• Translation
– Between LD and FBD usually straightforward
– network evaluation should follow rules in standard
– Generally left-to-right, top-to-bottom
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Sequential Function Chart (SFC)
Defined In IEC Standard 61131 Part-3
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Sequential Function Chart
Grafcet
• graphical language for industrial process control systems
• French national standard, Europe DIN EN 60848
• GRAFCET abbreviation for “GRAphe Fonctionnel de Commande
Etapes/Transitions.”
• It means: Step Transition function chart
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Sequential Function Chart
• IEC 848:1988 standard
– evolved from Grafcet language
– used for preparation of function charts for control systems
• Sequential Function Chart (SFC)
– language origin in Petri-net used for flow charting of computer
applications
• Evolution to IEC-61131-3 SFC
– IEC-61131-3 adopted many definitions of SFC from IEC- 848
– enhancements primarily to integrate with other IEC-61131-3 languages
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
SFC Components
• SFC
– represented as a sequence of Steps
– useful for any process with stages occurring in predetermined sequence
• Steps & Actions
– Each stage is called a Step
– Each step has certain associated functions, called Actions
• Transitions
– Progression from one Step to the next is called Transition
– Skipping steps or branching steps is possible with Divergent/Convergent
paths
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
SFC Action Steps
• Each STEP of an SFC is associated with certain Actions
• Actions indicated in rectangular box using any IEC standard language
• Wait STEPs
– has no actions
– just waiting for next transition condition to be fulfilled
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
SFC Structure
SFC consists of
• Steps - first one called START
• Transitions
• change between steps
• Conditions for transition
• Actions
• performed in each step
• PATH
• Sequence of execution of steps
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
SFC Summary
SFC = flexible method for representing complex systems
• STEPs and transitions elements of SFC
– can be represented using any of the graphical languages defined in the
standard.
– Action Qualifiers are used to define the manner in which actions are
sequenced.
• General note:
– Though SFC is generally used for representing large control systems, it
can also be used to represent low level actions in a part of a sequence
such as a function block, which occur within a POU
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Instruction List Language
Defined In IEC Standard 61131 Part-3
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
IL Basics
Instruction List (IL)
• one of five programming languages covered in IEC-61131-3
• low-level language (in a way similar in concept to Assembler)
• textual language
• can mimic behavior of any function, function block or program
• based on earlier low level proprietary languages used by PLC
manufacturers
• consists of a series of instructions, each being a line of code
• an instruction contains
– operator + one or more operands (silent or explicit) +
– comment (to document the purpose of an instruction)
• more appropriate for small parts of code that need to be highly
optimized and efficient
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Instruction Capabilities
An instruction can typically do the following:
• Get stored value from a Register (memory location)
• Modify the value using operators
• Store the result
– to a result register (a.k.a. Accumulator or just ACCU) or
– the register content to a variable
• JUMP to another Instruction
• Perform logic operations
• Perform arithmetic operations
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Instruction Capabilities
Note
• to improve readability, IL programs are written with fixed Tabs
– (i.e. as a table)
• The constituent parts of each line are clearly identifiable by columns
– i.e. Label, Operator, Operand and Comment
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
A Typical IL Program
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Equiv. Code in Structured Text
IF RPM > 500
Voltage := Voltage-5
END_IF
%Q70 := 1
• Note
‐ simplicity of ST compared to IL
‐ IL may NOT be the best option except where there is a specific need for
▪ low level or
▪ optimized operations
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Sample of IL Operators
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Portability Example
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Summary
Instruction List (IL) is a text based programming language, has well defined
semantic rules and provides for calling function blocks and functions
• But, not for programming complex tasks
– difficult in comparison
– standard does not provide full definitions for errors and their handling
• only used for simple problems requiring highly optimized or tight code
• Comments (optional) = highly recommended to ensure code is readable
and understood properly
• Conversion
– from IL to other languages difficult, only under certain conditions
– from other language to IL, easier, not straightforward
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Function Block Diagram Language
Defined In IEC Standard 61131 Part-3
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
FBD Basics
Function Block Diagram = FBD
• 1 of 5 programming languages covered in IEC-61131-3
• first Graphical Language covered by the standard
• represents control system i.t.o. signal flow between elements
• can be used within Sequential Function Chart
• modes of representations are permitted
– semi-graphic
– full-graphic
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
What is FBD?
FBD used to represent:
• control system made of functions and function blocks
• using set(s) of interconnected blocks
• modeling signal flow between different program components
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
FBD Graphical Conventions
Function block = rectangular block with in a FBD with
• inputs left
• outputs right
• type name always within block
• name of function block instance always above block
• formal names of inputs and outputs shown within the block
Note:
• In some implementations, input and output parameters are denoted
using their ‘pin’ numbers and use other means, such as pull down
menu, to show full names
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Typical FBD Example
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Function Execution Control in FBD
Execution
• depends on position of block
• can be made explicit by using the Enable input EN
– function will be evaluated only if EN is TRUE
– function will NOT be evaluated if EN is FALSE
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Summary
FBD expresses control behavior of industrial control system
• using a network of software blocks with signals transferred between
them
• similar to electrical circuit where interconnections represent signal flow
• Basic rules for network evaluation should be followed for proper
execution of the program and correct control functions.
– Evaluation won’t start until all inputs are available
– Evaluation not complete unless all outputs calculated
• FBD networks best suited to express continuous behavior
– Revert to SFC where there is a need for sequencing
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Structured Text Language
Defined In IEC Standard 61131 Part-3
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Structured Text Basics
ST
• high level textual language
• similar to PASCAL
• primarily aimed at Real Time control
• written with
– indenting to improve readability
– comments to make the code understandable
• list of statements used to assign values to variables
• uses various arithmetic and Boolean operators to calculate values
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Assignment & Expressions
• ‘:=‘ is called an assignment
‐ assigns a value on right hand side to a variable on left hand side
• Right hand side can contain
‐ a literal constant,
▪ Speed : = 12.5; (*12.5m/sec constant *)
▪ Assigns a constant (12.5) to variable (Speed)
‐ another variable
▪ A := B;
▪ Value of variable on right hand side assigned to variable on left hand
side = B assigned to A
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Assignment & Expressions
‐ an expression = statements that employs calculation operators
▪ Countadd := Countadd + 1;
▪ Pressure[4] := Force[4]/Area;
▪ A := SIN (Angle);
• Notes
‐ Expression manipulate one or more variables or constants using
operators to produce a single value
‐ expression is placed on right hand side of assignment
‐ value of expression is stored to variable on left hand side of assignment
‐ data-type of expression result must match or be compatible with that of
variable
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Assignment & Expressions
Expression
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Expression Operators (IEC-61131)
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
Conditional Statements
• STL provides conditional statements
• CASE statement
• Iteration statements
Example:
• FOR … DO IF Pump_Running AND (Pressure =>
Set_Point) THEN OpenVentValve := TRUE;
• WHILE … DO ELSE
OpenVentValve := FALSE;
• REPEAT … UNTIL ENDIF;
• EXIT
• RETURN
• IF.. THEN.. ELSE
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
STL Summary
• ST (or STL)
– makes it relatively easy to represent complex process logic
– is a high level textual language
– similar to PASCAL
– uses strong data typing to avoid errors due to type mismatch
• Variables
– need to be declared
– forms part of strict type checking
• Operators defined for
– Arithmetical operations, Boolean operations , and comparisons
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
STL Summary
• Can define
– programs, Function Blocks and Functions in STL
• Programs can call and use
– Function blocks and Functions by using calls provided
• Statement syntax includes features such as
– conditional and iterative execution
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971
End of Webinar
Any Questions?
CRICOS Provider Number: 03567C | Higher Education Provider Number: 14008 | RTO Provider Number: 51971