Internet PLC Forum

General => Technical support => Topic started by: scottsaunders on April 14, 2003, 05:56:00 AM

Title: Trigonometry Calculation
Post by: scottsaunders on April 14, 2003, 05:56:00 AM
Are trigonometry calculations possible?

I'm trying to do:

Y=3/cos(A)
Title: Re: Trigonometry Calculation
Post by: support on April 14, 2003, 12:28:36 PM
Sorry. Not supported.

The M-series PLC do not support floating point math. But it's 32-bit integer math is good enough for 95% of control system.
Title: Re: Trigonometry Calculation
Post by: Joel Moore on May 05, 2003, 01:25:39 PM
I know this is an old post but I just thought I'd mention the idea of using tables of trig calculations (wasn't that how they did it in the old days?).  It uses up space but if you have it and you can tolerate the imprecision then you can load up a few hundred memory locations with calculation results and just reference them.  Scale them by 100 or 1000 to avoid losing too much precision.
Title: Re: Trigonometry Calculation
Post by: support on May 05, 2003, 05:41:41 PM
Thank you for the update. Yes, it is possible to use a look up table to solve the trig function but provided it is only limited to a small range of values.
Title: Re: Trigonometry Calculation
Post by: raan on June 19, 2003, 05:21:39 PM
In the past with another brand of plc, I have used a simple math technique of approximating a trig function with a taylor series power expansion of the form:
cos(x)= 1-(x*x)/2  +(x*x*x*x)/(1*2*3*4) -(x*x*x*x*x*x)/(1*2*3*4*5*6) .....see any calculus book for the taylor series expansion of the cosine function
raan