EasyManua.ls Logo

Omron NJ501-1500

Omron NJ501-1500
990 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2-391
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
MovingAverage
This sample shows how to eliminate the effect of noise and other disturbances in analog input data,
e.g., from a sensor. It assigns the average (DataAve) of the last 25 values of the input data (InputData)
to the input data (InputDataForOperating) for the next process.
InputData is input every task period as long as the value of the execution condition (Trigger) is TRUE.
Until 25 values of InputData are input, there is not enough data to calculate the average, so the most
recent value of InputData is assigned to InputDataForOperating.
When the value of Trigger changes to TRUE, the average is cleared and input of InputData is started
again from the beginning.
Sample Programming
Time
Average of last 25 values is assigned to InputDataForOperating.
Task period
InputData: Measured value for the current task period
Measured value
Variable
When there are 25 or more input values for InputData , DataAve is assigned to InputDataForOperating.
When Trigger changes to TRUE, 0 is assigned to IndexNo.
While Trigger is TRUE, the value of InputData is input every task period and the average is calculated.
Until there are 25 or more input values for InputData , InputData is assigned to InputDataForOperating.
Data type
Initial value
LD
Trigger
UINT#0
IndexNo
UINT#25
OneRound
InputData
IndexNo
Buffer[0]
Trigger
InputData
Buffer
DataAve
OneRound
IndexNo
InputDataForOperating
False
10
[25(0)]
0
False
0
0
BOOL
INT
ARRAY[0..24] OF INT
INT
BOOL
UINT
INT
Execution condition
Input value
Input value storage array
Average value
Flag that indicates 25 inputs
Input value storage position
Input to next operation
@MOVE
EN ENO
In Out
MovingAverage
EN ENO
In DataAve
CurIndex
Buf
BufSize
Q
OneRound
DataAve InputDataForOperating
MOVE
EN ENO
In Out
OneRound
InputData
InputDataForOperating
MOVE
EN ENO
In Out
Comment

Table of Contents

Related product manuals