Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Captcha Click on image to update the captcha .

Login

Register Now

register content

PLC AVE (Average) Instruction Example

We all know what the mean command means and what it does mathematically.
The average command is generally used to average a series of variables. In general, we assign the data to an array every second so that it is not affected by instantaneous changes at the decision-making point according to variable values such as temperature and pressure, and we perform the operations by taking the average here.
If we do not want to use the average command, we add the value every second and assign it to another variable and divide the total value by this number.

PLC FIFO Instructure Usage (FFL)

We have seen the Fifo command in our previous article, we have written multiple values in a sequence with the FIFO command, if you want, you can find the average of the array used in the FIFO command. Thus, your variables are stored in the array in order, and you can easily find the average of this array with the AVE command.

Now we will explain how to use the AVE command with an example.

plc programming PLC AVE Usage plc

Array part of the array (we want to find the average) we will use,
We write the result of the average in the Destination section of the tag that we want to write.

AV (Average) Instruction Parameters:

Array – The Array which holds the values you wish to calculate an Average of

Dem. To Vary – The array’s Dimension to use (0, 1, 2)

This parameter allows users with multi-dimensional arrays to select the dimension in the array to use (- ed.)

Destination – Where to place the Result of the Average Instruction. Consider this a “MOV” block inside the AVG instruction.

Control – This will be a CONTROL data type similar to the one used in the FFL and FFU instructions, but can not be the same tag as the FFL and FFU instructions. The AVG instruction needs to have its own dedicated CONTROL tag.

Length – The length of the array to AVERAGE.

In some situations, you may only want or need to Average a part of the array, but it’s more common to Average all of the stored variables.

Position – The offset into the selected array which the instruction is accessing.

This value is typically set initially to 0. (- ed.)