[TRNSYS-users] How to connect dynamic number of output variables

Jeff Thornton thornton at tess-inc.com
Wed May 9 09:35:49 PDT 2012


 

Henk, 

Depending on which version of the software you're using (16
or 17), I'm guessing you didn't set the INFO(6) array indicator
correctly or didn't call the SetNumberofOutputs function correctly.
Let's say you had two outputs plus a variable number of outputs
depending on the number of layers (let's say this is parameter 5).


Here are the relevant snippets of code you'll need in both versions:


v 17: 

!Declarations 

Integer N_Layers_Max, N_Layers,N_Outputs


Parameter (N_Layers_Max=99) 

Double Precision
Temp_Layer(N_Layers_Max) 

!First Call of Simulation Manipulations 

If
(FirstCallofSimulation) Then 

 N_Layers=JFIX(getParameterValue(5)+0.5)


 If (N_Layers>N_Layers_Max) Then 

 Call
FoundBadParameter(5,'Fatal','The number of layers must be less than
99.') 

 Return 

 EndIf 

 N_Outputs=2+N_Layers 

 Call
SetNumberofOutputs(N_Outputs) 

EndIf 

v 16: 

!Declarations 

Integer
N_Layers_Max, N_Layers, N_Outputs, N_Parameters, N_Inputs, N_Derivatives


Parameter (N_Layers_Max=99) 

Double Precision
Temp_Layer(N_Layers_Max) 

!First Call of Simulation Manipulations 

If
(Info(7).eq.-1) Then 

 N_Layers=JFIX(PAR(5)+0.5) 

 If
(N_Layers>N_Layers_Max) Then 

 Call Typeck(-4,Info,0,5,0) 

 Return 1


 EndIf 

 N_Outputs=2+N_Layers 

 N_Parameters=3 

 N_Inputs=3 


N_Derivatives=0 

 Info(6)=N_Outputs 

 Call
Typeck(1,Info,N_Inputs,N_Parameters,N_Derivatives) 

EndIf 

Hope this
helps. 

Jeff 

---

Jeff Thornton 

_President - TESS LLC_ 

_22 N.
Carroll Street, Madison WI USA 53703_ 

_Office: (608) 274-2577 Fax:
(608) 278-1475_ 

_www.tess-inc.com_ 

_E-Mail: thornton at tess-inc.com_


On 05/08/2012 8:22 am, Henk Stijnen wrote: 

> Hi, 
> 
> I've created
a component in which it's possible to specify a dynamic number of output
variables. In the parameters there is a variable "number of segments to
monitor" and depending of that number there are output variables
created. So far OK. However, when I link the newly created output
variables to some printer I get an error "The listed input referenced an
output number beyond the allocated outputs for the connected type". What
can be wrong? 
> 
> Thanks for help 
> 
> Henk
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20120509/d14e10da/attachment-0001.htm>


More information about the TRNSYS-users mailing list