Skip to main content

SQRT

Calculates the square root of Value and stores the result in Result.

Ladder Representation

SQRT block

Block Structure

Variable TypeNameData TypeDescription
VAR_INPUTENBOOLBlock enabling.
VAR_INPUTValueREALReference variable for the operation.
VAR_OUTPUTDoneBOOLEnd of operation.
VAR_OUTPUTResultREALVariable that stores the operation result.

Operation

When EN is TRUE, the block writes the square root of Value to Result.

If the operation completes without errors, Done is set. If an operation error occurs, Done remains FALSE and Result keeps its previous value.

When EN is FALSE, Result remains unchanged and Done remains FALSE.

Execution Flowchart

SQRT execution flowchart

Examples

SQRT ladder example 1

This example calculates the square root of VALUE and stores the final result in RESULT. The block completes successfully and activates Done.

SQRT ladder example 2

This example attempts to calculateste the square root of a negative VALUE. The block reports an execution error, leaves RESULT unchanged, and keeps Done disabled.