# Productivity PLC Motion – How To Control the Velocity of Your System

The Velocity Move instruction is nearly identical
to the Simple Move instruction so if you are familiar with that one you will recognize
a lot of what we are going to do here. If we look at the two instructions side by
side we can see they only differences are: We specify velocity instead of position.
The Velocity move has only has one parameter to specify acceleration and deceleration,
where the simple move you could have different values for each.
And the biggest difference is you can change the velocity while the instruction is running
– as indicated by this “on-the-fly” symbol here. You could change the Simple Move
position while the instruction was running, but the new value wouldn’t take effect until
the current move completed and the instruction was re-enabled. If you change the velocity
during a velocity move, the change will happen almost immediately.
Here we go. We have a new project and I’ve already selected
the CPU and auto detected the hardware. Let’s drop into the High Speed output module and
set it up. We won’t have any need for the inputs in
this demo, but if we did we would define them here.
Let’s define the module error tag and module ready tag.
When I click on the next TAB the software asks if I would like to define those tags
– we do and they all look ok. We’re using channel 2 for this demo since
channel 1 is still wired to the linear slide we used in the simple move video. Let’s
name the channel and let’s setup the units like we did in the simple move video – this
makes programming so much easier. In that video we used inches per second because
we were moving a carriage on a slide. In this demo we’ll be specifying speed so let’s
make sur units revolutions. The stepper drive is set to 400 pulses per revolution so we
just put that here. We’ll leave the time base in seconds but most of the time you will
probably want revolutions per minute so you would put that here. Now everything we do
going forward will be in revolutions per second which makes our programming job so much easier.
Let’s make this a float so we can use fractional numbers and increase the accuracy some too.
The current position tells us how many revolutions have occurred since the module was turned
on or were reset using a Set Position or Home command.
This is our current velocity and this is the status word we will want to keep an eye on
for debugging. We’re using pulse and direction to our stepper
motor and increasing counts will be the forward direction.
This backlash compensation accounts for slop in your system when doing a lot of back and
forth between forward and reverse directions. You can specify the number of revolutions
you want the system to ignore when changing directions. We won’t need that in this demo.
This guy accelerates your velocity changes. Instead of starting where the velocity currently
is, the velocity will jump by this amount and then start ramping up to speed. That’s
handy in systems where you don’t need to or want to wait through the lower velocities.
For the maximum velocity, our motor can handle up to 8000 pulses per second and our drive
is set for one revolution is 400 pulses so our max revolutions per second is 20.
And let’s make our max ramp rate 100 so we can ramp up to speed quickly if we want
to. We won’t need physical or position limits
– again we are doing velocity in this demo, not positioning.
Hit ok, modify the appropriate tags so we can use fractional numbers.
Let’s grab a velocity move instruction and we want to use that channel we just defined
in the hardware configuration. We do want to use a structure and let’s
make the direction follow the sign of the number we give it. These are part of the structure
so we don’t need to create those. The key thing to notice here is these little
arrows. They remind us that these tags can be changed while the instruction is running.
We’ll do an example of that in a minute. Jerk smooths out transitions between velocity
changes and is covered in depth in a separate video so we won’t mess with it here.
When things go wrong we could ramp to a stop so we don’t stress the system. We’ll leave
it at an immediate stop for this demo. We cover registration in the video on registration
and we’ll skip the commenting just so we can get more code on the screen for the video.
Normally we would definitely want to take advantage of this commenting.
Great, the hardware is configured and the instruction is ready so hit ok, change the
velocity and acceleration to floating point so we can use fractional speeds. We would
normally change some of these others too, but that’s all stuff we cover in other videos,
so we’ll skip it for now. Go back into the instruction and click this
monitor button to have the Productivity Suite automatically add these tags to a Dataview
for us. Instead of using a button here, let’s just
create a contact we can control from the dataview. Transfer to the processor.
Bring up the dataview we created and add the instruction enable bit. I’m going to clean
this up a bit by deleting things we aren’t going to use and re-arrange a little bit.
Perfect. Let’s add the shaft position and shaft velocity
tags so we can keep an eye on them. Turn on monitoring, put the processor in run
mode. Let’s start at a velocity of 1 revolution
per second and a ramp rate of 2 so we get there in half a second.
Let’s also plot the current velocity so we can better see what is going on.
Enable the VMOV instruction and sure enough the motor ramps up to a speed of 1 revolution
per second. Let’s increase the velocity to 8. Notice
that the velocity started ramping immediately – we didn’t have to re-enable the instruction,
did we? You can change the velocity on the fly.
You can play with the velocity and acceleration here using the dataview and graph and then
when you have what you like, you can start your programming with the full confidence
the system will behave exactly the way you expect. The productivity series controllers
make this so easy to do. There are separate videos on Jerk, registration
and how to use status words for debugging, so check those out if you have a need.
If you need any help with Productivity series controllers, please contact AutomationDirect’s
free award winning support team during regular business hours. They will be happy to help.
And don’t forget the forums. There are lots of folks there that love to share their years
of experience. Just don’t post and questions directed at AutomationDirect’s support staff
there, they don’t monitor the forums on a regular basis.

## One thought on “Productivity PLC Motion – How To Control the Velocity of Your System”

• #### Michael Molter says:

Teknic ClearPath servomotors have a frequency following velocity (velocity proportional to pulse frequency) mode and a PWM velocity mode (velocity proportional to duty cycle). How would these be configured on the P2-HSO module?