ATAN2 block
Short summary
Name |
ATAN2 |
→POU type |
|
Category |
|
Conform to →IEC-standard |
no restrictions |
Graphical interface |
|
Available since |
|
Functionality
The trigonometric function arctan is called: The block calculates the arc tangent with 2 parameters. In contrast to the ATAN block, this block observes the sign of both parameters and determines the quadrant of the result .
The return value of the block is the angle in the Cartesian plane between the X-axis and a vector that is pointing from the origin (0,0) to the point (X,Y). The block returns the result in radians, in the range of -PI to +PI (including). The angle is positive for counter-clockwise angles (upper halfplane, Y > 0) and negative for clockwise angles (lower half-plane, Y < 0).
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
Y |
REAL, LREAL |
Y-coordinate |
X |
REAL, LREAL |
X-coordinate |
|
Return value: |
– |
REAL, LREAL |
|
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Example for usage within ST-editor
PROGRAM Test
VAR
result : REAL;
END_VAR
result := ATAN2(Y :=
1000.0
, X :=
50.0
); (* The variable
'result'
evaluates to
'1.520838'
. *)
END_PROGRAM
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.