[Logix] Question about FGEN with REAL input

defcon.klaxon

Lifetime Supporting Member
Join Date
Feb 2015
Location
Far NorCal
Posts
616
Hey guys,

Here at the wastewater treatment plant I'm working on, I have an effluent reservoir that I have a level sensor for, but need to display the amount of storage volume in acre-feet. The reservoir is man made via earthen berm and has an irregular shape, so as it fills up the storage volume goes up exponentially.

I have been given a table of values that correlate storage volume as a function of level, so I have the data already. My first attempt was to use Excel to create a polynomial function that fit the given data. That's not going to work, as the function is off *just enough* that it doesn't match the print out, and the client doesn't like it (as in, when it should be 650 acre-feet the function will say 645).

Now I am looking into using FGEN, with the predetermined values in some arrays. My concern here is that the level sensor gives me a 4-20mA signal which I can scale, but the data table I've been given is in exact 0.1 foot increments for level. My concern is unless the level is in exact 0.1 increments, FGEN won't know what to do for intermediate values (like if my level was 10.566671 feet).

First, I don't now if FGEN is smart enough to round and I'll be fine. If not, I'm acutely aware of the dangers of trying to round floating points so I don't want to do anything stupid.

Can anyone give me some input on using FGEN, and how you guys might tackle this problem?

If it helps, I can provide the actual data I've been given.

Thanks!
 
I don't know the answers to your question about FGEN, but to get your real number in units that match the printed table I have an idea.

Multiply the real number by ten and store in a DINT. Then divide the DINT by 10 and store in a float. Use some dummy addresses and test this to make sure the results are as you expect. If that works and the rounding behaves as expected, then plug that result into your FGEN function.
 
Last edited:
You may want to try it both ways and find out if leaving all of the mantissa intact gives you a more precise output (in case the FGEN block does some interpolation between points for you).
 
You may want to try it both ways and find out if leaving all of the mantissa intact gives you a more precise output (in case the FGEN block does some interpolation between points for you).

I will try both and see if there is any difference. Thanks again; I've read about the multiply-by-ten trick but didn't realize it would automatically take care of all the additional values in the mantissa. I'll have to do some reading to see how that all works out mathematically.
 

Similar Topics

Is there a way to reset the count on the RS Logix BackUp?? XXXXX PROGRAM IN PROGRESS_BAK445.RSS XXXXX PROGRAM IN PROGRESS_BAK446.RSS XXXXX...
Replies
8
Views
262
I am currently backing a Micro Logix 1100 and no-one seems to have the file for me to upload from. Is there a way for me to upload the project off...
Replies
15
Views
545
Hi, I am working with a Micrologix 1400 model 1766-L32BXB. With no input wires connected to the “in12” thru “in19”, I am getting 24 volts while...
Replies
4
Views
234
hi , I need to sorry for my bad English first. I'm newbie at plc programming ,I had been asked about E/IP protocol information for some system...
Replies
3
Views
389
Hello. Was just curious, if it is possible to load an image from an SD card on to a Compactlogix PLC that came straight out of the box brand new...
Replies
4
Views
551
Back
Top Bottom