[TRNSYS-users] Moving average

Leen Peeters leen.peeters at mech.kuleuven.be
Fri Jun 19 05:30:13 PDT 2009


Fabien,

if I get your problem ... then there is a very simple way to do so:

take an equation writer:
for the weekly average:
week_count=7*24*(1/STEP)        %this gives you the number of calculation 
steps within a week
how_far=week_count-(flag*1)                % which is reduced each 
simulation steop and thus shoudl be 0 by the end of the week if flag =1
flag=1*(gt(how_far),0)                            % this value needs to be 
stored (type 93) and used as input the next timestep
sum=(heatingload+sumprev)*flag            %assuming hetaing load is an 
instantaneous input and sumprev is the value of sum of last simulation step
number=(1+numberprev)*flag                %idem as for sum
avg=sum/max(1,number)                        %where the 1 is added in order 
to prevent dividing by 0


this can be done for months, ...

hope this helps you out


Leen Peeters

----- Original Message ----- 
From: <fabien.talbourdet at legrand.fr>
To: <trnsys-users at engr.wisc.edu>
Sent: Thursday, June 18, 2009 2:12 PM
Subject: [TRNSYS-users] Moving average


>
> Hello TRNSYS-users,
>
> I want to calculate a moving average (over 24h, 1 week, 1 month...) of
> heating and cooling needs. I make it with the type 93 and the calculator
> but if the average is calculated over a very long period, this method
> becomes very tiring.
> So I want to know, if anyone of you has already developed a type for this?
> Thanks in advance for your help.
> Best regards.
>
>
>
> Ce message, ainsi que tous les fichiers joints à ce message,
> peuvent contenir des informations sensibles et/ ou confidentielles
> ne devant pas être divulguées. Si vous n'êtes pas le destinataire
> de ce message (ou que vous recevez ce message par erreur), nous
> vous remercions de le notifier immédiatement à son expéditeur, et
> de détruire ce message. Toute copie, divulgation, modification,
> utilisation ou diffusion, non autorisée, directe ou indirecte, de
> tout ou partie de ce message, est strictement interdite.
>
> This e-mail, and any document attached hereby, may contain
> confidential and/or privileged information. If you are not the
> intended recipient (or have received this e-mail in error) please
> notify the sender immediately and destroy this e-mail. Any
> unauthorized, direct or indirect, copying, disclosure, distribution
> or other use of the material or parts thereof is strictly
> forbidden.
> _______________________________________________
> TRNSYS-users mailing list
> TRNSYS-users at cae.wisc.edu
> https://www-old.cae.wisc.edu/mailman/listinfo/trnsys-users
> 




More information about the TRNSYS-users mailing list