Yaskawa
eLearning
You're watching the PLCopen Basics
Video Tutorial Series
This video shows how to initialize the Access Variables
used by all PLCopen Function Blocks
Hi, I'm Matt Pelletier
in order to program a particular servo axis
to Enable or to Move
the question is which axis are you referring to
PLCopens standardizes this Axis Definition
using a structure called Axis_Ref
in MotionWorks IEC
basically all you have to do is type
the logical access number from
hardware configuration into the initial value
of the axis num element of this structure
but I'd like to give you a more thorough
explanation and demonstration
so please follow along with me in the class project.
If you look at any of the PLCopen Function Blocks
they all have one thing in common
and that is that this
top connection is for this Axis Variable
and the Variable that is looking for is
a Data Structure with the Axis_Ref data type
Axis_Ref is a structure that is individually defined by
each manufacturer who implements PLCopen
and it could contain a large amount of data
and so to save memory in the controller
PLCopen defines that Axis_Ref is not
an Input Variable but instead a VAR_IN_OUT
and this means that the data is not
copied into the Function Block instance
in memory but instead it's referenced
directly from the original memory location
this means that for any Block with the Axis VAR_IN_OUT
there is no initial value and the Axis VAR_IN_OUT
must be connected for the Block to compile
the Axis_Ref Data Type definition is not
defined by PLCopen
because of the hardware specific data
that it can contain so instead each
vendor defines their own Axis_Ref structure
this way through one Axis_Ref Variable
all Axis specific information such as, for example,
the Axis Number, Maximum Speed,
Encoder Resolution or User Unit or any
other data that the manufacturer wants
can be referenced by the PLCopen
Function Blocks through this Variable
so each Block just takes whatever data
it needs from the Axis_Ref
to operate that Axis correctly.
So what about Yaskawa's implementation of Axis_Ref?
Well, we can see this Data Type defined in the
DataTypes_Toolbox let me do this live here
so this DataTypes_Toolbox can be
seen in the Library tab
we'll just go here to DataTypes_Toolbox > Data Types
and it's called MotionBlockTypes
because it has to do with Motion
looks like we need to go up a little bit
to Axis_Ref and you see that we have one
Element called Axis_Num and no other Elements
you see the MPiec controllers have all of the
Access Data like Encoder Resolution and User Units
in the hardware configuration
so there's really no need to redefine all those
details here in the Variable Structure
so that's why we see Yaskawa's
implementation containing just one single element
called Axis_Num
and what this means is the Logical Axis Number
this one number points to all the other
axis specific information
that's already residing in the controller
but this doesn't mean that Yaskawa can't
change that in the future
so while we have just one element now
as hardware functionality progresses
there is the option in the future
to be able to add Elements
to our custom Axis_Ref Data Type
as implemented by Yaskawa.
So what are the Axis Numbers
for the Axes in our demo project?
To see those numbers we have to go
to the hardware configuration
and so let's demonstrate that
if you'd like to follow along with me
I know we said that this training is about PLCopen
and not hardware configuration
but there are times like this when they are
closely connected.
So we'll click on one of the axes like Screw
and in the Configuration tab
we see Parameter 1831 Logical Axis Number
so our Screw is Logical Axis 1
Rotary is Logical Axis 2
if you have the MP2600iec
you'll see that the project has
set the Rotary as a Virtual Axis
with Logical Axis 27
our project also has a Virtual Axis
and you can see that the Logical Axis
number here is 26
and although you can't control the Motion
you do have the External Axis
External Encoder
which is also an Axis, Logical Axis 21.
So we do have 4 axes on this system
two Real, one Virtual and one External Encoder
and again, the MP2600iec has just one Real
which we're using this Screw to
represent the Real Axis and the
Rotary is another Virtual Axis
just so we can do the same programming exercises
what's of further interest in MotionWorks IEC
version 3 is that right above the Axis Number
is also the Axis Name
this name is important because this name
has created an Axis_Ref Variable already for us.
If you have version 2
you'll have to create this on your own
so back to the programming interface
I'll go to the Project tab and come down here to
Global Variables
and you see that these already exist
these exist because the hardware configuration creates
an Axis_Ref with that same name
so we got a Rotary Axis Ref
a Screw Axis_Ref
Virtual and the external four Axis_Ref Variables
while these variables are automatically created
you'll notice that they are not
automatically initialized
the initial value is not given
and that's because these are Structures
which could have multiple elements.
So in MotionWorks IEC version 3
we have a new option here under the View menu called
Initialize Multi-Element Variable Window
so you can pull that up and
then you'll see a window where you can
type in the Initial Value for each of these.
So I'll go through and do that along with you
for one of them, this Screw
here, I'll go to View Initialize Multi-Element Variable Window
you may have to adjust that window size and position
I'm going to adjust these columns
shrink the description
and then right here under the Axis_Num
Element
we know that we want this Screw to be Axis 1
because that's what we saw in
the hardware configuration was that this
Screw was Logical Axis 1
when you click off of it you can see
the little code that it puts in here
and just to make this training friendly for
any of you who might be using this
with MotionWorks IEC 2
these features of the Axis Names,
the Automatic Axis Variable Creation and
the Multi-Element Variable Initialization
don't exist for MotionWorks IEC 2
so instead you can manually create those
Axis Variables using the F5 key
and just create the variable and use
the datatype Axis_Ref
and then to initialize them we don't have
the Multi-Element Variable Window
MotionWorks IEC 2, instead you can use this
type of text line in a Structured Text program
and if you'd like to see a demonstration of
how to do it this way with MotionWorks IEC 2
and Text Code please refer to the
Quick Start video.
And now for your first programming challenge,
if you can call it that,
whether it will be a truly a program
or truly challenge will be yet to be determined
but I want to see if you can on your own
go and successfully initialize each of
the axes on this system.
Remember we have the 2 Real Axes
Screw and Rotary
and then also the Virtual Axis and the
External Encoder
and that to prove that it works
put each Variable like I've shown here
into the Watch Window
and then you'll be able to see the current
value that they have
you can also verify the operation
of these Initial Values with Warm Start
and Cold Start
OK, so please pause the video give it a shot
and when you're done or if you need a hint
play the video and I'll show you how I did it.
So I will continue to initialize
here's the Rotary
and I do remember that was
Axis Number 2, Logical Axis 2
hit Enter now click on the Virtual
and just in case you don't remember the
Virtual's Logical number
we click on it and see that it is number 26
and you can refresh your memory on External
that was number 21
so back to the Multi-Element Initialization
we'll give 26 and hit Enter
click on External that was number 21
and Enter so now I need to make those
changes and I will try it out in the controller
looks like I'm not connected
Login to my LinkManager
alright looks like I'm in
and we'll do Download
and then we'll do a Cold Start
you can do Warm Start or Cold Start
and now we wanted to see these in
the Debug mode in the Watch Window
so we go to Debug mode
and then we can add these
one-by-one to the Watch Window.
First I will view the Watch Window
I may have to move those around here okay
so now this Screw
Add to Watch and you click OK
to have the whole Element
alright, that one looks good
then Rotary > Add to Watch
that one looks good
Virtual > Add to Watch, looks good
External > Add to Watch and looks good
again, if you're doing the MP2600 IEC
then the Rotary you should have set to 27
and of course you could overwrite
these this wouldn't usually happen
you can overwrite these and you'll notice
then if you do a Stop and a Warm Start
they'll go back Stop in a Cold Start
same thing, these Variables are not
retained so that's why whether it is
Warm Start or Cold Start
the Initial Value is applied.
And I think I would leave it that way
we really don't want these to change
otherwise you'd start controlling
a different axis if it existed.
Very well we have each of the axes now initialized
to the correct Logical Axis Number
and can proceed with our program.