ACOS

Arccosine

ACOS calculates the arccosine of the input variable and writes the angle data in radians into the output variable. The function returns a value from 0.0 to p.

Parameters

Input

Unnamed input (REAL, LREAL)

Input value between -1 and +1

Output

Unnamed output (REAL, LREAL)

Output as input: arccosine of input value in radians

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)

if the input variable does not have the data type REAL, LREAL or if the input variable is not ³-1.0 and £1.0

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)

if the input variable does not have the data type REAL, LREAL or if the input variable is not ³-1.0 and £1.0

sys_bIsEqual (turns to TRUE and remains TRUE)

if the output variable is zero

sys_bIsCarry (turns to TRUE and remains TRUE)

if the 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
		start: BOOL:=FALSE;
			(*activates the function*)
		input_value: REAL:=0.5;
		output_value: REAL:=0.0;
			(*result after a 0->1 leading
edge from start: 1.047198
corresponds to 60° (PI/3)*)
	END_VAR

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

LD body

The arc cosine 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,ACOS!,Instance,9,2,14,4,,?D?C);
B(B_VARIN,,input_value,7,2,9,4,);
B(B_VAROUT,,output_value,14,2,16,4,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

output_value:=ACOS(input_value);

IL body

LD

input_value

ACOS

ST

output_value

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