[TRNSYS-users] External file and characters
David BRADLEY
d.bradley at tess-inc.com
Mon Jul 29 09:38:32 PDT 2013
Philip,
In standard TRNSYS, there are two ways to read in external files. If
the file acts like a lookup table then you can use the format that is
read by the InterpolateData routine. In this format, there are between 1
and 6 lines of "independent variable values" followed by a series of
lines containing at least one "dependent variable value." There will be
as many rows of dependent variable values as there are possible
combinations of independent variable values. You can fit your data below
into this form where the array indicies are the independent variable values:
1 2 3 4 5 6 7 8 ! first array index.
1 2 ! second array index
4.48638 ! value corresponding to (1,1)
0.047 ! value corresponding to (1,2)
-1.00294 ! value corresponding to (2,1)
-2.22745 ! value corresponding to (2,2)
Please note the order, which is important.
You can then use Type42 to read the file. You have two independent
variables and one dependent variable. You have two values of the first
independent variable and 8 values of the second independent variable.
Kind regards,
David
On 7/29/2013 03:32, Philip Horn wrote:
> Dear All,
>
> I searched previous postings regarding the external file handling, but
> could not find enough information.
>
> All external files I've seen so far consist of an arbitrary amount of
> comment lines (indicated with an "*") and some TAB-separated numerical
> values.
>
> My question:
>
> Is it possible to read in characters as well?
>
> I would like to read in something like this:
>
> GARWIH_Tcout(1, 1) = 4.48638
> GARWIH_Tcout(2, 1) = -1.00294
> GARWIH_Tcout(3, 1) = 0.20914
> GARWIH_Tcout(4, 1) = -2.36728
> GARWIH_Tcout(5, 1) = 2.42915
> GARWIH_Tcout(6, 1) = -2.3596
> GARWIH_Tcout(7, 1) = -0.33344
> GARWIH_Tcout(8, 1) = 1.30703
> GARWIH_Tcout(1, 2) = 0.047
> GARWIH_Tcout(2, 2) = -2.22745
> GARWIH_Tcout(3, 2) = -0.5901
> GARWIH_Tcout(4, 2) = -2.03408
> GARWIH_Tcout(5, 2) = -0.34727
> GARWIH_Tcout(6, 2) = -0.44872
> GARWIH_Tcout(7, 2) = 0.36808
> GARWIH_Tcout(8, 2) = 0.3456
> ............
> ............
>
> The dimensions (in this case 8x2) and thus the number of lines in the
> external file should be flexible, i.e. TRNSYS should automatically
> read in the whole file until the last line.
> The data should then be available throughout the whole simulation.
> Can this be done with an external file?
>
> I guess probably not :(
> Any recommendation how to cope with that problem instead?
> May be design a loop to access the numerical values and link them to
> the character.
> In order to make the values accessible during the whole simulation I
> would need to store them (stored variables), right?
>
>
> I would be very happy if you could share your thoughts!!
>
> Best,
> Philip
>
>
>
--
***************************
David BRADLEY
Principal
Thermal Energy Systems Specialists, LLC
22 North Carroll Street - suite 370
Madison, WI 53703 USA
P:+1.608.274.2577
F:+1.608.278.1475
d.bradley at tess-inc.com
http://www.tess-inc.com
http://www.trnsys.com
More information about the TRNSYS-users
mailing list