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

Re: [TRNSYS-users] If-clause



Hi Senne

 

All logical statements in the equation block will return 1 if they are true of 0 if they are false therefore you can create if statements by using addition/subtraction and multiplication.

 

This way shows how to do it using purely GT (Greater than) and LT (less than), though there are AND, OR and EQ commands that can be used.

 

FLOW = Gt(Lt(T,20) + Gt(Hour,1000),0)*Flow1 + Lt(Lt(T,20) + Gt(Hour,1000),1)*Flow2

 

Where flow1 is if the condition is met and flow 2 is when the condition is not met.

 

Hope this helps,

 

Alasdair

 


From: senne plessers [mailto:senne_plessers@hotmail.com]
Sent: 01 September 2009 10:50
To: trnsys-users@cae.wisc.edu
Subject: [TRNSYS-users] If-clause

 

Dear all,
 
is it possible to create an if-clause in an equation-component that
can use to or-button in the equation?
 
For example: if T < 20°C or Hour of the day > 1000
                  than flow=...
                  else flow=...
                  end
 
Is this possible or do I have to write my own algorithm?
 
Thanks in advance.
 
Best regards,
 
Senne Plessers


Je hele online leven op één stek? Ontdek Windows Live!