[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: type 9 quick question



Pietro,

in the examples in Trnsys I found "Ex5" with T9b (-> Summer.dat) data reader and T9d (->Copennew.try) in "Building" files.
in the weather files the data are as follows:
in Summer.dat:
" 8 1 11 3592 283 115 2" and in the T9 Special Card there is (10X ,F4.0,1X,F4.1,1X,F6.4,1X,F2.0)
in Copennew.try:
" 8 0.00 0.00 2.1 8.7 87" and in the T9 Special Card there is (6X F7.2,F7.2,F5.1,F6.1,F3.0)
The MAIN DIFFERENCE is the presence of the dot separator for decimals. In both Special Cards decimals are specified counting in the same way, I mean from the right. But in this way the dot separetor would become the first not decimal cararter. Is it automatically not taken in account while reading the data or is it indifferent to use one typology or the other?

Let's first take a look at the first format instruction:

(10X,F4.0,1X,F4.1,1X,F6.4,1X,F2.0)

This is how the file should look like (x stands for a blank and 12345... for numbers)
xxxxxxxxxx1234x12.3x1.2345x12
And this is what you have:
8 1 11 3592 283 115 2
xxxxxxxxxx1234x12.3x1.2345x12


The only catch is that (according to my tests) the "283" will be read as 28.3 and "115" will become 0.0115 because fortran knows it has to read a number with a decimal point and a given number of digits after the point (note that it "makes up the decimal point").

For the second FORMAT instruction:

(6X F7.2,F7.2,F5.1,F6.1,F3.0)

This gives:
xxxxxx1234.561234.56123.41234.5123
   8     0.00   0.00  2.1   8.7 87

In this case all numbers will be read correctly.

I would definitely avoid things like the first format.

Generally speaking, I tend to use free format read and just have numbers separated by spaces or tabs. In that case any number of digits, before or after decimal points, is OK, and special formats like 1.02e04 also work. Such files are easy to get from Excel, TRNSYS, etc.

I hope this helps,

Michaël

--
_________________________________________________________

Michaël Kummert

Solar Energy Laboratory - University of Wisconsin-Madison
1303 Engr Res Bldg, 1500 Engineering Drive
Madison, WI 53706

Tel: +1 (608) 263-1589
Fax: +1 (608) 262-8464
E-mail: kummert@xxxxxxxxxxxxx

SEL Web Site: http://sel.me.wisc.edu
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys