Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Simulation of water cooling circuit

Status
Not open for further replies.

dixib

Mechanical
Dec 1, 2011
21
Hi

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
 
 http://ole.dixib.dk/Indledende_beregninger.m
Replies continue below

Recommended for you

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

>>pumpything(17)

function[]=pumpything(loops)
clc
clear
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
tau_end = 600*loops; % Calculation end time

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

% CALCULATION
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;
end
if tv(i)>=t_v+t_v_lim
q_m = pump/3600;
end
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);
end
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);
end
end



plot(tau/60,tv,'k-',tau/60,tb,'r-',tau/60,tl,'b--',tau/60,ll,'b--')
end



Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
The problem have been somewhat solved. See solution in 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 ( and 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor