Beruflich Dokumente
Kultur Dokumente
PSS®E version 30 and version 31 can both be installed on the same computer and they will coexist
without interfering with each other (version 30 means any 30.x.x release).
However, there are some management issues that exist for users in one or both of the following
situations:
a. Those who need to compile and link user-written Dynamics models and/or Connection rou-
tines (i.e., CONEC and CONET), and to be able to do this for both versions, switching
between them from time to time.1
b. Those who intend to run PSS®E from the Python interpreters outside of the PSS®E GUI
environment, and to be able to do this for both versions, switching between them from time
to time.
To compile user-written Dynamics models and/or Connection routines and link a Dynamics User
Library you must use the same compiler(s) as the version of PSS®E that they are to be used with.
Version 30 and version 31 use different Fortran and C compilers (both run-time environments are
referenced, even if only Fortran code is used).2 In order to select the correct compiler versions the
Windows environment variables PATH and LIB need to be set appropriately.
Additionally, when running PSS®E from Python interpreters outside of PSS®E GUI environment,
the Python interpreter executables need to be activated with a PSS®E version specific activation
code.
Both of these issues can be managed using the PSS®E Version Management program described
in Section 1 below. A description of manual processes for managing the two issues are described
in Section 2 below, should you prefer it.
To use the PSS®E Version Management program, download the self-installing exe file for “PSS®E
Version Management” from PSS®E User Support Web page and install it. The installer will:
• Install the PSS®E Version Management program and user guide in the
C:\Program Files\PTI\PSSEVMgmt folder.
• Add a “PSSEVMgmt” desktop icon
• Add menu item Start >Programs >PSSE Version Management >Run
• Add menu item Start >Programs >PSSE Version Management >User Guide
1 This issue does not apply to users who have installed the 30.3.3 release built with the IVF compiler. PSS®E 30.3.3 is
available in both compiled forms.
2 If your source code is in FLECS, all the Fortran comments apply; FLECS is a pre-processor that generates Fortran
code, which is then compiled using the Fortran compiler.
• Controlling the version of Python and the version of PSS®E used to run a Python script out-
side of PSS®E’s GUI (see Section 2.1 below).
• Select the proper environment to compile Connection Routines and User Models, and to
link a Dynamics User Library (see Section 2.2 below).
(i) Start --> Settings --> Control Panel (ii) Select Properties from the context menu of
the desktop icon “My Computer”
Open System (double click)
Select Properties
Select tab Advanced
Select tab Advanced
Click button Environment Variables
Click button Environment Variables
B. If the System PATH variable contains C:\Python23 and/or C:\ Python25, remove
them.
D. Click the ‘New’ button in the ‘User variables’ section of the ‘Environment Variables’
dialog opened in (A). This opens the following dialog. Set these variables with appro-
priate values as shown below.
E. Create new or edit User variable PATH. If you already have a User variable PATH,
check for, and remove, references to the installed Python paths as we did for the
System PATH variable in (B) above. Add the variable PATH_PY25 or PATH_PY23 to
the User PATH variable, as shown below (either one, for now – but NOT both).
or
The steps (B), (C), and (D) above are needed only once. If you selected to add the vari-
able PATH_PY25 in (E) above, you are set up to run Python 2.5. If you selected to add
the variable PATH_PY23 in (E) above, you are set up to run Python 2.3. To change
between them, edit the User PATH variable as shown above and change PATH_PY25 to
PATH_PY23 or vice versa.
Be aware that changing environment variables does not affect running processes. For
example: if you open a Command Prompt and then change PATH_PY25 to PATH_PY23
as described above, and then run python, you will run Python 2.5 because that process
retains the value of PATH at the time that it started. If you now open another Command
Prompt and run python you will run Python 2.3.
In the examples in (E) above the variables we have been discussing are shown following
another variable specification. All elements in path lists, whether fixed paths or other
environment variables, are separated by semi-colons. The particular values shown here
are not random, but are related to this discussion. See Section 2.2.
When you run Python outside of the PSS®E GUI the program you are actually executing
is either python.exe or pythonw.exe. The PSS®E installer “activates” both of these pro-
grams. However the activation process only uses the name of the program, not the loca-
tion, version, or any other identifying characteristic to differentiate between two programs
with the same name. Since the executable files python.exe and pythonw.exe are the
same for Python 2.3 and 2.5 this means that each can only be “activated” for one version
of PSS®E at a time.
In an environment where both versions 30 and 31 of PSS®E are installed you may need
to change the activation of the Python executable files. One straightforward way of
achieving this is as follows:
A. Create two batch files, actvpy30.bat and actvpy31.bat, as follows:
• Contents of actvpy30.bat:
• Contents of actvpy31.bat:
Where:
• If you use any other Python executables (like pythonwin.exe), add those to this list.
• C:\PROGRA~1\PTI\PSSE30\PSSBIN is the PSS®E 30 installation path. If your
installation path is different, modify accordingly.
• C:\PROGRA~1\PTI\PSSE31\PSSBIN is the PSS®E 31 installation path. If your
installation path is different, modify accordingly.
• PUT_YOUR_V30_CODE_HERE and PUT_YOUR_V31_CODE_HERE are your activa-
tion strings. Substitute you actual activation strings in the code above.
B. Keep these files in a folder which is on your windows PATH, so that it can be accessed
from any folder. For example, C:\WINNT on Windows XP machines.
These steps are needed only once. Afterwards, if you are currently using, say, version
31 and want to switch to version 30, run actvpy30.bat. Following are two ways to do this:
• From any Command prompt window, run actvpy30.bat, from any location. The fol-
lowing example assumes you are located at the root directory of the C: drive:
C:\>actvpy30
2.1.3 Finding the PSS®E extension module and engine library from Python
Python searches for extension modules according to the paths included in the import path
list. This list can be examined in a Python program in sys.path. The initial setting of the
values in that list is beyond the scope of this document. Python modules may be in one
of several forms, including Python source, compiled Python code, and dynamic-link-
libraries. If a Python module is implemented as a dynamic-link-library, then it may in turn
be linked to other libraries. Those libraries will use the standard Windows load search
path, which is different than the import search path used by Python.
Both of these search paths use environment variables to set up part of the directory lists.
PYTHONPATH is used for the Python module search path, and PATH is used by the Win-
dows loader.
The list in sys.path can be manipulated by a running program, and the PATH environment
variable can also be changed by a running program (changing PYTHONPATH in a run-
ning program will not be helpful, since it is only used to initialize sys.path). Eaxmples of
this technique can be found in Chapter 12 of the Users Manual.
Both the Python extension modules and the libraries supplied with PSS®E will be located
in the PSSBIN directory of your PSS®E installation. This directory will need to be located
on both the Python import path list and the Windows load search path.
Similarly, when Visual Studio (1998) and the CVF compiler are installed, windows SYS-
TEM variables PATH and LIB are set by their installation. Typically the PATH and LIB val-
ues corresponding to these programs are:
(i) Start --> Settings --> Control Panel (ii) Select Properties from the context menu of
the desktop icon “My Computer”
Open System (double click)
Select Properties
Select tab Advanced
Select tab Advanced
Click button Environment Variables
Click button Environment Variables
B. Check values of the PATH and LIB variables in "System variables" section. You may
want to copy these values to a file using a text editor to make the following steps a
little easier.
If the LIB and PATH variables have any of the paths described above, they need to
be removed from here and set as "User variables", as described in (C), below. If these
paths are not present you will have to search your system for the installation paths of
the Visual Studio, CVF, Visual Studio 2005 and IVF programs in your computer.
C. Create new User variables LIB_IVF, PATH_IVF, LIB_CVF, and PATH_CVF as shown
below.
Click the ‘New’ button in the ‘User variables’ section of the ‘Environment Variables’
dialog opened in (A). This opens the following dialog. Set these variables with appro-
priate values obtained in (B). Their typical values are provided below.
LIB_IVF:
"C:\Program Files\Microsoft Visual Studio 8\VC\lib"
"C:\Program Files\Intel\Compiler\Fortran\9.1\IA32\Lib"
PATH_IVF:
"C:\Program Files\Intel\Compiler\Fortran\9.1\IA32\Bin"
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
"C:\Program Files\Microsoft Visual Studio 8\Common7\Tools"
"C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin"
"C:\Program Files\Microsoft Visual Studio 8\VC\BIN"
"C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin"
"C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages"
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin"
"C:\WINNT\Microsoft.NET\Framework\v2.0.50727"
LIB_CVF:
"C:\Program Files\Microsoft Visual Studio\DF98\LIB"
"C:\Program Files\Microsoft Visual Studio\VC98\LIB"
PATH_CVF:
"C:\Program Files\Microsoft Visual Studio\Common\Tools"
"C:\Program Files\Microsoft Visual Studio\Common\Msdev98\BIN"
"C:\Program Files\Microsoft Visual Studio\DF98\BIN"
"C:\Program Files\Microsoft Visual Studio\VC98\BIN"
D. Create new ‘User variables’ LIB and PATH as below to set LIB and PATH corre-
sponding to PSS®E version 31.
Steps (A) through (C) are needed only once. If you entered the LIB_IVF and PATH_IVF
variables as shown above, then you are set up to run the IVF compiler and version 8 of
the MS compiler and linker. If you entered instead the LIB_CVF and LIB_IVF variables,
then you are set up to run the CVF compiler and version 6 of the MS compiler and linker.
To change between them, edit the User PATH and LIB variables as shown above and
change IVF part of the name to CVF or vice versa.
Be aware that changing environment variables does not affect running processes. For
example: if you open a Command Prompt and then change PATH_PY25 to PATH_PY23
as described above, and then run python, you will run Python 2.5 because that process
retains the value of PATH at the time that it started. If you now open another Command
Prompt and run python you will run Python
In the exact examples shown in (D) above only the single variable value is entered. Mul-
tiple values of variables and/or path names are allowed, separated by semi-colons.