Go Down

Topic: Code for calculating final temperature of ice added to water  (Read 167 times) previous topic - next topic

Jeremy_nz

Hi.

I have constructed a water meter for a bakery. It uses a flow meter, solenoid and ds18b20 to dose water for mixing bread dough in a bakery environment.

Basically one punches in a volume of water into a keypad and then a solenoid opens dumping water into a mixer. The water is measured with the flow meter and interrupted when total volume measured = target volume.

All the while the temperature is monitored and averaged.

My problem is when I need to use colder water than is available via mains water supply. I would like to add a function to calculate the amount of ice to add to bring to a specific temperature.

Example: dumped 30L at 25C. how much ice in grams would I need to add to that water to bring temp down to 20C?

The information I would have is V=volume of water, OT= Starting Temperature and TT = Target Temp.
I want to find out how to use the Arduino to give me the volume of ice in grams I need to add to reach TT from OT.

If anyone is interested in having a crack at It I would be very thankful.

I'll also attach my code, knowing its not beautiful .

pert

Hunt down a formula for this and then if you need help converting it to code I'm sure someone here can assist.

robtillaart

Not trivial

The physics
There are three temperature coefficients you need to know to calculate the amount of energy needed to melt ice from ice to water.

- assume ice has temperature of -Y °C
- assume water has temperature of P °C (ist temperature)
- assume X °C is the temperature you want to have (soll temperature)

then the steps are

1) getting the ice from  -Y°C to 0°C-  => 2.108 J/gram  (search for specific heat ice)
2) getting ice from 0°C to water 0°C  => 334 J/gram  (this one is often forgotten)
3) getting water from 0°C to X°C       => 4.187 J/gram

In total to get 1 gram of ice from -Y to X costs   Q1 = 2.108*Y + 334 + 4.187*X  energy

This amount of energy should balance
4) getting water from  P °C to X °C     => 4.187 J/gram

In total to get 1 gram of water from P to X costs  Q2 = (P - X) * 4.187  energy

Example

30Liter @25° -->  30L @ 20°  ==> Q2 =  30000 gram * (25-20) * 4.187 = 628050 joule

Assume you have ice from -18°C then it would take

Q1 = 2.108*18 + 334 + 4.187*20 = 454.064 Joule per gram to heat to 20°C

The amount of ice would be 628050 / 454.064 = 1383.17 gram of ice of -18°C to end up at 20°C
in practice 1.4 Kg should work (depends on precission of parameters of course).

The code
Assuming my above physics is right we can derive the formula needs

1) amount of water in Kg (30.000)
2) IST temperature of the water in C (25.0)
3) SOLL temperature of the water in C  (20.0)
4) temperature of the ice in C (-18.0)

Code: ("not verified or tested") [Select]

float calculateIce(float water, float ist, float soll, float icetemp)
{
  float Q2 = 1000 * water * (ist - soll) * 4.187;
  float Q1pergram = -2.108 * icetemp + 334 + 4.187 * soll;   // note the - sign
  float gramsIce = Q2 / Q1pergram;
  float kgIce = gramsIce * 0.001;

  return KgIce;
}


You can modify the code to round the number to 100 grams or have the weight in grams etc

This formula does not take into account the environment temperature, which has effects too.
Furthermore the specific heat of water depends on the temperature but above formula should work well enough in practice. If not you need to extend the formula in a similar way.

Please do a number of testruns and let us know if it works.

Note:  ° char  == ALT 0176 on windows

updated the value for latent heat (ice2water) as Harlane spotted an error (see below)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

HareLane

2) getting ice from 0°C to water 0°C  => 0.334 J/gram  (this one is often forgotten)

334 not .334

I always remember the latent heat as 80 from the old days of calories, when the specific heat of water was 1, so in any units it must be 80x that of water.

So 4.2 x 80 ~ 330 not 0.33



robtillaart

OK thanks for spotting the error, I'll update the post and the code asap  (done)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Nick_Pyner

I would like to add a function to calculate the amount of ice to add to bring to a specific temperature.
What you say implies handling actual ice, therefore it may be simpler not to worry about the ice, but work on water flowing from it in the same manner as you are already doing, and using the method of mixtures.

A possibly better option is to have a heat exchanger using recirculated iced water with a temperature controlled circulation pump. No actual ice needed, just a water cooler.

Paul_KD7HB

Real bakeries would use crushed ice that melts immediately when added to the dough.

Paul

slipstick

If you're just dumping ice in do you need to allow for the fact that to end up with 30l of water you need to start with a bit less because the melted ice will add some volume?

Steve

robtillaart

If you're just dumping ice in do you need to allow for the fact that to end up with 30l of water you need to start with a bit less because the melted ice will add some volume?

Steve
Good observation :)
just poor same amount away AFTER temperature stabilization.

If you want to do end on 30L exactly the equation becomes more complex.
far easier is to do a binary search. you will get a sequence like

30L + calculated amount ICE = too much
15L + ca ICE = too little
22L + ca ICE = too little
26L + ca ICE = too little
28L + ca ICE = too much
27L + ca ICE = ...

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up