Block that calculates the arctangent of Y/X, storing the result in Angle.
Ladder Representation

Block Structure
Variable Type |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
X |
REAL |
Parameter X of the function |
|
Y |
REAL |
Parameter Y of the function |
|
VAR_OUTPUT |
Done |
BOOL |
End of operation |
Angle |
REAL |
Value of the angle whose tangent is equal to (Y/X) (in radians) |
Operation
When this block has a TRUE value in EN, it sends to the Angle output the arctangent of Y/X. If no errors, the Done variable is set. If there is any error in the operation, Done is not set, staying in FALSE status, while Angle remains with its value unchanged.
When EN has FALSE value, Angle remains unchanged and Done remains in FALSE.
Block Flowchart

Example in Ladder

The above example calculates the arc, in radians, whose tangent is the Y/X variable, storing the final result in ANGLE. The arc, for positive values of X and Y, is always in the first quadrant. The block ends with success and Done output is activated.

The above example calculates the arc, in radians, whose tangent is the Y/X variable, storing the final result in ANGLE. The arc, for negative values of X and positive values of Y, is always in the second quadrant. The block ends with success and Done output is activated.

The above example calculates the arc, in radians, whose tangent is the Y/X variable, storing the final result in ANGLE. The arc, for negative values of X and Y, is always in the third quadrant. The block ends with success and Done output is activated.

The above example calculates the arc, in radians, whose tangent is the Y/X variable, storing the final result in ANGLE. The arc, for positive values of X and negative values of Y, is always in the fourth quadrant. The block ends with success and Done output is activated.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR X : REAL := 1.0; Y : REAL := -1.0; ANGLE : REAL; END_VAR
ANGLE := FB_ATAN2( EN:=DI1, X:=X, Y:=Y, Done=>DO1);
|
|---|