Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
1
Redesign and optimization of a small coffee roasting machine
Student
Juanpablo Jordan Leal
201511922
Advisor:
Andres Leonardo Gonzalez Mancera
Mechanical engineer M.sc, Ph.D.
Mechanical engineering department
BOGOTÁ, COLOMBIA
JULY 2020
2
Acknowledgments:
Cuando me puse a pensar a quienes deseaba expresar mis agradecimientos del trabajo de
grado me salió una lista interminable, por eso quisiera resumir expresando mi gratitud por
su ayuda, sugerencias y esfuerzos en la creación de este trabajo a:
Elvis Jordan, por sus consejos y sus esfuerzos incalculables.
Patricia Leal, por su constante ejemplo y por la gran maestra de vida que es.
Lauren Jordan, por no dejarme caer en momentos difíciles y darme la energía y felicidad
para alcanzar mis objetivos.
Eso si el trabajo de grado no habría podido llegar a ver la luz sin el apoyo constante de
Carmen Martínez.
Infinitas gracias a Andrés Leonardo Gonzalez Mancera que me enseñó y guió en cada una
de las etapas del trabajo.
Y a todas las personas que estuvieron dispuestas a ayudarme en cada uno de los detalles
de este trabajo. A todos, ¡muchas gracias!
3
Abstract: This project studies the principal phenomenon of heat and mass transfer during the coffee
roasting process. It is possible to characterize and collect the most important coffee roasting
data using computational tools. Furthermore, during the development of the project, a
mass and color estimation model is introduced and aims to explain the behavior and main
processes of coffee during roasting. Finally, to understand the temperature distribution of
a coffee bean during the coffee roasting process, a finite difference model was introduced.
4
Glossary:
Mucilage: a polysaccharide substance extracted as a viscous or gelatinous solution from
plant roots, seeds, etc., and used in medicines and adhesives.
Hulling: verb
1. remove the hulls from (fruit, seeds, or grain).
"a cup of hulled strawberries"
Endocarp: noun: endocarp; plural noun: endocarps
1. the innermost layer of the pericarp which surrounds a seed in a fruit. It may be
membranous (as in apples) or woody (as in the stone of a peach or cherry).
Husk: noun: husk; plural noun: husks
1. the dry outer covering of some fruits or seeds.
"the fibrous husk of the coconut"
Pyrolysis: noun: pyrolysis
1. decomposition brought about by high temperatures.
"steam pyrolysis of hydrocarbons"
5
Contents: 1) Introduction ............................................................................................................ 6
2) Objectives: .............................................................................................................. 8
2.1 General objective: ....................................................................................................... 8
2.2 Specific objectives: ...................................................................................................... 8
3) Previous work: ........................................................................................................ 6
4) Coffee process: ........................................................................................................ 8
4.1 Planting: ...................................................................................................................... 8
4.2 Harvesting the cherries: .............................................................................................. 8
4.3 Processing the cherries: ............................................................................................... 9
4.4 Drying the beans: ...................................................................................................... 10
4.5 Threshing the beans: ................................................................................................. 10
4.6 Roasting the coffee: .................................................................................................. 11
4.7 Packaging the coffee: ................................................................................................ 11
5) Heat and mass transfer: ........................................................................................ 13
5.1 Thermal diffusivity: ................................................................................................... 14
5.2 The Heat Equation: .................................................................................................... 15
6) Finite Difference Method: ...................................................................................... 16
6.1 Taylor series expansion: ............................................................................................ 17
6.2 Central difference approximations: ........................................................................... 17
6.3 Noncentral Finite Difference Approximations: ........................................................... 18
7) Python: ................................................................................................................. 18
7.1 Python distributions: ................................................................................................. 19
7.2 Libraries: ................................................................................................................... 19
8) Data acquisition: ................................................................................................... 20
8.1 Raspberry-pi 4: .......................................................................................................... 21
8.2 Raspberry-pi configuration: ....................................................................................... 21
8.3 Anaconda distribution: .............................................................................................. 21
8.4 Sensors: .................................................................................................................... 22
8.5 Assembly: ................................................................................................................. 22
8.6 Coding the sensors: ................................................................................................... 23
6
8.7 Saving the data: ........................................................................................................ 23
9) Data processing: ................................................................................................... 23
9.1 Python data uploading: ............................................................................................. 24
9.2 Python data treatment and visualization: .................................................................. 25
9.3 Python image analysis: .............................................................................................. 25
10) Heat transfer Finite difference method: ............................................................. 25
10.1 Geometry: ................................................................................................................. 25
10.2 Polar coordinates and simplifications: ....................................................................... 26
10.3 Finite difference discretization: ................................................................................. 26
11) Analysis and results: .......................................................................................... 26
11.1 Full coffee batch temperature behavior: ................................................................... 26
11.2 5kg coffee batch temperature behavior: ................................................................... 27
11.3 The coffee mass-color model: .................................................................................... 28 11.3.1 100g coffee batch temperature behavior: ........................................................................... 28
11.4 Finite difference simulation: ...................................................................................... 29
12) Validation: ........................................................................................................ 30
13) Conclusions: ...................................................................................................... 31
14) Bibliography: ..................................................................................................... 31
15) Appendix: .......................................................................................................... 34
1) Introduction
Colombia is known for its variety of natural resources; coffee is one of the most important
resources in the country. Ocampo (2017) indicates that 80 percent of Colombian coffee
production is destined for international consumption [1]. At the same time, coffee
represents 16 percent of the national agriculture. However, most of the good quality coffee
is exported as a raw material (green coffee). As a result, the commercial value of coffee
decreases. This is partly caused by the insufficient local knowledge about the roasting
process. To create a solution and make an impact on the Colombian economy, it is necessary
7
to set up an efficient coffee roasting process using engineering and automatization that
guarantees a product of high quality.
The roasting method in which the coffee bean is transformed through a heat transfer
process is the best way to improve the profits in the Colombian coffee production. During
this process, coffee goes through different physical and chemical changes that give special
flavors and specific aroma. There are different toasting levels and techniques for each
coffee tester, starting with low roasting for the aroma lovers and high roasting for strong
flavors [2].
When the roasting process started to be implemented in the production of coffee, the only
way to assess the level of toasting was by manually checking the color, aroma and flavor of
the bean. [3]. Nowadays, different technological advances enable better ways to measure
the development of bean roasting using different sensors and methods that quantify color,
luminosity, and temperature. There are different techniques and well-defined quality
standards that ensure that all coffee beans are properly toasted. For example, the Agtron
scale has a range from 0 to 100, on which 0 is the carbon coffee color and 100 is the green
bean. On the other hand, temperature scales help to explain how the coffee is losing its
water. Another way to use temperature scales is by analyzing the coffee color at specific
points of temperature and contrasting it with the Agtron scale.
Taking all of this into consideration, the purpose of this project is to create a model of heat
and mass transfer that can explain the behavior of a small coffee roasting machine which
can be modified and replicated in different areas of the country. In addition, all these
solutions have to be practical and efficient for coffee producers.
All the project was developed in Villa Helena’s farm at Ibague Tolima that is one of the 25
companies in Colombia which standardized most of the coffee production by investing in
research and machinery that helps to increment profits in the Colombian economy
8
2) Objectives:
2.1 General objective:
The general objective is to study and implement algorithms that improve coffee roasting
in a small quantity and consequently, guaranteeing coffee international standards
2.2 Specific objectives:
• To gather information in specific areas of the coffee process for the analysis of
coffee techniques based on the roasting method.
• To create a coffee heat transfer model that explains the temperature behavior in a
coffee roasting process.
• To explain how temperature impacts the coffee color and taste during the roasting
process.
• To explain how coffee loses weight during the process and how to avoid it.
9
3) Previous work:
According to the Advances In Food Process Engineering book (AFPE), coffee emits volatile
organic compounds (VOC) and carbon monoxide (CO) during the coffee roasting process. A
typical roasting machine uses 11.2 ∗ 10!"𝑘𝐽𝑓𝑢𝑒𝑙𝑒𝑛𝑒𝑟𝑔𝑦/𝑦𝑒𝑎𝑟 and causes an emission of
7 ∗ 10#(𝑘𝑔_𝐶𝑜)/𝑦𝑒𝑎𝑟. The coffee roasting process implicates the generation of some
gases like oxygen, combustion products, and CO2, H2O, VOCs, and CO [1].
AFPE demonstrates that coffee changes in its molecular structure while being roasted. Also,
moisture vaporizes internally and diffuses out of the bean in the thermal process and
increments the internal pressure generating the expansion of them. This reaction generated
water vapor that escapes from the beans, causing a loss of mass.
Bean temperature profiles depend on the initial reactant concentration, the variety, and
the source of the bean. An AFPE study indicates that these reactions also depend on how
the temperature varies with time.
Graph 1 temperature profile for a regular roast [2]
Graph 1 shows the temperature profile of a regular roast and the relation between roast
darkness and temperature. Additionally, it specifies the Agtron scale and the roasting loss
in the specific points. This information will be useful to contrast with the experimental data
in a small roasting machine.
10
4) Coffee process:
4.1 Planting:
Since a coffee bean is a seed, it could be planted and grown into a coffee tree instead of
being processed.
illustration 1. Coffee tree at Villa Helena farm
Illustration 1 shows the first coffee fruit after four years of being watered frequently. The
fruit is known as cherry. When the cherry gets a shining deep-red color, it is ripe and ready
to be harvest, in Villa Helena farm most of the farmers are alert of the flowering of the
coffee, because most of time the major harvest occurs once a year. In Colombia, there are
two flowerings annually. This phenomenon increments coffee production and opens the
doors for constant exportation of a high-quality product.
11
4.2 Harvesting the cherries:
Cherries are stripped off the trees, either by a machine or by hand. It is important to know
that, when cherries are picked up by hand, a good picker could handle approximately 100
to 200 pounds of cherries per day [3]
illustration 2. cherries ready to be stripped at Villa Helena farm
Only 20 to 40 percent of cherries’ weight is transformed into green coffee beans. Villa
Helena workers are paid only for the merit of their work. Usually, the payment for a kilo of
cherries is about 500 COP.
4.3 Processing the cherries:
To avoid the spoilage of the coffee, cherries must be processed in the shortest amount of
time. There are two ways to process the coffee: the dry method and the wet method.
The dry method is an old method and is still used in many countries. This consist in spreading
out the seeds in a clear area to dry under the sun and to avoid the spoiling of cherries,
farmers usually rake and turn them during the day.
In the wet method, cherries are separated by weight using a water container. Usually,
cherries that are on the top are the ones that have problems with the coffee borer beetle.
In comparison this separation method helps to improve the coffee quality and ensure, in
the end, a better cup of coffee.
12
illustration 3. The Wet Method (cherries selection) at Villa Helena farm
In the same way, the fresh cherries pass through a screw pump that is a positive-
displacement pump that uses several screws to move solids within a tube. Afterward,
cherries go through a pulping machine to separate the skin and pulp from the bean.
illustration 4. Pulping machine at Villa Helena farm
As a result, cherries are transformed into beans. Then, the beans are separated by weight
as the cherries from the beginning of the selection process. Next, beans are passed through
a size selection machine which separates the beans by size. Finally, beans are transported
to a large water-filled container to be fermented.
13
illustration 5. water-filled container at Villa Helena farm
Fermentation is the process where the top layer of mucilage is removed. Water works as a
natural mucilage dissolver. When fermentation is completed, beans are ready for drying.
4.4 Drying the beans:
Because the beans are processed by the wet method, fermented beans are dried to 11
percent moisture to prepare them for storage.
14
illustration 6. Dryer machine at Villa Helena farm
4.5 Threshing the beans:
Villa Helena farm uses a hulling machine that removes the endocarp of the dry coffee beans.
This method removes the coffee husk and all strange materials that change the flavor and
aroma at the end of the coffee process.
illustration 7. Hulling and grading machines at Villa Helena farm
Moreover, the grading machine helps to sort out the coffee by different size and weight in
order to categorize it from the best to the worst. Hence, these machines play an important
role in the development of high-quality coffee.
Table 1. coffee size classification taken from
https://www.coffeelabequipment.com/coffeeparticlesize.html
15
Usually, coffee sizes are represented on a scale from 8” to 20”. This number represents the
diameter of the holes of the grading machine. In Colombia, the coffee is excelso when its
size is between 15” to 17” and supremo when it is 17” or higher. Finally, imperfect coffee
beans are removed ensuring that only the best coffee is going to be roasted.
4.6 Roasting the coffee:
After threshing the beans and selecting the best ones, coffee is known as green coffee.
Green coffee does not smell or taste like regular coffee and is known as the ‘raw’ stage of
the roasting process.
illustration 8. Green coffee at Villa Helena farm
Green coffee is introduced into the roasting machine. Here, the coffee is transformed into
the classical aromatic beans. Most of the roasting machines work at temperatures that go
from 150º Celsius to 220º Celsius.
16
illustration 9. Coffee roasting machine at Villa Helena farm
When coffee reaches an internal temperature of about 180º Celsius, it starts to spread the
aroma and to turn brown. This process is called Pyrolysis and it is the heart of the coffee
production [4].
4.7 Packaging the coffee:
While the coffee is cooling down, the packaging machine starts to warm up. This final stage
is very important because the roasted coffee needs to be sealed properly. If the coffee
package has a hole or something that lets the air in, the coffee probably gets spoiled.
illustration 10. Packaging machine at Villa Helena farm
17
In summary, all the steps in the coffee production line are important. However, to make a
high-quality coffee, it is essential to focus on the roasting process. Especially, because in
this step, coffee acquires its particular aroma and color that the consumers desire.
5) Heat and mass transfer:
5.1 Thermal diffusivity:
In the heat transfer analysis, the product 𝜌𝑐$ is frequently encountered and represents the
heat capacity of a material. 𝜌𝑐$ expresses the heat storage per unit volume and its units are %&!𝐾.
Graph 2. Variation of thermal conductivity [8].
In the analysis of transient heat conduction, the thermal diffusivity represents how fast heat
is diffused through a material and it is defined as:
18
𝛼 =𝑘𝜌𝑐$
Where 𝑐$ is the specific heat, 𝜌 the density and 𝑘 is the thermal conductivity that represents
how well a material conducts heat. As a result, the thermal diffusivity can be viewed as the
ratio of the heat conducted of a material to the heat stored per unit volume [5].
5.2 The Heat Equation:
In mathematics, a partial differential equation (PDE) is a differential equation with more
than one variable with its partial derivates. PDEs are used to solve problems in which
functions with several variables are involved. Either it can be solved by hand, or by using a
computational model.
A good example of a PDE is the heat equation that describes how the distribution of heat
evolves over time in a solid. This equation was developed and solved by Joseph Fourier in
1822. The heat equation is used in different fields such as in probability, financial
mathematics, and even in quantum physics. Also, the heat equation shapes the behavior of
the temperature inside of a coffee bean.
Heat diffusion equation:
(1) 𝜕"𝑇𝑑𝑥" +
𝜕"𝑇𝑑𝑦" +
𝜕"𝑇𝑑𝑧" =
𝜌𝑐$𝑘𝜕𝑇𝜕𝑡
6) Finite Difference Method:
19
6.1 Taylor series expansion:
Based on the forward and backward Taylor series expansion of a function 𝑓(𝑥) about x, the
approximation for the derivates of 𝑓(𝑥) of the finite difference are:
(2) 𝑓(𝑥 + ℎ) = 𝑓(𝑥) + ℎ𝑓'(𝑥) +
ℎ"
2! 𝑓''(𝑥) +
ℎ(
3! 𝑓'''(𝑥) +
ℎ)
4! 𝑓())(𝑥) + ⋯
(3) 𝑓(𝑥 − ℎ) = 𝑓(𝑥) − ℎ𝑓'(𝑥) +
ℎ"
2! 𝑓''(𝑥) −
ℎ(
3! 𝑓'''(𝑥) +
ℎ)
4! 𝑓())(𝑥) − ⋯
Sum and difference of the series:
(4) 𝑓(𝑥 + ℎ) + 𝑓(𝑥 − ℎ) = 2𝑓(𝑥) + ℎ"𝑓''(𝑥) +
ℎ)
12 𝑓())(𝑥) + ⋯
(5) 𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ) = 2ℎ𝑓'(𝑥) +
ℎ(
3 𝑓'''(𝑥) + ⋯
6.2 Central difference approximations:
Equation (5) can be solved for 𝑓 ’(𝑥) and its solution is:
(6) 𝑓'(𝑥) =
𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)2ℎ −
ℎ"
6 𝑓'''(𝑥) − ⋯
The term − -"
.𝑓'''(𝑥) − ⋯ is the truncation error that behaves as ℎ" and is expressed as
𝒪(ℎ"). As a result, equation (6) is expressed as follows:
20
(7) 𝑓'(𝑥) =
𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)2ℎ + 𝒪(ℎ")
This equation is known as the first central difference approximation for 𝑓 ’(𝑥). Similarly,
equation (4) can be solved for 𝑓''(𝑥) and its solution is:
(8) 𝑓''(𝑥) =
𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)ℎ" + 𝒪(ℎ")
6.3 Noncentral Finite Difference Approximations:
Sometimes, central difference approximations are not usable. For example, considering a
function that describes the temperature along a steel bar at n discrete points
𝑥/, 𝑥!, 𝑥", 𝑥(, … , 𝑥0. Because central finite difference uses values of each side of 𝑥, it is
impossible to evaluate the function at the end and in the start. Hence, the noncentral
difference is obtained solving the equations number (2) and (3)[6]
First forward difference approximation:
(9) 𝑓'(𝑥) =
𝑓(𝑥 + ℎ) − 𝑓(𝑥)ℎ + 𝒪(ℎ)
First backward difference approximation:
(10) 𝑓'(𝑥) =
𝑓(𝑥) − 𝑓(𝑥 − ℎ)ℎ + 𝒪(ℎ)
21
7) Python:
Python is an interpreted, high level, programming language and is designed to be easy to
read and simple to implement in different areas, such as mechanical engineering and
physics. Furthermore, python could be used for scientific computing (data science, machine
learning apps, predictive analytics, etc.)[7]
7.1 Python distributions:
There are many python distributions for different purposes; one of them is the Anaconda
distribution. Anaconda is a free open source distribution for python and it includes data-
science packages and libraries that help to solve diverse engineering problems[8]
7.2 Libraries:
The following Python libraries were used and will be explained below: Numpy, Matplotlib,
Pandas, Scipy, Scikit, Spidev
Numpy is an open source project which facilitates numerical computing on python.
Moreover, numpy helps to vectorize, index and broadcast arrays in a simple way and uses
easy mathematical expressions for data science [9].
Matplotlib is a comprehensive way for creating animated and interactive visualizations in
Python [10].
Pandas is a powerful and fast data analysis library based on the Python programming
language [11].
22
Scipy is a library that provides user-friendly and efficient numerical routines, such as
numerical integration, interpolation, optimization, linear algebra and statistics[12].
Scikit-learn is a collection of algorithms for image processing. Also, it is a simple and
effective tool for data analysis. This library is based on Numpy, Scipy, and matplotlib.
Spidev is a library that contains a python module for interfacing SPI devices.
8) Data acquisition:
8.1 Raspberry-pi 4:
It is important to create a cheap solution for the coffee industry since is very important to
have an accessible technology for all the farmers. For this reason, most of the sensors and
data processing was focus on open sources which helps to reduce costs
Raspberry-pi is a small computer that plugs into a computer monitor or tv and it uses a
standard keyboard and mouse. This computer allows people to code in different
programming languages such as Python. Also, Raspberry-pi has the ability to interact with
the outside world and is commonly used in digital projects.
illustration 11. Raspberry pi 4
23
8.2 Raspberry-pi configuration:
Before using the Raspberry-pi, an operating system was installed that works with Python.
Then, the Raspbian Os was chosen as the first alternative because it is easy to configure and
it counted with the last Python distribution.
8.3 Anaconda distribution:
To improve the data analysis and optimize acquisition processes, the Anaconda distribution
was selected to be installed in the Raspberry-pi.
8.4 Sensors:
Thermocouples: are electrical devices that are used to measure temperature. A
thermocouple produces a voltage as a result of the thermoelectric effect.
illustration 12. Thermocouple type K
There are many types of thermocouples, but for this project, it was necessary to select a
thermocouple type K because it is inexpensive, accurate, reliable, and has a temperature
range from -200º Celsius to +1350º Celsius.
24
MAX6675: this sensor performs cold-junction compensation and digitalizes the signal from
a type-K thermocouple[13]
illustration 13. MAX 6675 Sensor
8.5 Assembly:
When using the Raspberry-pi GPIO connectors and the MAX6675 sensor, the following
assembly is obtained:
illustration 14. Assembly
25
8.6 Coding the sensors:
illustration 15. Visual studio code window image
After all sensors are correctly assembled, it is necessary to code the MAX6675. First, it is
required to call all the libraries to speed up the procedure. Then, all Raspberry-pi GPIO ports
must be configured to enable them. Finally, the sensor signals are read and transformed
into temperature and humidity values. All the code is available in the appendix.
8.7 Saving the data:
All temperatures and humidity values are saved in a .npy archive that is useful for a future
data analysis.
In summary Raspberry-pi was used to connect and interpret the temperature information
from thermocouple and the sensor.
9) Data processing:
9.1 Python data uploading:
26
First, to read and extract the data from the temperature files taken from the thermocouple,
it is necessary to work with the NumPy library. Second, the tests were divided and organized
in its specific interval of time.
9.2 Python data treatment and visualization:
All tests were organized in a single array to facilitate the data organization. Following, using
the gaussian_filter1d algorithm of SciPy library, the signal noise of all temperatures is
eliminated to make it easier to study the behavior of the thermal phenomenon. Finally, all
data is reported and visualized with matplotlib library. The whole code is available in
annexes.
9.3 Python image analysis:
Scikit-image is an image processing library from Scikit. For this project it is necessary to use
a collection of algorithms that provides a utility for converting image colors to data that can
be studied and interpreted. The whole code is available in annexes.
10) Heat transfer Finite difference method:
10.1 Geometry:
The geometry of a coffee is similar to a semi-ellipsoid. As a consequence, to make the study
of the heat transfer inside of a coffee bean easier, this geometry is simplified into a
semicircular geometry.
27
illustration 16. Finite difference geometry simplification
10.2 Polar coordinates and simplifications:
To understand and simulate the behavior of coffee roasting, it is important to study the
three-dimensional base form of the diffusion equation:
𝜕"𝑇𝑑𝑥" +
𝜕"𝑇𝑑𝑦" +
𝜕"𝑇𝑑𝑧" =
𝜌𝑐$𝑘𝜕𝑇𝜕𝑡
According to the engineers Jorge Gallo Navarro and Fernando Jose Zorto Aguilera, the
transitory Heat equation in cylindrical coordinates is [14]:
(11) 𝜕𝑟𝜕𝑟 O𝑟
𝜕𝑇𝜕𝑟P +
1𝑟"
𝜕𝜕𝜃 O
𝜕𝑇𝜕𝜃P +
𝜕𝜕𝑧 O
𝜕𝑇𝜕𝑧P =
𝜌𝐶$𝑘𝜕𝑇𝜕𝑡
Using the chain rule and organizing all terms, the diffusion equation is the following:
R𝜕"𝑇𝜕𝑟" +
1𝑟𝜕𝑇𝜕𝑟 +
1𝑟"𝜕"𝑇𝜕𝜃" +
𝜕"𝑇𝜕𝑧"S𝛼 =
𝜕𝑇𝜕𝑡
1 2 3
iii.
28
Where 𝛼 is the thermal diffusivity. However, to simplify the finite difference model, the 𝑧 −
𝑡𝑒𝑟𝑚𝑠 are removed because only one slice of a coffee bean is being studied.
(12) R𝜕"𝑇𝜕𝑟" +
1𝑟𝜕𝑇𝜕𝑟 +
1𝑟"𝜕"𝑇𝜕𝜃"S𝛼 =
𝜕𝑇𝜕𝑡
10.3 Finite difference discretization:
Based on the central finite difference discretization method, the 𝑟 − 𝑡𝑒𝑟𝑚𝑠, and 𝜃 − 𝑡𝑒𝑟𝑚𝑠
are modified and discretized. Hence, the part that depends on the time is discretized with
a forward finite difference method to ensure that the result of temperature is going to be
the next step of time. Finally, the equation (12) is discretized as the following:
(13) R𝑇12!,4 − 2𝑇1,4 + 𝑇15!,4
∆𝑟" +𝑇15!,4 − 𝑇12!,4
𝑟1"2∆𝑟+𝑇1,42! − 2𝑇1,4 + 𝑇(1,45!)
𝑟1"∆𝜃S𝛼 =
𝑇1,405! − 𝑇1,4∆𝑡
Solving the equation number (13) for 𝑇1,405!:
(14) 𝑇1,405! = R
𝑇12!,4 − 2𝑇1,4 + 𝑇15!,4∆𝑟" +
𝑇15!,4 − 𝑇12!,4𝑟1"2∆𝑟
+𝑇1,42! − 2𝑇1,4 + 𝑇(1,45!)
𝑟1"∆𝜃S𝛼∆𝑡 + 𝑇1,4
Equation number (14) is introduced and solved in Python with computational methods. All
the codes will be available in appendix.
11) Analysis and results:
29
To understand the behavior of coffee roasting, it was necessary to make a test with a fully
charged coffee roasting machine, according to the machinery of Villa Helena farm the
maximum capacity of this toaster is 7.5 kg of green coffee. Using the Raspberry-pi assembly
the coffee roasting curve was the following:
11.1 Full coffee batch temperature behavior:
Graph 3. Fully charged coffee roasting machine (7.5kg)
The initial conditions of temperature for every test are approximately 170ºC. However, for
this fully charged test, the temperature was 200ºC. It is clear that the temperature
decreases in the first 2 minutes because of the conductive heat transfer between the cold
coffee and the steel parts of the machine. After 4 minutes, the curve indicates a sudden
increase, at this point the coffee moisture changed significantly and it is important to check
the coffee condition.
When the temperature was about 185ºC the first crack occurred. At this point, coffee
gained volume substantially and all the gases inside of it are released. According to AFPE,
the first crack liberated CO2, H2O, and VOCs. There is a strong possibility that the first crack
started to modify the coffee flavor and aroma with the interaction of the gases. On the
other hand, around 210ºC the coffee suffered the second crack. At this point, all the water
30
inside the coffee was evaporated and it turns into carbon-coffee. As a result, it is no longer
fit for consumption.
According to Villa Helena costumers, the coffee that they like the most is the one roasted
at 207ºC. There is a thin line demarking a good coffee from a bad carbon-coffee, so it is so
hard to control it’s quality by hand.
Finally, according to graph 3, coffee changes its color every minute because of the heat
transfer throughout the bean. A camera was used to record how coffee changes its color
every second. This was necessary to classify the color throughout the process.
11.2 5kg coffee batch temperature behavior:
Graph 4. 5kg coffee roasting process (no gaussian filter)
Graph 4 provides information about the coffee roasting process with a batch of 5kg. Also,
Graph 4 explains temperature changes as function of the time. These tests were made to
compare the effect of mass during the roasting process. Based on the result of Graph 4, the
mass affects the heat process because the amount of energy needed to roast the 5kg coffee
batch is lower than the energy used to roast the full batch in graph 3.
31
As a result, delta temperature from 𝑇/ to the lowest temperature (𝑇6) of Graph 4 is different
from the delta of Graph 3. In fact, there is a direct relation between the mass and the
temperature behavior. Also, the time of the roasting process depends on the amount of
coffee in the batch.
Graph 5. 5kg coffee roasting process (gaussian filter)
To better understand the data of the 5kg coffee batch, all the data was filtered with a
Gaussian filter. Despite all the tests being made in standard conditions, there is discrepancy
in the temperature curves. There is a good possibility that every time the roaster was
opened a convective effect occurred between the machine and the ambient which
generates a loss of energy and a reduction of the machine's efficiency. This convective
phenomenon could explain the discrepancy in the temperatures. Also, the lack of correct
maintenance of the roaster machine generates big leaks where the energy could escape
and this increases the expenses of the company.
11.3 The coffee mass-color model:
11.3.1 100g coffee batch temperature behavior:
32
Graph 6. Coffee roasting process at different temperatures
Graph 6 provides temperature curves for different final conditions; these tests were made
to compare how time and temperature have a relation with the mass loss and the color of
the coffee during the process.
Graph 7. behavior in the loss of coffee mass
According to the results in Graph 6 and the final mass provided in all the tests, Graph 7 was
constructed and it provides information about the coffee roasting process with a batch of
100g. Similarly, Graph 6 shows the coffee mass lost percentage in function of the
temperature. All the data reveals that the most important variable to estimate the loss of
mass in the coffee roasting process is the temperature. It is clear that the data fits correctly
in a linear regression and there is a good possibility to implement this model in the coffee
industry.
33
One of the most important variables in the coffee industry is the weight, the majority of
products made with coffee are sold by weight. As a result, the linear regression could
improve the profits in the coffee industry by estimating the lowest waste of coffee during
the process.
170ºC 175ºC 180ºC 185ºC 190ºC 195ºC 200ºC 205ºC 210ºC 215ºC
illustration 17. Coffee color scale
illustration 17 displays diverse colors of coffee at different roasting temperatures. The
coffee gets darker while the temperature increases. Furthermore, illustration 17 shows that
the biggest color change occurs between 205ºC and 210ºC, at this point moisture decreased
dramatically and coffee starts to accumulate a lot of energy that burns the bean.
Graph 8. Mass- color model
34
Graph 8 is the result of Using computational algorithms and different python libraries. The
given information summarizes most of the coffee process behavior. Graph 8 indicates how
coffee is losing its mass. At the same time, it also provides the coffee color for a specific
temperature point.
According to Graph 6, Graph 7, Graph 8 and illustration 17, it is clear that the loss of coffee
mass is directly proportional to the temperature. Also, there is a good possibility that the
coffee color does not depend on the roasting time. However, the aroma and the flavor of
the coffee directly depend on the time of roasting. All these qualitative variables make the
analysis harder and directly affect the improvement of the coffee industry.
11.4 Finite difference simulation:
The initial conditions of the coffee roasting simulation are the following:
(15) 𝑇(𝑟, 𝜃, 𝑡 = 0) = 25º𝐶
(16) 𝑇(𝑟 = 4.5, 𝜃, 𝑡 = 0) = 200º
(17) 𝑇(0 < 𝑟 < 4.5, 𝜃 = 0, 𝑡 = 0) = 200º𝐶
(18) 𝑇(0 < 𝑟 < 4.5, 𝜃 = 𝜋, 𝑡 = 0) = 200º𝐶
The initial condition inside of the coffee was assumed to be uniform. Also, the temperature
inside of the coffee roasting machine is constant over time.
35
Graph 9. Polar coordinates Heat and mass transfer finite difference simulation
Graph 9 illustrates the 3D temperature distribution profile in a coffee bean. Graph 9 is
presented in polar coordinates, so the temperature analysis is complex, and a contour
graph is required to simplify its geometry.
.
Graph 10. Polar coordinates Heat and mass transfer finite difference simulation (contour)
Graph 10 illustrates the contour of the simulation of the diffusion heat equation.
Nevertheless, the data is represented in polar coordinates and shows how the temperature
is distributed along the radio and theta. The thermal phenomenon is explained in cartesian
coordinates in graph 11.
36
Graph 11. Cartesian coordinates Heat and mass transfer finite difference simulation (contour)
Because of the complexity of polar coordinates, the solution of the heat equation was
transformed into cartesian coordinates. This change of coordinates gives a better
approximation to the coffee geometry. As a result, Graph 11 provides the distribution of
the temperature inside of a coffee bean at the end of the roasting process. The coffee
temperature distribution reveals that the highest temperature is located at the coffee crust
and has a value of 200ºC. On the other hand, the lowest temperature is located inside of
the coffee bean and has a value of 168ºC.
Graph 12. Cartesian coordinates Heat and mass transfer finite difference simulation
Additionally, Graph 12 contains information about the temperatures inside of a coffee bean,
this Transient-state simulation was used to obtain different temperature profiles that help
control the time of the roasting process.
37
Graph 13. Internal and external temperature node of the simulation
Graph 13 summarizes all the temperatures throughout the roasting process at different
points. The first node that was located in the inside of the coffee shows a gradual rise of the
temperature profile. On the other hand, the second node or the external node presents the
temperature profile outside of the coffee bean and has a significant change during the
simulation. The simulation data demonstrates that thermal diffusivity plays an important
role in the temperature distribution. It is very likely that the second node has a direct
relation with the lack of moisture at the end of the process. This could control future
processes.
Because of the simplification of the coffee geometry and the two changes of coordinates, it
is recommended to implement a finite element simulation in Ansys before starting the
roasting process. Since Ansys has a geometry modeler and a better equation solver, it is
probably one of the best ways to solve this problem.
12) Validation:
The Finite difference method analysis, at different temperature within the range of the
Geisha coffee, is presented below:
38
Graph 14. Temperature distribution at 200ºC and 190ºC
According to Graph 14, the distribution of temperature changes considerably with different
Dirichlet conditions. The most representative temperatures are the following:
Dirichlet condition Min Temperature Max Temperature Average Temperature of the whole distribution
190ºC 60ºC 200 178.688ºC 200ºC 156ºC 204ºC 182.047ºC
Table 2. representative condition of geisha simulation.
Equally important, the behavior of the temperature inside of the bean and the temperature
at the surface of the bean were studied for two different Dirichlet conditions:
Graph 15. center and surface temperature variation with time at 200ºC and 190ºC
39
Using the average temperature of the two simulations and the Graph 8 to calculate the
biggest loss of mass of the bean, the following results were obtained:
Graph 16.Geisha mass-color model results
According to the simulation temperatures and the mass-color model, the most probable
color of the coffee and the loss of mass are the following:
Condition Lost mass percentage Color Max temperature Dirichlet condition 190ºC
23%
Max temperature Dirichlet condition 200ºC
24.5%
Average temperature Dirichlet condition 190ºC
15.8%
Average temperature Dirichlet condition 200ºC
17.5%
Table 3. lost and color of Geisha coffee
40
As expected, the most relevant temperature for the prediction of the coffee color is the
maximum temperature, which provides the most accurate color of a Geisha coffee for these
specific conditions. On the other hand, the average temperature gives a good
approximation of the Geisha mass at the end of the roasting process. In summary, the
correct use of the mass-color model and simulations could predict the final coffee product
before it is toasted.
By applying the results shown in Graph 8 to the Villa Helena production, the increase in the
roasted coffee proportion is shown below:
Villa Helena coffee production in the last month:
Type of coffee
Green coffee (kg)
Temperature range(ºC)
Currently used T_f
Mass-color model
suggested T_f
Mass lost percentage
before Mass-color model
(%)
Mass lost percentage after Mass-color model
(%)
Improvement
(ºC) (ºC)
Caturra 1500 200-210 210 200 27% 23% 4% Tabi 50 195-205 206 197 25% 22% 3%
Geisha 35 185-200 195 190 21% 20% 1%
Table 4. Coffee production June 2020
Villa Helena coffee cost:
Type of coffee
Cost per kilogram (COP/kg)
Total cost before Mass-Color model
Total cost after Mass-Color model
Profits using Mass-
Color model
Caturra 6000 $2.430.000 $2.070.000 $ 360.000 Tabi 32000 $ 400.000 $ 352.000 $ 48.000
Geisha 48000 $ 352.800 $ 336.000 $ 16.800 Total $ 424.800
Table 5.coffee cost June 2020
41
In summary, the company’s profits increased by 15.4%. This result shows that the model
presented in Graph 8 could play an important role in optimizing the roasting process and
might be expandable to the whole Colombian coffee industry.
13) Conclusions:
Based on the data from the Villa Helena farm. It is clear that the coffee roasting processes
could be improved by implementing the mass and color model. By making a correct
management of temperature curves and the color scale, it was found that the company’s
profit could be improved up to 15.4%.
The finite difference method for the coffee roasting process explains accurately the heat
and mass transfer phenomenon. Moreover, the simulation clarifies how the temperature is
evolving at the exterior of the coffee bean and inside of it. Finally, the finite difference
method along with mass-color model, can predict the final color before proceeding with the
real toasting.
According to Graph 7 which summarizes all the coffee color behavior, it is clear that the
increase in temperature has a direct effect on the coffee bean color. Also, the coffee color
only depends on the temperature in small time intervals.
The most interesting finding during the project was the mass-color model which simplifies
how coffee is roasted. This model eliminates the time variable and only emphasizes the
temperature, mass, and color. In conclusion, the developed model has a great potential to
be implemented in the industry due to its optimization in the roasting process.
42
Future work:
• Automatize coffee roasting machine with the data provided in this project.
• Create a 3D simulation of the coffee bean during the roasting process.
• Study the coffee color selection process to automatize the roasting method.
• Implement a quenching method that increments coffee mass during the coffee
roasting process.
14) Bibliography:
[1] Clarke RJ (1979) Roasting and grinding. In: Clarke RJ, Macrae R (eds) Coffee, vol 2, Technology.
[2] BLOG // Sampo Latvakangas// Helsinki // 30.5.2017, //, B., Sampo Latvakangas// Helsinki, & Sampo Latvakangas
Coffee Roasting Quality Specialist Helsinki [email protected] paulig.fi I love developing flavor and
exploring new tastes. One of the most impo. (n.d.). Coffee Roasting Basics: Developing Flavour by Roasting.
Retrieved July 29, 2020, from https://www.baristainstitute.com/blog/sampo-latvakangas/may-2017/coffee-
roasting-basics-developing-flavour-roasting
[3] Rough Pictorial Guide to the Roast Process. (n.d.). Retrieved July 29, 2020, from
https://legacy.sweetmarias.com/library/a-rough-pictorial-guide-to-the-roast-process
[4] YANNIOTIS, S. (2016). Advances in food process engineering research and applications. Place of publication not
identified: SPRINGER-VERLAG NEW YORK.
[5] YANNIOTIS, S. (2016). Advances in food process engineering research and applications. Place of publication not
identified: SPRINGER-VERLAG NEW YORK.
[6] National Coffee Association. (n.d.). Retrieved July 29, 2020, from https://www.ncausa.org/About-Coffee/10-Steps-
from-Seed-to-Cup
[7] National Coffee Association. (n.d.). Retrieved July 29, 2020, from https://www.ncausa.org/About-Coffee/10-Steps-
from-Seed-to-Cup
[8] Cengel, Y. A. (2007). Heat transfer: A practica approach. Boston: McGraw-Hill.
[9] Chapra, S. C., & Canale, R. P. (2015). Numerical methods for engineers. New York, NY: McGraw-Hill Education.
43
[10] Anaconda (Python distribution). (2020, July 12). Retrieved July 29, 2020, from
https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)
[11] The World's Most Popular Data Science Platform. (n.d.). Retrieved July 29, 2020, from https://www.anaconda.com/
[12] ECOSYSTEM. (n.d.). Retrieved July 29, 2020, from https://numpy.org/
[13] Visualization with Python¶. (n.d.). Retrieved July 29, 2020, from https://matplotlib.org/
[14] Pandas. (n.d.). Retrieved July 29, 2020, from https://pandas.pydata.org/
[15] SciPy library¶. (n.d.). Retrieved July 29, 2020, from https://www.scipy.org/scipylib/index.html
[16] False. (n.d.). Maxim Integrated - Analog, Linear, and Mixed-Signal Devices. Retrieved July 29, 2020, from
https://datasheets.maximintegrated.com/
[17]
Https://www.researchgate.net/profile/Fernando_Zorto2/publication/281998756_Metodo_de_Separacion_de_V
ariables_Solucion_de_la_Ecuacion_General_de_Calor_por_Conduccion/links/5600d7b908aec948c4fa9413/Meto
do-de-Separacion-de-Variables-Solucion-de-la-Ecuacion-General-de-Calor-por-Conduccion.pdf [Pdf]. (n.d.).
44
15) Appendix:
Full coffee batch code: import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import interpolate archivo = pd.read_excel('analisis_curva_temperatura.xlsx',skiprows=1) archivo = np.array(archivo) tiempo = np.zeros(len(archivo)) temperatura = np.zeros(len(archivo)) for i in range(len(archivo)): tiempo[i] = archivo[i][0] temperatura[i] = archivo[i][1] fun= interpolate.interp1d(tiempo,temperatura,kind='cubic') tiempo_new=np.linspace(tiempo[0],tiempo[-1],100) temperatura_new= fun(tiempo_new) #grafico y_ticks= np.arange(140,250,10) #plt.figure(figsize=(43.2,28.8)) plt.plot(tiempo_new/60,temperatura_new) plt.plot(12,fun(12*60),'o',label='Primer_Crack') plt.plot(16,fun(16*60),'o',label='Segundo_Crack') plt.title('Curva_de_tostion_220ºC') plt.xlabel('tiempo ($min$)') plt.xticks([i for i in range (21)]) plt.ylabel('temperatura (ºC)') plt.yticks(y_ticks) plt.legend() plt.grid() plt.savefig('Curva_de_tostion_220ºC.png') #analisis imagenes import skimage import os from skimage import io from skimage.segmentation import slic filename = os.path.join(skimage.data_dir, '170.jpg') cafe_1 = io.imread(filename) filename = os.path.join(skimage.data_dir, '175.jpg') cafe_2 = io.imread(filename) filename = os.path.join(skimage.data_dir, '180.jpg') cafe_3 = io.imread(filename) filename = os.path.join(skimage.data_dir, '185.jpg') cafe_4 = io.imread(filename) filename = os.path.join(skimage.data_dir, '190.jpg') cafe_5 = io.imread(filename) filename = os.path.join(skimage.data_dir, '195.jpg') cafe_6 = io.imread(filename) filename = os.path.join(skimage.data_dir, '200.jpg') cafe_7 = io.imread(filename) filename = os.path.join(skimage.data_dir, '205.jpg') cafe_8 = io.imread(filename)
45
filename = os.path.join(skimage.data_dir, '210.jpg') cafe_9 = io.imread(filename) filename = os.path.join(skimage.data_dir, '215.jpg') cafe_10 = io.imread(filename) cafe_total=np.array([cafe_1,cafe_2,cafe_3,cafe_4,cafe_5,cafe_6,cafe_7,cafe_8,cafe_9,cafe_10]) for cafe in cafe_total: color=np.average(np.average(cafe,axis=0),axis=0) print(color) print(len(mean_18))
5kg coffee batch code: import numpy as np import matplotlib.pylab as plt import pandas as pd from scipy import interpolate from scipy.ndimage import gaussian_filter1d #datos #prueba_0 temperatura_prueba_19m_0=np.load('temperatura_prueba_19m.npy') temperatura_prueba_19m_0=temperatura_prueba_19m_0[60:1930] #delta=np.abs(temperatura_prueba_19m_0[0]-180) #temperatura_prueba_19m_0=temperatura_prueba_19m_0-delta #prueba_1 temperatura_prueba_19m_1=np.load('temperatura_prueba_19m_2.npy') temperatura_prueba_19m_1=temperatura_prueba_19m_1[80:1705] #delta=np.abs(temperatura_prueba_19m_1[0]-180) #temperatura_prueba_19m_1=temperatura_prueba_19m_1-delta #prueba_2 temperatura_prueba_19m_2=np.load('temperatura_prueba_19m_3.npy') temperatura_prueba_19m_2=temperatura_prueba_19m_2[50:1840] #delta=np.abs(temperatura_prueba_19m_2[0]-180) #temperatura_prueba_19m_2=temperatura_prueba_19m_2-delta #prueba_3 temperatura_prueba_19m_3=np.load('temperatura_prueba_19m_4.npy') temperatura_prueba_19m_3=temperatura_prueba_19m_3[50:1930] #delta=np.abs(temperatura_prueba_19m_3[0]-180) #temperatura_prueba_19m_3=temperatura_prueba_19m_3-delta #array temperaturas pruebas=np.array([temperatura_prueba_19m_0,temperatura_prueba_19m_1,temperatura_prueba_19m_2,temperatura_prueba_19m_3]) #calculos #sin filtro for i in range (len(pruebas)-1): i=i+1 tiempo=np.linspace(0,len(pruebas[i]),len(pruebas[i]))*0.2 #sec tiempo=tiempo/60 #min plt.plot(tiempo,pruebas[i],label='prueba_'+str(i)+',T0='+str(np.round(pruebas[i][0],2))+',Tf='+str(np.round(np.max(pruebas[i]),2))) plt.title('Proceso_tueste_cafe_sin_filtro') plt.xlabel('Tiempo_($min$)') plt.ylabel('Temperatura_($ºC$)') plt.legend() plt.grid() plt.savefig('pruebas_19m_sin_filtro.pdf') plt.show() #con filtro for i in range (len(pruebas)): i=i tiempo=np.linspace(0,len(pruebas[i]),len(pruebas[i]))*0.2 #sec
46
tiempo=tiempo/60 #min pruebas[i]=gaussian_filter1d(pruebas[i],7) plt.plot(tiempo,pruebas[i],label='prueba_'+str(i)+',T0='+str(np.round(pruebas[i][0],2))+',Tf='+str(np.round(np.max(pruebas[i]),2))) plt.title('Proceso_tueste_cafe_con_filtro') plt.xlabel('Tiempo_($min$)') plt.ylabel('Temperatura_($ºC$)') plt.legend() plt.grid() plt.savefig('pruebas_19m_con_filtro.pdf') archivo = pd.read_excel('analisis_curva_temperatura.xlsx',skiprows=1) archivo = np.array(archivo) tiempo = np.zeros(len(archivo)) temperatura = np.zeros(len(archivo)) for i in range(len(archivo)): tiempo[i] = archivo[i][0] temperatura[i] = archivo[i][1] fun= interpolate.interp1d(tiempo,temperatura,kind='cubic') tiempo_new=np.linspace(tiempo[0],tiempo[-1],100) temperatura_new= fun(tiempo_new) #grafico #y_ticks= np.arange(140,250,10) #plt.figure(figsize=(43.2,28.8)) plt.plot(tiempo_new[3:80]/60/2.1,temperatura_new[3:80]) #plt.plot(12,fun(12*60),'o',label='Primer_Crack') #plt.plot(16,fun(16*60),'o',label='Segundo_Crack') plt.title('Curva_de_tostion_220ºC') plt.xlabel('tiempo ($min$)') #plt.xticks([i for i in range (21)]) plt.ylabel('temperatura (ºC)') #plt.yticks(y_ticks) plt.legend() plt.grid() #plt.savefig('Curva_de_tostion_220ºC.png') plt.show()
100g coffee batch and mass loss code: import numpy as np import matplotlib.pylab as plt import pandas as pd from scipy import interpolate from scipy.ndimage import gaussian_filter1d from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score #prueba_1 no valida #prueba_1=np.load('prueba_4_julio_1_1.npy') #prueba_1=prueba_1[1:1900] #prueba_2 prueba_2=np.load('prueba_4_julio_1_2.npy') prueba_2=prueba_2[1:1520] #prueba_3 prueba_3=np.load('prueba_4_julio_3.npy') prueba_3=prueba_3[1:1400] #prueba_4 prueba_4=np.load('prueba_4_julio_4.npy') prueba_4=prueba_4[1:1400] #prueba_5 prueba_5=np.load('prueba_4_julio_5.npy') prueba_5=prueba_5[1:1310] #prueba_6 prueba_6=np.load('prueba_4_julio_6.npy') prueba_6=prueba_6[1:1310] #prueba_7 prueba_7=np.load('prueba_4_julio_7.npy') prueba_7=prueba_7[150:1270]
47
#prueba_8 prueba_8=np.load('prueba_4_julio_8.npy') prueba_8=prueba_8[74:970] #prueba_9 prueba_9=np.load('prueba_4_julio_9.npy') prueba_9=prueba_9[50:780] #prueba_10 prueba_10=np.load('prueba_4_julio_10.npy') prueba_10=prueba_10[1:720] pruebas=np.array([prueba_2,prueba_3,prueba_4,prueba_5,prueba_6,prueba_7,prueba_8,prueba_9,prueba_10]) index=np.arange(0,len(pruebas),1) temperaturas_finales=[] for prueba in pruebas: prueba=gaussian_filter1d(prueba,50) time=np.linspace(0,len(prueba),len(prueba))*0.2/60 plt.plot(time,prueba) plt.plot(time[-1],prueba[-1],'o') temperaturas_finales.append(prueba[-1]) plt.title('Temperature_vs_time_100_grams') plt.xlabel('Time_($min$)') plt.ylabel('Temperature_($ºC$)') plt.grid() plt.savefig('pruebas_100.png') plt.show() temperaturas_finales=np.array(temperaturas_finales) temperaturas_finales=temperaturas_finales.reshape(-1,1) #perdida de peso peso=np.array([70,79,77,79,77,80,83,86,86])/100 #Create linear regression object regr = linear_model.LinearRegression() # Train the model using the training sets regr.fit(temperaturas_finales,peso) # Make predictions using the testing set temperatures_y_pred = regr.predict(temperaturas_finales) plt.plot(temperaturas_finales,peso,'o') plt.plot(temperaturas_finales,temperatures_y_pred) plt.xlabel('Temperature_($ºC$)') plt.ylabel('$Coffee/(Green-Coffee)$') plt.grid() plt.savefig('perdida_peso_cafe.png',dpi=550) plt.show()
finite difference code: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.cm as cm %matplotlib inline nr = 30 nteta = 30 nt = 10000#3900 dr = 9 / (nr - 1) dteta = np.pi/ (nteta - 1) dt = 1000 alpha=1.875e-6 radio = np.linspace(0.0001, 4.5, nr) tetax = np.linspace(0, np.pi, nteta) T = np.ones((nteta, nr))*25 # create a 1xn vector of 1's
48
Tn = np.ones((nteta, nr))*25 T[-1]=200 T[0]=200 #T[0:,0]=25 T[0:,-1]=200 #T[0,0:]=200 T[0:,0:3]=200 #T[0,0]=200 t_mid=[] t_sup=[] for t in range (nt+1): for i in range(1,len(radio)-1): for j in range(1,len(tetax)-1): #T[i,j]=T[i,j]+alpha*dt*((T[i+1,j]-T[i-1,j])/(2*radio[i]*dr)+(T[i-1,j]-2*T[i,j]+T[i+1,j])/(2*dr**2)+(T[i,j-1]-2*T[i,j]+T[i,j+1])/(radio[i]*dteta**2)) #T[i,j]=T[i,j]+alpha*dt*(1/dr**2*(T[i-1,j]-2*T[i,j]+T[i+1,j])+1/(2*radio[i]*dr)*(T[i+1,j]-T[i-1,j])) #T[i,j]=T[i,j]+(alpha*dt)*(((T[i-1,j]-2*T[i,j]+T[i+1,j])/(dr**2))+((T[i+1,j]-T[i-1,j])/(radio[j]*2*dr))+((T[i,j-1]-2*T[i,j]+T[i,j+1])/(0.1**2 T[i,j]=T[i,j]+(alpha*dt)*((T[i,j-1]-2*T[i,j]+T[i,j+1])/(dr**2)+(T[i,j+1]-T[i,j-1])/(radio[j]**2*2*dr)+(T[i-1,j]-2*T[i,j]+T[i+1,j])/(radio[j]**2*dteta)) T[-1]=200 T[0]=200 #T[0:,0]=25 T[0:,-1]=200 T[0:,0:3]=200 #T[0,0]=200 t_mid.append(T[16,11]) t_sup.append(T[-2,13]) T #T[0:,0]=200 x=radio y =tetax X, Y = np.meshgrid(x, y) Z = T fig, ax = plt.subplots() ax.contourf(Y, X, Z, cmap=cm.jet) plt.xlabel('teta') plt.ylabel('radio') plt.colorbar(ax.contourf(Y, X, Z, cmap=cm.jet)) plt.savefig('contorno_polar_final.pdf') fig = plt.figure() ax = plt.axes(projection='3d') ax.plot_surface(X, Y, Z, cmap=cm.jet) ax.set_xlabel('radio') ax.set_ylabel('teta') ax.set_zlabel('temperatura') plt.tight_layout() plt.savefig('superficie_polar_final.pdf') #plt.polar(Y,X,'ro') #para Andres diaz # gracias perro por toda la ayuda y colaboracion en la tesis, basicamente la escribiste conmigo, gracias por tomarte el tiempo de revisarla, entenderla y tenerme una paciencia gigante. Que pena interrumpir tus peliculas con la teacher. Recuerda que eres de mis grandes amigos. Te debo unos buenos 10 six packs de pola!!!
fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Create the mesh in polar coordinates and compute corresponding Z. R, P = np.meshgrid(radio, tetax) Z = T # Express the mesh in the cartesian system. X, Y = R*np.sin(P), R*np.cos(P) # Plot the surface. ax.plot_surface(X, Y, Z, cmap=cm.jet) ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('temperatura ºC') plt.tight_layout() plt.savefig('superficie_final.pdf') #contourf
49
fig, ax = plt.subplots() ax.contourf(Y, X, Z, cmap=cm.jet) plt.colorbar(ax.contourf(Y, X, Z, cmap=cm.jet)) plt.xlabel('y') plt.ylabel('x') plt.tight_layout() plt.savefig('lineas_contorno_final.pdf') plt.show() time=np.linspace(0,600,len(t_mid)) plt.plot(time,t_mid,label='Temperatura en el centro del grano') plt.plot(time,t_sup,label='Temperatura en la superficie del grano') plt.ylabel('Temperatura ºC') plt.xlabel('Tiempo (s)') plt.legend() plt.grid() plt.tight_layout() plt.savefig('curva_temperatura_grano_cafe_final.pdf')