We have many advanced mathematical functions like trigonometric functions, Logarithms, exponents, square root functions etc . For complex type of calculation we use CPT. some functions we use is listed below….
ACS (Value, Destination) – inverse cosine
COS (Value, Destination) – Cosine
ASN (Value, Destination) – Inverse sine
SIN (Value, Destination) – Sine
ATN (Value, Destination) – inverse tangent
TAN (Value, Destination) – tangent
XPY (Value, Value, Destination) – X to the power of Y
LN (Value, Destination) – Natural log
LOG (Value, Destination) – base 10 log
SQR (Value, Destination) – Square root
CPT (Destination, Expression) – Does a calculation
Let us suppose we have problem like
A = sqrt ( ln B + e^c (a cos ( D ))………………………………… sqrt means square root
Solution:
We take LN function for natural log then we take XPY function for e^c. Now we use ACS for inverse cosine as question demands. For multiplication we use MUL, For Addition we use ADD and finally we use SQR function for final value to release from square root.
Before using any function we assign some address as shown below
A = F8:0
B = F8:1
C = F8:2
D = F8:3
Now we use function as I mentioned above. The below figure makes us easy to understand …..
FIG: An equation in Ladder logic
Here an equation has been converted to ladder logic. The first step in the conversion is to convert the variables in the equation to unused memory location in the plc. The equation can then be converted using the most nested calculation in the equation such as LN function. In this case the result of LN function are stored in another memory location, to be recalled later. The other operations are implemented in similar manner.
The same equation could have been implemented with CPT function as shown in below. The equation uses the same memory locations chosen in above for A,B,C and D. In this case the expression is typed directly into plc programming software.
FIG: File Algebra Example
No comments:
Post a Comment