FP_TANH

Hyperbolic tangent

This FP instruction calculates the hyperbolic tangent of the input variable. The result is stored in d.

Parameters

Input

s (ANY_REAL)

Angle data in radians

Output

d (ANY_REAL)

Hyperbolic tangent of input value

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.
  • if a data type other than REAL is specified.
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.
  • if a data type other than REAL is specified.

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
		bStart: BOOL:=FALSE;
			(*activates the instruction*)
		rInputValue: REAL:=0.0;
			(*angle data in radians*)
		rOutputValue: REAL:=0.0;
			(*result*)
	END_VAR

LD body

When the variable start is set to TRUE, the function is carried out. The tangent of rInputValue is calculated and written into rOutputValue.

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_CONTACT,,bStart,4,2,6,4,);
B(B_VARIN,,rInputValue,6,3,8,5,);
B(B_VAROUT,,rOutputValue,14,3,16,5,);
B(B_F,FP_TANH!,,8,1,14,5,,?DEN?D@'s'?AENO?Cd);
L(1,3,4,3);
L(6,3,8,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF bStart then
rOutputValue:=FP_TANH(rInputValue);
END_IF;

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