Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simulation of water cooling circuit

Simulation of water cooling circuit

Simulation of water cooling circuit


I'm working on a water cooling circuit, where I have a heat tank with a heat source that's on/off in 5 min. intervals, and a buffer tank, that's constantly cooled by a heat exchanger. There's a pump, that cycles water between the two tanks to keep a temperature of 15 °C (+/- 0.5 °C) in the heat tank.

I've tried to programme the on/off function of the pump to keep the temperature of the heat tank within the required interval, which seems to work, but would like to know if there's a cleaner way to achieve what I want, or is it done the way I've done it? Besides I would like to have the ability to change the number of cycles the calculation runs for, which is done manually in the attached example. Can this be done?

Thanks in advance

RE: Simulation of water cooling circuit

Your pump switching logic is fine, you could probably do it as one liner but it would be harder to understand. Hysteresis is by its nature a non smooth function

If you want to change the number of loops on the fly change it to a function and call it from the command line eg


close all

% Loops in calculation

lv = 1:loops*2; % Loop vector
even = lv(mod(lv,2)==0); % Even values in loop vector
odd = lv(mod(lv,2)~=0); % Odd values in loop vector

% Conditions/constants
t_v = 15; % Temperature in heat tank [°C]
t_b = 6.5; % Temperature in buffer tank [°C]
t_v_lim = 0.5;

tau_int = 1; % Calculation intervals [s]
tau_end = 600*loops; % Calculation end time [s]

c = 4192; % Specific heat capacity [J/(kg K)]
m_b = 4; % Mass in buffer tank [kg]
m_v = 2; % Mass in heat tank [kg]

P_b = -200; % Power from heat exchanger in buffer tank [W]
P_v = 400; % Power from dypkoger i varmetank [W]

pump = 60; % Pump effect [L/hr]
q_m = pump/3600; % Mass flow from pump [kg/s]

N = (tau_end/tau_int)+1; % Number of calculations

% Start values
tv(1) = t_v; % Temperature in heat tank
tb(1) = t_b; % Temperature in buffer tank
tau(1) = 0; % Start time
tl(1) = t_v+t_v_lim; % Upper temperature limit of heat tank
ll(1) = t_v-t_v_lim; % Lower temperature limit of heat tank

for i = 2:N;
tau(i) = tau(i-1)+tau_int;
tv(i) = (((q_m*c*(tb(i-1)-tv(i-1))+P_v)*tau_int)/(m_v*c))+tv(i-1);
tb(i) = (((q_m*c*(tv(i-1)-tb(i-1))+P_b)*tau_int)/(m_b*c))+tb(i-1);
tl(i) = tl(1);
ll(i) = ll(1);
if tv(i)<=t_v-t_v_lim
q_m = 0;
if tv(i)>=t_v+t_v_lim
q_m = pump/3600;
if tau(i) > (odd*tau_end)/(loops*2)
tv(i) = (((q_m*c*(tb(i-1)-tv(i-1)))*tau_int)/(m_v*c))+tv(i-1);
if tau(i) > (even*tau_end)/(loops*2)
tv(i) = (((q_m*c*(tb(i-1)-tv(i-1))+P_v)*tau_int)/(m_v*c))+tv(i-1);



Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: Simulation of water cooling circuit

The problem have been somewhat solved. See solution in http://ole.dixib.dk/indledende_beregninger_w.m.
There's still some problems in though. Weird things happen when I change the starting temperature. Haven't been able to find a solution to this problem.

For now the above version have been abandoned and I've made a Simulink version instead (http://ole.dixib.dk/sl_tanke.slx and http://ole.dixib.dk/tanke.m). This works fine as it is now, but I'd like to add a delay to the heat source, so the 5 min. on/off intervals doesn't start until the temperature af both tanks are under a certain limit. Hope someone can help with this, since I have been able to find any help through Googling.
In addition I'd like to control the solver step size from the script (maybe even choose the solver). Is this possible?

Thanks in advance

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close