TAN

Tangent

TAN calculates the tangent of the input variable and writes the result into the output variable. The angle data has to be specified in radians (value < 52707176).

Parameters

Input

Unnamed input (REAL, LREAL)

Input value in radians

Output

Unnamed output (REAL, LREAL)

Tangent of input value

Remarks

The accuracy of the calculation decreases as the angle data specified in the input variable increases. Therefore, we recommend to enter angle data in radians ³-2p and £2p.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)

if input variable does not have the data type REAL, LREAL or input variable ³ 52707176

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)

if input variable does not have the data type REAL, LREAL or input variable ³ 52707176

sys_bIsEqual (turns to TRUE and remains TRUE)

if output variable is zero

sys_bIsCarry (turns to TRUE for one scan)

if processing result overflows the output variable

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		input_value: REAL:=0.0;
			(*angle data in radians*)
		output_value: REAL:=0.0;
			(*tangent*)
	END_VAR

This example uses variables. You can also use a constant for the input variable.

LD body

The tangent of input_value is calculated and written into output_value.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,TAN!,Instance,7,2,12,4,,?D?C);
B(B_VARIN,,input_value,5,2,7,4,);
B(B_VAROUT,,output_value,12,2,14,4,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

IL body

LD

input_value

TAN

ST

output_value

Modified on: 2022-08-23Feedback on this pagePanasonic hotline