[TRNSYS-users] Branch function implementation using equations

David BRADLEY d.bradley at tess-inc.com
Tue Jul 19 06:59:25 PDT 2022


Ana,

  I think you can do it using boolean functions, which return a 1 when 
the condition is true and a 0 when the condition is false. GT(x,y) will 
return a 1 if x>y. GE(x,y) will return a 1 if x>=y.

I didn't try it out to be sure but I think you can write the following 
four equations:

cond1 = AND(GT(x,-57),LT(x,-30))

cond2 = AND(GE(x,-30),LT(x,-15))

cond3 = AND(GE(x,-15),LE(x,-5))

Y = cond1*(8E-5x**2-0.0024+0.2385) + cond2*(0.0001x**2+0.0028x+0.3494) + 
cond3*(-0.0001x**2-0.004x+0.3058)

best,

  David


On 07/19/2022 04:52, Ana Delgado via TRNSYS-users wrote:
>
> Hello,
>
> I have an input variable that changes over time. The most correct way 
> to characterize it is to use a branch function. I wanted to use the 
> equations feature but it is giving me lots of errors. Using 
> programming language, my variable changes like this:
>
> If -57 < x < -30
>
> Y1=8E-5x^2-0.0024+0.2385
>
> End IF
>
> If -30< x<-15
>
> Y2=0.0001x^2+0.0028x+0.3494
>
> End if
>
> If -15< x<-5
>
> Y3=-0.0001x^2-0.004x+0.3058
>
> End if
>
> Do you have any tip on how to do it on TRNSYS? Also it’s not mandatory 
> to use equations.
>
> Thank you in advance,
>
> Kind Regards,
>
>  Ana Delgado, University of Aveiro
>
>
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at lists.onebuilding.org
> http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org

-- 
***************************
David BRADLEY
Principal
Thermal Energy System Specialists, LLC
3 North Pinckney Street - suite 202
Madison, WI  53703 USA

P:+1.608.274.2577
d.bradley at tess-inc.com

http://www.tess-inc.com
http://www.trnsys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20220719/c52a6200/attachment.htm>


More information about the TRNSYS-users mailing list