Troubleshooting for TRNSYS/Type 169

20th Jun 2022

A new component for Python, Type 3157 (Calling Python from TRNSYS with CFFI), has been released and is more functional and stable than Type 169. I strongly recommend using Type 3157.

Calling Python from TRNSYS with CFFI

The following is a list of things to check if Type169 does not work properly.

The version of Python you have installed

First of all, please make sure that your Python environment is suitable for running Type169.

  • Python 3.6, or equivalent Anaconda version.

To use Type169 with other Python versions, you will need to build Type169 for that version.

Since the TRNSYS18.04.0000 release, the TRNSYS18\Exe\DLLS folder contains the pre-built DLLs. Unzip the compressed file corresponding to the Python version you are using and overwrite it in the C:\TRNSYS18\UserLib\ReleaseDLLs folder.

Type169 built for Python 3.8 is available at the following link.

Note: Type169 is built for the 64bit version of TRNSYS and Python. It does not work with the 32-bit version of TRNSYS and Python.

Errors and solutions

”TRNSYS Message 105 : A TYPE was called in the TRNSYS input file…”

*** Fatal Error at time   :         0.000000
    Generated by Unit     : Not applicable or not available
    Generated by Type     :   169
    TRNSYS Message    105 : A TYPE was called in the TRNSYS input file but was either not linked into trndll.dll or was not found in an external dll. A dummy subroutine was called in its place. Please link the TYPE or remove it from the input file
    Reported information  :  Type169 could not be located in either the TRNdll64.dll or in an external dll. Please relink theTRNDll64.dll including this Type or make sure that an external DLL in the \UserLib\DebugDLLs and \UserLib\ReleaseDLLs folders contain the Type.

If the appropriate version of Python is already installed, Type169 is unable to reference the Python path.

As a workaround, add the Python path to the environment variable, PATH, so that Type 169 can refer to the Python library.

The following is an example of specifying the Anaconda path.

Note: The path should match the Anaconda installation directory.

An empty error manager dialog is displayed.

When the calculation is executed, an error manager dialog is displayed immediately afterwards, but no error message is shown on the dialog.

This can occur if the environment variable PYTHONPATH is not defined.
Please define PYTHONPATH in the environment variable as shown in the image. The picture is an example of definition for Anaconda3.8.

If the above does not solve the problem, it is probably something in your Python environment. As a workaround, try the following steps.

  1. Download the Python embeddable version from the official Python website.

Download the “Windows x86-64 embeddable zip file” for the version corresponding to Type 169.

For example, to download the embeddable version of Python 3.8.3, click on the link in the red box in the picture below.

  1. Once the file has been downloaded, unzip the zip file.
  1. Copy all the unzipped files to the TRNSYS folder (C:\TRNSYS18\Exe).

Note: I haven’t tried this, but it might work around the error “TRNSYS Message 105 : A TYPE was called in the TRNSYS input file…”. error may also be avoided with this.

Floating point division by zero.

When you run the calculation, you will get an error message as shown in the picture.

Floating point division by zero.

If you click on the “OK” button, you will get a further error message as shown in the picture.

An unexpected error was encountered and TRNSYS will abort.

This error occurs if you are importing a non-standard library in a Python script. For example, if you are importing Numpy, you will get this error.
The cause of the error is under investigation.

Test Environment

It has been confirmed that the software works in the following environments.

Windows10 Pro(64bit, 20H2)



  • Dear Yuichi,
    I am a Ph.D. student from the Sapienza University of Rome and I am trying to work with TRNSYS and Python. I have read the “Troubleshooting for TRNSYS/Type 169” on your website and being grateful for your solution, it solved my problem. I still have another problem described as below and I would really appreciate it if you could guide me through it:

    When I use only one Type169 in TRNSYS, it works fine. But when the number of Type169s go beyond one (e.g. two Python components), TRNSYS executes only the commands stored in one of the python scripts. I have changed the order of python components (by using setting -> component order) and apparently, TRNSYS reads only the codes of the Type169 that has a higher index in “component order”. Would you please let me know how I could force TRNSYS to read both of my python scripts?
    I can share my TRNSYS files and python scripts if you send me an Email.

    Thank you very much and best regards,
    Erfan Tajalli-Ardekani

    • Erfan,
      I’m sure the early versions of Type 169 had the problem you are pointing out.
      What version of TRNSYS are you using?
      Updating TRNSYS to the latest version may solve the problem.


    • Erfan,

      I tried it under the conditions you pointed out, and got the same result.
      TRNSYS seems to read only the Type 169 code with a high index in the “Component Order”.

      This is probably a defect of Type 169. Please contact your distributor for advice.


    • Erfan,

      I re-read the source code of Type169. As it turns out, it seems to be difficult to use multiple Type169s in one project.
      In other words, only one Type169 can work correctly per project.


      • Dear Yuichi,

        Thank you very much for your replies. As you have said, we can apparently use only one Type169. I hope by modifying the source code this problem gets solved.


  • Dear Yuichi,

    I was also hampered by the problem of so-called “floating point division by zero”. Do you have any solution to this problem?
    By the way, I noticed that you have Type155.dll for Matlab2020a. Could you kindly share this file or other updated version with me?

    Thank you very much and best regards,


    • Dear Ethan,

      There is currently no solution for “floating point division by zero”.

      Please contact your TRNSYS distributor to obtain Type155.dll.


Leave a Comment

Your email address will not be published. Required fields are marked *