2-201
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Math Instructions
2
AryMean
AryMean
The AryMean instruction calculates the average of the elements of an array.
* If you omit the input parameter, the default value is not applied. A building error will occur.
The AryMean instruction calculates the average of Size elements of array to process In[] starting
from In[0].
The following example is for when Size is UINT#5.
Instruction Name FB/FUN Graphic expression ST expression
AryMean Array Mean FUN Out := AryMean(In, Size);
Variables
Name Meaning I/O Description Valid range Unit Default
In[] (array) Array to
process
Input
Array to process
Depends on data type.
---
*
Size Number of
elements to
process
Number of In[] elements 1
Out Calculation
result
Output Calculation result Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In[] (array) OK OK OK OK OK OK OK OK OK OK OK
Size OK
Out OKOKOKOKOKOKOKOKOKOKOK
Function
(@)AryMean
EN ENO
In Out
Size
def:=AryMean(abc[1], UINT#5);
LD ST
UINT#5
abc[1]
def
AryMean
EN ENO
In
Size
Average calculated.
3456
Out=def
1234
2345
3456
4567
5678
In[0]=abc[1]
In[1]=abc[2]
In[2]=abc[3]
In[3]=abc[4]
In[4]=abc[5]
Size=UINT#5