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

[TRNSYS-users] About storage of values between timesteps



Hi everyone,

I'm creating a new Type for TRNSYS 18 in TypeStudio, basically a concentrating solar collector based in Linear Fresnel Collectors. I finished the code with my mathematical model for the Type and it compiles, but when I use the new Type in TRNSYS I get the following "error":

TRNSYS Message 463: The SetNumberStoredVariables subroutine was not called to set the number of storage locations required before the SetStaticArrayValues routine was called. Please check formulation of the specified TYPE.

I use as reference for my code the one of the Type1288 provided in TESS library, but as this code was done for TRNSYS 16 I don't have a clear reference for the TRNSYS's functions for the storage of variables. I tried using the Dynamic and Static statements to store a value but I still don't understand how to solve this error.

In my code I use the statements for the storage of variables in this way:

--------- After convergence manipulations
      If(getIsEndOfTimestep()) Then
...
        Do i=1,Number_in_Series
  Do j=1,Number_of_Nodes_per_Collector
    Call setStaticArrayValue(((i-1)*Number_of_Nodes_per_Collector+j),getStaticArrayValue(Number_in_Series*Number_of_Nodes_per_Collector+(i-1)*Number_of_Nodes_per_Collector+j))
EndDo
EndDo 
...
Return 
      EndIf
---------
--------- Very First Call of the Simulation Manipulations
If(getIsFirstCallofSimulation()) Then
...
N_Items=2*Number_in_Series*Number_of_Nodes_per_Collector
Call SetNumberStoredVariables(N_Items,N_Items)
! Number_in_Series and Number_of_Nodes_per_Collector are parameters of the  model
...
  Return
      EndIf
-----------
----------- First Timestep Manipulations
If (getIsStartTime()) Then
...
    N_Items=2*Number_in_Series*Number_of_Nodes_per_Collector
Do i=1,Number_in_Series
  Do j=1,Number_of_Nodes_per_Collector
     Call setStaticArrayValue((i-1)*Number_of_Nodes_per_Collector+j,Initial_Collector_Temperature)
 Call setStaticArrayValue(Number_in_Series*Number_of_Nodes_per_Collector+(i-1)*Number_of_Nodes_per_Collector+j,Initial_Collector_Temperature)          
       EndDo
EndDo
...
Return
      EndIf
-----------

​In advance, thank you so much for your help.

Best Regards,

Carlos Felbol A.​





--
Carlos José Felbol Acuña Ingeniero de Proyectos 
Grupo de Energía Solar
Pontificia Universidad Católica de Chile 
Departamento de Ingeniería Mecánica y Metalúrgica
Av. Vicuña Mackenna 4860, Macul
Santiago
Chile