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

Re: [TRNSYS-users] calling sequence



David,

Actually, I did'nt understand why I should use the storage procedure. I use it already to store the values for 168 timesteps, to control the drift speed. But that's not the problem.

My problem is the following.
If I plug the iterative controller directly to my new type, and my type's output to the building, I get inconsistent results. The iterative controller oscillates : I think it's normal : If its output is limited by my type (and it will, since the iterative controller "tries" a wide range of values), the minimizing algorithm does'nt work, as a change does not make any difference in Qsens (the function to be minimized) since it is still the same setpoint sent to the building model.

...I hope I'm clear enough...

My idea was :
During the iterative calls, not interfere in the output made by the iter. controller. Once the simulation has converged, control the setpoint defined by the iter. controller, and change it if the drift speed is too high.

I made one test that does not work. I just want to :
- during iterative calls, send the iterative controller output to the building trough a type.
- for last convergence call, send simply, let's say 19°C, to the building.
I write smthg like that :

/Perform any after iteration.../
if(info(13)>0
Tout=19
endif

/this is an iterative call.../
if(info(13)=0
Tout=Tin
endif

out(1)=Tout

And I get always (iterative AND post-convergence call) the input temperature as outputs. Anyway, thanks for the help! Regards.

Thibaut

David Bradley a écrit :
Thibaut,
I think you need to use the storage structures (getStorageVars() and setStorageVars()). I am not sure that I have completely understood what you are trying to do but I think that what you want to do is store 2 values in the global storage structure. One of those values is the final calculated temperature of the last time step and the other one is the calculated temperature of the last iteration. Each time you enter the Type on an iterative call, you can call getStorageVars() and base your calculations on the final temperature of the previous time step. At the end of your calculations during an iterative call, you call setStorageVars() and update ONLY the calculated value of the last (just completed) iteration. Then, after convergence has been reached, you call getStorageVars(), retrieve the value that you calculated at the end of the last iteration and replace the value of the final calculated temperature at the end of the time step. Then call setStorageVars() again. Again, I may be misinterpreting what you are trying to do but hopefully the above is close enough that you can figure out how to make getStorageVars() and setStogageVars() to work appropriately for your situation.
Kind regards,
David



Dear Trnsys users,

I am modelling a setpoint that is drifting inside a dwelling (17-23°C for instance). So I use an iterative feedback controller, with upper and lower setpoints, which minimize abs(Qheat)+abs(Qcool). It works very weel.

Now I am writing a type, that controls (+/-1°C per week for instance) that temperature 's drift. But to get the iterative feedback controller working, I must not limit its output during the iterations, otherwise the results are not consistent. So I thought I couls let the outputs inchanged in the iterative calls (info(13)=0) and change them in the post convergence call.

e.g.

/Perform any after iteration.../
if(info(13)>0
Tout=Tin+.../
Limitation de la vitesse de dérive/
endif

/this is an iterative call.../
if(info(13)=0
Tout=Tin
endif

out(1)=Tout


Obviously, this isn't working, I get the input temperature as an output at every call, without any modification at the post-convergence call. Is it possible? Am I getting something wrong?

Thanks in advance for your help

Thibaut Vitte
_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@cae.wisc.edu
https://www-old.cae.wisc.edu/mailman/listinfo/trnsys-users



--
Thibaut Vitte
thibaut.vitte@h3c-energies.fr

H3C Energies
Services et Conseils en énergie
35 Ch. du vieux Chêne
38 240 Meylan

Tel. 04 76 41 88 66
Fax. 04 76 41 28 94
Mob. 06 23 42 05 07

www.h3c-energies.fr