Programming a curve for 4-20 mA input

jrsnydley

Member
Join Date
Dec 2014
Location
Minnesota
Posts
155
Hey everyone,

I have a sensor that gives a 4 - 20 mA signal that is not perfectly linear. There is a bit of a curve in it. I would like to hook the sensor directly up to a 1756-IF16 input card. Is there a way to program in the curve or does it have to be linear?
 
I've worked with load cell sensors that weren't linear... apart from that, the only other piece of equipment was a potmeter. Not that it isn't linear, but it shouldn't feel like for the user most times.

However, how noticeable is that curve? In my experience, you can just do a "look up" table of sorts with your ranges so that you approximate a curve with a number of "linear" ranges.

Input - Output
0 -20 - 0 - 10
21-40 - 11 - 22
41-60 - 23 - 40
61-80 - 41 - 60
81-100 - 61 - 100


The scale is funky and just as an example, but should be a curve of sorts.
 
It is an ammonia sensor. The gas is injected into it which changes the resistance. I have attached a copy of the curve. It's not much of a curve but there is one.
 
How about use excel to create curve equation. Then use a math instruction (assuming this is an option) to use the equeation with the raw 4-20ma input.
 
Fgen as stated or use excel to find a polynomial approximation for those points.

Edit: too slow.. mccormick was first on that one.
 
As per attached Excel chart:

y = 0.0385*x*x + 5.9753*x + 22.754

where:
y = NH3 in PPM
x = Analog input in percent (0 to 100)

curve.jpg
 
Was looking into this just the other day, on an AB PLC as well.

Use the FGEN instruction. It can only be used in Function Block though, so you need the Pro license for Logix/Studio 5000.

But I had it up and running simulating my non-linear curve within a matter of minutes.

Simply plot in the data points for your curve in the X and Y arrays and you're done.
 
That is what I love about this Forum!! I have been using the Excel Polynomial method for years. It has working for the most part but was always off at the extreme ends of the curve. I just re did a program that was using the Polynomial method with the FGEN function block and it works very slick and is way more accurate when compared against my data set.

You learn something new every day in the business!!🍺
 
I hit a snag, I need to set off an alarm at greater than or equal to 25 ppm. The output of the FGEN instruction will latch at 30 ppm due to 4 mA = 30 ppm. I have the scaling of the input channel set up so that 4.0 mA = 4.0 and 20.0 mA = 20.0 and the input range is 0 - 20 mA.

Will the excel spreadsheet and equation method resolve this or is there a way to fix this with the FGEN? I tried to adjust the scaling so 0.0 mA = 0.0 and 20.0 mA = 20.0 but that did not make a difference.

The range on the sensor is supposed to be 0 - 1000 ppm.
 
The range on the sensor is supposed to be 0 - 1000 ppm.

The chart shows 30 PPM at 0% output. That seems to be a problem regardless of the linearization technique. It may be best to contact the manufacturer of the instrument on whether it is advisable to extrapolate below 4 ma output.
 

Similar Topics

Hello all, I need to write a code for S-curve motion profiles (7 segments) to control speed of motor via PLC. however, I cannot find the...
Replies
56
Views
16,742
Does anyone can explain me how to do s-curve (for increasing and decreasing speed of the process ) programming in siemens simatic S7. If...
Replies
1
Views
1,857
Hello colleagues, Some time ago I started my adventure with programming. With your help and the courses, things are starting to come together...
Replies
13
Views
588
Dear All, I need a sample PLC program to count the output pulse of a mass flow meter so that a specific amount of mass (for example 100gm)can be...
Replies
2
Views
79
Hi Please I have zeilo smart relay #SR2A201BD but I don't have it's programming cable. Can I use any general usb/rs232 converter? Or need...
Replies
2
Views
78
Back
Top Bottom