Recompiling TRNSYS for non Windows Operating Systems


Recompiling TRNSYS 15 as a "console application" for use on non-windows operating systems is possible. However, you will lose a number of TRNSYS features such as the online plotter and the ability for TRNSYS to call other Windows programs. To recompile in this format, you will need a Fortran 90 compiler

The following combinations of operating systems and FORTRAN compilers have been tested:

WinNT (95/98/2000) Compaq Visual Fortran
  Salford FTN 95
  Lahey Fortran 90
Linux PGI90 (Portland Group)
  Lahey/Fujitsu LF95
Unix IBM F90

Console applications do not allow to use the ONLINE (TYPE 65) component. Only the CVF90 compiler allows calls to external WINDOWS DLLs or WINDOWS applications. Consequently, you will not be able to use TYPE 61, TYPE 66, userlib.for, or refprop.for.

Normally, when setting up a project to recreate the trnlib.dll for use on a Windows operating system, the user places all files in the \trnsys15\kernal and \trnsys15\types directory into the project. For recompiling as a console application, the user will replace one file with a version specific to their compiler.

  1. place all .for files from \trnsys15\kernal and \trnsys15\types into the project.
  2. remove the file \trnsys15\kernal\trnsys_win32_cvf90.for from the project.
  3. add one of:

    trnsys_ibm_f90.for

    trnsys_linux_lf95.for

    trnsys_win32_ftn95.for

    trnsys_win32_lahey.for

    depending upon the operating system and compiler being used. These files will can be found in the \trnsys15\kernal\OS_Comp\ directory of your standard TRNSYS installation. If you cannot locate them, ask your TRNSYS distributor for assistance.

  4. remove trnsys.for, exec.for and clock.for
  5. add trnsys_exe.for, exec_exe.for, and clock_exe.for
  6. the remainder of the recompilation process is similar to that for a .dll, however, as settings and procedures are different from compiler to compiler and from operating system to operating system, it is not possible to give comprehensive information here. Instructions on recompiling TRNSYS as an .exe for Windows using the Compaq Visual Fortran compiler is available in the tutorials section of this website. You may find that document to be a good starting place for your efforts.

Example:

To create a version of TRNSYS that will run under LINUX using the Lahey/Fujitsu LF95 compiler, use the following files:

trnsys_exe.for
exec_exe.for
clock_exe.for and
trnsys_linux_lf95.for

The following files should be removed from the project.

trnsys.for
exec.for
clock.for
trnsys_win32_cvf90.for

Furthermore, the following files from the standard distribution should be removed as they use Windows specific features.

callprogram.f90
userlib.for
online.for
refprop.for

A Couple of Notes Concerning LINUX

  1. LINUX is case sensitive: Type1.f is NOT the same as type1.f
  2. The suffix used for FORTRAN files in LINUX is different: *.f is used instead of *.for. It is easy to automatically change all filenames with a tool (for example, WindowsComander ==> www.ghisler.com) [if you're doing this under LINUX, you probably want to use one of the -free- tools that come with the shell - note from the editor who doesn't like the WindowsComander].