Siemens Energy, Inc. Power Technology Issue 111 Creating Dynamics User Model Dynamic Linked Library (DLL) for Various PSS E Versions Krishnat Patil Staff Software Engineer krishnat.patil@siemens.com Jay Senthil Senior Staff Software Engineer jayapalan.senthil@siemens.com General PSS E users, in addition to using the vast array of time tested library of dynamic models, can also write their own models in high-level language like FORTRAN or FLECS. For PSS E to recognize such userwritten models, the models written in FORTRAN or FLECS have to be compiled and a dynamic linked library (DLL) created using the compiled code. This article discusses the following aspects pertaining to creating user model static library (LIB) and dynamic linked library (DLL) files: Static LIB file or dynamic DLL files which one should the user use Compiler and Visual Studio software requirements for creating LIB and DLL files of PSS E userwritten models Use of Environment Manager (EM) for creating LIB and the DLL files Static library (LIB) or dynamic library (DLL)? The decision on whether to supply a LIB or the DLL of the user model depends on the PSS E version for which the model is developed. PSS E 33 and future versions For PSS E 33 and all future versions, it is recommended that the user always creates and provides the DLL files. The DLL file can have any name; it does not necessarily have to be dsusr.dll. If the DLL is named dsusr.dll, then PSS E will automatically load this at start-up, provided that PSS E is able to locate this DLL in its search path. If the DLL is named anything other than dsusr.dll, then the user has to load this DLL prior to running PSS E dynamics run. This can be done either from the graphical user interface (GUI) (via Tools>Load Model Library), or by using the ADDMODELLIBRARY API. It is to be noted that use of DLL will not require the user to perform any further compile or link operations. PSS E 32 and earlier versions For PSS E 32 and earlier versions, it is recommended that the user always creates and provides the LIB files. You can give any name to the LIB file. The PSS E user who uses this LIB file will have to perform further compile and link operations on this LIB along with connection routines (CONEC and CONET) to create dsusr.dll.
Software Requirements To compile and link user-written models, the appropriate Fortran compiler and Microsoft Visual Studio (C/C++) are needed. The compiler and linker used in various PSS E versions are as given below. 1. Version 33: Intel Visual Fortran Compiler version 12.0 and Microsoft Visual Studio 2010 (C/C++ compiler and linker version 10) 2. Version 32: Intel Visual Fortran Compiler version 10.1.024 and Microsoft Visual Studio 2008 (C/C++ compiler and linker version 9) 3. Version 31 and Version 30.3.3 IVF: Intel Visual Fortran Compiler version 9.1 and Microsoft Visual Studio 2005 (C/C++ compiler and linker version 8) 4. Version 30 and previous versions: Compaq Visual Fortran Compiler version 6.6B and Microsoft Visual Studio 1998 (C/C++ compiler and linker version 6) Although the compiler and linker versions specified above were used for the various PSS E releases, from a users point of view they can use any of the Fortran compiler and Microsoft Visual Studio versions as indicated below. 1. For Versions 33, 32, 31 and 30.3.3 IVF compile and link works well with Intel Visual Fortran (IVF) Compiler 9.1 or later Microsoft Visual Studio 2005 or later 2. For Version 30 and previous versions compile and link works well with CVF 6.6B Microsoft Visual Studio 1998 Microsoft Visual Studio comes in three different versions, any of which can be used for creating the DLL in PSS E 1. Microsoft Visual Studio Express Edition 2. Microsoft Visual Studio Premier Partner Edition (VSPPE) 3. Microsoft Visual Studio Professional It is to be noted that the Microsoft Visual Studio is available for Visual Basic as well; however, this cannot be used in PSS E for creating the DLL. PSS E Environment Manager (EM) The Environment Manager (EM) is a versatile tool that can be used to do the following: 1. Compile user-written models 2. Create static library (LIB) files 3. Create dynamic linked library (DLL) files 4. Set up the environment variables required to run specific PSS E versions The EM tool requires Python version 2.5 or 2.7. It is to be noted that the EM is independent of the PSS E version. Although the EM is provided as part of PSS E installation, since the EM is subject to updates to meet the wide requirements of our users, it is advisable to download the latest version of EM from the PSS E user support web page https://www.pti-us.com/pti/software/psse/user_support.cfm. When using the EM to compile and link, it is not required to update Windows Environment variables PATH and LIB. Instead these variables are updated temporarily by the EM and used as needed. This avoids the user from making modifications to Windows registry leading to possible permission conflicts. The EM can be used from: Graphical User Interface (GUI) Python script For details, the user is referred to the EM guide that is provided as part of the EM installation. Page 2
The GUI and progress message window when creating DLL for PSS E version 33, and GUI window when creating LIB for PSS E version 32 are shown below. Figure 1 - Create DLL for PSS E 33 Page 3
Figure 2 - Create LIB for PSS E 32 Page 4
Figure 3 - Progress Message when Creating PSS E 33 DLL Page 5