defcon.klaxon
Lifetime Supporting Member
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!
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!