Jump to content

Recommended Posts

I am having a problem of figuring out a way to calculate an average for variable number of varables.

That is, I receive new values to V350 once per second and I want to be able to change the averaging period without having to download new program to OPLC all the time.

The Filter FB is not suitable because it has only 16 values max and the number of valuables is a constant inside the FB and cant be changed.

The Vector Shift and Vector Store FB combination wont work for the same reason, the vector length is a fixed constant value.

If anyone has done something like that before or has any ideas - I would be happy to hear them.

Link to comment
Share on other sites

Hello Michael,

thanks for the input! However, I think I cant adapt this example to my program as it does reset all data after some period, and I need to show average value for the last n values at all times (I should have mentioned that in the first post, sorry).

I think I have actually found a solution by creating a sort of FIFO vector so I can um up all values in the vector irregardles of its length. It turned out that You actually can set vector length via a MI, I am yet to test this solution, but I believe it should work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...