Data fitting by least squares method
The purpose of the fitting is to obtain the values of the adjustment
parameters T0 , k and g (see our article). For the given T0 , a set of the optimal values
for k and g is recorded for each day in the file k&g.txt,
which is the main result of the data fitting procedure.
To perform this data processing sequence, one needs the data files of
homogeneous format. This concerns both the file name and its contents. The file
format conventions (except for YYMMDDvi.txt)
are very strict. We give examples for each file format that we use. All data
files are ASCII (text) files. All of them are organized into tab-separated
Four data files are needed as input:
in which all the data (except for the cloud cover) are present. Its format is
not very strict. It is important that the 3rd column is time in
d:hh:mm:ss format and 5th column is water mass in grams. This file
is produced by TESTO apparatus.
is created using YYMMDDvi.txt.
See below for more details on its
format. The cloud cover column should be created in it but its values are
arbitrary. They will be substituted by the real ones later on.
in which the cloud cover data are present. It is supplied by the
meteorological station and gives the cloud cover of the sky in octets (1/8
parts) each 3 hours. The format of each line is:
<station #>, AAAAMMJJHH,< cloud cover>
– the input data "File for Unit 2". for Condenser7.2.exe. It
contains mainly the condenser parameters. This file need not to be
modified by a text editor. It is modified by Condenser7.2.exe and can be saved
under any desired name (we require the name 3.txt for processing purposes) as
"File for Unit 3".
To start the processing, one needs to download seven executables
available for Windows 98/NT4/2000/XP:
- nebulo.exe – inserts the cloud cover data into D_YYMMDDvi.txt. You need
to download the file setup_nebulo.exe
into some temporary directory, run setup_nebulo.exe to unzip and run the
Setup.exe. The Install Wizard will let you to install nebulo.exe. It can be
moved after installation into any directory. The file setup_nebulo.exe and
the files created during its unzipping can be removed after the
– creates a directory structure and sorts the files. Requires list.txt as input
– the main condenser temperature fitting application. The purpose of this
program is to find the k value (see our article)
that provides the smallest variance Dev between the calculated (Tc) and
measured condenser temperatures. There are two input text files: "File
for Unit 1" and "File
for Unit 2".
for Unit 1" contains 6 columns of the data separated by tabulation
with a header line: time, u – wind velocity in m/s, N – cloud cover in
octets, Ta – ambient temperature in °C, H – humidity in %, Tref –
condenser temperature. The first 4 characters of this file must be "time". The first column gives time in seconds, such as 1:00:00:01 corresponds
Once the files for units 1 and 2 are chosen, the "Input
parameters" dialog window opens. It permits to adjust the parameters of
the condenser, the initial and ending times of the simulation, the initial
temperature, the value of g (to be guessed on this stage),
the dew temperature correction T0 (see our article), and the degree of smoothing of the
experimental data on wind velocity, cloud cover ("nebulocity"),
ambient temperature, and humidity. The actual beginning and ending times of
the simulation correspond to the times from "File for Unit 1".
Approximate values for them in decimal hours can be typed. These values will
be rounded to the closest times from "File for Unit 1". The ending
time (if after midnight) should be typed as <hour+24> to account for the day
change. It is advised to choose both these times between the sunset and the
sunrise because the program does not take into account the solar heating. The
unused data (before the beginning time and after the ending time) is not
included in the output "File for Unit 4".
If one types "Auto" in the "Initial condenser
temperature" box, the program chooses for the initial temperature the
value of Tref corresponding to the beginning time. Any other number can be
chosen either. The STOP button stops the execution of the program, CANCEL
button cancels the changes in the window "Input parameters" by
restoring the parameters from "File for Unit 2". After pressing OK
button, the parameters are recorded in "File for Unit 3" (of the
same format as "File for Unit 2"), to be chosen. The fitted and
smoothed data are saved in "File
for Unit 4", to be chosen either. The optimal
value for k is recorded in the header of "File
for Unit 4".
The results of the temperature fitting are displayed then on the screen and
can be either saved as the bitmap image or printed. The variance of (Tref –
Tc) is displayed as Dev.
modifies the format of 3.txt
("File for Unit 2" for Condenser7.2.exe)
and saves it as 3_11.txt
("File for Unit 2" for Condens11.exe).
See the description below.
works similarly to Condenser7.2.exe. Its purpose is to find the optimal g value
(see our article)
that provides the smallest variance Dev between the calculated (m) and
measured condensed masses of water. By default, it looks for M_YYMMDDvi.txt
as "File for Unit 1" (where YYMMDD is the name for the current
directory), from which the value of k is read. 3_11.txt
is read as "File for Unit 2". It is overwritten as "File for
Unit 3". "File for Unit 4 " is saved under the name FM_YYMMDDvi.txt.
Time in the "File for Unit 4" is formatted as d:hh:mm:ss.
kg.exe Extracts the values of k and g from the
headers of all FM_YYMMDDvi.txt
and saves them in k&g.txt. Requires list.txt
Algorithm of the data fitting:
Put all files D_YYMMDDvi.txt
into the same working directory <workdir>.
Run in the MS-DOS window commands
dir >> list.txt
The file list.txt is created. It contains the names of all the files as well as plenty of other information. Edit it
by using the column block function (Alt+left mouse) of MS Word in order to
clean up all other information and leave only the names of files which you put into <workdir>. Arrange these names into one column. Desired
into <workdir>. Edit list.txt using the Replace (Ctrl+H) function of
MS Word, replacing (Replace All) ^p by ^pnebulo .
NB: Type a space after
"nebulo"! Edit the result and save it in n.bat.
Run n.bat in the MS-DOS window. Check the date corresponding to each data
file, confirm it by pressing <Enter>. The linearly
interpolated cloud cover data is inserted into files D_YYMMDDvi.txt instead
of zeros. The resulting file is saved as DN_YYMMDD.txt
for each date. Instead of creating n.bat, you can run nebulo.exe many times opening one of your D_YYMMDDvi.txt files at a time.
Edit the file list.txt using the column block
function (Alt+left mouse) of MS Word to delete the columns with D_ and
into <workdir>. Run it. The directory structure is created. Each newly
formed directory <datedir> has a name YYMMDD. The files D_YYMMDDvi.txt
are moved into corresponding <datedir>.
Move both Condenser7.2.exe
into <workdir>. Find the optimal k value for each date from list.txt
by fitting the condenser temperatures: run Condenser7.2.exe.
as "File for Unit 1" and 2.txt
as "File for Unit 2". Save "File for Unit 3" and
"File for Unit 4" under the names 3.txt
in the corresponding <datedir>.
into <workdir>. Run it. It will create 3_11.txt
for each date.
By now, each <datedir> should contain 3.txt, 3_11.txt, D_YYMMDDvi.txt,
DN_YYMMDD.txt, and FN_YYMMDD.txt.
Create the directory <workdir>\Testo. Move all the Testo data files YYMMDDvi.txt
into it. Move Assm_File.exe
into <workdir>. Run it.
each YYMMDDvi.txt from <workdir>\Testo to <datedir>. Then it takes the measured
water mass data from YYMMDDvi.txt, the k value from FN_YYMMDD.txt and inserts them into DN_YYMMDD.txt.
The result is saved as M_YYMMDDvi.txt
in <datedir>. Assm_File.exe requires list.txt
Find the optimal g value for each date by
fitting the condensed water mass: move Condens11.exe
into a <datedir>, run it; move it to the next <datedir>, etc.
The files FM_YYMMDDvi.txt
are created for each date. They contain all results of the fits: the
measured and simulated time evolution of the water mass and condenser
temperature calculated for the optimal values of k and g.
These optimal values of k and g are recorded in the header.
kg.exe into <workdir>. Run it. It will create k&g.txt that
will contain the values of k and g for each date.
Author: Vadim S. Nikolayev
Organization For Dew
P U R. All rights reserved
[TO THE TOP]