Yaskawa
eLearning
You are watching the IEC 61131 Basics Series
this video is an overview of IEC 61131-3 Programming
within Yaskawa's MotionWorks IEC Software
Hi I'm Matt Pelletier
and at this point in the video series you've
already been exposed to bits and pieces
of IEC 61131-3 Programming
as you've been following along with me
in our programming example
this experience is important
as a base of understanding the Standard
the Programming Languages, Data Types,
the Software Model and Task Execution
IEC stands for the
International Electrotechnical Commission
and it is a well recognized
world standards organization founded in
1906 with a number of participating countries.
So when you're learning IEC 61131-3
you can be confident that you're learning a
global standard method of programming PLC's
and here we have a lineup of logos of different
manufacturers in the automation industry
who do support IEC 61131-3 to some extent
of course with Yaskawa being in the center of
this discussion.
The principle benefit to IEC and programming
standards in general, is that it allows
code to be reused and programming
techniques to be shared between
different hardware platforms.
This allows a code development to be
implemented quickly using this type of pyramid model
where at the base of the pyramid
are the IEC 61131 Functions and Function Blocks
along with that for Motion
is the PLCopenPlus Standard which accompanies
IEC 61131, but for Motion
and then what you have is the ability
for manufacturers to make higher-level
Function Blocks that build upon that base
giving a higher level of functionality
and bringing the application closer to completion
This leaves only then the highest level
the most specific application specific
Functions and Function Blocks
that make a specific type of machine run
a specific application
so because we can reuse much of this code
and programming units it means
that programming can be done expediently
and that there's a control also
and testability and the ability to if you
would certify certain pieces of the code
officially to government standards or
other standards
specifically the food and drug industry
that often is very important
so more specifically now
what are these standards
of IEC 61131?
and of course the most natural and visible
standard that will be apparent to the
programmer are the five standard languages
of IEC 61131
which are Instruction List, abbreviated IL
Structured Text (ST)
Function Block Diagram (FBD)
and Ladder Diagram (LD)
Sequential Function Chart is considered
to be the fifth language (SFC)
although it is a bit different it's more of an
organizational tool
than it is a programming language.
Let's take a moment
to examine the code sample
very simple code sample that's given
as an introduction to the five different languages
let's compare these four here
with Instruction List
it's a very low-level machine assembly language
type of language
where we have Load LD (Load) Value A
ANDN with a NOT of B
and Store to Value C
and Structured Text we would say set the
value of C
set the data equal to A
AND with the NOT of B
in Function Block Diagram
you would use the AND
operation as a Block
with inputs on the left
Value A and Value B inverted or NOTTED here
output to the Value C
and then in Ladder Diagram language
we have a rung with A
in series with the normally closed B
that's the inverted value of B
outputting to the coil C.
So these four languages
accomplish exactly the same thing
and so it comes down to simply
choosing and using the language
that is most natural
for the programmer and most easily
accomplishes the programming objective.
Now Sequential Function Chart
you notice is outside of these four
we're not trying here to do in this example
the same code, Sequential Function Chart
rather than doing this
low-level calculation is more of a
sequencing as you can imagine by the
name of sequencing according to three
major parts of the Sequential Function Chart
language which is this step
the Action and the Transition
here's another step Action and Transition
and so this is a way to structure and organize in a
logical manner, the different actions or
the different calculations or motions
whatever has to be done
in sequence and in order
in a very visual and a
straightforward manner.
So in this idea you may have FILL
maybe you'd open up
the code for FILL and maybe it looks like this
in Structured Text, maybe the transition
is based on Inputs and perhaps
it's written in Ladder Diagram
and maybe this Empty is also written in Text
or it could be written an Instruction List
or in it any of the languages can be used within
what they call the code worksheets the code behind
the Sequential Function Chart
so usually these four languages are familiar
to people and Sequential Function Chart is
the least familiar
so let's look a little more specifically here
what is SFC? What is Sequential Function Chart?
It is a graphical programming language to
describe control sequences in graphical form
it's a tool for top-down analysis
and representation of a control sequence
and it is great to show the main states
of a program,
it's very easy to understand in this example of a
traffic light controller if I'd tell you that
this is a traffic light example and you
just take a very short amount of time to look at it
you can see, okay, INIT the lights are out,
there's an error here for TRUE
you can kind of tell top to bottom
what's going on it's a familiar operation
you have a Green light, a Yellow light
and a Red light, and you can see the actions
here to turn the different lights OFF
wait for them to be a done
wait turn the Yellow light ON,
the Yellow light is ON for a certain amount of time
it looks like 3 seconds
and then the Red light turns ON
and there's an arrow jumping back to Green
so knowing the application
it's very easy to see how this would work if
you are familiar perhaps with the Ladder Diagram
or Structured Text
obviously you could also create this using other
languages but SFC makes it very easy
very visual way to see any sequence
and so this is when you may want to consider
using SFC, is that number one
when there is a definite sequence
for the machine to follow
also when it is advantageous
to think of the machine operation as
having different States
such as that traffic light and then
the third one is if you want somebody
who's not familiar with your code
to be able to work with it
it's very easy to tell with SFC
where the problem lies
and then to open up that area of code
and look specifically at the area where
the problem is or where the operation is
currently taking place.
Okay moving on from SFC programming language
is another part of the standard of IEC 61131
which we've already seen here as we
program and it's called Data Types
every Variable and Literal Value has a Data Type
and IEC 61131 defines these
twenty Data Types
you can see that each Data Type
has its official name
and there's a number of Bits associated with it
there are several different Data Types
that have, for example, 64 Bits
so it's not just the size of the data
it is the intended purpose and usage of that data
that gives it a Data Type
and within IEC 61131 you'll hear the term strict
Strict Data Typing or Strong Data Typing
and what this generally means is that any
changes of Data Type
will be shown in the code
you will not have in IEC 61131
automatically assuming any conversion
of any Data Types and while this looks like
a long list, in our experience at Yaskawa
there are a few of the Data Types
that seem to appear and are used
more often than others
so I've indicated those here BOOL for Boolean
you have Bit 1 or 0, TRUE or FALSE
Integers for negative and positive
counting variables
Unsigned Integer
where you have just the positive values
the REAL and probably more common the LREAL
meaning a floating-point, a decimal point
is implied and in fact required in those
you have TIME for the timers
and there's a special format
for using the data in TIME
and then a for just standard data
may be a blocks of data coming in from HMIs
or from remote I/O will use BYTE and WORD
and that's not to say that these other Data Types
are never used at Yaskawa
they certainly are, but if you want to
focus on a few of them here
that's the shortlist.
IEC 61131 also describes
what they call the Software Model
which in a sense is more of a hardware
operation model it says that the devices
running IEC 61131
in our case the PLC
are referred to as Resources
and they exist with any configuration
maybe you're already thinking of
the Hardware Tab
let's flip back over real quick
so we can relate this to what we've already seen
so here we can see in our project
under Physical Hardware
we have a configuration and within that
a Resource within the Resource Tasks
and within the Task List
different Tasks with programs running in them
so let's flip back to the presentation
we see these same terms
just displayed in a different graphical way here
we have the Configuration, the Resource
the resource is running Tasks
the Tasks run programs and then as you know
the programs each run Functions
and Function Blocks and have Global Variables
as well as Local Variables
and so each of these smallest units of Execution
are called POU or Program Organization Unit
there's a program Program Organization Unit
there's the Function POU and the Function Block POU
three types of Program Organization Unit
this is described and defined by IEC 61131.
So now to see an example of what a
configuration would be in IEC 61131
here's an example of some type of
packaging machine, I believe
with several different controllers, PLCs
operating and controlling the different stages
of this machine
and so this assembly of processors
running IEC 61131 is considered a configuration
so if we were to take one of these controllers
what would we call that? We call that a Resource
and so the Resource is the Controller
and in our case here in our project
it's the Simulator
and then that controller is
controlling just one part of the larger machine.
It may include several servo axes
or hundreds even of Input and Output points
but nonetheless that is considered
to be one Resource within the configuration
and it's valid to have a configuration
which includes only one Resource
which is exactly what we have in our project.
Every Resource or Controller or Simulator in our case
must execute the code according to the
standards of IEC 61131
and that's what we see inside of the Resource Folder
is we see the Execution and we see the
Global Variables and the I/O configuration
so these three components are defined by IEC 61131.
If you go to any other software, any other manufacturer
that claims IEC 61131
they will also have a Resource Folder with
Tasks, Global Variables and I/O Configuration
and this is an example here
with more than one Task
there's a Task called Start, Fast, Medium and Slow
so you can see here that as it says
Multiple tasks run at different system rates
any of these what we call Cyclic Tasks
can run at different rates
and then there are also System Tasks
that can Run based on System Events
such as Power ON
and within each Task there are
Program Instances of the Program Type POUs
its Program Type POUs only
appear here in the Task List
and as you have seen in the previous videos
it's possible to change the order of the
Program Execution it is Top to Bottom
within each Task and you're able to move
as it says here move a Program Instance
from one Task to another
or even completely remove it
so that it doesn't run at all.
And finally I would like to emphasize
there are three types of POU
the Program, the Function and the Function Block
and only the program POUs run in a Task
as it says here Functions and Function Blocks
run in the program and as indicated here in
this diagram the program contains the
Functions and Function Blocks that is the
Functions and Function Blocks of IEC 61131
such as the Counter that we're using and
also any custom Functions or Function Blocks
and later in this training sequence here
there will be a video where we explain
how to make a Function and how to
make your own Function Block
and when we make those, you will not run
them in the Task they will run in one of the POUs
as an instruction just like a Counter
or any other Block that is used in a program
also please notice the difference
between the folder for Logical POUs
and the Task List
it's a common to see that we have a Logical POU
also in the Task List
but that will only be true when the POU is what type?
The Program Type.
So the Program Type of POU
can run in the Task.
Does it have to run in the task?
No, it does not.
In fact, if you remember back to the
Programming QuickStart
we had to create a POU
and then add an Instance to our Task
so it's not required that the Logical POU
run in the Task
it may be a previous version or
maybe for troubleshooting
you don't want it to run at all
and so you can have Logical POUs
that don't run in the Task List
number one, because maybe they're
not a Program POU,
they're Function or Function Block
or number two, they are Program POU
but you just don't want them to run
at this particular point in time.
Let me just reiterate this then
and give a little a preview
if you wanted to make a Function
or Function Block, the first step would be
to right-click Logical POUs and Insert
and here is where you can choose
Program, Function or Function Block
so these are the three types of POUs
you can see that in your program
and we have created program POUs only
and they're running in our single Task
as we move ahead here we'll
make more Tasks
we'll end up making more POUs
and we'll end up making our own
Function and Function Block
and so with this I will conclude
the IEC 61131 Programming Overview.