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

[TRNSYS-users] Trnsed and making simili cycles



Dear trnsys users,


I'm struggling with a trnsed application regarding defining a building's envelope. I want let the user add walls when one after the oether to define the envelope.
I  use the following scheme with checkboxes involved :
    input wall 1
    Uw1, Area_w1
    Do you want to input another wall ?
   
        Input wall 2
        Uw2, Area_w2
        Do you want ton input another wall ?
etc.

It seems to me that this is the most user friendly way to make a simili-cycle in trnsed. I managed to code it in Trnsed language.
But now I'm struggling with the trnsys code. I did'nt think of that before but here's the problem : I don't know how many walls are to be inputed !

The problem can be simplified like this : I want to calulate a mean value for 1, 2 or 3 values.
First Group:
A=10
2nd group
B=5
3rd group
C=6

I can calculate each time the mean value :
First Group:
A=x
M1=A/1

2nd group
B=y
M2=(A+B)/2

3rd group
C=z
M3=(A+B+C)/3


But the problem is: If I want to reuse that mean value as an input for another component, how do I do? If I use an equation I will automatically call an input that does'nt exist if there are only 2 values for instance. If I define the 3 values for each group  and calculate the mean at the end like :
First Group:
A=x
B=0
C=0

2nd group
B=y
C=0


Then I get an error because I define an value twice ! In fact that was the way I thought of firstly... I think I mixed coding in Trnshell and in Fortran in my head..

So do you see a way to get the right "mean value" (ie the right overall heat transfer coefficient in my case)? It can include to write a piece of code, I thought of that solution but I don't see neither how it can work.

I hope I've been clear enough !
Happy new year to all Trnsys users.

Thibaut