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

Re: [TRNSYS-users] help abuout programing new compoment



Duguofu,
  I have never found a very satisfactory way of making an adjustable array in a Type. It is possible but I have found that it is more trouble than it is worth. What is typically done instead is to define the array with a maximum size (set as a parameter in the Fortran code - NOTE that this is NOT a TRNSYS component parameter) and then only use what you need of the array. For example:

DOUBLE PRECISION myArray
INTEGER maxArraySize
PARAMETER (maxArraySize=100)
DIMENSION myArray(maxArraySize)

 This method was used a lot in Trnsys16 for handling components that have a variable number of parameters, inputs or outputs. You can look at Type17 as an example. In Trnsys17 access to the parameters, inputs, and outputs is typically done through access functions like getParameterValue() so you don't need to worry so much about setting up the size of the PAR() array the ways you used to.
 David

 

On 11/26/2013 04:49, fuguodu wrote:

Dear all,

Good day!

I met an problem when I want to program a new compoment.Since Trnsys cancel the type’s program arguments. So how to define adjustable array. I define adjustable array in new compement’s tmf and use file /export as /fortran. auto generated file ( .for ) does not contain any information about adjustable array. the name of array is just handled as a single variable.

Did you meet this problem? How could you deal with it?

Thank you, looking forward to your reply.

Best Regards

Duguofu



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

-- 
***************************
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