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

RE: IF-THEN-ELSE Statements



Dear Mike,

IF-THEN-ELSE statements are not possible as such. However, some functions
are available to obtain similar results in most simple cases: GT; LT; EQ;
OR; NOT

For example, let's assume you would like to use the following "if-then-else"
statement:

if (Z>0) then
X=Y1
else
X=Y2
endif
The following equation will do the same:

X=GT(Z,0)*Y1+(1-GT(Z,0))*Y2

Please refer to the TRNSYS manual (p 2-8) for a description of available
functions.
Please also note that if-then-else tests can lead to oscillations due to the
iterative nature of TRNSYS. E.g. you could implement a controller similar to
Type 2 with equations. However, you have no way to tell TRNSYS to stop
changing a variable if the number of iterations is beyond a certain value
(which Type 2 does with the NSTICK parameter).


Regards,

Michaël Kummert

_________________________________________________________

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@engr.wisc.edu

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


-----Original Message-----
From: owner-trnsys@relay.doit.wisc.edu
[mailto:owner-trnsys@relay.doit.wisc.edu] On Behalf Of MIKE MATHEUS
Sent: Wednesday, June 11, 2003 17:01
To: trnsys@relay.doit.wisc.edu
Subject: IF-THEN-ELSE Statements


Dear TRNSYS users,

Does anybody know if it is possible to write IF-THEN-ELSE statements in the
equation editor in IISiBat?

Thank you for your help


Mike Matheus
Energy Assessment Center
University of Nevada, Reno
Phone: (775) 784-6468
Fax: (775) 327-5273