0% found this document useful (0 votes)
3 views43 pages

Controller Programming

The document provides an overview of controller programming within Unity Pro, emphasizing the standardization of PLC programming through IEC 61131-3, which defines five programming languages. It details the creation of a new project, specifically a Pasteurisation project, and explains the use of various language editors, tasks, sections, and elementary functions. Additionally, it covers the concept of variables, including located and unlocated variables, and their importance in programming within the Unity Pro environment.

Uploaded by

Adi yan Putra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views43 pages

Controller Programming

The document provides an overview of controller programming within Unity Pro, emphasizing the standardization of PLC programming through IEC 61131-3, which defines five programming languages. It details the creation of a new project, specifically a Pasteurisation project, and explains the use of various language editors, tasks, sections, and elementary functions. Additionally, it covers the concept of variables, including located and unlocated variables, and their importance in programming within the Unity Pro environment.

Uploaded by

Adi yan Putra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Unity Pro Configuration

Chapter 2: Controller Programming


Controller Programming

● Chapter Overview
● Standardising PLC Programming
● New Project Creation
● Language Editors
● Tasks
● Sections
● Elementary Functions (EFB’s)
● Variables

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 2
Standardised PLC Programming

● The International Electrotechnical Commission (IEC) has defined the standard


IEC 61131 for programmable controllers and their peripherals.
● The third part of this standard, IEC 61131-3, defines programming languages in
programmable controllers (PLCs).

● Five programming languages have been defined. This means that their syntax
and semantics have been defined so that every vendor uses the same
language.
Textual Graphical
• Instruction List, IL • Function Block Diagram, FBD
• Structured Text, ST • Ladder Diagram, LD
• Sequential Function Chart, SFC
● These languages are fully standardised and portable across solutions from ALL
vendors

● A sixth language is available in Unity Pro. LL984 this will be covered later in the
course.
Unity Pro Configuration – V11.1 Training
Schneider Electric | Industry Business | Training – July 24, 2018 3
IEC 611131-3 PLC programming

● Set Output ‘C’ to TRUE only if Input ‘A’ is TRUE and Input ‘B’ is False

Sequential
Function
Chart (SFC)

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 4
Exercise (p2-3)

View Programming Language


Examples
Unity Pro Configuration – V11.1 Training
Schneider Electric | Industry Business | Training – July 24, 2018 5
New Project Creation

● Overview of Project for the class

● In this course we will create a PAC project. It will be a Pasteurisation


project. We will program different sections of the project using different
IEC 61131 PLC programming languages.

● This will help us become familiar with the different languages. Unity Pro
software supports the 5 different languages and they can all be used in
the same project if desired.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 6
Pasteurisation Project

● The Pasteurisation graphic of the project is as follows:

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 7
New Project Creation

● The first step is to create a new project . The project is where all the
information is stored.

● A project is based on a specific PAC model number and cannot be


saved until the PAC is defined. It is possible, however, to change to a
different PAC at a later stage.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 8
How to Create a New Project

● To create a new project:


● Click the New Project button,
or select File » New... from
the main menu.

● Then select a PLC/PAC from


the New Project list:
● Selecting the correct Rack
where appropriate:

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 9
Exercise (p2-8)

Create a New Project

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 10
Language Editors

● The editors for each of the five languages provide a


number of common tools used for writing, reading, and
analysing programs in a user-friendly manner.
● The graphical editors for Ladder Diagram language (LD),
Function Block Diagram language (FBD), and the
Sequential Function Chart language (SFC), feature the
following elements:
● Palette toolbar
● Context menu
● Comments
● Data Entry Functions
● Standard Editing Features
● Bookmarks

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 11
Language Editors - Comments

● Unity Pro provides an unlimited quantity and length of comments.


These comments may be positioned as text objects in any cell
(graphical languages) or at any point in expressions (textual
languages).

● In the graphical language interfaces, Comments are always positioned


in the background behind all active objects on the page.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 12
Data Entry Functions

● Assisted data entry functions for gaining access to function libraries, the
Variables Editor, or the text object used to enter comments.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 13
Standard Editing Features

● Unity Pro supports the standard Microsoft standard editing features


such as: Cut, Paste, Clear, and Move functions.

