Math question

SeanLee

Member
Join Date
Mar 2004
Location
Minot, ND
Posts
122
I am working on a problem here. the operators are getting
many mnay rate errors like 50 a night

We are generating a rate alarm if the flow in or out of an oil tank goes over 5ft/hr

I have been looking at the logic that someone else did for
this system
ControLogix System


A=Tank Prev Value
B=Tank Currant Value
C=Timer in sec
D=3600 sec
X=Rate

If B not Equal A then
X = SQR((A-B)**2/(C/D))
Then A=B
Reset Timer


I dont like this formula, I dont believe it is a godd rate
formula

I want to change it to

((((ABS(A-B))/C)*(D/C)

This formula seems for stable
Please let me know what you all think
I am not a Math wiz just asspire to be one.
 
Is the tank level really changing? What type of device are you using to capture/check level? If this is only happening at night is there any function that times this event to happen in the night hours? You got ta love troubleshooting programs you know little about … I like your idea. Perhaps write your logical equation into or with the current logic and trend the response then choose what works better for your application.
 
It happens all the time at different times i guess i just know it happened 50 times last night

The tank level is measured my radar
The flow will vary depending on incoming pipe line pressure
Many variables

I do have my algorithm in there now and am trending right now.

My algorithm is considerably lower value but the weird this is the change is flow is exponencialy different when there is a change in flow maybe due to the squaring the tank level
so with the Level change squared it causes the higher changes to be many times higher
I will post a graph when i can
 
you can always apply a slew rate to the input.. allowing only small changes or any way to dampen the input?
 
Is this programmed in STL? FBD? RLL?

Is your timer a 0.001 timebase? Is the preset 3600 seconds, or 3600 of some other unit of time?

Can we ASsume that the timer done bit triggers the IF/Then logic? The calculation? Both?

I am not sure you want to run the math every scan. I would do time weighted averaging before calculating the error, and then I would require multiple consecutive rate errors over a period of a few seconds (application permitting) before issuing the alarm.

You're trying to trap an error measured over a period of an hour, so maybe your PLC is doing the math too fast and detecting every little bit of noise or sensor error...

I would only calculate the rate once per second, or slower, add a counter to look for two or three consecutive errors, and then issue the alarm.

Not sure why you need advanced math to do this, just precalculate the rate of change error limit based on the frequency you want to test, and use a LIMit instruction. So if you're sampling every second, your rate limits would be +/-0.0013888888888889

[1 second oneshot] X=(B-A)

[/quote]LIM X, Low Limit = -0.0013888888888889 High Limit =+0.0013888888888889 OTE Rate_Okay
EDIT: This takes care of a change in either direction

Then timeweight filter the level value faster than once per second using the device itself, the input module, or PLC code, so you can clip any "garbage in" before garbage gets out to your alarm bits.

If your math is only executing when the timer gets done, which I think is unlikely since there aren't fifty hours in a night (unless you're a tire curing press tender)!

Rather than try to calculate the rate per hour, why not calculate the rate per minute, or a shorter interval...leading to this question:

Is it okay if the rate jumps to 10 feet per hour, but only for a duration of 1 minute, and then is reduced to normal?

Paul

SeanLee said:
The problem with doing a time weighted average is
i dont reaaly know if the tank is going up or down
all i have to go off of is the tank level
no flow meters

i will post a pdf of the logic[/quote]
No problem...just gimme 300 minutes to download a pdf viewer...my sys7em incysted on restoring its sad self today, and I am on a low tech cell modem through a Wilson Wi-Ex booster downloading at half the speed of smell...
 
Last edited:
The problem with doing a time weighted average is
i dont reaaly know if the tank is going up or down
all i have to go off of is the tank level
no flow meters

i will post a pdf of the logic
 
Would it be possible that the problem is the radar/sonar sensor detecting turbulence creating this false alarm? I am somewhat lost on your last reply. The level device is calculating a fluid level? With this you should tank level % and whether it is increasing or decreasing in %.
 
It executes the math when the current tank level is not equal to the last tank level

timers is free running

after execution of math send new tank level to last value
and reset timer

this is on a L62 Control Logix so i have the speed
to do this constitly
but is has never been more frequent then every 4 sec
what slows is down is the hart connection to the Radar gauge

but it can go up to 30 sec or more between math executions

I dont know how to get the latter logix to fit on the page
but heres the logic
 
I do look at tank level percentage but some damn manager
thinks we need to monito flow rate without a flow meter
so an outsorced company set this up and now i have to deal with it

This is a 80K barrel tank so the level percentage change is so small
 
My concern is I think the original math is not right

to calculate flow as far as i know you just need
F=amount/time

the original math is just too over done
so i just looking for second eyes to tell me if i am right
 
Well, one thing I've always tried to teach -- since they don't seem to teach this in schools anymore -- is to work through the equation with the units (feet, lbs, miles, widgets, whatever it is you're working with...). If the units to the answer aren't the units you need, then the equation is wrong. Doesn't matter how good your math is, the answer will still be wrong! When the units work out right, you might still make a math error, but at least there's a chance that it's right...

The original equation: X = SQR((A-B)**2/(C/D))
SQR((ft-ft)**2/(sec/(sec/hour)))
= SQR(FT**2/hour)
= ft/(sqr(hr)) << That's not a rate...

On your equation: ((((ABS(A-B))/C)*(D/C)
((((ABS(FT-FT)/HR)*((SEC/HR)/SEC))))
= FT/HR/HR
= FT << That's not a rate, either...

You want (A-B)/C/D
= (Ft-Ft)/Sec/(sec/hr)
= Ft /hr << There's a rate!

Or more simply 3600*(A-B)/C

You might need to adjust the sign on (A-B) because I don't know what you're measuring. I assume since it's a radar, you're measuring head-space. So (Previous - Current)>0 should indicate a dropping level, while <0 should indicate a rising level. But if you're measuring product level, not head space, you would need to reverse A and B...

I think... it's getting too late for my old brain to think...
 
Thank You for the help
I knew something was not right
I guess I am just been out of school to long
to remember the basics
 
I dont know i still like thsi equation but help me out here

((((ABS(A-B))/C)/(C/D)
((((ABS(FT-FT)/SEC)/((sec/hr))))
= FT/sec/(sec/hr)
=FT/HR

Does this look better or am I missing something
 
Found another problem
In ControlLogix you only get timers in msec
so with data like this

(.001953ft/65990msec)/(65990/3600000)=1.6154E-06
or
(.001953ft/65sec)/(65/3600) = .001664095
 

Similar Topics

... I followed a link dealing with Permutations and Combinations, and learnt a (to me) startling fact ! 0 * 0 = 0 agreed ? 0 * 0 * 0 = 0 agreed...
Replies
12
Views
3,510
See attached pic Why is R02451 reading 0 before the Real_to_Int conversion? It is reading 23 after, which is what it should read.
Replies
8
Views
1,664
Im using Wonderware Intouch machine edition v8.0. Question: How does the Math Worksheet/Task scripting work? I have the following expression...
Replies
3
Views
2,252
Hi Group, I'm the new owner of an AB MicroLogix 1400 processor and have been trying to decide the best way to de-pressurize a compressed air tank...
Replies
8
Views
1,963
🤷 I have a small cattle herd and am trying to create a feed estimate calculator. Each beast will eat about 3% of its body weight each day...
Replies
4
Views
2,755
Back
Top Bottom