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

[TRNSYS-users] Sharing some informtion - (simple example and Some hints to creat new component via simulation studio)



Hello everybody

 

I was trying to follow the trnsys guide line to create the new components in simulation studio. I faced problems in compiling the exported fortran skeleton. Regarding to trnsys instruction “creating new component” in page 1-65 of the manual “Getting started”; I was looking for right place to add the equation in the fortran skeleton. After search and asking trnsys users I have got it and I think every beginner in trnsys would face the same.

I hope it helps.

 

Simple example: Generation of a new component via simulation studio

 

Generation of the component which is able to evaluate this equation:

Opt = inp + par

 

Input: inp

Output: opt

Parameter: par

 

  1. First we have to follow the instruction of “creating new component” which has been mentioned in page 1-65 of trnsys manual “Getting started”.
  2. This instruction should be followed up to the end of exporting the new component to fortran.
  3. When the fortran Skelton is coming up in CVF 6.6B the desired equation should be written along with some modifications.
  4. in page 1-68 of transys instruction “Getting started” it has been mentioned the desired equation has to be replaced with question marks “ ? “ in the fortran skeleton but there is no sign of question mark in  trnsys 17 and CVF6.6B
  5. For this simple example we have to add our desired equation just after this comment “! Perform All of the Calculations Here to Set the Outputs from the Model Based on the Input”. We have to write opt=inp+par
  6. Moreover, when the output is calling we have to put our output instead of default value which already is 0.

            Call SetOutputValue(1, 0) ! opt                            Call SetOutputValue(1, opt)

  1. Finally in declaration part of the script  “!Trnsys Declarations” we have to define the output by writing this script “DOUBLE PRECISION opt”
  2. Now the new component would be successfully compiled.

 

Finally as attached you can find two fortran program as references:

1-     The automatically exported fortran script in CVF6.6b from simulation studio without modification which could not be compiled

2-     Modified script which could be compiled (the modifications are highlighted)

 

Thanks to David Bradley, Stefan Thiemann and Jaime Gonzalez Rodriguez for their replies.

 

Regards

Mehdi Shahrestani

 

Attachment: Type211 after modification.doc
Description: MS-Word document

Attachment: Type211 before modification.doc
Description: MS-Word document