Group Abstract Group Abstract

Message Boards Message Boards

3
|
21.1K Views
|
10 Replies
|
20 Total Likes
View groups...
Share
Share this post:

Model the Coffee cooling problem with WSM?

Posted 9 years ago
Attachments:
POSTED BY: Gary Bass
10 Replies

Hi Everyone, I know that I am not actually answering the question, which is already answered, I believe. Here is something that I do in my lectures regarding that same problem. I don't use WSM, but just standard Mathematica and a rather simple approach based on Newton's law for cooling. Please see: Coffee & milk problem with Arduino and Newton's law of cooling

Attachments:
POSTED BY: Marco Thiel
Posted 9 years ago

Nicely done Marco.

POSTED BY: Gary Bass
Attachments:
POSTED BY: Patrik Ekenberg
Posted 9 years ago
POSTED BY: Gary Bass

Hi Gary,

I see two approaches you could take when adding the milk to the coffee. Either you could have everything collected into a single component that has a event in it corresponding to the addition of the milk, or you could have a separate component that specifies the addition of milk as a flow over time. I explored both those scenarios in the attached model. Would be very interesting to hear your input which one would be better from a teaching perspective.

Approach 1, with a discrete event in the coffee involves creating a copy of the HeatCapacitor component and adding some parameters that separates the heat capacity of the milk, the amount of milk added, when it is added, etc. As you say, the mixed Cp is unknown. A naïve initial approach could be to just add the two heat capacities together. If C is the total heat capacity of the coffee, with or without milk, you could add an equation that says:

  C = if time > AddTime then Ccoffee * Vcoffee * 1000 + Cmilk * Vmilk * 1000 else Ccoffee * Vcoffee * 1000;

The coefficients are just there to convert the different units.

The temperature is a bit more difficult, since it varies continuously over time it is state so and can't be as easily changed as the capacity (which changes values only at one discrete interval).

What you have to do with states is using the reinit(var,newValue) function to reinitialize variable var, to the new value newValue. If you mix fluids together, the new temperature is the new total enthalpy divided by the new heat capacity:

t = (m1 c1 t1 + m2 c2 t2 + ... + mn cn tn) / (m1 c1 + m2 c2 + ... + mn cn)

(from Engineering Toolbox)

In Modelica, we could reinitialize the temperature when the simulation time exceeds the time when the milk should be added, using the following:

  when time > AddTime then
    reinit(T, (Ccoffee * Vcoffee * 1000 * T + Cmilk * Vmilk * 1000 * MilkTemperature) / C);
  end when;

I replaced the coffee heat capacitor from experiment 1 in the previously attached models. You could however use the new coffee component in any of the other experiments. This results in a fairly compact model:

enter image description here

If milk is added after 300 seconds, it produces the following simulation:

enter image description here

Approach 2 is having a short flow of milk, instead of a instantaneous addition of milk. The benefit of this is you could create your own addition strategy. For example, you could add half of the milk at the beginning, and half after 300 seconds. Or any arbitrary strategy. For now, I focused on doing it as a 1 second pulse.

An input is added to the coffee, corresponding to the flow of milk:

enter image description here

The volume of the milk in the coffee is no longer a parameter but increases with the flow:

  der(Vmilk) = u;

And the capacity increaces with the milk volume:

  C = Ccoffee * Vcoffee * 1000 + Cmilk * Vmilk * 1000;

Adding milk will increase the enthalpy in the system, but the increased heat capacity will still cause a drop in temperature:

  T = H/C;
  der(H) = port.Q_flow + Cmilk * 1000 * u * MilkTemperature;

With H being the enthalpy.

The milk component is simply a pulse from Modelica.Blocks.Sources.Pulse that has some additional parameters.

enter image description here

Everything taken together, we now have an additional component in the coffee cooling model:

enter image description here

As it should, this approach gives a similar plot as the first one. The only difference is that the milk is added over a duration of 1 second. As the duration approaches zero, the two approaches would converge.

enter image description here

You could use this approach to fit parameters, using the methodology from the electric kettle example. I am a bit unsure if I would recommend trying fitting one of the higher order models that was suggested in the paper. With so many unknowns, you run the risk of significantly over-fitting you model. Though for a student lab, it could be a very good exercise to try and isolate each of the factors and explore them separately. I.e, cover the mug with an isolating material to avoid radiation and evaporation and take some data. Then put it in a open vacuum flask to study the evaporation without the conduction.

Attachments:
POSTED BY: Patrik Ekenberg
Posted 9 years ago
POSTED BY: Gary Bass

WSM can do this easily and is perfect for that type of system. I would start with one of the heat transfer examples and modify it. You can even add some of the thermal components if you want to model circulating air (i.e. someone turns on a fan!). Look at the thermal examples to see how to do that. The basic case is very much like the examples.

If you have problems you can post your example for some more help.

Regards

POSTED BY: Neil Singer

BTW why not Mathematica? See: The Coffee Cooling Problem. You can download the code freely there.

enter image description here

POSTED BY: Vitaliy Kaurov
Posted 9 years ago

Greetings Vitally i was aware of the Demonstration, however the differential equation and approximate exponential over estimates higher temperatures and underestimates lower temperatures. if you 'stand back' far enough observation data and the calculated data points are close, but a not very good fit.

an 'ideal' cooling curve does not represent real behaviour of a container. e.g.. radiation, convection, convection, insulation of milk fat layer http://demonstrations.wolfram.com/NewtonsLawOfCooling/

Better than a quadratic or quartic approximation however, not an accurate predictor of behaviour as the model does not take into account colour, container or surface interface (i.e. insulated with milk fat).

The demonstration is good as far as it goes.

I was after something like the kettle WSM example which calibrates the theory with real data to achieve a far better fit (~ 2%) http://www.wolfram.com/system-modeler/examples/consumer-products/electric-kettle-fluid-heat-transfer.html

regards Gary (39?C here today!)

POSTED BY: Gary Bass

This doesn't answer your question but I couldn't resist posting that a classmate of mine at Reed College, Andrew Case, wrote a B.A. dissertation modelling the behaviour of milk drops falling into a cup of coffee, and if I recall correctly, even did some of the work in Mathematica http://catalog.library.reed.edu/REED:local:CP71102917680001451

POSTED BY: Arno Bosse
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard