Frequently Asked Question

How do I import external python packages in Typhoon HIL?
Last Updated 2 years ago

When you wish to import external Python packages in Typhoon HIL, an important thing must be taken into consideration – different tools within Typhoon HIL utilize different kinds of Python interpreters. You can learn more about these Python interpreters in our documentation.

HIL SCADA and Schematic Editor

HIL SCADA and Schematic Editor are using a Python interpreter created during the build of our software. This Python interpreter is frozen from that build procedure, and you cannot install anything to it as a user. However, there is a workaround which enables you to use additional packages in HIL SCADA and Schematic Editor. The main idea behind this workaround is to add the appropriate path from your computer (where the package you wish to add is actually installed), into this frozen Python. The procedure, in an example where the Pandapower package is installed, is shown below:

  1. Open the Command Prompt
  2. Type the following command: typhoon-python -m pip install pandapower – this will install the package into our environment directly
  3. Open HIL SCADA
  4. In the Panel Initialization write the following code:
import os 
from os import path 
import sys 
sendto_dir = path.expandvars(r'C:\Users\user_name\AppData\Roaming\typhoon\20XX.X\python_portables\python3_portable\Lib\site-packages') 
add_to_python_path(os.path.normpath(sendto_dir)) 
import pandapower as pp 

   5. After starting the simulation/running the initialization script, Pandapower will be available.

    Note:

    • The path specified in step 4 should be set according to your own username and version of Typhoon HIL Control Center that is used.
    • To install packages, you will need to have administrator rights on your PC.

    The same procedure that was shown above for HIL SCADA, can be performed if you wish to import external Python packages into Schematic Editor. Instead of step 3, you should open Schematic Editor and add the code from step 4 into Model Initialization script inside Schematic Editor.

    TyphoonTest IDE and Script Editor

    By using Typhoon Test and Script Editor, you can write scripts and run them either by Typhoon Python or any other Python interpreter you have installed on your computer. Typhoon Python is the embedded Python which we ship with our installation. In Typhoon Python, as with any Python you may have installed on your PC, you can install any library that you want.

    The procedure for adding/installing an external Python library in Typhoon Test IDE can be found in this knowledgebase article.

    Please Wait!

    Please wait... it will take a second!