average / averageL

PLCopen motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Calculates the average of signal samples.

Inputs

Input

Data Type

Range

Unit

Default

Description

RUN

BOOL

 

 

 

EnablingClosed Enable signal for the drive, Hardware-Enable with 24V signal to X8, Software-Enable command by setup Software, fieldbus or permanently set. Both are required for enabling the drive. command.

XIN

REAL

 

 

 

Input signal.

N

DINT

 

 

 

  • Number of samples stored for average calculation.
  • Cannot exceed 128.

Outputs

Output

Data Type

Range

Unit

Description

XOUT

REAL

 

 

  • Average of the stored samples.
  • averageL has LREAL arguments.

Remarks

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the input rung is the RUN command.
    • The output rung keeps the state of the input rung.
    • ENO has the same value as RUN.

IL Language Example

(* MyAve is a declared instance of AVERAGE function block *)
Op1: CAL MyAve (RUN, XIN, N)
     FFLD  MyAve.XOUT
     ST  XOUT

ST Language Example

(* MyAve is a declared instance of AVERAGE function block. *)
MyAve (RUN, XIN, N);
XOUT := MyAve.XOUT;

See Also