[TRNSYS-users] if-elseif statement in TRNSYS
Miroslava Kavgic
miroslava.kavgic at gmail.com
Thu Feb 28 02:17:35 PST 2013
Hi Raksit,
yes, by using an equation editor in the simulation studio. IF-THEN-ELSE can
be described using GT (greater than), LT (less than), EQ (equal to), OR,
and NOT.
*As Mr. Michaël Kummert wrote:*
*'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,
Miroslava
On 28 February 2013 00:31, leen peeters <l.f.r.peeters at gmail.com> wrote:
> Raksit,
>
> you can 'translate it'...
> say
> if A=1 then B else C
>
> you can make it
> (eql(A,1)*B)+(not(eql(A,1)*C)
>
> Leen
>
>
> On Thu, Feb 28, 2013 at 12:20 AM, Raksit Pattanapitoon <rp327 at cornell.edu>
> wrote:
>>
>> Dear all,
>>
>> Does anyone know if there's TRNSYS component that can implement the
>> if-elseif statements? Any direction would be helpful. Thank you in
advance!
>>
>> Best,
>> Raksit
>>
>> --
>> Raksit Pattanapitoon
>> Cornell University Mechanical Engineering
>> B.S. 2012, M.Eng. 2013
>>
>> _______________________________________________
>> TRNSYS-users mailing list
>> TRNSYS-users at cae.wisc.edu
>> https://mailman.cae.wisc.edu/listinfo/trnsys-users
>>
>
>
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://mailman.cae.wisc.edu/listinfo/trnsys-users
>
--
Miroslava Kavgic Dipling, MSc
PhD Candidate
Bartlett School of Graduate Studies
University College London (UCL)
Central House
14 Upper Woburn Place
London WC1H 0NN UK
E-mail:miroslava.kavgic at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20130228/7648ff1b/attachment-0001.htm>
More information about the TRNSYS-users
mailing list