● Bookmarks
● Setting of bookmarks on lines of text or in the margin enables users to
easily locate these lines in an important program sections.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 14
Tasks

● The first operation that needs to be performed in order to create an


application program is to define the Tasks.

● These are the main types of Task:


● Master
● Fast
● Auxiliary
● Event & Timer

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 15
Tasks – Master

● Master
● Usually abbreviated to MAST
● Main code for the whole PLC
● Identified under the Program branch
● Contains Sections and Subroutines
● Cyclic or Periodic execution (0 to 255 ms)
● Controlled by:
●Watch Dog
●System bits & words

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 16
Tasks – Master (cont.)

● Sections of the Master can variously be coded in any of the 5 standard


languages (LD, FBD, IL, ST or SFC):

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 17
Tasks – Fast

● Fast
● High priority
● Interrupt processing
● Alarms for instance
● Contains Sections and Subroutines
● Programmed in LD, FBD, IL or ST
● Periodic execution (1 to 255ms)
● Controlled by:
●Watch Dog
●System bits & words

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 18
Tasks – Aux

● Auxiliary
● Low priority
● Typically measurement or slow process control
● Only available on ‘top of the line’ processors
● Up to 4 Auxiliary tasks (AUX0 to AUX3) on
Premium and Quantum PLCs
● Contains Sections and Subroutines
● Programmed in LD, FBD, IL or ST
● Periodic execution (10 to 255ms)
● Controlled by:
●Watch Dog
●System bits & words

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 19
Tasks – Events & Timers

● EVT and TIMER


● To reduce response time of application program
● Single section programmed in LD, FBD, IL or ST
● EVT# : events come from I/O modules
● TIMER# : events come from event timers

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 20
Sections

● Tasks are divided into multiple sections


● Autonomous programming entities
● Must be composed of a single language type
● Typically represent the code for a single object or a group

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 21
Sections (cont.)

● Unlimited number of sections


● Attributes of each section
● Name : 32 characters maximum
● Language : LD, FBD, IL, ST or SFC
● Associated task : MAST, FAST, AUX, Event
● Condition (optional) : validation bit for
execution
● Localization : functional module containing
the section
● Protection : No, write or read/write
● Comment : 256 characters maximum
● Order of execution
● Order in which the sections appear in the
structural view of the browser
Unity Pro Configuration – V11.1 Training
Schneider Electric | Industry Business | Training – July 24, 2018 22
Subroutines

● Unlimited number of subroutines

● Attributes of each subroutine


● Name: 32 characters maximum
● Language : LD, FBD, IL, ST
● Associated task : MAST, FAST, AUX
● Call is carried out from a section or another
subroutine Number of nesting is limited to 8.
A subroutine should not call itself (not
recursive)
● Subroutine is linked to a task. It cannot be
called from sections or subroutines of the
other task

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 23
Exercise ( p2-15)

Create a Section

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 24
Elementary Functions

● Unity Pro is supplied with over 900 in built functions.


● These are:
● Elementary Functions
● Elementary Function Blocks

● The functions are sorted into libraries depending on their type of use.

● Elementary Functions (EF) are the simplest functions.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 25
Elementary Functions

● No internal states
● Sorted into libraries
● Represented as a box
● multiple input pins
● Single output pin Name

Function Execution
Counter Number

Output Pin
Input Pins

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 26
Elementary Functions

● Some easy to understand examples:

Output is true when ALL Output is true when ANY


inputs are true input is true

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 27
Sample Function Block Diagram

Feed Pump Control

OR AND Feedpump Run


Feedpump Stop
Feedpump Start
Feedpump Estop
Feedpump Run
Feedpump Available

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 28
More Elementary Functions

● Unity Pro has hundreds of Elementary Functions, for example:


● ABS (absolute value)
● ADD_TIME (add two or more times)
● EQ (equal to)

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 29
Exercise (p 2-19)

Use a Function Block

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 30
Variables

● Variables exist in most, if not all, programming languages.

● A variable is a symbol or a name that represents a value.

● Consider this algebraic expression:


●z = x + y

● The letters x, y and z are variables. The right side of the equation is
evaluated and then assigned to the left side.

● Variables in programming work the same way. Variables are names


given to represent the data.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 31
Variables (cont.)

● In Unity Pro, as with most software programming, a Variable is a


