Jump to content

Recommended Posts

Posted

On experimenting with the problem I was having here with my water tank level sender, I switched over to a cheap Chinese 4-20mA sender 

It seems to be working fine. However, the number output jumps around a little and makes the graph jump around as well. +-3%  

I tried to use AVG to smooth it out, but it might not be the right approach. 

The program is in the other thread. 

Sorry if this is a rookie question and as really appreciate the support. 

Posted
3 hours ago, Shaynet said:

I tried to use AVG to smooth it out, but it might not be the right approach.

The problem with the AVG instruction is it collects samples based on PLC scan time. In many cases, this is too fast to do proper averaging for a live signal. Using a timer does not work because every time the AVG instruction turns OFF then ON again, it starts over from the beginning. So, you are correct, it's the wrong instruction for this purpose. 

This is a rookie question but you don't have to be sorry for it. There are many here that are willing to help out. 

I'm not sure any PLC manufacturer has the perfect instruction for this so most programmers will do it with simple math. Collect and store x amount of samples, add them together and divide by x. Use a timer to collect your samples and play around with the sample time. Obviously, the longer the sample time, the longer your analog update time. There are other methods using simple math so have a look at this search and don't be afraid to look at other PLC manufacturers. 

smooth analog signal site:forums.mrplc.com - Google Search

 

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...