CPT for linear motion using laser produced 4-20

John Morris

Lifetime Supporting Member
Join Date
Sep 2015
Location
San Antonio
Posts
689
Hello all

L30ER, rs 5000 MINI

Using a laser as redundancy for encoder for linear motion. Placement is critical.

Please look over this CPT expression. Is it accurate? If not please advise.

If you need more info, please let me know. If I'm off my rocker, please let me know.

(0.006008412*RAW)-37.4984979

I am looking to use the Dest. tag as a validation of the encoder (HSC input)

Any and all are appreciated

You aint going to hurt my feelings

PS. what does this mean

Error: Rung 94, CPT, Operand 1: Referenced tag is undefined. (NM...I found it)
 
Last edited:
The error message is because there is a tag that is undefined. If you hover over any tags in that rung, it will display some info about it or that its undefined.

As far as your main problem, there are too many things unknown for us to give you help yet.

I'm assuming you are trying to scale the analog signal from a laser into a distance? We need to know what sensor, input card, input scaling, and what the physical layout looks like.
 
Laser distance measuring- acculaser.

1769-IF8

4-20 ma @ 60Hrz, in engineering units.

Laser is looking thru a hole at one end of the machine and as the trolley (carriage) progresses forward, I will need to do a compare or and equal to to see if the range on the laser and the track of the encoder are accurate.
 
You're only part-way there.

When I use a CPT instruction of this sort, I like to add a long rung comment that explains which factors I have combined to reach my scaling value.

Some notes on the input value for the 4-20 mA signal to the 1769-IF8 module.

The 1769-IF8 is high resolution: 16 bit resolution when you're using uni-polar (which 4-20 mA inherently is).

The "Engineering Units" feature on the 1769 modules is different from the 1756 modules that let you actually do onboard calculations so you can get a user-specified engineering unit like ft/min or gal/hour.

On the 1769-IF8, "Engineering Units" means integer numbers of microamperes. 4 mA gives you a value of 4000, and 21 mA gives you a value of 21000.

Using engineering units in this case reduces your effective resolution, so I would use raw values instead.

Raw values are a little weird: the Integer datatype means that -32768 to +32767 is your range for the minimum (3.2 mA) to maximum (21.0) current. In a CompactLogix, you'll want to process that by adding +32768 to the value and making the destination a DINT.

Once you've got a nice clear integer of 0-65535 for the 3.2 to 21.0 mA range, we can start working on how to scale that for distance.

What is the physical distance represented by the 4-20 mA span of the laser sensor ?
 
Is there any point in taking a step back to ask why you're using a HSC counter and an analog sensor for motion control ?

What sort of physical drive system is moving this machine carriage ? Servo, AC VFD, hydraulic, pneumatic, horse-drawn, man-powered ?
 
Yes sir

Carriage drawn by 1/2 horse/right angle drag chain.

Will cover about 16 ft in 33 second

Because I don't want to get the call about WHY my machine just dropped a 5,000 lb tool

tolerance is about +/- 1/8 inch (indefinitely repeatable)

You'll have to give me a while to grasp this, I severely su*k at math.
 
Last edited:
Maybe I'm having a definition problem

• In = Input value RACK:6:I.Ch0Data
• InRawMax = Maximum attainable input value +32767
• InRawMin = Minimum attainable input value -32768
Wait I think i know
• InEUMax = Maximum scaled value 65535?
• InEUMin = Minimum scaled value 0 ?



OUT=(In-In raw Min) X (in eu max - in eu min/ in raw max- in raw min) + in eu min
 
Last edited:
Use the SCP AOI in the samples folder...

It will do the relevant math for you without wearing out your eyebrow raising muscles.
 
Use the SCP AOI in the samples folder...

It will do the relevant math for you without wearing out your eyebrow raising muscles.

Agreed. Add the SCP addon instruction to your program. Then position your motor so it is in the home position and place whatever the value of your sensor is in the InMin spot of the SCP instruction and put 0 in your ScaledMin spot. Then move your motor to the the farthest position and put whatever value you sensor gives you in the InMax spot. You can then physically measure that distance between home and where you are now put that distance in the ScaledMax spot. The SCP add-on instruction will then do the math for you automatically and give you the actual distance at any spot in between. And then if you ever need to "calibrate" your your scale factor just a hair, it is simple to do.
 
Thank you all.

Quite a learning curve.

To quote a rather simple man, Theodore Logan, "True knowledge is knowing you know nothing".

Have to start there.

Now how do I get my IF8's into these AOI's.

FOUND IT,

Thank you all for you time.

You have my appretiation
 
Last edited:

Similar Topics

I am using the following formula and I am getting error, Invalid Expression - too many closing parenthesis. when i copy the formula to notepad or...
Replies
4
Views
154
In the CPT in rung 2, i'm having an issue where if there is any value less than 0.0115 in "verticalSpeed", "festoonPosition"'s value does not...
Replies
3
Views
1,117
I have ran into something I have not seen before and wondering if any one had any ideas. The logic I'm currently troubleshooting is using a...
Replies
3
Views
1,660
so I have to find the standard deviation for amperage readings at my plant. when I input the formula into the CPT instruction it is automatically...
Replies
7
Views
1,852
Hello, I am having trouble with the CPT in RSLogix 500, with a ML1400. At first I had everything in one equation, it gave me the Source and...
Replies
5
Views
2,027
Back
Top Bottom