CCW/micro 820 Comparing Values

Justin E

Member
Join Date
Mar 2024
Location
Colorado
Posts
4
I’m running a micro 820 to measure a tank level, then turning on equipment at certain levels. I have an analog input (4-20) that I’m storing and comparing to user input levels for the equipment to turn on. Everything works as intended and the analog is within 0.2in of the actual level, but for some reason the compare function will show true within a few inches:

Say I want pump on at 20 in, pump off at 10 in, the compare function line will hit true anywhere from 17-19 inches instead of 20. I’ve watched the values while connected to the plc, and it never jumps to 20. I’ve tried adding 1000 to each value to boost the range difference but no luck; considering converting to percentages and trying that, but has anyone ran into this issue, or have a more elegant method?
 
You do not see every value that the PLC sees on each scan cycle*; it is likely that a value greater than or equal to 20 is being detected by the comparison during a scan cycle that lasts maybe 1ms, but you do not see that value in whatever monitoring tool is available. And once that single value is detected, the pump turns on, the level starts to drop, and even with the noise there will not be another such value.

Without more detail I can't say much more, but that is the most likely explanation. We do not know if the conversion from the 4-20mA signal is calculating a REAL or an INT, or what kind of rounding is in effect.

TL;DR

How much noise is in the analog signal?

Can you post the code (I suspect it's something like BST > measured_level 20 NXB XIC pump_on BND < measured_level 10 OTE pump_on)?

* If you write the measured level value on every scan cycle to a circular array that is 1000 elements long, do you see the value that exceeded 20 then? Or if you wrote a rung like this:

BST XIO pump_on > measured_level saved_max_level NXB < measured_level 11 BND MOV measured_level saved_max_level

or like this

>= measured_level 20 ADD count_20s 1 count_20s

Then you will see that the measured level does indeed reach the 20.

PLCs care not a whit what you want them to do or what you think you see them doing, but they will mercilessly and inexorably do exactly what you tell them to do.

The only thing worse than the PLC not doing what you want it to do is when it does exactly what you told it to do.
 
It's all in ladder, there's probably a much cleaner and straight forward approach, but self taught and ladder was just intuitive. The ladder is only 43 rungs so it's a fairly short cycle.

Here's how I'm reading and converting/storing the analog.
Analog Read.png

The "Lvl" tags I'm comparing the elevation to is the user inputted levels and also stored as INTs. The pump status code is checked lower in the ladder to see if it's the run code, just because there's a number of sensors and failsafes that are also checked before hand to see if the pumps are allowed to run.

Pump Call.png
 
I’m running a micro 820 to measure a tank level, then turning on equipment at certain levels. I have an analog input (4-20) that I’m storing and comparing to user input levels for the equipment to turn on. Everything works as intended and the analog is within 0.2in of the actual level, but for some reason the compare function will show true within a few inches:

Say I want pump on at 20 in, pump off at 10 in, the compare function line will hit true anywhere from 17-19 inches instead of 20. I’ve watched the values while connected to the plc, and it never jumps to 20. I’ve tried adding 1000 to each value to boost the range difference but no luck; considering converting to percentages and trying that, but has anyone ran into this issue, or have a more elegant method?
 

Attachments

  • Sample.jpg
    Sample.jpg
    188 KB · Views: 15
That’s similar to what I’m doing, just with fewer steps. This is for more than one commercial application so I have the option to input different ranging pressure transducers and offsets as needed. My elevation integer shows the correct level on the HMI and on CCW when running, but for some reason it trips the compare function whenever it gets within 2-3 inches.
 
That’s similar to what I’m doing, just with fewer steps. This is for more than one commercial application so I have the option to input different ranging pressure transducers and offsets as needed. My elevation integer shows the correct level on the HMI and on CCW when running, but for some reason it trips the compare function whenever it gets within 2-3 inches.
Maybe a P.I.D. control to maintain a specific tank level?
 
I still think it's noise, and ElevationInt is reaching 20, even if you don't see it.

You could add a MOV ElevationInt ElevationIntAtTrigger instruction to the end each of Rungs 20-23 to catch the actual value when the pump is turned on to see.
 
I would suggest adding a debounce timer, where the level has to be at setpoint for 0.5 to 2 seconds. The level could be at the set-point for a split second which would turn on-off the output. It may be happening to quick for you to see.
 
I tried the MOV command and looks like it is split second noise adding a few inches. For the debounce timer, how would i go about adding it in ladder form?
 
I would recommend a couple of things:
1) Filter your analog value. I like a first order filter for things like this and use a formula I learned on this forum. If your signal doesn't need filtering, you can easily disable it by setting the filter constant to 1.0

2) Use floating point values, or integers with implied decimal points for tank levels and setpoints. This allows you to have more precise control over the levels. With tanks shorter than 327.67 feet tall measured in feet, I commonly use "Feet x 100" as my units for systems where I have remote communications and it makes for less comms to have everything in integers (one block of integers over a radio can include analogs with implied decimal as well as packed bits). Floats are even easier if they don't have to travel over a wire to a 3rd party device along with a bunch of discrete signals.

3) Debounce start and stop levels as already suggested. With a filtered analog, you can probably set the debounce delays quite small, but keep them in there to keep from short cycling pumps if your sensor really does go ape (and someday, it will).
 

Similar Topics

I am trying to upload from a remote Micro 820. I am getting this error message. unable to load project with limited license. The target '' used...
Replies
2
Views
1,663
Hello- struggling with multiple issues on the Micro 820. #1) Can't flash without getting error. Have a flashing fault light but do not know how...
Replies
8
Views
4,581
Hello all- Is there a way to use a timer enabled bit in CCW? When i try to use a contact and reference say TIMER.IN, it causes an error when I...
Replies
7
Views
4,820
Hi, I can't connect to a Rockwell Micro850 using Connected Components Workbench (CCW) 12.00. - I can ping the PLC - I can flash the PLC (from 10...
Replies
2
Views
1,505
Back
Top Bottom