symbolic name that points to a unique memory location in the
PLC/PAC, that contains information, typically a value.

● Within Unity Pro there are two main types of variable:


● Located Variables
● Unlocated Variables

● It is good programming practice to have a naming convention for the


variables. These exercises use a simplified system during the
progression of this course. The names will contain only the device and
action or device and status.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 32
Located Variables

● A located variable is defined by a “Symbolic Name” (32 characters),


then mapped to an Address.

● This address may be a memory bit or word in the State RAM of the
PAC, or a topological address that has been assigned to an I/O module.
Address Type Description
%M17 Memory Bit Flat address for a discrete
output
%QI.3.5 Topological address Discrete output at Rack 1,
Slot 3, Point 5
%MW0.5.1 Memory Word Flat address for a memory
word
%QW1.5.2 Topological address Analog output at Rack 1, Slot
5, Point 2
Unity Pro Configuration – V11.1 Training
Schneider Electric | Industry Business | Training – July 24, 2018 33
Common Data Types and Ranges

● A Data Type must also be assigned to the variable. The data type will
determine what kind of data can be stored in each memory location and
the amount of RAM required to store the data.
Digital/Boolean value not connected to State RAM, Can be
BOOL
Set but not Forced. Must be FALSE (0) or TRUE (1)
Digital I/I or internal State RAM data that can be Forced, with
EBOOL
edge detection
Numerical data from -32,768 to +32,768. Analog module data
INT
type

UINT Numerical data from 0 to +65,535

REAL 1EEE 32 Bit floating point data from -3.40e+38 to 3.40e+38

16 bit binary value represented in Unity Pro in hexadecimal


WORD 16#
format
32 bit format, a maximum of 49 days, 17 hours, 2 min, 47
TIME T#
sec, 200ms

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 34
Unlocated Variables

● An Unlocated variable shares the same characteristics as the located


variable, with one major exception, it is not associated with a physical
memory location, instead the PAC is responsible for managing the
variables memory location internally.

● If the data is required externally to the PAC application (i.e. from a


SCADA system), this can be achieved using the symbolic name for
reference.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 35
Located/Unlocated Variables Example

● In the Data Editor these are displayed as:

Located variable
(tag name, type and
address)

Unlocated variable
(without address)

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 36
Located Variables

● Some variables are named by the action they are to initiate.

● Other variables represent the status of a device. For example:

Action Variables Status Variables

Feedpump_Start Feedpump_Running

Feedpump_Run BypassValve_Opened

BypassValve_Open HoldingTubeTemp_OK

Feedpump_Estop Agitator_Available

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 37
I/O Data Types

● The I/O Data Type is the term used for the choice of addressing
schema within Unity Pro. There are two choices of I/O Data Type:
● Topological addressing and IODDT structures

● Device DDT structures.

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 38
I/O Data Types

● The supported I/O Data Type in Unity Pro is dependent upon Unity
Controller family and the equipment location, here are some examples:

Topological Addressing & Device DDT


I/O Equipment Location I/O Equipment Family
IODDT Structures Structure

Modicon M580 X X
Local Rack Modicon M340 X -
Premium X -

Remote Equipment Modicon M580 - X


(RIO Scanner) Quantum X -
Distributed Equipment Schneider Electric or
- X
(DIO Scanner) 3rd Party

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 39
Device Data Types (DDTs)

● When using M580 CPU is used, a Device DDT (Derived Data Type) is
added to the application that can be used to easily obtain information
about the CPU, including running services, diagnostics and the state of
embedded Ethernet ports.
● The default name is BMEP58_ECPU and type is T_BMEP58_ECPU:

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 40
Exercise (p 2-26)

Variables

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 41
Chapter 2 - Summary Questions

● The following questions will help to check understanding of the topics


covered in this chapter:
● What is IEC 61131-3?

● Which programming languages are textual and which are graphical?

● Which common tools are used in each of the graphical editors?

● What are bookmarks?

● What are the three Task types?

● What are Sections?

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 42
Controller Programming

● Chapter Summary
● Standardising PLC Programming
● Language Editors
● Tasks
● Sections
● Elementary Functions (EFB’s)
● Variables

Unity Pro Configuration – V11.1 Training


Schneider Electric | Industry Business | Training – July 24, 2018 43

You might also like