[TRNSYS-users] Type 155 - Matlab/TRNSYS - Global variables

Tarik Ferhatbegovic tarikf at gmail.com
Wed Jul 25 01:18:33 PDT 2012


Hello!



Currently I am working on the implementation of a two-point (bang-bang)
controller using the Matlab Type 155 for TRNSYS.

As a matter of fact, the code is quite simple, shown as follows:



if Tso<45 && flag_boiler_act<0.5

        flag_boiler_act=1.0;

elseif Tso>50 && flag_boiler_act>0.5

        flag_boiler_act=0.0;

end



The variable “flag_boiler_act” (state variable, storage variable) is
supposed to toggle depending upon the values of “Tso”. Regarding the code
above, this means that within the range of “45” and “50” the variable “
flag_boiler_act” should not change (therefore remain “1.0”).

However, when I run the simulation, the variable “flag_boiler_act” toggles
to “0.0” as “Tso” as exceeds “45” (should remain “1.0” tough) , which
therefore leads to the assumption that Matlab does not store “
flag_boiler_act” at all.



Can you please give me some advice about the better way to do that?



Best regards.

Tarik


P.S.: I am well aware of the fact that I can use the standard controller
with a hysterisis, however, I would like to understand the concept of the
Type 155 and also exploit its full potential.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20120725/5b9a323a/attachment-0005.htm>


More information about the TRNSYS-users mailing list