Velocity calculation

Learning every day. I love it and hate it..

I have not been back to the machine to sort it out. When things are running I have other things to do. Unfortunately, the velocity calculation I will need to take control of the machine and play with it a bit to tweak it out.
Thankfully, I am doing this as a way to set the valve speed instead of controlling a position. It makes me realize why motion controllers are used and how important they are for precision positioning.

I did end up programming a self learning offset calibration. Each time the machine auto positions it calculates the error and applies it to the next move. I move all axis at one time until in position within X amount, then move one at a time until in position then move another and so forth. There is a different calculation for each direction and it works real well for the application and all done with bang bang valves.
 
How?

I recommend using the Coordinated System Time (CST) timestamp to determine the precise time between logic executions. It's in microseconds, so it's the best precision you have in the CompactLogix.

Use a GSV instruction to read that value (two DINTs, but you'll only need the lower one) in subsequent executions of your distance measuring logic and subtract to get the difference.




How exactly do you use this to trigger a sub instruction? That has me stuck....
 
Just FYI, TON timers on Compact and ControlLogix accumulate time by looking at the time now and the time last scan and rounding the difference to the nearest ms. That means that every single scan of a TON on a Rockwell system can accumulate error of up to half a ms. The accumulated time on the TON can get really far off from the actual time passed very quickly if you are executing the TON quickly.

On Rockwell, for anything that is over a long period of time or needs good precision, you should be reading the clock values yourself. Most other platforms implement the TON function by storing a start time and constantly check the current time against it; a much more accurate way of doing things and essentially what you need to do manually to get good timing on a CompactLogix.

Old thread, but this is some good information that I did not know. From the manual:
How a Timer Runs
A timer runs by subtracting the time of its last scan from the current time:
Code:
ACC = ACC + (current_time - last_time_scanned)
After it updates the ACC, the timer sets last_time_scanned = current_time. This gets the timer ready for the next scan.
 

Similar Topics

Hi all, I am having a problem with my servo motor and I'm absolutely stuck as to why it wont run. Without any gearbox or any load attached to...
Replies
9
Views
3,697
Hello, I have a reactor with a cascaded PID control for control of the batch and jacket inlet temperature. We throw in all the required...
Replies
6
Views
1,726
A query for the motion control experts: I have an app where I measure the position (encoder ∝ K * angle) of a rotating device, and use that along...
Replies
15
Views
3,740
Hi folks, I am upgrading a SLC to a ControlLogix platform. The goal of the project isn't simply to get the same program to run on different...
Replies
7
Views
2,836
Hello All, We are developing a machine that will pull in corrugated pipe into a system. The machine in general is like a worm, as in the pipe has...
Replies
9
Views
3,341
Back
Top Bottom