Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab pump control

Status
Not open for further replies.

skini

Electrical
Jul 2, 2010
4
I need to use the Matlab for controling water pump speed which will control water level in a small tank. Water pump (windshield-water pump, 12v) is connected to DC-DC converter controller which is control by Matlab (0-5V).
Water level is messured by pressure sensor and this is INPUT.
So this is what i need from Matlab:

When input in Matlab is 0-0.5V, OUT must be 5V.
When IN is 2.5V, OUT must be 3V. If Input then raises, OUT must decrease for 0.5V. If it raises again, then OUT must again decrease by 0.5V. And so on.
If Input lowers then OUT must raise for 0.5V. And if it sill raises, again 0.5V increase in OUT and so on...
When IN is 4V, OUT must be 0V.

So if someone can help me to write code in Matlab that will do that.
Thank You.
 
Replies continue below

Recommended for you

For real-time simulation?
Why not use an embedded function in Simulink that has a few if statements that say exactly what you said.

"When input in Matlab is 0-0.5V, OUT must be 5V."

%
while input<=0.5 & input>=0
output=5;
end
%

ect.



[peace]
Fe
 
There's some missing information here:

- What is the sampling rate of your system? Over what period is a raise or fall in voltage measured?

- What's the desired behaviour between 0.5V and 2.5V?

- Steve
 
Yes it is for real time simulation.
I must control water level in one tank. Motor is pumping water, and water is flowing out through manual valve. And pressure sensor is there to "see" water level.

So my system must fill tank with water and then control level fluid to be lets say around 30-32cm (pressure sensor reading 2.5-2.7V).

As a read on web and getting familiar to Matlab and Simulink, i see that for controling water level is maybe better use some PID controller.
With this IF statements it can be done too i think, but maybe it is simplier with PID? But how to do it.

Sample rate i don't know. I need something to start with that my system work, then i will fine tune it.
 
Without a sample rate, your problem statement is meaningless. How much must the input raise to decrease your voltage by 0.5V? And is that a raise over a period of 1 microsecond or one hour?

- Steve
 
Sorry if i don't understand you or you me because of my english is not so good, and i am not that tehnical about this stuff.

When input raise 0.3V over 2.5V (which will be refferent fluid level), then out must decrease so that motor pumps water slower.
0.3V raise is done in 2 seconds.
 
Is it a homework assignment?

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
A something like that. I need it for my faculty work, and we didn't learnt Matlab much, just some basic stuff.
 
Seems like you have zero knowledge of control.
Without the basics, it will be difficult to help....

Aside from this, my opinion is to use a PD or PI with set point diversion.

[peace]
Fe
 
lol...Gregs comments always make me laugh....but always soo true.

[peace]
Fe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor