Rate and position from same card

rocksalt

Member
Join Date
Aug 2008
Location
Texas
Posts
102
I have a 1794-VHSC and I would like to get rate and position feedback from the same input.

Is this possible?

What I need to do is calculate the FPS from the encoder and its position. I did not want to use the GSV to time the actual position start point to the actual position end point in time to calculate.

What is the best way to do this?
 
First you have to have a conversion factor worked out for pulses per distance unit, feet in your case. Sounds like seconds is the time unit for rate.
Set up a relatively high priority periodic task to monitor your high-speed counts. The task rate (ms) will be dependent on the precision and update rate necessary for your application. The other thing to consider is the RPI of your VHSC. If I had an RPI of 5ms on my VHSC then I would set my task rate of no lower than 10s.
If precision is REALLY important then first thing inside your periodic task, GSV the WallClockTime. Use the last register, which is microseconds and rolls over at 1,000,000 to get a truly accurate time delta in microseconds. Multiply this delta time by 0.000001 to get the delta time in seconds. You will need to include some rollover logic on the microseconds from GSV. If it's not that crucial, then just assume the periodic rate is perfect and use a fixed-rate value task rate * 0.001.
Next thing is to get a distance delta by subtracting last count from current count, again checking for rollover (based on how you set encoder channel up).
Divide position delta by your pulse/foot factor to get delta in feet. Finally divide footage delta by delta time seconds to get FPS.

Using your pulse/foot factor with current encoder count makes position calculation easy.
 
What I would do is record the count, them time exactly 0.100 seconds later & record the new count, subtract to get the counts per 1/10 second, divide that by your CPF. multiply by 10 for a full second & you have FPS. If the encoder can rollover to Zero during travel I would check to make sure the new count is greater than the old count or else ignore it for that 1/10 second. If 1/10 is too often you can change to 1/2 seconds or even full seconds.

For the position, you just need to know where Zero is for the encoder & calculate from there based on your CPF. If the encoder rolls over to Zero during travel you will have to count the rollovers & do some calculations for that.

Must be moving pretty good to get a Feet Per Second reading & not an Inches Per Second.
 
The card has a rate function and thought it would be easier to use its function vs. programming. However, I can only set it to one setting :( Basically, I wanted the card to do the work for me.

Does this logic seem acceptable (I don't have the rollover programmed yet).

ipm2.jpg
 
has been bookmark, this seems like a very interesting thread
g.png
 

Similar Topics

Seems like this should be a simple thing but I’m struggling with it. The basis is that I am trying to detect if a linear assembly is stopped or...
Replies
6
Views
3,034
I have been looking to this and thought I'd ask for input from others before I take it in a wrong direction. The guy who used to set these up...
Replies
9
Views
325
How can I integrate my S7-300 Simatic with the IFM AS-i Master AC1335 and its slave IOs, such as 2411 and Airbox 2041, into Simatic Manager?
Replies
0
Views
88
Hi Guys, I want to connect my 1769-L36ERM to a different network domain, is it possible to do it using only the dual ports in the Controller? Or...
Replies
3
Views
144
Hi.In the S7-300 plc, DB100.DBB10, whose data type is byte, is transferred to db23.dbb10, whose data type is bool, with the move command. This...
Replies
5
Views
755
Back
Top Bottom