ATAN2 block

Short summary

Name

ATAN2

→POU type

→function

Category

IEC-block, Numeric

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/check.svg no restrictions

Graphical interface

images/download/thumbnails/414781953/ATAN2-version-1-modificationdate-1535031826762-api-v2.png

Available since

  • version 1.18.0 (for logi.CAD 3) – initial variant: inputs IN1 and IN2

  • version 1.58.0 (for logi.CAD 3) – enhancement: names of inputs changed to Y und X

  • version 3.1.0 (for library Standard) – For inputs of data type REAL, the optimized float variant of the C-runtime is used. Compared to previous versions , it is possible that (marginal) other results are returned within the threshold range of the block.

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

→Data type

Description

Inputs:

Y

REAL, LREAL
(corresponds to →generic data type ANY_REAL)

Y-coordinate

X

REAL, LREAL
(corresponds to →generic data type ANY_REAL)

X-coordinate

Return value:

REAL, LREAL
(corresponds to →generic data type ANY_REAL)


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

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.