## Simulation of water cooling circuit

## Simulation of water cooling circuit

(OP)

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

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

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 [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

% 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: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

## RE: Simulation of water cooling circuit

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