Shaynet

NT20S --> C200HS --> Stabilise a reading

2 posts in this topic

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. 

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now