Anda di halaman 1dari 46

Chapter 16

Program Automation
Chapter 16 - Program Automation

16.1 What is Program Automation?


Program automation in PSSE provides the mechanism to control PSSE execution other than by
direct user interaction. This is the ability to define a set of operations for PSSE to perform in a file
of some kind (explained in the following sections) and to tell PSSE to use the instructions in that
file as a single command. We will call these files Automation Files. There are two primary ways to
use Automation Files:

As a program extension. In this case the user, in the course of using the program interactively, can decide to select an existing Automation File as the next instruction to the
program.

For un-attended execution. This is commonly called batch execution. In this case the
entirety of the users interaction would be the specification of the source of the instructions for it to execute (although there may be other options specified at the same time).

Although there are a few minor exceptions, for the most part the specification of the instructions, i.e.
the contents of the Automation File, is the same in both cases.
The following sections will concentrate on the first alternative. Near the end of the chapter is a
section on batch execution. There is also a section on entering single commands; while not a
program automation method it uses the commands defined here and is best understood in this
context.

16.2 Controlling PSSE Execution Using the API


Activity Application Program Interface

An Application Program Interface (API) is a set of callable routines for building software applications. PSSE has a supported, documented API available for use with PSSE. The API is the
primary and recommended method for accessing PSSE functionality for automation. The PSSE
API is described in PSSE Application Program Interface (API). That manual includes descriptions
of the syntax for using each API routine in each automation method in which it is supported. Not
every API routine is supported in every automation method.
In most cases the API manual will also describe the syntax for calling an equivalent Fortran
subroutine.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-1

PSSE 33.4
Program Operation Manual

Program Automation
Automation Methods in PSSE

Siemens PTI will support users who make use of the API through the automation methods
described here, such as batch commands and Python programs, only. No support is provided
for Fortran or, say, C applications developed by users of PSSE.

16.3 Automation Methods in PSSE


Activity Automation Methods

There are six automation processors in PSSE:

An embedded Python interpreter (refer to Section 16.4 Python Programs)

The Batch (or BAT_) Command interpreter (Section 16.5 Batch Commands)

The Line Mode Interpreter (LMI) (Section 16.11 Line Mode Commands)

The PSSE Engineering Basic (PSEB) macro processor (Section 16.14 Building a
Response File, Power Flow Calculation)

The PSSE Simulation Run Assembler (PSAS) macro processor (Section 16.15
Building a Response File, Dynamic Simulation)

The IPLAN simulator (Section 16.16 Launching an IPLAN Program File)

Only five file types are available in the GUI, because line mode commands and batch commands
can be intermingled in the same file, so the Response File file type (*.idv) is used for either (or both).
Some general observations are appropriate at this point:

Python and IPLAN are both programming languages, i.e. they can be used to write any
kind of a program, not just control PSSE (although IPLANs features are fairly limited,
relatively speaking).

IPLAN programs must be compiled (they do not need to be linked). The compiler
(called IPLAN) is a Siemens PTI product and supplied with PSSE. The source files
are of file type *.ipl. The result (*.irf) are not object code files in the normal sense, but
a unique format.

Python programs are interpreted (one command at a time is executed - no compilation


is necessary); although Python does support optional byte-compilation.

PSEB and PSAS commands can also be embedded in Response Files, albeit in a particular context.

Python programs can use existing IPLAN programs and Response Files. The other
automation methods can all interact with each other.

Response Files, PSAS, and PSEB Command Files are free-format data files.

16.4 Python Programs


Python is an OSI certified, freely available, object-oriented, interpreted programming language. Its
syntax and usage are well-documented on the web and in numerous publications, so we will
concentrate here solely on its interaction with PSSE.
A Python installer is included in the PSSE program installation package for your convenience. The
language can also be downloaded from the official Python site at http://www.wxpython.org/. Python
language documentation, extension modules, book recommendations, and user forums are also
available directly from this site. Siemens PTI recommends the following textbooks for reference:

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-2

PSSE 33.4
Program Operation Manual

Program Automation
Python Programs

Learning Python - Lutz and Ascher

Python Essential Reference - Beazley

Programming Python - Lutz

Python in a Nutshell - Martelli

Python Cookbook - Martelli and Ascher

Python Programming on Win32 - Hammond and Robinson

Siemens PTI supports the use of Python programs within PSSE, however, the language
itself is not supported nor maintained by Siemens PTI staff.
The PSSE installation package will also install the following freely available third-party extension
modules:

