Santiago, I'm not sure that you need to do anything special. The TRNSYS kernel (the brains that determine when convergence has been reached) call the Types and then just waits until the Type hits its "return" statement (returning control to the kernel). The kernel will not increment the timestep until all of the outputs from Types have converged (stopped changing from one iteration to the next). I assume that you have developed some Type in your simulation that communicates with your controller. The kernel should call that Type and then wait until the controller is ready to make its decision. The controller's decision should get placed into the Type's outputs and then the Type should return control to the kernel as all Types do. The one thing you might do a little differently is to prevent your Type/controller from trying to make a new decision at every simulation iteration; allow it to make one control decision per time step and then hang on to that control decision until the next time step. You can do that either by having your Type only process at the "post convergence" call or it can make its decision on the first iteration of a new time step and then return without reevaluating at all other iterations. Best, David On 3/24/2011 09:11, Santiago Naranjo Palacio wrote:
-- *************************** David BRADLEY Principal Thermal Energy Systems Specialists, LLC 22 North Carroll Street - suite 370 Madison, WI 53703 USA P:+1.608.274.2577 F:+1.608.278.1475 d.bradley@tess-inc.com http://www.tess-inc.com http://www.trnsys.com |