math with slc505 and stepper card to move spray bar

irondesk40

Member
Join Date
Jan 2008
Location
nc
Posts
630
have something that i could use some advice on. Have a machine in one of our off shore plants that has a spray bar that is 10 inches long and pivots in the middle. The plc is a slc505 and the stepper card is a 1746 hstp1. The only thing i know at the moment is that the card is set up as well as the stepper drive that controls the turning of the spray bar so that 20000 pulse will rotate the spray one full revolution.
In the hmi a operator will enter that the fabric width is anywhere from 0-10 inches wide. The card is set up as a absolute type move and there is a home switch that is made when the bar is straight out across a piece of fabric that is 10 inches wide.

total length of bar is 10 inches center pivot point

To me it would appear that if a value for example of 0 inches was put in as the width then if you sent 5000 pulses then the bar would rotate 90 degrees and now be in the followin gposition

Since this would be the same as a fabric width of 0 inches, the bar would move to a position of 5000 since one full revolution is equal to a value of 20000. Could you not use the scp instruction and scale the operator input of 0-10 inches to a value from 0-5000? I was told by a coworker that it would not work that you would have to use trig math functions to figure out how far to rotate the spray bar.

Am i way off on my thinking on this, have to admit math is not my strong point, so any advice would be appreciated. I have not actually seen the machine yet, but will be going over in a couple of weeks.
Thanks
 
If the 10" bar is pivoting around the centre, then assuming that at pulse value of 0 the bar is across the fabric (covering the whole 10"), then for a 5" strip of fabric the calculation would be sin^-1(2.5/5) as the arc is of radius 5", this would come out as 30 degree angle. This means that the bar would actually have to move 60 degrees (as its starting across the fabric).
So you can see that from 0 degrees through to 90 degree is not linear / proportional to the width of fabric covered and hence you would not be able to use a SCP function (which assumes linearity).
What i suggest is, you must run specific widths of fabric? if this is the case then all you need to do is calculate the angle / pulse count for each size, e.g.

10" fabric = 0 degrees = 0 pulses
5" fabric = 60 degrees = 3333 pulses
0 " fabric = 90 degrees = 5000 pulses

You could also use the trig function in the PLC if there are lots of different fabric widths which would take a bit more programming but achievable.

hope this helps

LH
 
Last edited:
If the 10" bar is pivoting around the centre, then assuming that at pulse value of 0 the bar is across the fabric (covering the whole 10"), then for a 5" strip of fabric the calculation would be sin^-1(2.5/5) as the arc is of radius 5", this would come out as 30 degree angle. This means that the bar would actually have to move 60 degrees (as its starting across the fabric).
So you can see that from 0 degrees through to 90 degree is not linear / proportional to the width of fabric covered and hence you would not be able to use a SCP function (which assumes linearity).
What i suggest is, you must run specific widths of fabric? if this is the case then all you need to do is calculate the angle / pulse count for each size, e.g.

10" fabric = 0 degrees = 0 pulses
5" fabric = 60 degrees = 3333 pulses
0 " fabric = 90 degrees = 5000 pulses

hope this helps

LH


thanks, have to admit i think this is one that i dont understand how to do in the plc code, any advice
 
You need to use an acos(width/10) function then scale the angle 0-∏/2 to 0-5000 counts.

Peter
What is the acos intruction? I see a ACS instruction. Could you explain the math in this? I fully admit, I do not understand the math. Hope i am not asking for too much, any advise is greatly appreciated.
thanks
 
To understand ArcSin (ASIN) and ArcCos (ACOS) functions you should google them.
Also you need to cast your mind back to school trogonometry lessons :-

http://en.wikipedia.org/wiki/Trigonometry

You can either calculate each fabric size (provided there arent too many) then convert this into pulses and when a size is selected then the calculated pulse value will me moved to the stepper card.
Or you can use the more complex trig method so that the value is being calculated...this would be the preferred option if there are many fabric widths.:confused:
 
It has been over 30 years since I was in school too.

The question is does the SLC have a ACOS function? Apparently not. I would use a Padé approximant to calculate the ACOS. I can tell you how to do this but must people just give up and use a look up table. I will let the others tell you how to use a look up table.

For those interested see example 11 and know that ACOS(X)=∏/2-ASIN(X)
http://math.fullerton.edu/mathews/n2003/PadeApproximationMod.html
ACOS(X)≈∏/2-(((69049*x^2-717780)*x^2+922320)*x)/(((9675*x^2-58100)*x^2+61488)*15)

MaxWidth=10;
X=Width/MaxWidth

The graph indicates that the approximation is pretty good for X between -1 and 1.
 
The SLC does have these functions. The units are all in radians.

ACS-Arc Cosine
ASN-Arc Sine

When using trig functions in a PLC, be sure that they are only enabled when needed since they will eat up considerable processing time.

Paul
 
thanks to everyone. Man,i have a lot to learn. Do not have a engineering degree, just mostly on the job learning for the last 30 years. If i knew half of what most of you guys know as far as math i would feel a lot better.
Is there anything out there that would explain this in like a excel for dummys type format. I will look at the example later tonight that was posted, took a quick look and _ Wow.
Wish now I had paid more attention in math
 
As OkiePC said, the SLC supports the functions you need so you don't need the Padé approximation of the function. Just use the functions in the plc.

If you need help with the trigonometric functions you can Google those and get the information you need. I don't know what you remember about basic trig but the basic trig functions (sine, cosine and tangent) will give you the length ratio of various sides of a right triange given an angle between two sides. The inverse of those function (arcsine, arccosine and arctangent) give you the angle between two sides of a right triange given the length ratio between two sides.

In your application you have the ratio of the lengths in a right triangle and you need to determine the angle needed to achieve that length ratio. That means you need the arc functions. As OkiePC said, the functions in the SLC require an input in radians. There are 2*Pi radians (6.283184) in 360 degrees.

Keith
 
thanks to everyone. had a engineer here at work who is very good at math help me with getting the formulas correct. ( still learning that part more), have created a sample program on a old slc rack that is here in the shop and connected a stepper motor and drive (applied motion products st5-q). have been able to move the drive to desired position, but wierd thing is that if i turn the plc off and back on the stepper card faults and i have to go into the output word (7.0) and clear the fault bits manually. Could someone take a look at see what i may be doing wrong.
thanks
 
Is there anyone out there that could possible tell me what I may be doing wrong. I have read the book and still not sure why i get configuration errors.
What i trying to do is send pulsed to a stepper drive and so many pulse equal a certain distance.
we do not have a tech connect support agreement so not able to call ab and our local rep does not have much experience with the stepper card.
thanks
 

Similar Topics

This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,296
Hi all. First time programming a machine of this type. A center driven unwind feeding to a center driven rewind. No dancers or load cells, just...
Replies
37
Views
4,712
Hello, Been a while since I posted , Still sucking air been a interesting 3.5 years the dreaded health with old age scenario. Back at it and had a...
Replies
11
Views
2,030
Hello: Some time ago I wrote some basic code for a GuardLogix, in which I needed to add and subtract tags of LINT data type. When tried to use the...
Replies
13
Views
3,664
I have a customer who has a centrifuge application. The plant engineer did all the calculations on the centrifuge to arrive at a WK^2 of 6458...
Replies
14
Views
3,504
Back
Top Bottom