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

RE: writing your own component



Dear Ruut, 

Here is my view on the pro's and con's of the external DLL:

External DLL Pro's:

- If you are familiar with another programming language, 
  you do not need to learn Fortran
- You do not need to have a Fortran compiler 
  (Note however that I strongly recommend you to acquire
  one if you are going to develop your own Types!)
- Once your Type is ready, you can just give your DLL 
  to anyone using TRNSYS, s/he will be able to use it 
  without recompiling nor rebuilding anything. 

Fortran Pro's:

- Using Type61 and external DLL's is harder to set up, 
  but it is possible. You can have a look on a discussion 
  thread from this email list about using a DLL programmed 
  in Delphi: 
  http://sel.me.wisc.edu/trnsys/mailinglist/archive1999-2002/msg00672.html
- With Fortran, you can use the skeleton created by IIsiBat
  (Create a new component and export as Fortran). That way 
  all "typical TRNSYS TYPE behavior" is already coded for you.
- You can use all existing Types as template/reference 
  (and copy-paste some tricks used by other developers).
- Debugging is certainly easier, although it is also 
  possible to debug an external DLL.
- Fortran has some dangerous features (e.g. implicit 
  variables) but you can avoid most of them by strictly 
  adhering to good-practice rules. (e.g. use the 
  "implicit none" statement)
- Fortran is reasonably intuitive for mathematical 
  programming


The decision will also depend on what you intend to do with the component
(use it in TRNSYS only, etc.)

If you are not a Delphi or C++ wizard and if you don't absolutely want to
use some existing code in another programming language, I would recommend
you to give a try to Fortran using the skeleton generated by IISiBat and
have a look to other Trnsys Types for reference. Everything you learn that
way will be useful for you, even if you decide to switch to an external DLL
afterwards. Don't forget that you can always get help from your distributor
and from people on this list.

Good luck,

Michaël Kummert

_________________________________________________________

Michaël Kummert

Solar Energy Laboratory - University of Wisconsin-Madison
1303 Engr Res Bldg, 1500 Engineering Drive
Madison, WI 53706

Tel: +1 (608) 263-1589
Fax: +1 (608) 262-8464
E-mail: kummert@engr.wisc.edu

SEL Web Site: http://sel.me.wisc.edu 
TRNSYS Web Site: http://sel.me.wisc.edu/trnsys




> -----Original Message-----
> From: owner-trnsys@relay.doit.wisc.edu 
> [mailto:owner-trnsys@relay.doit.wisc.edu] On Behalf Of Ruut Brandsma
> Sent: Monday, March 03, 2003 06:00
> To: Trnsys mailing list (E-mail)
> Subject: writing your own component
> 
> 
> Dear reader, 
> 
> I plan to make a greenhouse component in Trnsys. I studied 
> chapter 2 and 3 of the reference manual and I also studied 
> the description of type 61 (calling external DLL). Could you 
> tell me what the disadvantages are of calling an external DLL 
> instead of making a component with Fortran. 
> 
> 
> With kind regards,
> 
> Ruut Brandsma
> Modelling specialist
> Ecofys b.v
> Our Mission "A sustainable energy supply for everyone"
> ---------------------------------------------
> P.O. Box 8408
> NL-3503 RK Utrecht
> Kanaalweg 16-G
> NL- 3526 KL Utrecht
> The Netherlands
> ---------------------------------------------
> tel. +31 (0)30 280 84 35
> cell.+31 (0)6 1500 22 05
> fax +31 (0)30 280 83 01
> email R.Brandsma@ecofys.nl
> ---------------------------------------------
> Visit our Homepage!	 		http://www.ecofys.com
> Monitor your Energy Usage!		http://www.Enerlyser.com
> Make use of Solar Energy!		http://www.BeldeZon.nl
> Green energy in Europe		http://www.greenprices.com 
> 2002: the year of the urban turbine!	http://www.urbanturbines.com 
> For a sunny choice:			http://www.mysolar.com  
>  
>