how to Invert the Analog water Level Sensor

google08

Member
Join Date
Jun 2011
Location
Kiruna
Posts
51
how to Invert the Analog water Level Sensor values?

It messure number in int from 27565 (tank empty) to 0 (tank Full)

It there som kind of math operation that can do

0 (tank empty) to 27565 (tank Full)

Inverse the Analog value
 
I am surprised at how often this kind of question comes up. Scaling inputs is just a standard linear equation that we learned in high school algebra: y = mx +b. Don't let the data registers and such confuse you. Both the slope and the intercept can be negative, so the fundamental methog attached works no matter what. If you have floating point math in your PLC you can skip the FACTOR, but if all you have is integer math you can get the needed resolution by using it.
 
Whilst the above answers are perfectly correct I would ask whether this is for an ultrasonic (or radar) sensor which has been set to read distance rather than level. If so you could correct the sensor set up to get the desired result.
 
What processor are you using?

In AB you could use the SCL instruction (RS500) or SCL function block (in RS5000), or CPT instruction in RS5000 also.

This is the formula you want if you use raw math.

scaled value = (0.00363 * raw input)

This will give you 100% for 27565 raw input, and 0% for 0 raw input.

edit: this is how you work it out

Analog scaling
y = scaled value
m = rate
b = offset
x = raw value

y = (m * x) + b

m = (y2-y1)/(x2-x1)
b = y1 - (x1 * m)
x = (y – b) / m
 
Last edited:
But Tom, that means one had to stay awake during algebra class! C'mon. Nobody uses algebra in the real world! :')

Good point, Dan!

We had an interesting discussion at UW a few days ago. The graduating engineers are required to know calculus (which I haven't used in 25 years at least) but are not able to read or create engineering drawings (which I have to do every week).

That's a little troubling. Still, for most graduates the theoretical background probably serves them better than more day-to-day type instruction - as long as they know they dont know and appreciate the experise of the guys that do have theses skills.
 
Still, for most graduates the theoretical background probably serves them better than more day-to-day type instruction -
Tom, My observation is that the theoretical stuff in engineering school is mostly wasted time. It is amazing how little engineering education reflects the day-to-day jobs that most engineers do. After getting their BS degrees, most graduate engineers have to be trained on-the-job on how to do the real work.

I think the disconnect is that engineering schools teach what they like to teach - a lot of math, a lot of therory, and how to prove the theories. I spent days in classes listening to some fat balding stuffed-shirt prove Einstein's theories. I wanted to stand up and yell, "Hey, I belive Einstein was right. You don't have to prove it again, or teach me how to prove it. Now lets move on to something useful"! These theories are easy to make tests for, easy to grade, require no real student learning of skills, and require little effort from the professors. Skills such as designing, drawing, testing, and troubleshooting require a lot of work to teach successfully, and (if they are taught at all) are stuck in some dusty lab course under a graduate student, and given little credit and little attention.
 
Without the underlying theory & knowledge of calculus, statistics, and physics, along with the direct shop experience, I know I would not have been part of some interesting & advanced projects during my career. Looking back, I can't imagine just limiting myself to what I do most days.
 
It is same as ever: Some engineers are theorists who don't like to get their hands dirty, but want to work in the exalted atomosphere of "what if". Others just want to get their hands on the stuff and make it work.
 
The graduating engineers are required to know calculus (which I haven't used in 25 years at least) but are not able to read or create engineering drawings (which I have to do every week).

Wow, not a single PID control loop in 25 years?!

While you may not get out a sheet of paper to do derivatives by hand in 25 years, I bet you've used calculus concepts a lot more than you think. Calculating volts RMS is a perfect application for calculus.

I will completely agree that there seems to be much more emphasis on teaching the abstract rather than the practical.
 
Wow, not a single PID control loop in 25 years?!

While you may not get out a sheet of paper to do derivatives by hand in 25 years, I bet you've used calculus concepts a lot more than you think. Calculating volts RMS is a perfect application for calculus.

I will completely agree that there seems to be much more emphasis on teaching the abstract rather than the practical.

Well, of course there is calculus underlying a lot of my daily tasks - after all, Sir Isaac developed calculus as part of developing Newtonian mechanics! But, as with his first law, my applications don't involve me in the calculus when I tune a PID loop. (Remember, PID was initially a pneumatic control methodology and calculus was certainly not part of the tuning process when it was called proportional, reset, and rate three mode controller.)

However, it has been many years since I developed a differntial equation or even had to integrate a function. The closest I've come is using Simpson's rule for totalizing electric power.

I've started a thread specifically for this topic, and rather than hijack this one go to:

http://www.plctalk.net/qanda/showthread.php?t=70421
 

Similar Topics

Our customer site has a few units Power flex 4 & 40 running at their machines. A sensor (4-20mA) output is direclty wired into the analog input...
Replies
6
Views
5,760
Hi, Has anyone had this problem: - I send a speed reference to my ABB ACS550 Drive via Modbus TCP to it's register via an INT. However when I...
Replies
1
Views
1,007
Converting an iFix 5.0 HMI to Ignition, not developed by me. Been a long time since using iFix. On Digital Input tags, what does the property...
Replies
3
Views
1,873
A B D E G ---| |----| / |---+---| / |---| |------+----( )--- | |...
Replies
9
Views
2,178
Hi everybody, I’m trying to find the best way to do invert a 4-20 mA signal in the device, PLC and citect. I have a Rotork actuator...
Replies
16
Views
6,150
Back
Top Bottom