wxPython (http://www.wxpython.org//)

win32all (Python Extensions for Windows) (http://sourceforge.net/projects/pywin32/)

Python files can be in source form (*.py, *.pyw) or byte-compiled (*.pyc). Python Files can be used
in PSSE in any of the following ways:

From Run Program Automation File (see Section 16.3 Automation Methods in
PSSE)

At program startup by using the -pyfile option (see Section 16.9 Unattended Execution
of PSSE)

16.4.1 PSSE Extension Modules For Python


One of Pythons greatest strengths is its ability to be easily extended. These extensions can be
written in Python or in system languages (C/C++, Fortran, etc.). Libraries and legacy code can be
therefore be made accessible in Python. It is also an excellent transition language in that it can
communicate with other programs and processes (e.g. Microsoft Excel). Extensions are accomplished through the creation and use of packages that Python calls modules.
Many extension modules are currently available on the Internet for download including: numeric
processing and optimization, graphic and data visualization (plotting), database connectivity, graphical user interface programming, XML and text processing, network programming and connections
to Microsoft Excel and Microsoft Access.
Your PSSE installation will include the following Python extension modules, documented in
PSSE Application Program Interface, that can be imported into user programs inside or outside of
the PSSE GUI:

excelpy - provides Python functions to interface with Excel; these functions can be
used to create, populate and format Excel workbooks from Python.

pssarrays - provides Python functions to retrieve PSSE solution results

pssexcel - provides Python functions to export PSSE data or solution results to


Microsoft Excel spreadsheets.

pssplot - provides access to the PSSPlot API

psspy - provides access to the PSSE API

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-3

PSSE 33.4
Program Operation Manual

Program Automation
Python Programs

Your PSSE installation will also include the following Python extension modules which can also be
imported into user programs inside or outside of the PSSE GUI:

bsntools - a set of simple bus name manipulation tools

caspy - provides access to the Saved Case Data Extraction routines (USRCAS)

createusrdll - provides a graphical interface to create a user dll for dynamics


simulation

dyntools - tools for processing channel output files

excelexport - provides a graphical user interface to PSSEXCEL for exporting PSSE


results into Excel spreadsheets.

plot2word - provides a graphical user interface to WORDPY for inserting plot/picture


files into a Microsoft Word document.

pssgrpg - provides functions intended to be used to supply valves to report nodes on


I-line diagrams

redirect - some tools to connect I/O streams between PSSE and Python

sliderPy - provides functions to directly manipulate diagram elements

wordpy - provides Python functions to interface with Microsoft Word; these functions
can be used to create, populate, and format a Microsoft Word document from Python.
This is especially useful to insert plot files (*.eps, *.wmf, *.png, etc.) created by
PSSPLT/PSSPLOT or any picture file into a Word document.

These modules are fully supported as part of the PSSE program product. There are other Python
modules and programs that are supplied with PSSE that either support the above modules or are
used by other program features. Modules that are designed as standalone programs (for example,
createusrdll) are also supplied. In addition you will find several *.py files supplied in the Example
directory for you to use and modify as you see fit.
Each of the modules above provides built-in documentation which can be accessed via the Python
help command. In the case of psspy, however, the result will be too voluminous to be useful. A
summary is available by entering:
help(psspy.psspyc)
Help is also available for individual API routines, e.g:
help(psspy.pout)
Some features of the psspy module that are not part of the API itself are documented in the doc
string for psspy. Enter:
print psspy.__doc__

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-4

PSSE 33.4
Program Operation Manual

Program Automation
Python Programs

16.4.2 The Embedded Interpreter Environment


PSSE contains an embedded Python interpreter. This is what allows PSSE to execute Python
files and commands. When the PSSE GUI is started, it initializes the Python interpreter and
executes a few initial commands. Those commands are:
import sys
sys.path.append(pathname)
import psspy
import pssplot
import os
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()
import sliderPy
import redirect
redirect.py2psse()
(where pathname is a variable containing a value retrieved from the registry; you will generally not
need to be concerned with this)
The os and sys modules are supplied with Python and contain commonly used functions for
accessing operating system features. The psspy, pssplot, and redirect modules are defined above.
The use of the _i, _f, and _s variables is explained in the section about default values in Python
Files, below, and in the PSSE Application Program Interface (API). The redirect.py2psse() function causes Pythons stdin (standard input) to use the function userin from the psspy module
(psspy.userin) and Pythons stdout (standard output) and stderr (standard error) to be redirected to
PSSEs progress device.
Note in particular that none of the modules are imported into the local name space. That means, for
example, that to use a PSSE API routine defined in the API manual as, say:
ierr = abc()
You would need to reference it as:
ierr = psspy.abc()
This is in keeping with standard practice for the Python community.
A Python program is shown below that performs the following:
1. Read a PSSE Saved Case file, savnw.sav, into working memory.
2. Solve the power flow.
3. Loop through the buses and print the bus number and area to the Report tab.
psspy.case('savnw.sav')
psspy.fnsl((0,0,0,1,1,0,99,0))
psspy.inibus(0)
while 1:
ierr,busnum,busname = psspy.nxtbus()

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-5

PSSE 33.4
Program Operation Manual

Program Automation
Python Programs

if ierr!=0: break
ierr,busarea = psspy.busint(busnum,'AREA')
psspy.report('%s %s' % (busnum,busarea))
One idiosyncrasy of the current embedded interpreter is that results are not automatically echoed
to the terminal as they are in the stand-alone Python interpreter. To view the values of expressions
you must use the print command.

16.4.3 The External Interpreter Environment


Python programs that access PSSE functions can be used without starting the PSSE GUI.
Python is installed with its own command line interpreter, its own integrated Development Environment (IDE) - called IDLE -, and programs can be written to create their own GUIs. Any of these can
use the PSSE supplied extension modules shown above.
In order to use the PSSE supplied extension modules in this way, you must first make sure that
the Python import path can find all the modules by name, and that the windows load path can find
any required DLLs. The following example replicates the environment in the embedded interpreter
explained in the preceding section:
>>> import os,sys
>>> sys.path.append(r"C:\Program Files\PTI\PSSE33\PSSBIN")
>>> os.environ['PATH'] = r"C:\Program Files\PTI\PSSE33\PSSBIN;"
+ os.environ['PATH']
>>> os.chdir(r"C:\work_dir")
>>> import psspy
>>> import redirect
>>> _i=psspy.getdefaultint()
>>> _f=psspy.getdefaultreal()
>>> _s=psspy.getdefaultchar()
>>> redirect.psse2py()
>>> psspy.psseinit(80000)
This example assumes the standard PSSE installation location, and a starting bus size of 80000.
Other values could have been chosen. Other techniques could be used as well. For example, if the
PYTHONPATH and PATH variables already contained the PSSBIN directory, then they would not
need to be set here. If the current directory was to be the working directory then that statement
would not be necessary, either. The only absolutely critical statements are the import psspy and
the call to psseinit.
The import of pssplot is omitted in the example above because its functions depend on the PSSE
GUI and cannot be used in this mode. There are some graphics functions in psspy for which this is
true as well.

16.4.4 The Embedded Interpreter Version


For PSSE versions 31, 32, and 33 the standard interpreter supplied for python has incompatible
with the PSSE GUI. As a result we have supplied a rebuilt copy of the interpreter that is installed
with PSSE. When you run the GUI, you are using this rebuilt interpreter. When you use the
external interpreter, you are running the native installed version.
For most uses you will see no issues. However, certain third party modules (which ones is very difficult to predict) will not load in the GUI for the same incompatibility reasons.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-6

PSSE 33.4
Program Operation Manual

Program Automation
Batch Commands

Starting with release 33.4.0, a new command line switch has been supplied to allow you to run any
of several versions of Python with PSSE, including the native interpreter for 2.7, the version that
we supply a rebuilt copy of. Through some internal conversions that we have developed, most of
the original problems have been avoided. If you specify no command line switch then you will still
get the rebuilt interpreter. The shortcut in the Start Menu will specify -pyver 27.

16.5 Batch Commands


Activity Batch Commands

Batch commands are free-format forms of inputs to the PSSE API. What this means is best illustrated by an example.
Lets say there is a PSSE API routine called abcd. It takes an integer argument (IVAL), a twoelement integer array (IDATA) and returns a floating-point value and an integer return code. The
batch command syntax for this hypothetical API routine would be:
BAT_ABCD IVAL IDATA(1) IDATA(2)
In other words, three integers after the command name that correspond to the arguments IVAL, the
first element of IDATA and the second element of IDATA, respectively. The returned values are not
represented. Furthermore, if the function of the API routine was only to return those values, then
there will not be a batch command syntax defined for it. The reason for this is that the batch
commands are not a language; there are no variables or logic controls. A batch command is really
data to the batch command interpreter, which then calls the indicated API routine with the input
values defined after the command name.
The format of the batch commands is the same as the standard free-format rules used for all
PSSE data files. The following additional rules apply to batch commands, though:

The command name itself is case insensitive, i.e. it doesnt matter whether you use
upper case or lower case letters, or mix them (the documentation will always define
them as all upper case).

The commands may be continued on multiple lines. The interpreter keeps reading data
until all the arguments that it needs for a given API routine are satisfied.

There is a special token, a semi-colon, that can be used to tell the interpreter that it
should return all remaining inputs to default settings for that particular API routine. It
must be a separate token, not part of the previous value. In our example above,
BAT_ABCD 1 34 ;
will reset the third value to the default value, but
BAT_ABCD 1 34;
will return a syntax error because 34; is not a valid integer.

Batch commands can be used in Response Files or entered as Command Line input.

16.6 Recording
Activity Recording

The PSSE interface is capable of recording PSSE API commands. Recorded API commands
can be in the form of either Python statements or batch commands (Response File) depending on
a specified user option. The easiest way to record a Python script (*.py, for Python statements) or
a Response File (*.idv, for batch commands) for later execution is to use the I/O Control>Start

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-7

PSSE 33.4
Program Operation Manual

Program Automation
Argument Passing

Recording option. Selecting this option will start the recorder. The entry of subsequent selections
of PSSE commands will record the API routines used to an automation file for later use until the
I/O Control>Stop Recording option is selected.

As an example, suppose you wanted to print power flow results to the Report View for buses 101,
201, 205, 154, and 3001. To record these interactions:
1. Select I/O Control>Start Recording and select the type of file you wish to record: Python
File (*.py) or Response File (*.idv).
2. Specify, say, busout.idv or busout.py as the filename depending on your selection of file type
in Step 1, and open it.
3. Select File>Open, select savnw.sav, and open it.
4. Select Power Flow>Solution>Solve. The power flow solutions dialog is displayed. Solve it
and then close it.
5. Select Power Flow>Reports>Bus based reports. The bus based reports dialog is displayed.
Enter buses 101, 201, 205, 143, 3001 in the text box provided. Select Go and then close it.
6. Select I/O Control>Stop Recording.
Using a text editor, open the file busout.idv (Figure 16-1) or busout.py (Figure 16-2) and you will see
the following:
@! File:"C:\Program Files\PTI\PSSE31\EXAMPLE\busout.idv", generated on TUE, AUG 17 2004 15:41
BAT_CASE,'C:\Program Files\PTI\PSSE31\EXAMPLE\savnw.sav'
BAT_FDNS,0,0,0,1,1,0,99,0
BAT_BSYS,1,0,0.0,0.0,0,5,101,201,205,154,3001,0,0
BAT_POUT,1,0

Figure 16-1. Response File Recorded by PSSE


# File:"C:\Program Files\PTI\PSSE31\EXAMPLE\busout.py", generated on WED, AUG 18 2004
psspy.case(r"""C:\Program Files\PTI\PSSE31\EXAMPLE\savnw.sav""")
psspy.fdns([0,0,0,1,1,0,99,0])
psspy.bsys(1,0,[0.0,0.0],0,[],5,[101,201,205,154,3001],0,[],0,[])
psspy.pout(1,0)

15:13

Figure 16-2. Python File Recorded by PSSE

16.7 Argument Passing


Activity Argument Passing

Arguments can be passed to a response file by using the Arguments button located on the
[Select Program Automation File to Run] dialog.
Arguments can be passed to the following types of automation files:

Python files

Response files

IPLAN files

but how they are handled by each varies. Note that the dialog permits specifying arguments for
PSAS and PSEB files, but those languages have no facility for retrieving the argument values.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-8

PSSE 33.4
Program Operation Manual

Program Automation
Argument Passing

16.7.1 Arguments in Python Files


The list argv in the module sys can be used to access the program arguments. Consider the
following Python program named arg0.py:
import sys
print sys.argv
When run using the Python interpreter from a Command Prompt the input is assumed to be space
delimited and is parsed into separate values, e.g.:
Enter:
python arg0.py a list of words
and the following is displayed:
['arg0.py', 'a', 'list', 'of', 'words']
From within PSSE the input string is entered as a single argument. If the file arg0.py is selected
(say, in the root directory of the C drive) and the string a list of words is entered in the argument
string dialog box, the following will be displayed at the Progress tab:
Executing Python file:C:\LocalDocs\dev\testing\arg0.py
['C:\\arg0.py', 'a list of words']

16.7.2 Arguments in Response Files


The argument string is parsed according to the standard PSSE free-format input rules for strings.
Arguments in the Response File are then replaced by simple string substitution. If an argument
contains a blank, comma, or slash, the argument must be enclosed in single quotes; otherwise the
quotes are optional.
A Response File that is receiving arguments has the appropriate argument, less any surrounding
quotes, substituted by the input processor before the dialog input line is passed to PSSE itself.
Arguments replace argument designator strings, which are of the form %n%, where < n > is one of
the numbers 1 through 15. Any recording of input lines contains the argument values in place of the
argument designator strings. A Response File may pass an argument that it receives to another
Response File, which it, in turn, initiates. It is usually good practice to place such argument designators in quotes so that a single argument that contains blanks and/or commas not be interpreted
by the designated Response File as multiple arguments.
An example of an argument would be %1%, which could appear anywhere in the file. In this case
%1% would be replaced by the first value parsed from the argument string. Likewise %5% would
be replaced by the fifth value parsed from the argument string.
Response Files require that all arguments receive values. When a Response File references an
argument that was not passed to it at the time it was initiated, an error condition occurs A useful
technique is to document all arguments referenced in a Response File using the TEXT command
at the beginning of the Response File. This approach will help detect missing argument errors
before any lengthy computations specified in the Response File are performed.
The following are examples of specifying arguments to a response file that can be entered in the
command line:
@INPUT , filename , 'argument 1' , 'argument 2' ... 'argument 15'

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-9

PSSE 33.4
Program Operation Manual

Program Automation
Default Values

or:
@CHAIN , filename , 'argument 1' , 'argument 2' ... 'argument 15'

16.7.3 Arguments in IPLAN Files


The entire argument string is placed in a buffer. The IPLAN command ARGUMENT can then be
used to parse the string in any way - and repeatedly - using the standard PSSE free-format input
rules. Refer to Section 3.27 Program Arguments of the IPLAN Program Manual.

16.8 Default Values


Activity Default Values

Many of the statements in automation files specify data for which defaults exist. The idea of a default
value is one that is simply not specified. Typically this means that either some function or action
associated with that value is ignored, or a specific documented value is used; that specific value
might be a fixed value - say, zero - or the current value of some quantity in the network case or a
program setting.
While it is possible in some programming languages for a value to be missing, the general case is
that in order to indicate this situation a special value is used. When input values are omitted in automation files such special values are substituted for them. The various API routines check for the
special values and take appropriate default actions when they are encountered.
Currently spaces and false are used for filenames and logical values when they are omitted. The
special values for integers, real numbers (floats), and characters (strings) are returned from the API
routines GETDEFAULTINT, GETDEFAULTREAL, and GETDEFAULTCHAR. No assumptions
should be made that these precise values will be identical from one release of the PSSE to
another. If it is necessary to acquire these values, always run the API routine to get the current
values.
Default values can be specified in references to API routines in Python Files. Data items can be
omitted in Response Files. The concept of default values does not apply to IPLAN programs in
general, but there are some functions that take optional arguments, and because PUSH statements
can contain anything that could be in a Response File, any comments about Response Files will
apply there. All data values are required in PSEB and PSAS files, unless the syntax specifically indicates otherwise.

16.8.1 Defaults in Python Functions


The Python language provides an easy mechanism for permitting optional arguments to functions.
However it requires that each function be coded in such a way as to permit this. Not every one is.
All the functions in the psspy module are coded in this way. For other modules delivered with
PSSE please check the help facility.

16.8.2 Defaults and Keywords in Module psspy


All arguments to functions defined in module psspy may be omitted and default values will be
supplied. All arguments to functions defined in module psspy may be specified by keyword.
In addition psspy contains a unique feature for specifying values for specific elements in an input
list. This is best illustrated by example. Lets say a function mysub takes a single argument, opt,
which is a 2-element list of integers, then the following are equivalent:

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-10

PSSE 33.4
Program Operation Manual

Program Automation
Unattended Execution of PSSE

mysub([_i,1])
mysub(opt=[_i,1])
mysub(opt2=1)
mysub(opt=None,opt2=1)
mysub(opt=[_i,42],opt2=1)
mysub(opt2=1,opt=[_i,352])
mysub(opt1=_i,opt2=1)
where _i is a variable equal to the default integer value.
What this means is that all the functions in psspy recognize special keywords formed by concatenating any input list name and the string representation all the possible index values (starting at 1)
and will use them to override just that specific element of the list.

16.8.3 Defaults in Recorded Python Files


When recording is enabled and the Python format is chosen, values for all arguments are specified.
Where default values are recorded, actual values are used except for the following:

in place of default integer values, the variable _i is used.

in place of default float values, the variable _f is used.

in place of default string values (not filenames) the variable _s is used.

This will work directly inside of the PSSE GUI because those variable are automatically assigned
the appropriate values at program startup. This is why the statements
_i=psspy.getdefaultint()
_f=psspy.getdefaultreal()
_s=psspy.getdefaultchar()
are recommended in Section 16.4.3 The External Interpreter Environment.

16.8.4 Defaults in Response Files


Because Response Files are simply free-format data files, an input value can be omitted by two
commas either together or separated by only spaces.
For batch commands there is a special token, a semi-colon, that can be used to tell the interpreter
that it should return all remaining inputs to the default settings (see Section 16.5 Batch Commands).
Files containing recorded batch commands will use consecutive commas for default values specified to the API routine.

16.9 Unattended Execution of PSSE


Activity Unattended Execution of PSSE

In some cases, it may be desirable to run PSSE in batch mode, that is, without any user interface.
PSSE provides command line options that can be used for this purpose. In Section 16.9.1 Startup Commands provides a list of all the available command line options; these four specifically
pertain to this purpose:
-rspfile

-pyfile

-argstr

-embed

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-11

PSSE 33.4
Program Operation Manual

Program Automation
Unattended Execution of PSSE

note that the initial - is part of the command

-rspfile, -pyfile, and -argstr all expect to be followed by a string

-pyfile will be ignored if -rspfile is specified

-argstr and -embed will be ignored if neither -rspfile nor -pyfile are specified

the command line is blank delimited; if the string specified to -rspfile, -pyfile, or -argstr
contains a blank then the string must be quoted

if the same option is specified more than once, only the last one will be used

notwithstanding the previous point, the order of the options is unimportant

the string value for the -argstr option is the argument string (see Section 16.7 Argument
Passing)

Provision is made for specifying only Response Files or Python Files. Both of those file types can
use other types of Automation Files so, indirectly at least, any type can be used.
The -embed option has the effect of suppressing the display of the PSSE GUI. If the Automation
File terminates without stopping the execution of PSSE the GUI will be displayed at that time.
The following are a few points to be aware of when preparing to run PSSE in an unattended mode:

PSSE does not read input from stdin or write to stdout, so pipes cannot be used for
batch execution of PSSE.

Be aware of the nature of the operating system tool you are using to start PSSE. In
Microsoft Windows, for example, non-console application programs, such as PSSE,
are executed asynchronously. This means that should you have a batch file that starts
PSSE it will not wait for the program to stop before continuing on the next statement
in the batch file.

When running in batch mode (i.e. with a startup automation file specified that stops the
program) the Progress tab and Report tab output should be re-directed to a printer or
file, otherwise output will be sent to windows that would be closed when the program
stops.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-12

PSSE 33.4
Program Operation Manual

Program Automation
Running a Python Program

Here are some examples of starting PSSE from a Command Prompt:


psse33 -rspfile busout.idv
psse33 -pyfile busout.py
psse33 -pyfile busout.py -embed
psse33 -embed -pyfile "study number 2.py" -argstr 101
Appendix D - Command Line Options contains a complete list of all the command line options that
are available.

16.10 Running a Python Program


Run Python Program - GUI
I/O Control>Start recording
[Select Program Automation File to Record]
Python file (*.py)
Interrupt Control Codes
None

Python programs run in this manner execute in the embedded interpreter environment as described
in Section 16.4.2, The Embedded Interpreter Environment. All code runs in that local namespace
and can therefore be impacted by previous Python programs, or affect subsequent Python
programs. Specifically, local variables retain their bindings (values) for the entirety of the execution
of PSSE. Use Modules, Classes, or functional programming techniques to create independent
namespaces.
Pythons interaction with PSSE is strictly through the API. PSSE functions can be executed, and
data can be retrieved from PSSEs working memory. API routines are provided to run Response
Files and IPLAN programs from within a Python program, so the other automation methods are integrated with Python in this way, and functionality that was developed using this other methods, which
all predate Pythons introduction into PSSE, is preserved and can be used with minimal rework.

16.11 Line Mode Commands


The line mode was the primary method of controlling PSSE through rev 29 (and the only method
through rev 18). It was highly efficient, very thorough, but completely procedural. It was essentially
a question-and-answer session with a program that began with the question:
Activity?
The appropriate response to this question was any of about 170-180 (in the last few releases) activities that comprised the primary functions that PSSE could perform. Each activity name was four
characters long; most could be abbreviated. Some activities could accept optional suffixes which
modified their behavior somewhat. Almost all would then ask a series of questions, unique to each
activity, to which the user would respond to operate the program. Many of those activity names are
preserved today in API routines that perform similar functions.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-13

PSSE 33.4
Program Operation Manual

Program Automation
Line Mode Commands

Line mode commands can be used to automate PSSE through Response Files (*.idv), so called
because they contain responses to the questions that the command line of PSSE asks.
The modern GUI has replaced this previously common method of operation, but there is a wealth
of existing Response Files containing line mode commands used to automate PSSE. Therefore
PSSE currently contains a feature called the Line Mode Interpreter (LMI) - a new program written
to imitate the traditional line mode of PSSE, but that actually uses the PSSE API. In a way it is
a translator from line mode to batch commands. It is not a perfect imitation, and those differences
are captured in PSSE Command Line Interface (CLI) Users Guide, Appendix A.
It is worth noting that, although the line mode now comprises a subset of the full functionality of
PSSE, for those functions it can perform, and for those users who are thoroughly familiar with the
command line (and are good typists), the program can still be operated more quickly from the
keyboard than is physically possible with a point-and-click interface (i.e., a mouse). So while
command line capabilities are not likely to be enhanced in the future, its current operation is considered to be an important feature of the program.

16.11.1 Mixing Line Mode and Batch Commands


Response files can contain both line mode and batch commands. The batch commands can be
thought of as additional activities of the line mode. They are not, and they are handled very differently; but for purposes of understanding how they may be combined in the same file, that image
provides the guidelines that need to be followed.
The format of the line mode commands also conforms to the PSSE standard free-format rules

16.11.2 Immediate Commands


The line mode has been augmented over the years with a set of Immediate (@) Commands, so
called because their actions occur without the involvement of any of the API routines in PSSE.
They are functions of a utility library (a Siemens PTI product) that is used by PSSE but separately
maintained. Immediate Commands can also be mixed with line mode and batch commands. Unlike
batch commands, however, they can be used anywhere, even in the middle of a series of responses
to a particular activity using the command line. The following list is provided for convenience:
@CHAIN filename - Open the specified file as a chained response file.
@INPUT filename - Open the specified file as a nested response file.
@PAUSE - Temporarily suspend response file operation.
@CONTINUE - Resume PAUSEd response file operation.
@END - Close the current response file.
@SYSTEM command - Issue a designated operating system specific command
@RELEASE - display the PSSE release number and date, along with similar information
about selected subsystems.
@DONGLE - display time used statistics for time lock users
@! - Ignore the entire line.
The last one, @!, will work from any input file. The others are only recognized from terminal input,
such as a Response File.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-14

PSSE 33.4
Program Operation Manual

Program Automation
Running a Response File

16.11.3 Version
The LMI provides an additional feature that the original line mode did not - the ability to change
versions. As releases of PSSE come out, sometimes changes are necessary in the sequence of
line mode commands. The creates maintenance work for existing Response Files. The LMI
provides a command, VERSION, which displays or sets the version of the line mode language
being processed. Introduced at rev 31 of PSSE, it recognizes versions from rev 30 and newer, for
example:
VERSION 30 - sets the version to rev 30
VERSION 31 - sets the version to rev 31
etc.
VERSION - displays the current version

16.12 Running a Response File


IDEV

Run Response File - GUI


I/O Control>Run Program Automation file
[Select Program Automation File to Run]
Response file (*.idv)
Run Line Mode Activity IDEV - CLI

ACTIVITY?
>>IDEV <filename>
Immediate Commands - CLI

@ input filename
OR
@ chain filename
Python Command

psspy.runrspnsfile <filename>
Interrupt Control Codes
None

Executing activity IDEV in Line Mode should be considered an obsolete capability which is retained
for backward compatibility purposes. Activity IDEV itself is not sensitive to any interrupt control code
options. While one or more Response Files are active, the CL interrupt control code may be used
to close all open Response Files.

16.12.1 Application Notes


The Response File must contain PSSE Batch Commands and/or an exact image of the Line Mode
user responses which would normally be entered by the user from the Command Line and/or Immediate Commands. Therefore, the manual creation of a Response File, which is done with the text
editor, requires an intimate familiarity with these commands, particularly for dialog intensive Line

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-15

PSSE 33.4
Program Operation Manual

Program Automation
Recording User Actions

Mode activities such as CHNG and ALTR.


Additional Information

PSS E GUI Users Guide, Section 23.2.1, Response File


PSSE Command Line Interface (CLI) Users Guide,
Section 19.2, Assigning Interactive Input to a Response File

16.13 Recording User Actions


Activity ECHO
Run Line Mode Activity ECHO - CLI

ACTIVITY?
>>ECHO
Interrupt Control Codes
None

The dialog echoing activity ECHO enables the writing of all subsequent user dialog input to a designated file, which may subsequently be used as a Operation of activity ECHO.
Users of PSSEs traditional command line interface will be familiar with the activity ECHO. It
performs a function similar in effect to the recording function in the current program. It is a very
different thing, however, and a remnant of it remains.
ECHO copies terminal input to a file. Because all PSSE input in a console application either came
from a terminal or a device that imitated the terminal, that meant all (interactive) input. This capability is retained in the PSSECMD console application.
The current recording function is a feature of the API routines. When they are called, if recording is
enabled, they record a copy of their input in the designated format in the designated file; it doesnt
matter how the call occurred - by menu selection, through line mode, from an automation file, etc.
The ECHO function still exists in the GUI, and it still does the same thing, i.e. copies all terminal
input to a file. The difference is that there is very little terminal input. The API routine userin, the
IPLAN function INPUT (and INPUTLN), and the @pause immediate command all attempt to read
from the terminal, which is handled in via a pop-up window. So data entered there will show up in
an ECHO file.
Related to this is the traditional command line activity IDEV, meaning Input DEVice. IDEV was used
to replace the terminal with a file so that subsequent READs from the terminal would find the
responses in the file (hence the name Response File). IDEV never executed the commands in a
Response File, although that appeared to be the situation. The implementation of IDEV in the GUI
does what most people would expect, therefore; it causes the commands in the Response File to
be interpreted by the LMI. This means, however, that IDEV no longer runs the way it used to, i.e.
replaces terminal input with a file. That function is now performed by the API routine
SET_INPUT_DEV. The outcome of that API is opening a file to respond to input requests from the

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-16

PSSE 33.4
Program Operation Manual

Program Automation
Recording User Actions

terminal (except @pause which will still force an actual terminal read, handled via a pop-up
window).
When activity ECHO is initiated, if a file for capturing responses had previously been opened with
an earlier execution of activity ECHO, it is closed.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-17

Program Automation
Building a Response File, Power Flow Calculation

PSSE 33.4
Program Operation Manual

16.13.1 Application Notes


With a console application like PSSECMD the file built as a result of activity ECHO can be used as
a PSSE Response File with @INPUT or @CHAIN or IDEV command to exactly reproduce a
sequence of PSSE activity commands and responses to instructions. Files written by activity
ECHO are source files which may be modified with the text editor (e.g., to specify different faulted
buses, switched branches, Saved Case and Snapshot File names, and so on) to tailor the original
set of user responses to the application at hand.
Activity ECHO copies to the designated file those user inputs that are entered into PSSE as part
of the interactive dialog. In addition, whenever a PSSE bulk data input activity is reading data from
the dialog input device (rather than from a bulk data input file), these data records are also recorded
in the file. This applies to activities such as READ, Reading Power Flow Data Additions from the
Terminal, RESQ, TRSQ, MCRE, and PSAS.
Additional Information

PSS E Command Line Interface (CLI) Users Guide,


Section 19.3, Recording User Actions

16.14 Building a Response File, Power Flow Calculation


Activity PSEB
Run Activity PSEB - GUI
I/O Control>Run program Automation file
[Select Program Automation File to Run]
PSEB Command file (*.pse)
Run Line Mode Activity PSEB - CLI

ACTIVITY?
>>PSEB
ENTER INPUT FILE NAME (0 TO EXIT, 1 FOR TERMINAL):
>>
Interrupt Control Codes
None

The power flow run assembler activity PSEB allows the user to specify routine power flow runs in
an English-like language. Input to activity PSEB is taken either from a PSEB Command File or from
the dialog input device. This can be in-stream in a Response File, typed into the command line in
the GUI, or entered at the console in PSSECMD. The output from activity PSEB is in the form of a
PSSE Response File.

16.14.1 PSSE PSEB Macro Language


PSEB (PSSE Engineering Basic) is a built-in macro language that supports PSSE Power Flow
operations through the use of English-like command macros. PSEB commands are created within
a text file using a text editor. Each record is in the form of a command starting with a verb from a

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-18

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Power Flow Calculation

previously defined vocabulary. The PSEB commands are documented below and in the PSEB
Users Ready Reference.
PSEB commands do not interact with PSSE directly. The PSEB macro processor is really a translator from the PSEB language to a Response File, which may contain a mixture of command line
and batch commands. The PSEB command line command normally automatically performs the
commands in the Response File after the translation. When used with the suffix CHECK (i.e. PSEB,
CHECK) only the translation is performed. When using the PSEB API routine only the translation is
performed.
Each PSEB command begins with a verb from the vocabulary recognized by activity PSEB. Some
commands require additional keywords (e.g., BUS, BRANCH), numeric quantities (e.g., bus
number, load MW), and/or character identifiers (e.g., bus name, circuit identifier) in specific fields of
the command format. Some commands provide for the optional specification of keywords, numeric,
and/or character quantities; these are shown in the command syntax enclosed in braces ([ ]).
Where one of several keywords may be specified, they are shown in the command format enclosed
in vertical bars (| |). One of the keywords listed must be entered in the field.
Each keyword or data value must be followed by one or more blanks. For clarity, a comma or equal
sign may be used in place of, or in addition to, a blank space. For example, the following two PSEB
commands are equivalent:
OPEN TIE FROM BUS 153 TO BUS 154 CKT 2
OPEN TIE, FROM BUS = 153, TO BUS = 154, CKT = 2
Any field labeled bus id designates that a bus identifier is to be entered. When the numbers input
option is in effect, the bus number must be specified; using the names input option, the extended
bus name enclosed in single quotes is required.
Any field labeled dc id designates that a two-terminal dc line name is to be entered. If the name
contains any blanks or special characters, it must be enclosed in single quotes.
I and R indicate that integer and real (i.e., it may include a decimal point) numeric values respectively are to be specified.
Many PSEB commands provide for the insertion of optional descriptive text in designated fields,
indicated by [n] in the command syntax. For example, the following two PSEB commands translate
into the same PSSE dialog:
RECOVER FROM SAVNW.SAV
RECOVER saved case FROM SAVNW.SAV
A dollar sign ( $ ) at the end of a PSEB command line is used to continue the command on the
following line. At least one space must precede the dollar sign. As many physical lines as required
may be used to specify a single PSEB command as long as all lines except the last one are terminated with a dollar sign. This multiline capability may be used with all PSEB commands except the
USE command (see below). In addition, each PSSE activity command and response to an instruction entered in passthru mode (see below) must be entered on a single line.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-19

Program Automation
Building a Response File, Power Flow Calculation

PSSE 33.4
Program Operation Manual

16.14.2 PSEB Commands


The detailed syntax of each PSEB command is given below and also on the PSSE Engineering
Basic PSEB Users Ready Reference sheet. Keywords shown in uppercase letters must be entered
as shown in either upper or lowercase characters.
HOLD [n] IN (saved-case-filename) [NOW]
The HOLD command is used to preserve the power flow working case in the designated
Saved Case File; refer to Section 5.45 Creating a Saved Case File. When the HOLD
command includes the optional keyword NOW, activity SAVE is immediately executed. In
this case, the PSSE responses for activity SAVE are not written to the Response File
being constructed by activity PSEB.
When the HOLD command does not include the optional keyword NOW, the appropriate
entries in the Response File are made to save the working case during the subsequent
execution of the Response File.
RECOVER [n] FROM (saved-case-filename)
The RECOVER command is used to access the designated Saved Case File; refer to
Section 5.1 Retrieving a Power Flow Saved Case File. Activity CASE is executed immediately and the PSSE responses for activity CASE are written to the Response File being
constructed by activity PSEB. Note that the RECOVER command overwrites the working
case. The HOLD command with the NOW option may be used before the RECOVER
command to save the working case.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-20

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Power Flow Calculation

|MW
|
|MWP |
|MWI |
|ALTER | |MWY |
[ |MW | ]
|CHANGE| |MVAR | LOAD [n] BUS (bus id) [LOAD (id)] TO (R) [ |MVAR| ]
|MVARQ|
|MVARI|
|MVARY|
This form of the ALTER command is used to change a specified component of a designated
load at a designated bus to a specified value. If the optional load identifier tokens are
omitted, a load identifier of 1 is assumed. The second token specified indicates the component of load as follows:
MW, MWP

Active power component, constant power characteristic.

MWI

Active power component, constant current characteristic.

MWY

Active power component, constant admittance characteristic.

MVAR, MVARQ

Reactive power component, constant power characteristic.

MVARI

Reactive power component, constant current characteristic.

MVARY

Reactive power component, constant admittance characteristic; R is


negative for an inductive load.

The value specified is always in MW or Mvar at unity voltage. Refer to Load Data.
SHED LOAD [n] BUS (bus id)
The SHED command is used to set all loads at the specified bus out-of-service. Refer to
Load Data.
|MW
|
|ALTER | |MWG |
[|MW |]
|CHANGE| |MVAR | SHUNT [n] BUS (bus id) [SHUNT (id)] TO (R) [|MVAR|]
|MVARB|
This form of the ALTER command is used to change a specified component of a specified
fixed shunt at a designated bus to a specified value. If the optional shunt identifier tokens
are omitted, a shunt identifier of 1 is assumed. The second token specified selects either
the active (MW or MWG) or reactive (MVAR or MVARB) component of bus shunt. Values
entered are in MW or Mvar at unity voltage. The reactive component is specified as a negative quantity for an inductive load. Refer to Fixed Bus Shunt Data.
|ALTER |
|CHANGE| BUS (bus id) CODE TO (I)
This form of the ALTER command is used to change the bus type code of a designated bus.
Refer to Bus Data.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-21

Program Automation
Building a Response File, Power Flow Calculation

PSSE 33.4
Program Operation Manual

|ALTER | |R|
[|CKT
|
]
|CHANGE| |X| TO (R) [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|B|

This form of the ALTER command is used to change the per unit resistance, reactance or
charging of a designated non-transformer branch or two-winding transformer to a specified
value. If the optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed.
Refer to Non-Transformer Branch Data.
DROP PLANT [n] BUS (bus id)
This form of the DROP command is used to disconnect all generation at a specified bus.
The bus type code is set to one; refer to Bus Data and Section 5.9.1 Equipment Status
Changes.
RECONNECT PLANT [n] BUS (bus id)
This form of the RECONNECT command is used to reconnect generation at a specified
bus. The bus type code is set to two; machine status flags are not changed. Refer to Bus
Data, Generator Data, and Section 5.9.1 Equipment Status Changes.
|UNIT
|
DROP |GENERATOR| (id) [n] BUS (bus id)
|MACHINE |
|LOAD
|
|SHUNT
|
This form of the DROP command is used to disconnect a specified machine, load, or fixed
shunt at a designated bus. The machine, load, or shunt status flag is set to zero; refer to
Load Data, Fixed Bus Shunt Data, Generator Data, and Section 5.9.1 Equipment Status
Changes.
|UNIT
|
RECONNECT |GENERATOR| (id) [n] BUS (bus id)
|MACHINE |
|LOAD
|
|SHUNT
|
This form of the RECONNECT command is used to reconnect a specified machine, load,
or fixed shunt at a designated bus. The machine, load, or shunt status flag is set to 1; the
bus type code is not changed. Refer to Bus Data, Load Data, Fixed Bus Shunt Data, Generator Data, and Section 5.9.1 Equipment Status Changes.
DISCONNECT BUS (bus id)
This form of the DISCONNECT command is used to electrically disconnect a bus and all
equipment connected to it. This command results in the use of activities DSCN and ORDR.
|DISCONNECT| |LINE |
[|CKT
|
]
|TRIP
| |TIE
|[n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|OPEN
| |BRANCH|

This form of the DISCONNECT command is used to remove a specified branch from
service. If the optional circuit identifier tokens are omitted, a circuit identifier of 1 is
assumed. The branch status flag is set to zero; refer to Non-Transformer Branch Data and
Section 5.9.1 Equipment Status Changes.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-22

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Power Flow Calculation

|RECONNECT| |LINE |
[|CKT
|
]
|CLOSE
| |TIE
| [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT|(id)]
|RECLOSE | |BRANCH|

This form of the RECONNECT command is used to return a specified branch to service. If
the optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed. The
branch status flag is set to 1; refer to Non-Transformer Branch Data and Section 5.9.1
Equipment Status Changes.
|DISCONNECT|
[|CKT
|
]
|TRIP
|THREEWINDING [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|OPEN
|

This form of the DISCONNECT command is used to remove all windings of a specified
three-winding transformer from service. If the optional circuit identifier tokens are omitted,
a circuit identifier of 1 is assumed. The transformer status flag is set to zero; refer to Transformer Data and Section 5.9.1 Equipment Status Changes.
|DISCONNECT|
[|CKT
|
]
|TRIP
|THREEWINDING [n] AT [n] BUS (bus id) TO [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|OPEN
|

This form of the DISCONNECT command is used to remove the winding connected to the
bus specified as the AT bus of a specified three-winding transformer from service. If the
optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed. The transformer status flag is set to 2, 3 or 4; refer to Transformer Data and Section 5.9.1 Equipment
Status Changes.
|RECONNECT|
[|CKT
|
]
|CLOSE
|THREEWINDING [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|RECLOSE |

This form of the RECONNECT command is used to return all windings of a specified threewinding transformer to service. If the optional circuit identifier tokens are omitted, a circuit
identifier of 1 is assumed. The transformer status flag is set to 1; refer to Transformer Data
and Section 5.9.1 Equipment Status Changes.
BLOCK DCLINE (dc id)
The BLOCK command is used to block a specified two-terminal dc line. The control mode
is set to zero; refer to Two-Terminal DC Transmission Line Data.
UNBLOCK DCLINE (dc id)
The UNBLOCK command is used to unblock a specified two-terminal dc line. The control
mode is set to 1 (i.e., the UNBLOCK command assumes power control mode). Refer to
Two-Terminal DC Transmission Line Data.
|SETPOINT|
SET DCLINE (dc id) |SCHEDULE| TO (R)
This form of the SET command is used to change the current or power demand
(SETPOINT) or scheduled dc voltage (SCHEDULE) on a specified two-terminal dc line to
a designated value; refer to Two-Terminal DC Transmission Line Data.
SET LOADFLOW TITLE LINE |1| TO (title)
|2|
This form of the SET command is used to change the designated line of the two-line case
heading to a specified string. The title may be up to 60 characters and must be enclosed in
single quotes; refer to Case Identification Data.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-23

Program Automation
Building a Response File, Power Flow Calculation

PSSE 33.4
Program Operation Manual

|BUS |
NET GENERATION [n] |BUSES| (bus id) [(bus id)...[(bus id)]]
This form of the NET command is used to net the generation with the load at specified
buses; refer to activity GNET. Up to 25 buses may be specified in each use of this
command.
NET GENERATION [n] FOR BUSES (I) THRU (I)
This form of the NET command is used to net the generation with the load at all buses within
a specified bus number range; refer to activity GNET. This command is valid only when the
bus input option is in its numbers setting.
SET SOLUTION OPTION[S] TO DEFAULT
This form of the SET command is used to instruct activity PSEB that subsequent SOLVE
commands (see below) are to execute power flow solutions with the present power flow
solution adjustment option settings honored. Refer to Sections 3.3.3 and 6.3.20 and activity
OPTN.
SET SOLUTION OPTION[S] TO [|DISCRETE-TAP|],[|AREA-LOCKED|],[FLAT-START],[|DC-LOCKED|],[|SHUNT-LOCKED|],[|PHASE-SHIFT |]
[|DIRECT-TAP |] [|AREA-INTCHG|]
[|DC-ADJUST|] [|SHUNT-ADJUST|] [|PSHFT-LOCKED|]
[|TAP-LOCKED |] [|TIES+LOADS |]
[|SHN-ADJ-CONT|]

This form of the SET command is used to enable and/or disable the power flow adjustments
to be used on subsequent power flow solutions initiated with the SOLVE command (see
below). For any adjustment option not specified, the present program option setting is
honored. Refer to Sections 3.3.3 and 6.3.20 and activity OPTN.
|FNSL|
|FDNS| [
|AFTER (I) [ITERATION[S]]|]
SOLVE [n] USING |NSOL| [WITH VAR LIMITS [n] |IMMEDIATE[LY]
|]
|SOLV| [
|IGNORED
|]
|MSLV|
|INLF|
The SOLVE command is used to execute one of the power flow solution activities. Solution
options as established by the last SET SOLUTION OPTIONS command are honored; if no
SET SOLUTION OPTIONS command was specified, the current solution adjustment option
settings are honored. Refer to activities SOLV, MSLV, FNSL, NSOL, FDNS, INLF, and
OPTN and Section 3.3.3 Program Run-Time Option Settings.
|PSS
|
|PASS
|
|PASSTHRU|
The PASSTHRU command is used to inform activity PSEB that subsequent command
input is in the form of BAT_ records (refer to PSSE Application Program Interface (API))
and/or PSSE activity commands and responses to questions rather than in the form of
PSEB commands. While passthru mode is in effect, each input to activity PSEB is simply
appended without modification to the Response File being built. If input to activity PSEB is
being taken from the users terminal, the prompt PASSTHRU: is issued while this mode is
in effect. Passthru mode is terminated and PSEB command mode reinstated by entering
the command FIN (see below). @INPUT and @CHAIN commands must not be specified
while passthru mode is in effect; the IDEV activity command may be specified.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-24

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Power Flow Calculation

FIN
Terminate passthru mode (see above) and reinstate PSEB command mode.
|USE |
|COPY| (response-file-filename) [arg1 ... [arg9]]
|IDEV|
The USE command allows the user to include the BAT_ records (refer to PSSE Application Program Interface (API)) and/or PSSE line mode commands and responses to
instructions which are contained in a Response File within the PSEB commands which
define a PSSE calculation sequence. The USE filename command is converted to an
@INPUT filename command and inserted into the Response File being constructed by
activity PSEB. Note that entries in the designated file must be in the form of BAT_ records
and/or activity commands and responses to questions rather than in the form of PSEB
commands.
The designated file may contain @INPUT commands but must not contain any @CHAIN
commands or IDEV activity commands. The designated file must be terminated with an
@END command; it must not be terminated with an IDEV activity command or a FIN PSEB
command.
EXECUTE (iplan-program-filename)
The EXECUTE command allows the user to include the execution of an IPLAN program
within the PSEB commands which define a calculation sequence. The EXECUTE filename
PSEB command is converted to an EXEC filename activity command (refer to activity
EXEC) and inserted into the Response File being constructed by activity PSEB.
WATCH [OFF]
The WATCH command is used to enable or disable the echoing of responses generated
from PSEB commands to the dialog output device (normally the users terminal). Response
echoing is disabled upon entering activity PSEB; the PSEB command WATCH enables
response echoing and WATCH,OFF disables it.
CHECK
The CHECK command instructs activity PSEB to bypass the automatic execution of the
Response File that it constructs.
END
The END command terminates PSEB command input. Unless it is otherwise suppressed,
the Response File constructed by activity PSEB is automatically executed.
ABORT
The ABORT command terminates activity PSEB and bypasses the automatic execution of
the Response File that it has constructed.
HELP
This form of the HELP command displays the list of PSEB commands at the dialog output
device (refer to Section 4.4 Virtual Output Devices).

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-25

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

HELP,command
This form of the HELP command displays the syntax format of the specified PSEB
command at the dialog output device (refer to Section 4.4 Virtual Output Devices).
Additional Information

PSS E GUI Users Guide, Section 23.3.3, PSEB Command File, Power Flow Calculation
PSSE Command Line Interface (CLI) Users Guide,
Section 19.4, Building a Response File, Power Flow Calculation

16.15 Building a Response File, Dynamic Simulation


Activity PSAS
Run Activity PSAS - GUI
I/O Control>Run program Automation file
[Select Program Automation File to Run]
PSAS Command file (*.psa)
Run Line Mode Activity PSAS - CLI

ACTIVITY?
>>PSAS
ENTER INPUT FILE NAME (0 TO EXIT, 1 FOR TERMINAL):
>>
Interrupt Control Codes
None

The simulation run assembler activity PSAS allows the user to specify dynamic simulation runs in
an English-like language. Input to activity PSAS is taken either from a PSAS Command File or from
the dialog input device. This can be in-stream in a Response File, typed into the command line in
the GUI, or entered at the console in PSSECMD. The output from activity PSAS is in the form of a
PSSE Response File.

16.15.1 PSSE PSAS Macro Language


PSAS (Simulation Run Assembler) is a built-in macro language that supports PSSE Dynamics
simulations through the use of English-like command macros. PSAS commands are created within
a text file using a text editor. Each record is in the form of a command starting with a verb from a
previously defined vocabulary. The PSAS commands are documented below and in the PSAS
Users Ready Reference.
PSAS commands do not interact with PSSE directly. The PSAS macro processor is really a translator from the PSAS language to a Response File, which may contain a mixture of command line
and batch commands. The PSAS command line command normally automatically performs the
commands in the Response File after the translation. When used with the suffix CHECK (i.e. PSAS,
CHECK) only the translation is performed. When using the PSAS API routine only the translation is
performed.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-26

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

16.15.2 PSAS Commands


Each PSAS command begins with a verb from the vocabulary recognized by activity PSAS. Some
commands require additional keywords (e.g., BUS, VAR), numeric quantities (e.g., bus number,
VAR index), and/or character identifiers (e.g., dc line name, circuit identifier) in specific fields of the
command format. Some commands provide for the optional specification of keywords, numeric
and/or character quantities; these are shown in the command syntax enclosed in braces ([ ]).
Where one of several keywords may be specified, they are shown in the command format enclosed
in bars (| |). One of the keywords listed must be entered in the field.
Each keyword or data value must be followed by one or more blanks. For clarity, a comma or equal
sign may be used in place of a blank space. For example, the following two PSAS commands are
equivalent:
START OUTPUT SAVNW.PLT
START, OUTPUT=SAVNW.PLT
Any field labeled bus id designates that a bus identifier is to be entered. When the numbers input
option is in effect, the bus number must be specified; using the names input option, the extended
bus name enclosed in single quotes is required.
Any field labeled dc id designates that a two-terminal dc line name is to be entered. If the name
contains any blanks or special characters, it must be enclosed in single quotes.
I and R indicate that integer and real (i.e., it may include a decimal point) numeric values respectively are to be specified. C indicates that a one or two character alphanumeric value is to be
specified.
Many PSAS commands provide for the insertion of optional descriptive text in designated fields,
indicated by [n] in the command syntax. For example, the following two PSAS commands translate
into the same PSSE dialog:
RECOVER FROM SAVNW.SNP AND SAVNW.SAV
RECOVER snapshot and saved case FROM SAVNW.SNP AND SAVNW.SAV
A dollar sign ( $ ) at the end of a PSAS command line is used to continue the command on the
following line. At least one space must precede the dollar sign. As many physical lines as required
may be used to specify a single PSAS command as long as all lines except the last one are terminated with a dollar sign. This multiline capability may be used with all PSAS commands except the
USE command (see below). In addition, each PSSE activity command and response to an instruction entered in passthru mode (see below) must be entered on a single line.
The detailed syntax of each PSAS command is given below and also on the PSSE Simulation Run
Assembler PSAS Users Ready Reference sheet. Keywords shown in uppercase letters must be
entered as shown in either upper or lowercase characters.
[|NOW
|]
HOLD[n]IN(snapshot-filename)AND(saved-case-filename) [|SIZE[S](I1)(I2)(I3)(I4)(I5)|]

The HOLD command is used to preserve dynamics working memory and the power flow
working case in Snapshot and Saved Case Files respectively (refer to activities SNAP and
SAVE). When the HOLD command includes the optional keyword NOW, activity SNAP and
SAVE are immediately executed and the user specifies the number of dynamic simulation
array elements to save in the same manner as when activity SNAP is specifically invoked.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-27

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

In this case, the PSSE responses for activity SNAP and SAVE are not written to the
Response File being constructed by activity PSAS.
When the HOLD command does not include the optional keyword NOW, the appropriate
entries in the Response File are made to take a Snapshot and save the working case during
the subsequent execution of the Response File. In this case, the user may optionally
specify the keyword SIZES followed by the number of CONs, STATEs, VARs, ICONs and
output channels to be preserved. If this keyword and its data are omitted, a blank response
is generated in the Response File and, when the Response File is subsequently executed,
activity SNAP preserves up to the next available positions in the respective dynamics data
arrays.
RECOVER[n] FROM (snapshot-filename) AND (saved-case-filename) [NOFACT] [NOTYSL] [NORETURN]

The RECOVER command is used to access the designated Snapshot and Saved Case
Files (refer to activities RSTR and CASE). Activities RSTR and CASE are executed immediately and the PSSE responses for activities RSTR, LOFL, and CASE are written to the
Response File being constructed by activity PSAS. The activity commands FACT, TYSL,
and RTRN are included in the Response File unless they are suppressed with one or more
of the optional tokens NOFACT, NOTYSL and NORETURN. If NOFACT is specified,
NOTYSL is assumed. If NORETURN is specified, NOFACT and NOTYSL are also
assumed, and the next PSAS command must be either CONVERT, USE or PASS; the
CONVERT command (see below) generates the RTRN activity command but in passthru
mode (see below), the RTRN activity command must be specified before terminating
passthru mode.
The RECOVER command overwrites dynamics working memory and the power flow
working case. The HOLD command with the NOW option may be used before the
RECOVER command to preserve these two sets of data.
|INITIALIZE| OUTPUT |(filename)| [SNAPSHOT |(filename)|]
|START
|
|NONE
| [
|NONE
|]
This form of the START command is used to initialize the dynamic model in preparation for
state-space simulations. The STRT activity command is generated with user specified
channel output and Snapshot filename responses. The reserved token NONE may be used
to indicate that the corresponding filename is not to be specified.
|INITIALIZE| EXTENDED [n] OUTPUT |(filename)| [n]
|START
|
|NONE
|
This form of the START command is used to initialize the dynamic model in preparation for
extended term simulations. The MSTR activity command is generated with a user specified
channel output filename response. The reserved token NONE may be used to indicate no
channel output file is to be specified.
|TO |
|CYCLE[S] |
RUN [n] |FOR| (R) |SECOND[S]| [PRINT (I)] [PLOT (I)] [CRTPLT (I)]
The RUN command is used to perform dynamic simulation calculations with activity RUN
or MRUN. If the RUN command is preceded by the START command (see above), the form
of the START command determines whether activities RUN or MRUN is to be used. Otherwise, state-space simulations are assumed and activity RUN is used. The real value indicates the duration of the simulation calculation and may be specified in either seconds or
cycles. It is the value of simulation time (i.e., TPAUSE) when the token TO precedes it and
an incremental value of time when the token FOR precedes it. The optional integer tokens

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-28

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

and their corresponding keywords allow the user to specify channel printing and plotting
intervals (refer to Section 14.10 Performing State-Space Simulation in Time Steps). By
default, PRINT=20, PLOT=5 and CRTPLT=0.
|OFF|
CONVERGENCE MONITOR |ON |
The CONVERGENCE MONITOR command is used to enable or disable the printing of the
network solution convergence monitor during the execution of the PSSE activity calls
generated by subsequent START and RUN commands (see above). By default, the
convergence monitor is suppressed.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-29

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

APPLY FAULT [n] BUS (bus id) [n]


This form of the APPLY FAULT command is used to apply a solidly grounded three-phase
fault at the designated bus. The Response File being constructed by activity PSAS includes
responses to use activity ALTR to change the fixed shunt at the bus to j(-2.109); refer to
Bus Data, activity ALTR and Section 19.7.2 Applying Disturbances.
|Y
|
|MVA
|
APPLY FAULT [n] BUS (bus id) [n] |ADMITTANCE| (R1) (R2) |MHO[S]| [BASEKV (R)]

This form of the APPLY FAULT command is used to apply a fault with a specified fault
admittance, (R1) + j(R2), at a designated bus. The Response File being constructed by
activity PSAS includes responses to use activity ALTR to change the fixed shunt at the bus.
(R2) should be entered as a negative number. Refer to Bus Data, activity ALTR and
Section 19.7.2 Applying Disturbances.
If the MVA token is specified, the active and reactive components of fixed shunt at the bus
are set to the values specified as (R1) and (R2) respectively; i.e., the fault admittance is
specified in the same MVA units as is bus shunt.
If the MHO or MHOS token is specified, (R1) and (R2) are entered in mhos and activity
PSAS converts them to the MVA units used for specifying bus shunts. If the optional base
voltage tokens are specified, the base voltage specified on the PSAS command is used in
the conversion calculation; otherwise, the base voltage contained in the working case for
the designated bus is used. In either case, a positive base voltage value is required.
|Z
|
APPLY FAULT [n] BUS (bus id) [n] |IMPEDANCE| (R1) (R2) OHM[S] [BASEKV (R)]
This form of the APPLY FAULT command is used to apply a fault with a specified fault impedance,
(R1) + j(R2), at a designated bus. The Response File being constructed by activity PSAS includes
responses to use activity ALTR to change the fixed shunt at the bus. (R2) should be entered as a
positive number and (R1) and (R2) are specified in ohms. Activity PSAS converts them to the MVA
units used for specifying bus shunts. If the optional base voltage tokens are specified, the base
voltage specified on the PSAS command is used in the conversion calculation; otherwise, the base
voltage contained in the working case for the designated bus is used. In either case, a positive base
voltage value is
|L-G |
SCMU |L-L | FAULT [n] BUS (bus id) [n] [ZL-G (R1) (R2)] [n]
|L-L-G|
[ZL-L (R3) (R4)] [n] [CONVERTDC] [n] [APPLYZCOREC]
The SCMU FAULT command is used to calculate and apply a single line-to-ground, lineto-line, or line-to-line-to-ground fault at a designated bus. For the L-G and L-L-G faults, (R1)
and (R2) may optionally specify the complex line-to-ground fault impedance to be used;
similarly, for the L-L and L-L-G faults, (R3) and (R4) may optionally specify the complex
line-to-line fault impedance to be used. These impedances are specified in per unit. For any
of these impedance values that are not specified, 0.0 is assumed.
If the optional token CONVERTDC is specified, dc lines and FACTS device boundary
conditions are converted to constant admittance load for the fault calculation. Otherwise,
they are neglected.
If the optional token APPLYZCOREC is specified, for those transformers which include a
transformer impedance adjustment table, the same correction factor is applied to the zero

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-30

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

sequence impedance as is applied to the positive sequence impedance. Otherwise, transformer zero sequence nominal impedances are used.
|L-G
|
|L-L
|
|L-L-G |
[|CKT
|
]
SPCB |3PHASE| FAULT (R1) [n] FROM [n] BUS (bsid) TO [n] BUS (bsid) [n] [|CIRCUIT| (id)]
[n] [ZL-G (R2) (R3)] [n] [ZL-L (R4) (R5)] [n] [CONVERTDC] [n] [APPLYZCOREC]

This form of the SPCB FAULT command is used to calculate and apply a ground fault at a
designated point along a transmission line. (R1) specifies the fault location as the fraction
of the line from the FROM bus; the default value of 0.5 applies the fault at the midpoint of
the line.
For the L-G and L-L-G faults, (R2) and (R3) may optionally specify the complex line-toground fault impedance to be used; similarly, for the L-L and L-L-G faults, (R4) and (R5)
may optionally specify the complex line-to-line fault impedance to be used. These impedances are specified in per unit. For any of these impedance values that are not specified,
0.0 is assumed.
If the optional token CONVERTDC is specified, dc lines and FACTS device boundary
conditions are converted to constant admittance load for the fault calculation. Otherwise,
they are neglected.
If the optional token APPLYZCOREC is specified, for those transformers which include a
transformer impedance adjustment table, the same correction factor is applied to the zero
sequence impedance as is applied to the positive sequence impedance. Otherwise, transformer zero sequence nominal impedances are used.
[|CKT
|
]
SPCB 2PHASE OPEN [n] FROM [n] BUS (bsid) TO [n] BUS (bsid) [n] [|CIRCUIT| (id)]
[n] [CONVERTDC] [n] [APPLYZCOREC]

This form of the SPCB FAULT command is used to calculate and apply a transmission line
unbalance with two of its three phases open.
If the optional token CONVERTDC is specified, dc lines and FACTS device boundary
conditions are converted to constant admittance load for the fault calculation. Otherwise,
they are neglected.
If the optional token APPLYZCOREC is specified, for those transformers which include a
transformer impedance adjustment table, the same correction factor is applied to the zero
sequence impedance as is applied to the positive sequence impedance. Otherwise, transformer zero sequence nominal impedances are used.
[|CKT
|
]
SPCB 1PHASE OPEN [n] FROM [n] BUS (bsid) TO [n] BUS (bsid) [n] [|CIRCUIT| (id)]
[n] [PATH (R1) [ [n] [ZL-G (R2) (R3)] ] [n] [CONVERTDC] [n] [APPLYZCOREC]

This form of the SPCB FAULT command is used to calculate and apply a transmission line
unbalance with one of its three phases open.
This branch unbalance may optionally include a ground fault at a designated point of the
open phase by specifying the optional token PATH, along with (R1) which specifies the fault
location as the fraction of the line from the FROM bus; the default value of 0.5 applies the

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-31

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

fault at the midpoint of the open phase. (R2) and(R3) may optionally specify the complex
line-to-ground fault impedance in per unit to be used. For any of these impedance values
that are not specified, 0.0 is assumed.
If the optional token CONVERTDC is specified, dc lines and FACTS device boundary
conditions are converted to constant admittance load for the fault calculation. Otherwise,
they are neglected.
If the optional token APPLYZCOREC is specified, for those transformers which include a
transformer impedance adjustment table, the same correction factor is applied to the zero
sequence impedance as is applied to the positive sequence impedance. Otherwise, transformer zero sequence nominal impedances are used.
[|CKT
|
]
SPCB BREAKER OPEN [n] AT [n] BUS (bsid) TO [n] BUS (bsid) [n] [|CIRCUIT| (id)]
[n] [PATH (R1) [ [n] [ZL-G (R2) (R3)] ] [n] [CONVERTDC] [n] [APPLYZCOREC]

This form of the SPCB FAULT command is used to calculate and apply a transmission line
unbalance with the breaker of one phase open. The breaker at the AT bus is assumed to
be the open breaker.
This branch unbalance may optionally include a ground fault at a designated point of the
open phase by specifying the optional token PATH, along with (R1) which specifies the fault
location as the fraction of the line from the FROM bus; the default value of 0.5 applies the
fault at the midpoint of the open phase. (R2) and(R3) may optionally specify the complex
line-to-ground fault impedance in per unit to be used. For any of these impedance values
that are not specified, 0.0 is assumed.
If the optional token CONVERTDC is specified, dc lines and FACTS device boundary
conditions are converted to constant admittance load for the fault calculation. Otherwise,
they are neglected.
If the optional token APPLYZCOREC is specified, for those transformers which include a
transformer impedance adjustment table, the same correction factor is applied to the zero
sequence impedance as is applied to the positive sequence impedance. Otherwise, transformer zero sequence nominal impedances are used.

CLEAR FAULT [n] [BUS (bus id)]


CLEAR BUS [FAULT] [n] [BUS (bus id)]
These forms of the CLEAR command are used to clear bus faults which were previously
applied with the APPLY FAULT command (see above). The Response File being constructed by activity PSAS includes responses to use activity ALTR to change the fixed bus
shunt at the bus back to its original value.
Activity PSAS remembers the faulted bus and the fixed bus shunt which was replaced with
the fault admittance for up to ten bus faults. If the optional bus identification tokens are
omitted, activity PSAS clears the last bus fault which was applied and which has not already
been cleared.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-32

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

|LINE |
[|CKT
|
]
APPLY FAULT [n]|TIE
|[n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [n][|CIRCUIT|(id)] [n]
|BRANCH|

This form of the APPLY FAULT command is used to apply a solidly grounded three-phase
fault at the from bus end of a designated non-transformer branch. The Response File being
constructed by activity PSAS includes responses to use activity ALTR to change the line
shunt at the from bus end of the branch to j(-2.107). If the optional circuit identifier tokens
are omitted, a circuit identifier of 1 is assumed. Refer to Bus Data, activity ALTR and
Section 19.7.2 Applying Disturbances.
|LINE |
APPLY FAULT [n] |TIE
| [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [n]
|BRANCH|
|Y
|
|ADMITTANCE| (R1) (R2)

[|CKT
|
]
[|CIRCUIT| (id)] [n]
|MVA
|
|MHO[S]| [BASEKV (R)]

This form of the APPLY FAULT command is used to apply a fault with a specified fault
admittance, (R1) + j(R2), at the from bus end of a designated non-transformer branch. The
Response File being constructed by activity PSAS includes responses to use activity ALTR
to change the line shunt at the from bus end of the branch. (R2) should be entered as a
negative number. If the optional circuit identifier tokens are omitted, a circuit identifier of 1
is assumed. Refer to Non-Transformer Branch Data, activity ALTR and Section 19.7.2
Applying Disturbances.
If the MVA token is specified, the values specified as (R1) and (R2) are divided by the
system base MVA and the active and reactive components respectively of the line shunt at
the from bus end of the branch are set to these values. The fault admittance is therefore
specified on the record is in the same MVA units as is bus shunt (refer to Bus Data).
If the MHO or MHOS token is specified, (R1) and (R2) are entered in mhos and activity
PSAS converts them to the per unit values used for specifying line shunts. If the optional
base voltage tokens are specified, the base voltage specified on the PSAS command is
used in the conversion calculation; otherwise, the base voltage contained in the working
case for the designated from bus is used. In either case, a positive base voltage value is
required.
|LINE |
[|CKT
|
]
APPLY FAULT [n] |TIE
| [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [n] [|CIRCUIT| (id)] [n]
|BRANCH|
|Z
|
|IMPEDANCE| (R1) (R2) OHM[S] [BASEKV (R)]

This form of the APPLY FAULT command is used to apply a fault with a specified fault
impedance, (R1) + j(R2), at the from bus end of a designated non-transformer branch. The
Response File being constructed by activity PSAS includes responses to use activity ALTR
to change the line shunt at the from bus end of the branch. (R2) should be entered as a
positive number and (R1) and (R2) are specified in ohms. Activity PSAS converts them to
the per unit values used for specifying line shunts. If the optional base voltage tokens are
specified, the base voltage specified on the PSAS command is used in the conversion calculation; otherwise, the base voltage contained in the working case for the designated from
bus is used. In either case, a positive base voltage value is required. If the optional circuit
identifier tokens are omitted, a circuit identifier of 1 is assumed. Refer to Non-Transformer
Branch Data, activity ALTR and Section 19.7.2 Applying Disturbances.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-33

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

|LINE |
CLEAR |TIE
| FAULT [n]
|BRANCH|
This form of the CLEAR command is used to clear the last line fault which was previously
applied with the APPLY FAULT command (see above). The Response File being
constructed by activity PSAS includes responses to use activity ALTR to change the appropriate line shunt on the faulted branch back to its original value.
Activity PSAS remembers the faulted branch and the from and to bus orientation specified
on the last APPLY FAULT command. Note that only the last line fault command is remembered by activity PSAS.
CONVERT [n] MW TO (R) (R) [MVAR TO (R) (R)]
The CONVERT command is used to convert the constant MVA load at all buses in the
working case to a specified mix of the constant MVA, constant current and constant admittance load characteristics. The (R) values are specified as percents where the first value of
each pair is the percentage of load to be converted to the constant current characteristic
and the second is the percentage to be converted to constant admittance. If the optional
Mvar tokens are omitted, the same split of load is used for the active and reactive power.
The Response File being constructed by activity PSAS includes responses to use activity
CONL to convert the load as specified in the CONVERT command, followed by the activity
commands CONG, ORDR, FACT, TYSL, and RTRN.
The CONVERT command must be used immediately following a RECOVER command on
which the optional token NORETURN is specified.
|MWP |
|MWI |
|ALTER | |MWY |
[ |MW | ]
|CHANGE| |MVARQ| LOAD [n] BUS (bus id) [LOAD (id)] TO (R) [ |MVAR| ]
|MVARI|
|MVARY|
This form of the ALTER command is used to change a specified component of a designated
load at a designated bus to a specified value. If the optional load identifier tokens are
omitted, a load identifier of 1 is assumed. The second token specified indicates the component of load as follows:
MWP

Active power component, constant power characteristic.

MWI

Active power component, constant current characteristic.

MWY

Active power component, constant admittance characteristic.

MVARQ

Reactive power component, constant power characteristic.

MVARI

Reactive power component, constant current characteristic.

MVARY

Reactive power component, constant admittance characteristic; R is negative for an inductive load.

The value specified is always in MW or Mvar at unity voltage. Refer to Load Data.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-34

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

SHED LOAD [n] BUS (bus id)


The SHED command is used to set all loads to out-of-service at the specified bus. Refer to
Load Data.
|ALTER | |MWG | |LOAD |
[|MW |]
|CHANGE| |MVARB| |SHUNT| [n] BUS (bus id) [SHUNT (id)] TO (R) [|MVAR|]
This form of the ALTER command is used to change a specified component of a specified
fixed shunt at a designated bus to a specified value. If the optional shunt identifier tokens
are omitted, a shunt identifier of 1 is assumed. The second token specified selects either
the active (MWG) or reactive (MVARB) component of bus shunt. Values entered are in MW
or Mvar at unity voltage. The reactive component is specified as a negative quantity for an
inductive load. Refer to Fixed Bus Shunt Data.
|ALTER |
|CHANGE| BUS (bus id) CODE TO (I)
This form of the ALTER command is used to change the bus type code of a designated bus.
Refer to Bus Data.
|ALTER | |R|
[|CKT
|
]
|CHANGE| |X| TO (R) [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|B|

This form of the ALTER command is used to change the per unit resistance, reactance or
charging of a designated non-transformer branch or two-winding transformer to a specified
value. If the optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed.
Refer to Bus Data.
DROP PLANT [n] BUS (bus id)
This form of the DROP command is used to disconnect all generation at a specified bus.
The bus type code is set to one; refer to Bus Data and Section 5.9.1 Equipment Status
Changes.
RECONNECT PLANT [n] BUS (bus id)
This form of the RECONNECT command is used to reconnect generation at a specified
bus. The bus type code is set to two; machine status flags are not changed. Refer to Bus
Data, Generator Data, and Section 5.9.1 Equipment Status Changes.
|UNIT
|
DROP |GENERATOR| (id) [n] BUS (bus id)
|MACHINE |
|LOAD
|
|SHUNT
|
This form of the DROP command is used to disconnect a specified machine, load, or fixed
shunt at a designated bus. The machine, load, or shunt status flag is set to zero; refer to
Bus Data, Fixed Bus Shunt Data, and Section 5.9.1 Equipment Status Changes.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-35

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

|UNIT
|
RECONNECT |GENERATOR| (id) [n] BUS (bus id)
|MACHINE |
|LOAD
|
|SHUNT
|
This form of the RECONNECT command is used to reconnect a specified machine, load,
or fixed shunt at a designated bus. The machine, load, or shunt status flag is set to one; the
bus type code is not changed. Refer to Bus Data, Load Data, Fixed Bus Shunt Data, Generator Data, and Section 5.9.1 Equipment Status Changes.
DISCONNECT BUS (bus id)
This form of the DISCONNECT command is used to electrically disconnect a bus and all
equipment connected to it. This command results in the use of activities DSCN and ORDR.
|DISCONNECT| |LINE |
[|CKT
|
]
|TRIP
| |TIE
| [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|OPEN
| |BRANCH|

This form of the DISCONNECT command is used to remove a specified branch from service. If the optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed.
The branch status flag is set to zero; refer to Non-Transformer Branch Data and
Section 5.9.1 Equipment Status Changes.
|RECONNECT| |LINE |
[|CKT
|
]
|CLOSE
| |TIE
| [n] FROM [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT|(id)]
|RECLOSE | |BRANCH|

This form of the RECONNECT command is used to return a specified branch to service. If
the optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed. The
branch status flag is set to one; refer to Non-Transformer Branch Data and Section 5.9.1
Equipment Status Changes.
|DISCONNECT|
[|CKT
|
]
|TRIP
|THREEWINDING [n] FROM [n] BUS (bsid) TO [n] BUS (bsid) TO [n] BUS (bsid) [|CIRCUIT| (id)]
|OPEN
|

This form of the DISCONNECT command is used to remove all windings of a specified
three-winding transformer from service. If the optional circuit identifier tokens are omitted,
a circuit identifier of 1 is assumed. The transformer status flag is set to zero; refer to Transformer Data and Section 5.9.1 Equipment Status Changes.
|DISCONNECT|
[|CKT
|
]
|TRIP
|THREEWINDING [n] AT [n] BUS (bsid) TO [n] BUS (bsid) TO [n] BUS (bsid) [|CIRCUIT| (id)]
|OPEN
|

This form of the DISCONNECT command is used to remove the winding connected to the
bus specified as the AT bus of a specified three-winding transformer from service. If the
optional circuit identifier tokens are omitted, a circuit identifier of 1 is assumed. The transformer status flag is set to 2, 3 or 4; refer to Transformer Data and Section 5.9.1 Equipment
Status Changes.
|RECONNECT|
[|CKT
|
]
|CLOSE
|THREEWINDING [n] FROM [n] BUS (bsid) TO [n] BUS (bsid) TO [n] BUS (bsid) [|CIRCUIT| (id)]
|RECLOSE |

This form of the RECONNECT command is used to return all windings of a specified threewinding transformer to service. If the optional circuit identifier tokens are omitted, a circuit
identifier of 1 is assumed. The transformer status flag is set to one; refer to Transformer

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-36

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

Data and Section 5.9.1 Equipment Status Changes.


BLOCK DCLINE (dc id)
The BLOCK command is used to block a specified two-terminal dc line. The control mode
is set to zero; refer to Two-Terminal DC Transmission Line Data.
UNBLOCK DCLINE (dc id)
The UNBLOCK command is used to unblock a specified two-terminal dc line. The control
mode is set to one (i.e., the UNBLOCK command assumes power control mode). Refer to
Two-Terminal DC Transmission Line Data.
|POWER
|
|CURRENT |
SET [n] DCLINE (dc id) |SETPOINT| TO (R)
|SCHEDULE|
|VOLTAGE |
This form of the SET command is used to change the current or power demand (POWER,
CURRENT, SETPOINT) or scheduled dc voltage (SCHEDULE, VOLTAGE) on a specified
two-terminal dc line to a designated value; refer to Two-Terminal DC Transmission Line
Data.
|VAR|
SET [n] |CON| (I) TO (R)
This form of the SET command is used to change a specified VAR or CON to a designated
value. Refer to activity ALTR and 19.1.2.
|(C)|
SET [n] ICON (I) TO |(I)|
This form of the SET command is used to change a specified ICON to a designated integer
or character value. Refer to activity ALTR and 19.1.2.
|VAR[S]|
SET [n] |CON[S]| (I1) THRU (I2) TO (R1) ... (Rm)
This form of the SET command is used to change up to twenty-five consecutive VARs or
CONs to designated values. Refer to activity ALTR and 19.1.2.
|(C1)|
|(Cm)|
SET [n] ICON[S] (I1) THRU (I2) TO |(I1)| ... |(Im)|
This form of the SET command is used to change up to twenty-five consecutive ICONs to
designated integer and/or character values. Refer to activity ALTR and 19.1.2.
[|CYCLE[S] |]
SET [n] STEP TO (R) (n) [|SECOND[S]|] [n]
This form of the SET command is used to change the simulation time step, DELT, to a designated value. The new time step may be specified in either seconds or cycles. When neither of the optional tokens is specified, SECONDS is assumed.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-37

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

NEXT [CHANNEL[S] (I)] [VAR[S] (I)] [ICON[S] (I)]


The NEXT command is used in conjunction with PLACE commands to form the dialog
required by activity CHAN to assign simulation variables to PSSE output channels. It is
used in setting the responses for the starting channel, VAR and ICON indices to be used
by activity CHAN. If a NEXT command is not entered, or if the CHANNEL, VAR and/or
ICON keywords and values are omitted from the NEXT command, a corresponding default
response is generated in the Response File. When the Response File is subsequently
executed, activity CHAN will use the next available location pointers as contained in
dynamics data memory.
PLACE quantity [n] BUS (bus id) [MACHINE (id)] IN CHANNEL[S]
[WITH IDENTIFIER[S] (ident) [AND (ident)]]
This form of the PLACE command is used to assign a single machine quantity (two quantities in the case of MACHAPPIMP) to an output channel. < quantity > may be specified as
one of the following machine related tokens:
ANGLE

PELEC

QELEC

ETERM

ECOMP

EFD

VREF

SPEED

XADIFD

VOTHSG

VUEL

VOEL

MACHAPPIMP

PMECH

MACHITERM

If the optional machine identifier tokens are omitted, channels for all machines at the bus
are generated. The user may either specify the channel identifier(s) to be assigned to the
output channel(s) or let activity CHAN assign them. Refer to Table 15-2 Activity CHAN
Summary and 19-1, activity ALTR, and Section 19.6.1 Output Channel Selection.
|BSFREQ |
|VOLTAGE |
PLACE |VOLT&ANG| [n] BUS (bus id) IN CHANNEL[S]
[WITH IDENTIFIER[S] (ident) [AND (ident)]]
This form of the PLACE command is used to assign a single bus quantity (two quantities in
the case of VOLT&ANG) to an output channel. The user may either specify the channel
identifier(s) to be assigned to the output channel(s) or let activity CHAN assign them. Refer
to Table 15-2 Activity CHAN Summary and 19-1, activity ALTR, and Section 19.6.1 Output
Channel Selection.
|PLOAD|
PLACE |QLOAD| [n] BUS (bus id) [LOAD (id)] IN CHANNEL[S]
[WITH IDENTIFIER (ident)]
This form of the PLACE command is used to assign a single load quantity to an output
channel. If the optional load identifier token is omitted, channels for all loads at the bus are
generated. The user may either specify the channel identifier to be assigned to the output
channel(s) or let activity CHAN assign it. Refer to Table 15-2 Activity CHAN Summary and
19-1, activity ALTR, and Section 19.6.1 Output Channel Selection.
PLACE quantity [n] BUSES (I1) THRU (I2) IN CHANNEL[S]
This form of the PLACE command is used to assign a specified machine, bus, or load
related quantity to output channels for all machines, buses, or loads within a designated
bus number range. < quantity > is specified as in the three BUS forms of the PLACE
command given above. Refer to Table 15-2 Activity CHAN Summary and 19-1, activity

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-38

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

ALTR, and Section 19.6.1 Output Channel Selection.


|FLOWP |
[|CKT
|
]
PLACE |FLOWPQ | [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
|FLOWMVA|
|RELAY2 |
IN CHANNEL[S] [WITH IDENTIFIER[S] (ident) [AND (ident)]]

This form of the PLACE command is used to assign one or two branch related quantities
to output channels for a designated branch. If the optional circuit identifier tokens are
omitted, a circuit identifier of 1 is assumed. The second token specified indicates quantities
to be monitored as follows:
FLOWP

One channel containing the active power flow on the branch.

FLOWPQ

Two channels containing the active and reactive power flow on the branch.

FLOWMVA One channel containing the MVA flow on the branch.


RELAY2

Two channels containing the apparent impedance on the branch as n by


the RELAY2 model.

The user may either specify the channel identifier(s) to be assigned to the output channel(s)
or let activity CHAN assign them. Refer to Table 15-2 Activity CHAN Summary and 19-1,
activity ALTR, and Section 19.6.1 Output Channel Selection.
|3WNDFLOWP |
|3WNDFLOWPQ |
|3WNDFLOWMVA|
[|CKT
|
]
PLACE |3WNDRELAY3 | [n] BUS (bus id) TO [n] BUS (bus id) TO [n] BUS (bus id) [|CIRCUIT| (id)]
IN CHANNEL[S] [WITH IDENTIFIER[S] (ident) [AND (ident)]]

This form of the PLACE command is used to assign one or two branch related quantities
to output channels for the three-winding transformer winding connected to the first bus
specified. If the optional circuit identifier tokens are omitted, a circuit identifier of 1 is
assumed. The second token specified indicates quantities to be monitored as follows:
3WNDFLOWP

One channel containing the active power flow into the winding.

3WNDFLOWPQ

Two channels containing the active and reactive power flow into the
winding.

3WNDFLOWMVA

One channel containing the MVA flow on the winding.

3WNDRELAY3

Two channels containing the apparent impedance on the winding


as n by the RELAY3 model.

The user may either specify the channel identifier(s) to be assigned to the output channel(s)
or let activity CHAN assign them. Refer to Table 15-2 Activity CHAN Summary and 19-1,
activity ALTR, and Section 19.6.1 Output Channel Selection.
|VAR[S] |
PLACE |STATE[S]| (I1) [THRU (I2)] IN CHANNEL[S]
This form of the PLACE command is used to assign one or more consecutive VARs or
STATEs to output channels. Refer to Table 15-2 Activity CHAN Summary and 19-1, activity
ALTR, and Section 19.6.1 Output Channel Selection.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-39

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

|PSS
|
|PASS
|
|PASSTHRU|
The PASSTHRU command is used to inform activity PSAS that subsequent command
input is in the form of BAT_ records (refer to PSSE Application Program Interface (API))
and/or PSSE activity commands and responses to questions rather than in the form of
PSAS commands. While passthru mode is in effect, each input to activity PSAS is simply
appended to the Response File being built without modification. If input to activity PSAS is
being taken from the users terminal, the prompt PASSTHRU: is issued while this mode is
in effect. Passthru mode is terminated and PSAS command mode reinstated by entering
the command FIN (see below). @INPUT and @CHAIN commands must not be specified
while passthru mode is in effect; the IDEV activity command may be specified.
FIN
Terminate passthru mode (see above) and reinstate PSAS command mode.
|USE |
|COPY| (response-file-filename) [arg1 ... [arg9]]
|IDEV|
The USE command allows the user to include the BAT_ records (refer to PSSE Application Program Interface (API)) and/or PSSE line mode commands and responses to
instructions which are contained in a Response File within the PSAS commands which
define a PSSE calculation sequence. The USE filename command is converted to an
@INPUT filename command and inserted into the Response File being constructed by
activity PSAS. Note that entries in the designated file must be in the form of BAT_ records
and/or activity commands and responses to questions rather than in the form of PSAS
commands.
The designated file may contain @INPUT commands but must not contain any @CHAIN
commands or IDEV activity commands. The designated file must be terminated with an
@END command; it must not be terminated with an IDEV activity command or a FIN PSEB
command.
EXECUTE (iplan-program-filename)
The EXECUTE command allows the user to include the execution of an IPLAN program
within the PSAS commands which define a calculation sequence. The EXECUTE filename
PSAS command is converted to an EXEC filename activity command (refer to activity
EXEC) and inserted into the Response File being constructed by activity PSAS.
WATCH [OFF]
The WATCH command is used to enable or disable the echoing of responses generated
from PSAS commands to the dialog output device (normally the users terminal). Response
echoing is disabled upon entering activity PSAS; the PSAS command WATCH enables
response echoing and WATCH,OFF disables it.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-40

PSSE 33.4
Program Operation Manual

Program Automation
Building a Response File, Dynamic Simulation

CHECK
The CHECK command instructs activity PSAS to bypass the automatic execution of the
Response File which it constructs (refer to Section 16.15.3 Operation of Activity PSAS).
END
The END command terminates PSAS command input. Unless it is otherwise suppressed
(refer to Section 16.15.3 Operation of Activity PSAS), the Response File constructed by
activity PSAS is automatically executed.
ABORT
The ABORT command terminates activity PSAS and bypasses the automatic execution of
the Response File which it has constructed.
HELP
This form of the HELP command displays the list of PSAS commands at the dialog output
device (refer to Section 4.4 Virtual Output Devices).
HELP,command
This form of the HELP command displays the syntax format of the specified PSAS
command at the dialog output device (refer to Section 4.4 Virtual Output Devices).

16.15.3 Operation of Activity PSAS


The user specifies either:

The name of the appropriate PSAS Command File (refer to Section 2.4.1 File Usage).
If the specified file does not exist or some other file system related error occurs, an
appropriate error message is printed and the request for the input device is repeated.

Data input from the users terminal. This applies to both interactive and Response File
operation of PSSE.

The user specifies an output filename. Refer to Section 2.4.1 File Usage for the file specification
conventions used by activity PSAS. If a file system error occurs while opening the specified file, an
appropriate error message is printed. If no filename is specified, activity PSAS writes its output into
a file for which the name is of the form PSASnnn.IDV, where < nnn > is a number which is set such
that the resulting filename is a new file in the users directory.
When terminal input had been specified, activity PSAS issues the prompt PSAS: each time it is
ready to accept a new PSAS command. PSAS command input is terminated by entering either the
END or ABORT command.
When input is taken from a PSAS Command File, no prompts are issued. If the input file is not terminated with either the END or ABORT command, the following message is printed:
OUT OF FILE DATA--SWITCH TO TERMINAL INPUT MODE
Additional PSAS command input records may then be entered from the users terminal.
If an error occurs in processing an input record, an appropriate error message is printed, the
offending record is ignored, and processing continues.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-41

Program Automation
Building a Response File, Dynamic Simulation

PSSE 33.4
Program Operation Manual

Upon entry of either the END or ABORT command, activity PSAS is terminated and, except as
described below, an @INPUT command is automatically issued to execute the Response File
constructed by activity PSAS. If PSSE is already being operated in Response File mode (i.e.,
activity PSAS was initiated from a Response File), any remaining commands contained in the original Response File are executed following the execution of the Response File created by activity
PSAS.
The execution of the PSAS Response File is bypassed if any one of the following has occurred:
1. Command line only: Activity PSAS was invoked with the suffix CHECK.
2. The PSAS command CHECK was entered during PSAS command input.
3. Command line only: PSAS command input was terminated with the command ABORT
rather than END.
4. Any errors were encountered during the processing of PSAS command input. In this case,
if PSSE is being operated in its Response File mode, all active Response Files are closed
and further user inputs to PSSE are taken from the users terminal.
When automatic Response File execution is bypassed, activity PSAS prints the message:
YOUR RESPONSE FILE IS filename
where < filename > is the name of the PSSE Response File corresponding to the run described
by the PSAS commands which were specified.
While activity PSAS may be used with an ECHO file enable, care must be exercised if the automatic
execution of the Response File built by activity PSAS occurs. In this case, the ECHO file will contain
the commands used to execute activity PSAS as well as the Response File commands generated
by activity PSAS. That is, if subsequently executed as a PSSE Response File, the ECHO file will
perform the sequence defined by the PSAS commands twice.

16.15.4 Application Notes


When using the SET command to assign values to VARs, CONs and/or ICONs, the corresponding
Response File dialog is not generated until either:
1. A START, RUN, HOLD, PASS, USE, EXECUTE, END, or ABORT command, or one of their
synonyms, is entered; or
2. Two hundred data items have been specified in SET commands.
This minimizes the number of entries into activity ALTR.
In a similar manner, the Response File dialog for PLACE commands is not generated until either:
1. A NEXT, START, RUN, HOLD, PASS, USE, EXECUTE, END, or ABORT command, or one
of their synonyms, is entered; or
2. Two hundred simulation variables have been specified in PLACE commands.
This minimizes the number of entries into activity CHAN.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-42

PSSE 33.4
Program Operation Manual

Program Automation
Launching an IPLAN Program File

The generation of the Response File entries corresponding to previously specified PLACE
commands cancels the parameters established by any previous NEXT command.
Additional Information

PSS E GUI Users Guide, Section 23.3.4, PSAS Command File, Dynamic Simulation
PSSE Command Line Interface (CLI) Users Guide,
Section 19.5, Building a Response File, Dynamic Simulation

16.16 Launching an IPLAN Program File


Activity EXEC
Run an IPLAN Program - GUI
I/O Control>Run program Automation file
[Select Program Automation File to Run]
IPLAN File (*.irf)
Run Line Mode Activity EXEC - CLI

ACTIVITY?
>>EXEC,filename
ENTER INPUT FILE NAME (0 TO EXIT, 1 FOR TERMINAL):
>>
Python Command

psspy.runiplanfile <filename>
Interrupt Control Codes
None

The programmable PSSE execution activity EXEC retrieves an IPLAN executable program and
starts its execution. The IPLAN program must have been compiled by the IPLAN compiler from its
source form into an IPLAN Executable Program File, and the name of the IPLAN Executable
Program File must be specified.
Activity EXEC itself is not sensitive to any interrupt control code options. However, PSSE activities
executed under control of an IPLAN program respond to interrupt control codes in their normal
fashion. In addition, the IP interrupt control code may be used to terminate execution of an active
IPLAN program.

16.16.1 IPLAN Programs


IPLAN is high-level programming language designed to be utilized as an enhancement to existing
application programs such as PSSE, but which can also be used as a stand-alone product. IPLAN
is a Siemens PTI proprietary programming language that requires compilation in order to be
executed in PSSE. The compiled IPLAN program in binary format is used as input to the IPLAN
simulator which is built into PSSE. Programs written in IPLAN are created by the user with a standard text editor and compiled using the IPLAN compiler program supplied with PSSE.

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-43

PSSE 33.4
Program Operation Manual

Program Automation
Launching an IPLAN Program File

Compiled IPLAN Files can be used in PSSE in any of the following ways:

from I/O Control >Run Program Automation File (see Section 16.3 Automation
Methods in PSSE)

via line mode activity EXEC (see Section 16.11 Line Mode Commands)

via the EXECUTE command in PSAS and PSEB (see Sections 16.14.1 and 16.15.1)

via the runiplanfile function in the Python extension module psspy (see Section 16.4.1
PSSE Extension Modules For Python)

For specific detailed information and instructions on how to use the IPLAN language, please refer
to the IPLAN Program Manual.

16.16.2 Interaction With PSSE


The IPLAN compiler and simulator recognize the Single Element Data Retrieval routines from the
PSSE API. They are used in IPLAN CALL statements. This means that IPLAN programs can
assign various values from the PSSE network case to variables and act on them.
IPLAN cannot modify PSSE directly, or call other routines in the PSSE API directly. However, via
the PUSH (and PUSHX, QPUSH, QPUSHX) command(s) it can do anything that can be done in a
Response File. That includes, say, @input, which will open a Response File; in that case, the
commands in that response file will not take effect immediately unless other steps are taken. This
is explained in detail in the IPLAN Program Manual.
One of the commands in line mode is EXEC, which is used to load an IPLAN program. If an IPLAN
program invokes EXEC through a PUSH statement or by causing a Response File containing EXEC
to run, that program will replace the current one in the IPLAN simulator. IPLAN programs do not
nest.

16.16.3 The IPLAN Stand-Alone Simulator


The IPLAN compiler can call the IPLAN simulator directly. When used in this mode PUSH
commands are just displayed at the terminal, and fetch routines return default values (non-zero
return codes where appropriate, else zeros and blanks).

16.16.4 Operation of Activity EXEC


If no file is specified, or if a file system error condition is encountered in opening the designated file,
an error message is printed and activity EXEC is terminated.
Activity EXEC first searches the current directory for the IPLAN program file. If it is not found there,
activity EXEC follows the directory search sequence described in Section 2.1 Directories and Files
Overview and looks to the users home directory and the PSSE master directory PROGRAMS for
the file. If the file is not found, an appropriate message is printed and activity EXEC is terminated.
Refer to Section 2.4.1 File Usage for the file specification conventions used in specifying filenames
to activity EXEC.
If the IPLAN program in the above example requires run-time arguments, it may be initiated with
either of the activity commands:
exec,job1, argument_list
exec,job1, -arg

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-44

PSSE 33.4
Program Operation Manual

Program Automation
Launching an IPLAN Program File

When the token -arg is specified, activity EXEC instructs the user to specify the argument list which
is to be passed to the IPLAN program.
After the IPLAN program is loaded into PSSEs working memory, activity EXEC is terminated and
execution of PSSE continues. PSSEs next request for input (i.e., for the users specification of
the next function or activity to be performed) triggers the execution of the IPLAN program. When
the PSSE GUI is being used, a read from the dialog input device is forced after the IPLAN program
is loaded. While an IPLAN program is controlling the execution of PSSE, input to PSSE is
normally taken from the IPLAN program rather than from the PSSE dialog input device. On the
other hand, input to the IPLAN program to satisfy any IPLAN INPUT and INPUTLN statements is
always taken from the dialog input device. When the PSSE GUI is being used, a General Input
Window is created containing whatever prompts are awaiting display and taking the request input.
PSSE continues to accept input from the IPLAN program until either an IPLAN PAUSE, PAUSE
UNTIL, or PAUSE READ statement is executed; or the IPLAN program is terminated. At this time,
PSSE looks to the dialog input device for its input, or control returns to the GUI.
The input conventions described above apply regardless of whether interactive operation is active,
the execution of the IPLAN program is initiated from a Response File, or the IPLAN program
PUSHes an @INPUT or @CHAIN command or an IDEV,filename activity command. IPLAN
Program Manual gives some examples describing the interaction of Response Files and IPLAN
programs when both are active simultaneously.
While the redirection of input to PSSE provided by activity EXEC is similar in concept to the use
of Response Files, an IPLAN program is much more flexible than a Response File; it may receive
information from PSSE and make decisions based upon PSSE execution results.
For details on the IPLAN programming language, the IPLAN language interface to the PSSE
working case and dynamics data, and the IPLAN compiler, refer to the IPLAN Program Manual.
Additional Information

PSS E GUI Users Guide, Section 23.3.2, IPLAN Program File


PSSE Command Line Interface (CLI) Users Guide,
Section 19.7, Launching an IPLAN Program File

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-45

PSSE 33.4
Program Operation Manual

Program Automation
Launching an IPLAN Program File

All material contained in this documentation is proprietary to Siemens Industry, Inc., Siemens Power Technologies International.

16-46