[TRNSYS-users] External file and characters
Philip Horn
philip.horn at ise.fraunhofer.de
Mon Aug 5 07:18:20 PDT 2013
Dear David,
thanks a lot for your reply!
The values from the external file should be read-in at the start of the
simulation and then be available at every timestep. I do not know wether
the lookup-table is suitable for that... ?
I think type 42 is not suitable for this problem.
It would be better to have no additional type, and simply read the
values via an assigned external file.
My idea is to
-define an external file in the proforma
-as I understood it needs to have the format that you mentioned in your
previous answer:
1 2 ! 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)
etc. ......
-call it with something like
READ(LU_DATA,*,ERR=2000,END=2000)
(here it is not clear to me where I can see which Logical number the
file defined in the proforma actually has? In TYPE 109 it is defined as
a parameter, but can I simply declare it in the code?)
ASSIGN \externalfile.txt "arbitrary LU number"
( I know that there are some preassigned LUs...)
- create a routine that links the values to a specific name, i.e.
GARWIH_Tcout(1, 1) = 4.48638
Are there any examples that I could have a look at?
Would it be possible to use the Control Card command Include, or is this
only suitable for a small amount of Parameters?
i.e. : INCLUDE "externalfile.txt"
Many thanks in advance,
Philip
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Re: [TRNSYS-users] External file and characters.eml
Betreff:
Re: [TRNSYS-users] External file and characters
Von:
David BRADLEY <d.bradley at tess-inc.com>
Datum:
29.07.2013 18:38
An:
philip.horn at ise.fraunhofer.de, "TRNSYS users mailing list at the Solar
Energy Lab, UW-Madison" <trnsys-users at cae.wisc.edu>
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
More information about the TRNSYS-users
mailing list