Professional Documents
Culture Documents
User Manual
A product of
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
PSAT Python User Manual
THIS SOFTWARE AND ITS DOCUMENTATION WERE PREPARED BY POWERTECH LABS, INC.
(PLI). NEITHER PLI, ANY COSPONSOR, NOR ANY PERSON ACTING ON BEHALF OF ANY OF
THEM:
PSAT PYTHON program and its documentation are confidential property of Powertech Labs Inc. This
Program is protected under the copyright laws and by application of international treaties. All Rights
Reserved under the Copyright Laws.
Except as expressly provided by the terms and conditions set forth in the License, the LICENSEE
shall not:
(a) distribute or disclose the Program, Documentation or Derivative Work thereof to others;
or
(b) disclose the Proprietary Information associated with or embodied in the Program and
Documentation in any form whatsoever;
Without prior written consent of Powertech Labs Inc.
The LICENSEE shall not use the program except as expressly provided by the conditions of
LICENSE TYPE in the License.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
CONTENTS Page
1. Introduction .......................................................................................................................1
2. Imported Modules .............................................................................................................1
3. Error Argument ................................................................................................................1
4. Data Structures..................................................................................................................2
4.1 PSAT Component Data Structures ...............................................................................2
4.2 PSAT Component ID Structure ....................................................................................2
5. Get and Set Bus Data.........................................................................................................4
6. Get and Set Generator Data..............................................................................................6
7. Get and Set Load Data ......................................................................................................8
8. Get and Set Load Model Data ......................................................................................... 10
9. Get and Set Fixed Shunt Data ......................................................................................... 11
10. Get and Set Switchable Shunt Data ................................................................................ 12
11. Get and Set Line Data ..................................................................................................... 14
12. Get and Set Fixed Transformer Data ............................................................................. 16
13. Get and Set Adjustable Transformer Data .................................................................... 19
14. Get and Set Impedance Correction Table Data ............................................................. 22
15. Get and Set 3-Winding Transformer Data ..................................................................... 23
16. Get and Set Fixed Series Compensator Data.................................................................. 27
17. Get and Set Adjustable Series Compensator Data ......................................................... 30
18. Get and Set Static Tap Changer / Phase Regulator Data .............................................. 32
19. Get and Set DC Bus Data ................................................................................................ 35
20. Get and Set DC Converter Data ..................................................................................... 36
21. Get and Set Voltage Source Converter Data .................................................................. 38
22. Get and Set DC Line Data ............................................................................................... 41
23. Get and Set DC Breaker Data ......................................................................................... 43
24. Get and Set Area Data..................................................................................................... 44
25. Get and Set Zone Data .................................................................................................... 45
26. Get and Set Owner Data ................................................................................................. 46
27. Get and Set Node Data .................................................................................................... 47
28. Get and Set Zero Sequence Coupling Data .................................................................... 48
29. Get and Set Node Breaker Station .................................................................................. 49
30. Get and Set Node Breaker Busbar .................................................................................. 50
31. Get and Set Node Breaker Node ..................................................................................... 51
32. Get and Set Node Breaker Connector ............................................................................ 52
33. Get and Set Component’s Node Data ............................................................................. 54
34. Get and Set Case Data ..................................................................................................... 55
35. Get Short Circuit Data .................................................................................................... 57
36. Get WSCR Data .............................................................................................................. 58
37. Get and Set Criteria File ................................................................................................. 59
38. Get and Set Properties .................................................................................................... 59
39. Add and Delete Components........................................................................................... 62
40. Add and Delete Sectional Branches ................................................................................ 64
41. Counting Sections of a Branch ........................................................................................ 65
42. Get a Section of a Branch ................................................................................................ 65
43. Get Solution Status .......................................................................................................... 66
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
1. Introduction
PSAT supports the use of Python programs. Python is a powerful and popular programming language,
which can be freely downloaded from http://www.python.org. This site provides valuable information on
Python and includes tutorials to help you become familiar with this tool.
For use in PSAT, you need to download the latest version of Python 2.7, Python 3.4 or Python 3.8 from
http://www.python.org and install it on your computer. While installing a new version of python
remember to make a new environmental variable namde “Python[XX]_64_DIR” pointing to the location
of the python in you system, where [XX] designates the Python version supported (27, 34 or 38). You
must specify which python version to use from the Scripts menu in PSAT.
Python modules named psat_python[XX] are provided with PSAT, where [XX] designates the Python
version supported (27, 34 or 38). These modules include the functions that you can call from a Python
program to obtain powerflow data, change powerflow data, solve powerflow, etc. You write a Python
program, using these PSAT functions and any other Python feature, and you run it within PSAT.
Running PSAT Python programs in PSAT is similar to running PSAT Macros from file. You must first
save the program in a Python file (with extension .py) and use the Run Python File option from the
Scripts menu to run the saved file.
2. Imported Modules
When you invoke Python within PSAT, modules sys and psat_python[XX] (where [XX] is the Python
version) are automatically “imported”, so you don’t need to “import” these in every PSAT Python
program. The following sections describe the data structures and functions provided in psat_python.
The functions in this module can be called, for example, as:
_psat_python[XX].subsys_clear ()
or
subsys_clear ()
The _psat_python[XX]. prefix is not necessary, unless you may want to import other modules that
might have functions with similar names as psat_python functions.
You can write your own Python functions and call them from other scripts as described in section 51
3. Error Argument
Most PSAT Python functions have a psat_error class argument that returns an error in two attributes:
error = psat_error()
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
4. Data Structures
The set_*_dat and add_comp functions described below require an argument that is a PSAT Component
Data Structure (psat_*_dat) class. This argument specifies the values for the attributes of the object that
will be set (modified) or added by these functions. These objects can be created by assigning a PSAT
Data Structure. For example, a bus object is created by:
busdat = psat_bus_dat()
Note that this assignment does not accept arguments. It sets defaults for all attributes (described below)
of busdat object. You need to assign a proper value to each attribute (e.g., busdat.number, busdat.name,
etc.) before giving it to the set_bus_dat or add_comp functions.
These objects are also created by calling the get_*_dat functions, as in:
In this case, busdat gets the attributes of bus “ABC”. You can then change some of the attributes and give
busdat to the set_bus_dat (to change the attributes of the existing bus) or add_comp (to add a new bus).
All PSAT Component Data Structures (psat_*_dat) have a function called comp_id() that returns a
psat_comp_id that can represent the component in other PSAT python function that take a psat_comp_id
structure. For more details on the psat_comp_id structure refer to section 4.2.
Many PSAT python functions (get/set_*_dat, get/set_*_prop, get_next_comp, etc.) take or return a
psat_comp_id structure. This structure is used to uniquely identify an individual component (AC Bus,
Line, Generator, etc.) in the powerflow. It only contains identifying component attributes (such as
component type, bus connections, id, etc.) and does not contain any specific property attributes (such as
voltage levels, flows, limits, etc).
psat_comp_id Note that there are two groups of attributes for AC and DC component
“types”. The DC attributes are ignored for AC components and vice versa
(except for “bus” and “bus2”, which are required to identify Converters and
VSCs).
fixed_transformer or fxtr
adjustable_transformer or ultc
three_winding_transformer or twtr
fixed_series_compensator or fxsc
adjustable_series_compensator or vrsc
static_tap_changer_phase_regulator or stcpr
dc_bus or dcbs
dc_converter or cnvrtr
voltage_source_converter or vsc
dc_line or dcln
dc_breaker or dcbrkr
area or ar
zone or zn
owner or own
node or nd
z_seq_coupling or zseq
nb_station or nbst
nb_busbar or nbbb
nb_node or nbnd
nb_connector or nbcn
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The psat_comp_id structure can be initialized for the various component types by passing in the required
properties to uniquely identify that component. For example to initialize for AC Bus number 123:
acbus_id = psat_comp_id(ctype.bus,123)
Or for example to initialize for an AC line between buses 1 and 8 with an ID of ‘1’:
The component type can be specified as either a string or integer (ctype.*) value, all AC buses must be
specified by their bus number (integer) and DC buses by name (string).
Currently the psat_comp_id equipment name attribute ‘eqname’ is only used in searching for node
components, for all other components it is only a return value set by PSAT.
For specific situations the psat_comp_id structure can be initialized with a ‘type’ value only, as is
required by some functions like the subsystem function ‘get_next_comp’.
Where
Returned values Data of bus busid, in psat_bus_dat structure, with the following attributes:
number bus number
name bus name
eqname bus equipment name
basekv base kV
type bus type 1: load bus, 2: gen bus, 3: swing bus, 4: out of service bus
vmag voltage magnitude in pu
vang voltage angle in degree
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
For example,
error = psat_error()
busno = 123
busdat = get_bus_dat (busno, error)
Returns:
busdat.number: 123
busdat.name: ’ABCD 110.’
busdat.basekv: 110.
. . . etc.
error.code: 0
But if bus 123 doesn’t exist, the returned busdat is unknown and error.code is 1.
The following function sets (changes) the data of a bus in the powerflow data.
Where
For example,
error = psat_error()
busno = 123
busdat = get_bus_dat (busno, error)
busdat.type = 1
busdat.vmag = 1.0
busdat.vang = 0.0
busdat.area = 5
busdat.zone = 51
set_bus_dat (busno, busdat, error)
changes the type of bus 123 to “load bus”, its voltage to (1.0, 0.0) and its area and zone to 5 and 51
(powerflow data must have area 5 and zone 51 for this bus data to be acceptable).
Where
Returned values Data of the generator, in psat_gen_dat structure, with the following
attributes:
bus generator bus number
id generator id
eqname generator equipment name
status generator status (1: in service, 0: out of service)
basemva generator base MVA
mw MW output
mwmax maximum MW
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
mwmin minimum MW
mvar MVAr output
mvarmax maximum MVAr
mvarmin minimum MVAr
openvar open MVAr limit (1: Yes, 0: No)
vhi upper limit of terminal voltage in pu
vlo lower limit of terminal voltage in pu
rembus remote controlled bus number (0: no remote bus)
vrem scheduled voltage of remote controlled bus
varshare share of the generator for control of the remote bus
rgen generator internal resistance in pu of generator base MVA
xgen generator internal reactance in pu of generator base MVA
rtrnsf step-up transformer resistance in pu of generator base MVA
xtrnsf step-up transformer reactance in pu of generator base MVA
taptransf step-up transformer tap ratio in pu
wmcm wind machine MVAr control mode
0:N/A,1:QT&QB,2:MW&GWPF,3:Fixed
wmpf wind machine power factor
govbl governor base load 0: No, 1: Yes
owner(0:3) generator owners 1 to 4
ownfrac(0:3) generator owner fractions 1 to 4
inr N-seq resistance
inx N-seq reactance
izr Z-seq resistance
izx Z-seq reactance
ipr pos-seq resistance
ipx pos-seq reactance
igr grounding resistance
igx grounding reactance
The following functions set (change) the data of a generator in the powerflow data.
Where
gendat.bus.
If gendat.id is different from genid, the ID of generator is set to the new
gendat.id.
error Is the returned error (psat_error class).
If the powerflow data is changed to gendat,
error.code, error.msg: 0, ’’
If the generator genid at busid doesn’t exist in the powerflow data,
error.code, error.msg: 1, ’Generator is not found.’
If gendat.bus doesn’t exist in the powerflow data,
error.code, error.msg: 2, ’New generator bus is not found.’
If gendat has invalid (unacceptable) values,
error.code, error.msg: 3, ’New generator data is invalid.’
If gendat has invalid node,
Where
Returned values Data of the load, in psat_load_dat structure, with the following attributes:
bus load bus number
id load id
name load name
eqname load equipment name
status load status 0: out, 1: in
owner load owner
area load area
zone load zone
refmw reference MW load
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a load in the powerflow data.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
Returned values Data of the load model, in psat_load_model_dat structure, with the
following attributes:
number load model number
pc(0:2) P coefficients 1 to 3
pe(0:2) P exponents 1 to 3
qc(0:2) Q coefficients 1 to 3
qe(0:2) Q exponents 1 to 3
The following function sets (changes) the data of a load model in the powerflow data.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
busid Is the number (integer) or name (string) of the fixed shunt bus.
shuntid Is the fixed shunt ID (string).
shunt_compid Is the psat_comp_id (structure) of a fixed shunt
error Is the returned error (psat_error class).
If fixed shunt shuntid at bus busid exists in the powerflow data,
error.code, error.msg : 0, ’’
Otherwise,
error.code, error.msg : 1, ’Fixed shunt is not found.’
The following functions set (change) the data of a fixed shunt in the powerflow data.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
busid Is the number (integer) or name (string) of the fixed shunt bus.
shuntid Is the fixed shunt ID (string).
shunt_compid Is the psat_comp_id (structure) of a fixed shunt
fx_shuntdat Is the new data for the fixed shunt , in
psat_fx_shunt_dat structure (as above).
If fx_shuntdat.bus is different from busid, the fixed shunt is moved from
busid to fx_shuntdat.bus.
If fx_shuntdat.id is different from shuntid, the ID of fixed shunt is set to the
new fx_shuntdat.id.
The mw and mvar attributes of fx_shuntdat are ignored (since these are
calculated form the nominal values).
error Is the returned error (psat_error class).
If the powerflow data is changed to fx_shuntdat,
error.code, error.msg: 0, ’’
If the fixed shunt shuntid at busid doesn’t exist in the powerflow data,
error.code, error.msg: 1, ’Fixed shunt is not found.’
If fx_shuntdat.bus doesn’t exist in the powerflow data,
error.code, error.msg: 2, ’New fixed shunt bus is not found.’
If fx_shuntdat has invalid (unacceptable) values,
error.code, error.msg: 3, ’New fixed shunt data is invalid.’
If fx_shuntdat has invalid node,
Where
busid Is the number (integer) or name (string) of the switchable shunt bus.
shuntid Is the switchable shunt ID (string).
shunt_compid Is the psat_comp_id (structure) of a switchable shunt
error Is the returned error (psat_error class).
If switchable shunt shuntid at bus busid exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg: 1, ’Switchable shunt is not found.’
Returned values Data of the switchable shunt, in psat_sw_shunt_dat structure, with the
following attributes:
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a switchable shunt in the powerflow data.
Where
busid Is the number (integer) or name (string) of the switchable shunt bus.
shuntid Is the switchable shunt ID (string).
shunt_compid Is the psat_comp_id (structure) of a switchable shunt
sw_shuntdat Is the new data for the switchable shunt, in psat_sw_shunt_dat structure
(as above).
If sw_shuntdat.bus is different from busid, the switchable shunt is moved
from busid to sw_shuntdat.bus.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
line.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
line.
lineid Is the line ID (string).
line_compid Is the psat_comp_id (structure) of an AC line
secno Is the section number.
If the line is not part of a sectional branch, secno is ignored
Otherwise, secno must be the correct section number for this line.
error Is the returned error (psat_error class).
If line lineid, section secno, between bus1id and bus2id exists in the
powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg: 1, ’Line is not found.’
Returned values Data of the line, in psat_line_dat structure, with the following attributes:
frbus from-bus number
tobus to-bus number (order of frbus and tobus is significant)
id line ID
eqname Line equipment name
sec section number (ignored if the line is not part of a sectional branch)
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of an AC line in the powerflow data.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
line.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
line.
lineid Is the line ID (string).
line_compid Is the psat_comp_id (structure) of an AC line
secno Is the section number.
If the line is not part of a sectional branch, secno must be 0. Otherwise,
secno must be the correct section number for this line.
linedat Is the new data for the line, in psat_line_dat structure (as above).
If linedat.frbus is different from the “from-bus” of the line in the powerflow
data, the “from-bus” is changed to linedat.frbus.
If linedat.tobus is different from the “to-bus” of the line in the powerflow
data, the “to-bus” is changed to linedat.tobus (the order of from-bus and to-
bus is important).
If linedat.id is different from lineid, the ID of line is changed to the new
linedat.id.
secno and linedat.sec must be equal (to change the sections, see Add and
Delete Sectional Branches below).
linedat.pfr/qfr/ifr/pto/qto/ito values are ignored (flows are not set to
specified values).
error Is the returned error (psat_error class).
If the powerflow data is changed to linedat,
error.code, error.msg: 0, ’’
If the line lineid, section secno, between bus1id and bus2id doesn’t exist in
the powerflow data,
error.code, error.msg: 1, ’Line is not found.’
If linedat.frbus or linedat.tobus doesn’t exist in the powerflow data,
error.code, error.msg: 2, ’New line from/to bus is not found.’
If from-bus, to-bus or ID is changed to new linedat.frbus, linedat.tobus or
linedat.id and another branch with these new from-bus, to-bus and ID
already exists,
error.code, error.msg: 3, ’Another branch with the same from-bus, to-
bus and ID already exists.’
If linedat has invalid (unacceptable) values,
error.code, error.msg: 4, ’New line data is invalid.’
If linedat has invalid node,
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
fixed transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
fixed transformer.
transid Is the fixed transformer ID (string).
trans_compid Is the psat_comp_id (structure) of a fixed transformer
secno Is the section number.
If the fixed transformer is not part of a sectional branch, secno is ignored
Otherwise, secno must be the correct section number for this fixed
transformer.
error Is the returned error (psat_error class).
If fixed transformer transid, section secno, between bus1id and bus2id
exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg: 1, ’Fixed transformer is not found.’
Returned values Data of the fixed transformer, in psat_fx_trans_dat structure, with the
following attributes:
frbus from-bus number
tobus to-bus number (order of frbus and tobus is significant)
id fixed transformer ID
name fixed transformer name
eqname fixed transformer equipment name
sec section number (ignored if the fixed transformer is not part of a
sectional branch)
status status (1: in service, 0: out of service)
basmva transformer base MVA
meter metered end (F: from-bus, T: to-bus)
ratio off-nominal turns ratio in pu.
phsh phase shift angle in degree
rsr series resistance
xsr series reactance
gfr from-bus magnetizing conductance
bfr from-bus magnetizing susceptance
gto to-bus magnetizing conductance
bto to-bus magnetizing susceptance
gch charging conductance
bch charging susceptance
pfr MW flow at from bus side
qfr MVAr flow at from bus side
ifr Current (in Amps) at from bus side
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a fixed transformer in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
fixed transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
fixed transformer.
transid Is the fixed transformer ID (string).
trans_compid Is the psat_comp_id (structure) of a fixed transformer
secno Is the section number.
If the fixed transformer is not part of a sectional branch, secno must be 0.
Otherwise, secno must be the correct section number for this fixed
transformer.
fx_transdat Is the new data for the fixed transformer, in psat_fx_trans_dat structure
(as above).
If fx_transdat.frbus is different from the “from-bus” of the fixed
transformer in the powerflow data, the “from-bus” is changed to
fx_transdat.frbus.
If fx_transdat.tobus is different from the “to-bus” of the fixed transformer
in the powerflow data, the “to-bus” is changed to fx_transdat.tobus (order
of from-bus and to-bus is important).
If fx_transdat.id is different from transid, the ID of fixed transformer is
changed to the new fx_transdat.id.
secno and fx_transdat.sec must be equal.
fx_transdat.pfr/qfr/ifr/pto/qto/ito values are ignored (flows are not set to
specified values).
error Is the returned error (psat_error class).
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
adjustable transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
adjustable transformer.
transid Is the adjustable transformer ID (string).
trans_compid Is the psat_comp_id (structure) of an adjustable transformer
secno Is the section number.
If the adjustable transformer is not part of a sectional branch, secno is
ignored.
Otherwise, secno must be the correct section number for this adjustable
transformer.
error Is the returned error (psat_error class).
If adjustable transformer transid, section secno, between bus1id and bus2id
exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’Adjustable transformer is not found.’
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Returned values Data of the adjustable transformer, in psat_2w_trans_dat structure, with the
following attributes:
frbus from-bus number
tobus to-bus number (order of frbus and tobus is significant)
id adjustable transformer ID
name adjustable transformer name
eqname adjustable transformer equipment name
sec section number (ignored if the adjustable transformer is not part of a
sectional branch)
status status (1: in service, 0: out of service)
basmva transformer base MVA
meter metered end (F: from-bus, T: to-bus)
fsratio from-side off-nominal turns ratio in pu.
tsratio to-side off-nominal turns ratio in pu.
maxratio from-side maximum turns ratio in pu.
minratio from-side minimum turns ratio in pu.
stepratio step size of from-side turns ratio in pu.
phsh phase shift angle in degree
maxphsh maximum phase shift angle in degree
minphsh minimum phase shift angle in degree
rsr series resistance
xsr series reactance
zct impedance correction table number
gfr from-bus magnetizing conductance
bfr from-bus magnetizing susceptance
gto to-bus magnetizing conductance
bto to-bus magnetizing susceptance
gch charging conductance
bch charging susceptance
ctl control flag (1: enabled, 0: disabled)
ctlvar control type (V: voltage, Q: MVAr flow, P: MW flow)
ctlside control side (F: from-side, T: to-side)
ctlbus controlled bus number
vhi upper limit for controlled bus voltage in pu
vlo lower limit for controlled bus voltage in pu
qhi upper limit for controlled MVAr flow
qlo lower limit for controlled MVAr flow
phi upper limit for controlled MW flow
plo lower limit for controlled MW flow
pfr MW flow at from bus side
qfr MVAr flow at from bus side
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of an adjustable transformer in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
adjustable transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
adjustable transformer.
Transid Is the adjustable transformer ID (string).
trans_compid Is the psat_comp_id (structure) of an adjustable transformer
Secno Is the section number.
If the adjustable transformer is not part of a sectional branch, secno must be
0. Otherwise, secno must be the correct section number for this adjustable
transformer.
2w_transdat Is the new data for the adjustable transformer, in psat_2w_trans_dat
structure (as above).
If 2w_transdat.frbus is different from the “from-bus” of the adjustable
transformer in the powerflow data, the “from-bus” is changed to
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
2w_transdat.frbus.
If 2w_transdat.tobus is different from the “to-bus” of the adjustable
transformer in the powerflow data, the “to-bus” is changed to
2w_transdat.tobus (order of from-bus and to-bus is important).
If 2w_transdat.id is different from transid, the ID of adjustable transformer
is changed to the new 2w_transdat.id.
secno and 2w_transdat.sec must be equal.
2w_transdat.pfr/qfr/ifr/pto/qto/ito values are ignored (flows are not set to
specified values).
test_data_entry Is an optional boolean value (True or False). When ‘True’, it specifies that
the test data entry fields (mgl,mxc) of the 2w_transdat parameter are used
instead of the PSAT default Admittance fields (gfr,bfr,gto,bto,gch,bch)
Error Is the returned error (psat_error class).
If the powerflow data is changed to 2w_transdat,
error.code, error.msg: 0, ’’
If the adjustable transformer transid, section secno, between bus1id and
bus2id doesn’t exist in the powerflow data,
error.code, error.msg: 1, ’Adjustable transformer is not found.’
If 2w_transdat.frbus or 2w_transdat.tobus doesn’t exist in the powerflow
data,
error.code, error.msg: 2, ’New adjustable transformer from/to bus is
not found.’
If from-bus, to-bus or ID is changed to new 2w_transdat.frbus,
2w_transdat.tobus or 2w_transdat.id and another branch with these new
from-bus, to-bus and ID already exists,
error.code, error.msg: 3, ’Another branch with the same from-bus, to-
bus and ID already exists.’
If 2w_transdat has invalid (unacceptable) values,
error.code, error.msg: 4, ’New adjustable transformer data is invalid.’
If 2w_transdat has invalid node,
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
Where
Returned values Data of the Impedance Correction Table, in psat_zct_dat structure, with the
following attributes:
tno table number
trps(0:10) turns ratio (in pu) or phase shift angle (in degrees) of 11 points in the
table
fctr(0:10) correction factors for the above 11 points
The following function sets (changes) the data of an Impedance Correction Table in the powerflow data.
Where
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
3-winding transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the 3-
winding transformer.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
bus3id Is the number (integer) or name (string) of the third terminal bus of the 3-
winding transformer.
transid Is the 3-winding transformer ID (string).
trans_compid Is the psat_comp_id (structure) of an 3-winding transformer
error Is the returned error (psat_error class).
If 3-winding transformer transid, between bus1id, bus2id and bus3id exists
in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’3-winding transformer is not found.’
Returned values Data of the 3-winding transformer, in psat_3w_trans_dat structure, with the
following attributes:
prbus primary-bus number
scbus secondary-bus number
trbus tertiary-bus number (order of prbus, scbus and trbus is significant)
id 3-winding transformer ID
name 3-winding transformer name
eqname 3-winding transformer equipment name
status status:
0: out of service
1: in service
2: secondary winding out of service
3: tertiary winding out of service
4: primary winding out of service
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
xsrs
xsrt
gmp magnetizing conductance (in pu) of P, S and T windings
gms
gmt
bmp magnetizing susceptance (in pu) of P, S and T windings
bms
bmt
gcp charging conductance (in pu) of P, S and T windings
gcs
gct
bcp charging susceptance (in pu) of P, S and T windings
bcs
bct
przct impedance correction table number of P, S and T windings
sczct
trzct
prctl control flag of P, S and T windings (0: disabled, 1: voltage, 2: mvar,
scctl 10: mw)
trctl
prctlside control side of P, S and T windings (T: tap-side, I: impedance-side)
scctlside
trctlside
prctlbus controlled bus number of P, S and T windings
scctlbus
trctlbus
prvhi upper limit for controlled bus voltage in pu of P, S and T windings
scvhi
trvhi
prvlo lower limit for controlled bus voltage in pu of P, S and T windings
scvlo
trvlo
ppr MW flow at the P, S and T windings
psc
ptr
qpr MVAr flow at the P, S and T windings
qsc
qtr
ipr Current (in Amps) at the P, S and T windings
isc
itr
ratpr1:ratpr6 primary-winding MVA ratings 1 to 6
ratsc1:ratsc6 secondary-winding MVA ratings 1 to 6
rattr1:rattr6 tertiary-winding MVA ratings 1 to 6
ratgr rating group number
owner(0:3) 3-winding transformer owners 1 to 4
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a 3-winding transformer in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
3-winding transformer.
bus2id Is the number (integer) or name (string) of the other terminal bus of the 3-
winding transformer.
bus3id Is the number (integer) or name (string) of the third terminal bus of the 3-
winding transformer.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
fixed series compensator.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
fixed series compensator.
scid Is the fixed series compensator ID (string).
sc_compid Is the psat_comp_id (structure) of a fixed series compensator
secno Is the section number.
If the fixed series compensator is not part of a sectional branch, secno is
ignored.
Otherwise, secno must be the correct section number for this fixed series
compensator.
error Is the returned error (psat_error class).
If fixed series compensator scid, section secno, between bus1id and bus2id
exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg: 1, ’Fixed series compensator is not found.’
The following functions set (change) the data of a fixed series compensator in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
adjustable series compensator.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
adjustable series compensator.
scid Is the adjustable series compensator ID (string).
sc_compid Is the psat_comp_id (structure) of an adjustable series compensator
secno Is the section number.
If the adjustable series compensator is not part of a sectional branch, secno
is ignored.
Otherwise, secno must be the correct section number for this adjustable
series compensator.
error Is the returned error (psat_error class).
If adjustable series compensator scid, section secno, between bus1id and
bus2id exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg: 1, ’Adjustable series compensator is not
found.’
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
kvrat kV rating
pfr MW flow at from bus side
qfr MVAr flow at from bus side
ifr Current (in Amps) at from bus side
pto MW flow at to bus side
qto MVAr flow at to bus side
ito Current (in Amps) at to bus side
owner adjustable series compensator owner
The following functions set (change) the data of an adjustable series compensator in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
adjustable series compensator.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
adjustable series compensator.
scid Is the adjustable series compensator ID (string).
sc_compid Is the psat_comp_id (structure) of an adjustable series compensator
secno Is the section number.
If the adjustable series compensator is not part of a sectional branch, secno
must be 0. Otherwise, secno must be the correct section number for this
adjustable series compensator.
aj_sercompdat Is the new data for the adjustable series compensator, in
psat_aj_sercomp_dat structure (as above).
If aj_sercompdat.frbus is different from the “from-bus” of the adjustable
series compensator in the powerflow data, the “from-bus” is changed to
aj_sercompdat.frbus.
If aj_sercompdat.tobus is different from the “to-bus” of the adjustable
series compensator in the powerflow data, the “to-bus” is changed to
aj_sercompdat.tobus (order of from-bus and to-bus is important).
If aj_sercompdat.id is different from scid, the ID of adjustable series
compensator is changed to the new aj_sercompdat.id.
secno and aj_sercompdat.sec must be equal.
aj_sercompdat.pfr/qfr/ifr/pto/qto/ito values are ignored (flows are not set to
specified values).
error Is the returned error (psat_error class).
If the powerflow data is changed to aj_sercompdat,
error.code, error.msg: 0, ’’
If the adjustable series compensator scid, section secno, between bus1id
and bus2id doesn’t exist in the powerflow data,
error.code, error.msg: 1, ’Adjustable series compensator is not
found.’
If aj_sercompdat.frbus or aj_sercompdat.tobus doesn’t exist in the
powerflow data,
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
18. Get and Set Static Tap Changer / Phase Regulator Data
The following functions return the data of a Static Tap Changers / Phase Regulators (STCPR) in the
powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
STCPR.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
STCPR.
scid Is the ID (string).
sc_compid Is the psat_comp_id (structure) of a STCPR
secno Is the section number.
If the STCPR is not part of a sectional branch, secno is ignored.
Otherwise, secno must be the correct section number for this STCPR.
error Is the returned error (psat_error class).
If STCPR scid, section secno, between bus1id and bus2id exists in the
powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’STCPR is not found.’
Returned values Data of the STCPR, in psat_stcpr_dat structure, with the following
attributes:
frbus from-bus number
tobus to-bus number (order of frbus and tobus is significant)
id ID
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of an STCPR in the powerflow data.
Where
bus1id Is the number (integer) or name (string) of one of the terminal buses of the
STCPR.
bus2id Is the number (integer) or name (string) of the other terminal bus of the
STCPR.
scid Is the ID (string).
sc_compid Is the psat_comp_id (structure) of a STCPR
secno Is the section number.
If the STCPR is not part of a sectional branch, secno must be 0. Otherwise,
secno must be the correct section number for this STCPR.
stcprdat Is the new data for the STCPR, in psat_stcpr_dat structure (as above).
If stcprdat.frbus is different from the “from-bus” of the STCPR in the
powerflow data, the “from-bus” is changed to stcprdat.frbus.
If stcprdat.tobus is different from the “to-bus” of the STCPR in the
powerflow data, the “to-bus” is changed to stcprdat.tobus (order of from-
bus and to-bus is important).
If stcprdat.id is different from scid, the ID of STCPR is changed to the new
stcprdat.id.
secno and stcprdat.sec must be equal.
stcprdat.pfr/qfr/ifr/pto/qto/ito values are ignored (flows are not set to
specified values).
error Is the returned error (psat_error class).
If the powerflow data is changed to stcprdat,
error.code, error.msg: 0, ’’
If the STCPR scid, section secno, between bus1id and bus2id doesn’t exist
in the powerflow data,
error.code, error.msg : 1, ’STCPR is not found.’
If stcprdat.frbus or stcprdat.tobus doesn’t exist in the powerflow data,
error.code, error.msg : 2, ’New STCPR from/to bus is not found.’
If from-bus, to-bus or ID is changed to new stcprdat.frbus, stcprdat.tobus or
stcprdat.id and another branch with these new from-bus, to-bus and ID
already exists,
error.code, error.msg : 3, ’Another branch with the same from-bus,
to-bus and ID already exists.’
If stcprdat has invalid (unacceptable) values,
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Note that changing the from-bus, to-bus, ID or status of one section of a sectional branch results in similar
changes for all sections of that branch.
Where
Returned values Data of the Dc bus, in psat_dcbus_dat structure, with the following
attributes:
name DC bus name
area area number
zone zone number
vmag DC bus voltage
The following functions set (change) the data of a DC bus in the powerflow data.
Where
Where
dcbnm1 Is the name (string) of the first DC terminal bus of the converter.
dcbnm2 Is the name (string) of the second DC terminal bus of the converter.
acbusid Is the number (integer)/name (string) of the AC-side (primary) terminal bus
of the converter transformer.
cnvid Is the converter circuit number (integer).
cnv_compid Is the psat_comp_id (structure) of a DC converter.
error Is the returned error (psat_error class).
If the converter exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’Converter is not found.’
Returned values Data of the Converter, in psat_converter_dat structure, with the following
attributes:
dcb1 name of first DC bus (8 character long).
dcb2 name of second DC bus (8 character long).
acbus number of AC bus (primary terminal) of converter transformer.
id circuit number (ID) of the converters (integer).
type converter type (R: Rectifier, I: Inverter )
xc commutating reactance, either in ohms per bridge when transformer
MVA is zero, or in pu based on transformer MVA rating.
rcomp voltage compounding resistance in Ohms.
nbr number of series bridges in this converter.
basmva transformer MVA rating (zero when Xc is in ohms/bridge).
baskv base voltage of transformer primary side in kV.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
nratio transformer nominal ratio (DC side base voltage / AC side base
voltage).
maxratio maximum off-nominal turns ratio of the transformer in pu.
minratio minimum off-nominal turns ratio of the transformer in pu.
stepratio transformer step size in pu.
ctl1 first control variable (VD, ID, etc.) described in PSAT manual.
sp1 set point of the first control variable in the units specified in PSAT
manual.
ctl2 second control variable (VD, ID, etc.) described in PSAT manual.
sp2 set point of the second control variable in the units specified in PSAT
manual.
almax maximum alpha in degrees.
almin minimum alpha in degrees.
gamin minimum gamma in degrees.
pmax maximum real power in MW.
pmin minimum real power in MW.
qmax maximum reactive power in MVAr.
qmin minimum reactive power in MVAr.
imax maximum DC current in Amps.
vdc DC Voltage (kV)
idc DC Current (A)
alpha Alpha (Deg)
gamma Gamma (Deg)
ratio Transformer Ratio
pac AC Power (MW)
qac AC Power (MVAr)
iac AC Current (A)
The following functions set (change) the data of a Converter in the powerflow data.
Where
dcbnm1 Is the name (string) of the first DC terminal bus of the converter.
dcbnm2 Is the name (string) of the second DC terminal bus of the converter.
acbusid Is the number (integer) / name (string) of the AC-side (primary) terminal
bus of the converter transformer.
cnvid Is the converter circuit number (integer).
cnv_compid Is the psat_comp_id (structure) of a DC converter.
convdat Is the new data for the converter, in psat_converter_dat structure (as above)
If convdat.dcb1 (or .dcb2 or .acbus or .id) is different from dcbnm1 (or
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
dcbnm1 Is the name (string) of the first DC terminal bus of the VSC.
dcbnm2 Is the name (string) of the second DC terminal bus of the VSC.
acbusid1 Is the number (integer) / name (string) of the first AC terminal bus of the
VSC.
acbusid2 Is the number (integer) / name (string) of the second AC terminal bus of the
VSC.
vscid Is the VSC circuit number (integer).
vsc_compid Is the psat_comp_id (structure) of a Voltage Source Converter (VSC).
error Is the returned error (psat_error class).
If the VSC exists in the powerflow data,
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’Voltage Source Converter is not found.’
Returned values Data of the VSC, in psat_vsc_dat structure, with the following attributes:
dcb1 name of first DC bus (8 character long).
dcb2 name of second DC bus (8 character long).
acb1 number of first AC bus (integer).
acb2 number of second AC bus (integer).
id circuit number (ID) of the VSC (integer).
type VSC type (R: Rectifier, I: Inverter )
xt transformer reactance, either in ohms per bridge when transformer
MVA is zero, or in pu based on transformer MVA rating.
xl line reactance, either in ohms if transformer MVA is zero, or in pu
based on transformer MVA rating. This is the reactance of line in series
with the transformer between the two AC buses.
nbr number of series bridges in this VSC.
kc code for the DC-to-AC gain (i.e. Vl-1/Vd), which can be one of the
following (integer):
0 - gain is 1
1 - SQRT(6)/4 for linear sinusoidal PWM
2 - SQRT(6)/ for square-wave pulse switching
3 - 0.727 for 5th and 7th harmonic elimination switching
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a Voltage Source Converter in the powerflow data.
Where
dcbnm1 Is the name (string) of the first DC terminal bus of the VSC.
dcbnm2 Is the name (string) of the second DC terminal bus of the VSC.
acbusid1 Is the number (integer) / name (string) of the first AC bus of the VSC.
acbusid2 Is the number (integer) / name (string) of the second AC bus of the VSC.
vscid Is the VSC circuit number (integer).
vsc_compid Is the psat_comp_id (structure) of a Voltage Source Converter (VSC).
vscdat Is the new data for the VSC, in psat_vsc_dat structure (as above).
If vscdat.dcb1 (or .dcb2 or .acb1 or acb2 or .id) is different from dcbnm1
(or dcbnm2 or acbno1 or acbno2 or vscid), the first DC bus (or second DC
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
dcbnm1 Is the name (string) of one of the DC terminal buses of the DC line.
dcbnm2 Is the name (string) of the other DC terminal bus of the DC line.
dclid Is the DC line circuit number (integer).
dcl_compid Is the psat_comp_id (structure) of a DC line.
error Is the returned error (psat_error class).
If the DC line exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’DC line is not found.’
Returned values Data of the DC line, in psat_dcline_dat structure, with the following
attributes:
dcb1 name of first (From) DC bus (8 character long).
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following functions set (change) the data of a DC line in the powerflow data.
Where
dcbnm1 Is the name (string) of one of the DC terminal buses of the DC line.
dcbnm2 Is the name (string) of the other DC terminal bus of the DC line.
dclid Is the DC line circuit number (integer).
dcl_compid Is the psat_comp_id (structure) of a DC line.
dclinedat Is the new data for the DC line, in psat_dcline_dat structure (as above).
If dclinedat.dcb1 is different from the From-bus of the line in the
powerflow data, the From-bus is changed to dclinedat.dcb1.
If dclinedat.dcb2 is different from the To-bus of the line in the powerflow
data, the To-bus is changed to dclinedat.dcb2 (the order of From-bus and
To-bus is important).
If dclinedat.id is different from dclid, the ID (number) of DC line is
changed to the new dclinedat.id.
dclinedat.pfr/ifr/pto/ito values are ignored (flows are not set to specified
values).
error Is the returned error (psat_error class).
If the powerflow data is changed to dclinedat,
error.code, error.msg : 0, ’’
If the DC line dclid, connected between dcbnm1 and dcbnm2 doesn’t exist
in the powerflow data,
error.code, error.msg : 1, ’DC line is not found.’
If dclinedat.dcb1 (or dclinedat.dcb2) is different from dcbnam1 (or
dcbnam2) and there is no DC bus with this name in the powerflow data,
error.code, error.msg : 2, ’New DC bus 1/2 of DC line is not found.’
If dclinedat.id is different from dclid and there is another DC line between
the same buses with the same ID,
error.code, error.msg : 3, ’Another DC line with the same ID already
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
exists.’
If dclinedat has invalid (unacceptable) values,
error.code, error.msg : 4, ’New DC line data is invalid.’
Where
dcbnm1 Is the name (string) of one of the DC terminal buses of the DC breaker.
dcbnm2 Is the name (string) of the other DC terminal bus of the DC breaker.
dcbid Is the DC breaker circuit number (integer).
dcb_compid Is the psat_comp_id (structure) of a DC breaker.
error Is the returned error (psat_error class).
If the DC breaker exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’DC breaker is not found.’
Returned values Data of the DC breaker, in psat_dcbrkr_dat structure, with the following
attributes:
dcb1 name of first (From) DC bus (8 character long).
dcb2 name of second (To) DC bus (8 character long).
id circuit number (ID) of the DC breakers (integer).
stat status (C: Closed, O: Open)
pfr Breaker Power (MW)
ifr Breaker Current (Amp)
The following functions set (change) the data of a DC breaker in the powerflow data.
Where
dcbnm1 Is the name (string) of one of the DC terminal buses of the DC breaker.
dcbnm2 Is the name (string) of the other DC terminal bus of the DC breaker.
dcbid Is the DC breaker circuit number (integer).
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
Returned values Data of the area arid, in psat_area_dat structure, with the following
attributes:
number area number
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function sets (changes) the data of an Area in the powerflow data.
Where
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Otherwise,
error.code, error.msg : 1, ’Zone is not found.’
Returned values Data of the zone znid, in psat_zone_dat structure, with the following
attributes:
number zone number
name zone name
The following function sets (changes) the data of a Zone in the powerflow data.
Where
Where
Returned values Data of the owner owid, in psat_owner_dat structure, with the following
attributes:
number owner number
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function sets (changes) the data of an Owner in the powerflow data.
Where
Where
Returned values Data of the node nodeid, in psat_node_dat structure, with the following
attributes:
number node bus number
eqname node equipment name
The following function sets (changes) the data of a Node in the powerflow data.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
line1fr Is the number (integer) of the from-bus end of the first zseq coupling line
line1to Is the number (integer) of the to-bus end of the first zseq coupling line
line1id Is the ID (string) of the first zseq coupling line.
line2fr Is the number (integer) of the from-bus end of the second zseq coupling
line
line2to Is the number (integer) of the to-bus end of the second zseq coupling line
line2id Is the ID (string) of the second zseq coupling line.
zseq_compid Is the psat_comp_id (structure) of a Zero Sequence Coupling item
error Is the returned error (psat_error class).
If the node exists in the powerflow data,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ’Node is not found.’
Returned values Data for the zseq coupling item, in psat_z_seq_coupling_dat structure, with
the following attributes:
line1eq Z-Seq coupling line1 equipment name
line1fr Z-Seq coupling line1 from-bus number
line1to Z-Seq coupling line1 to-bus number
line1id Z-Seq coupling line1 ID
line2eq Z-Seq coupling line2 equipment name
line2fr Z-Seq coupling line2 from-bus number
line2to Z-Seq coupling line2 to-bus number
line2id Z-Seq coupling line2 ID
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
sr line-to-line resistance
sx line-to-line reactance
line1cf line1 coupling factor
line2cf line2 coupling factor
line1md line1 metered end direction
line2md line2 metered end direction
The following function sets (changes) the data of a Zero Sequence Coupling item in the powerflow data.
Where
line1fr Is the number (integer) of the from-bus end of the zseq coupling line1
line1to Is the number (integer) of the to-bus end of the zseq coupling line1
line1id Is the ID (string) of the zseq coupling line1.
line2fr Is the number (integer) of the from-bus end of the zseq coupling line2
line2to Is the number (integer) of the to-bus end of the zseq coupling line2
line2id Is the ID (string) of the zseq coupling line2.
zseq_compid Is the psat_comp_id (structure) of a Zero Sequence Coupling
zseqdat Is the new data for the zseq coupling item, in psat_z_seq_coupling_dat
structure (as above).
If zseqdat line equipment names or line bus numbers are different from the
specified zseq coupling item, the zseq coupling is changed to the new
zseqdat values.
error Is the returned error (psat_error class).
If the powerflow data is changed to zseqdat,
error.code, error.msg : 0, ’’
If the specified zseq coupling item doesn’t exist in the powerflow data,
error.code, error.msg : 1, ’Z-Seq Coupling item is not found.’
get_nb_station_dat(stnid, error)
Where
Otherwise,
error.code, error.msg : 1, ‘Station is not found.’
Returned values Data of station stnid, in psat_nb_station_dat structure, with following
attributes:
number station number
name station name
type station type. 1: Generic 2:Substation 3:Thermal 4:Hydro 5:Wind 6:Solar
7:Diesel 8:Gas 9:Nuclear 10:Biomass 11:Geothermal
kv station kv
gps_lat location lattitude
gps_long location longitude
sgr station sgr
The following function sets (changes) the data of a Station in powerflow data.
Where
get_nb_busbar_dat(bbid, error)
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function sets (changes) the data of a Busbar in powerflow data.
Where
get_nb_node_dat(ndid, error)
Where
ndid Is the name (string) or psat_comp_id (structure) of the node breaker node.
error Is the returned error (psat_error class).
If the function is successful,
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ‘No Node found with the equipment name
"****"’
Returned values Data of node ndid, in psat_nb_node_dat structure, with following attributes:
number node number
name node name
stNum station number
stName station name
bbNum busbar number
bbName busbar name
pfBus preferred bus
The following function sets (changes) the data of a Node in powerflow data.
Where
get_nb_conn_dat(connid, error)
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ‘Connector is not found.’
Returned values Data of conenctor connid, in psat_nb_conn_dat structure, with following
attributes:
number connector number
name connector name
stNum station number
stName station name
status connector status 0:Opem 1:Closed
norStatus connector norma status 0:Open 1:Closed
type connector type 1:Circuit Breaker 2:Switch
frNode from node
toNode to node
rat1 Rating 1
rat2 Rating 2
rat3 Rating 3
react connector Reactance
The following function sets (changes) the data of a Station in powerflow data.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
get_comp_node_dat(compid, error)
Where
The following function sets (changes) the data of a node of the component in powerflow data.
set_comp_node_dat(compid, error)
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Connector)
error Is the returned error (psat_error class).
If the function is successful,
error.code, error.msg: 0, ’’
Otherwise,
error.code, error.msg : 1, ‘Component Specified doesn't have node data’
eg.
compID = psat_comp_dat(ctype.load, error)
compID.busid = 11
compID.loadid = “1”
compID.nodes.nd1 = “Node11”
set_comp_node_dat (compID,error)
Return: Will update the “Node Name” of load “1” to “Node 11”
OR
loadDat = psat_load_dat()
loadDat.bus = 11
loadDat.id = “1”
compID = loadDat.comp_id()
get_comp_node_dat(compID, error)
compID.nodes.nd1 = “Nodes11”
set_comp_node_dat (compID,error)
Return: Will update the “Node Name” of load “1” to “Node 11”
get_case_dat(error)
Where
Returned values The case data in psat_case_dat structure, with the following attributes:
projfile Path to project file (259-char)
pffile Path to powerflow file (259-char)
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function sets (changes) the case settings of the powerflow data.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
Where
bus_list Is an optional list of bus numbers used to generate short circuit results for
each bus in the list. If this parameter is not specified the short circuit report
will be generated for all buses.
seqfile Is an optional path to the sequence data file to be used in the short circuit
calculations.
refbus Is an optional bus number for the bus that is to be used as the Transfer
Impedance Reference bus.
unit_flag Is an integer flag to indicate the unit of the return values where:
0 = Per-Unit, 1 = kA, 2 = MVA
format_flag Is an integer flag to indicate the format of the return values where:
0 = Cartesian, 1 = Polar
error Is the returned error (psat_error class).
If the function is successful,
error.code, error.msg: 0, ’’
Otherwise, error.code is non-zero.
Returned values A list of SCItem elements (sc_vector list class), one element for each buses
short circuit result. Each SCItem in the list has the following attributes:
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
get_wscr_dat(error)
Where
Returned values A list of WSCRItem elements (w_vector list class), one element for each
WSCR criteria group specified in the criteria file. Each WSCRItem in the
list has the following attributes:
name group name of the WSCR criteria (string)
limit WSCR criteria limit as specified in the critera file (real)
value calculated WSCR value (real)
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
get_criteria_file()
Where
Returned value A string value that is the full path to the criteria file specified in the PSAT
project, if no file is specified the string is blank.
The following function can be used to set or change the the criteria file used in the current PSAT project:
set_criteria_file(filename, error)
Where
filename Is the full path to the criteria file to be set to the PSAT project (string)
error Is the returned error (psat_error class).
If the function is successful,
error.code, error.msg: 0, ’’
Otherwise, error.code is non-zero.
Returned values A string value that is the full path to the criteria file that was previously
specified in the PSAT project, if no file was specified the string is blank.
The following three functions set the value of an integer property, a floating point property or a string
property, respectively, of a component in the powerflow data (they have no Returned value).
Where
psat_bus_dat, psat_gen_dat and other data structures are described for Get
and Set Bus Data, Gen Data and similar functions above. Alternatively,
propnam can be integer prop.number, prop.id, etc., described below
(computation is faster with integer prop.*).
Note that Get and Set Property functions can’t be used for an element of an
array attribute, e.g., they can’t get or set nb(2) of a switchable shunt. Use
Get and Set Data functions above for the array attributes.
intval Is the integer value of the property to be “set”.
realval Is the floating point value of the property to be “set”.
strval Is the string value of the property to be “set”.
error Is the returned error (psat_error class).
If the component and property identified by compid and propnam (or
cmptype and propid described below) exist in the powerflow data and there
is no error,
error.code, error.msg : 0, ’’
If the component does not exist,
error.code, error.msg : 1, ’Component is not found.’
If compid.type (or cmptype) does not have one of the values listed above
for this attribute,
error.code, error.msg : 2, ’Component type is invalid.’
If propnam (propid) is not the name (value) for of one of the attributes of
the corresponding component data structure,
error.code, error.msg : 3, ’Property name (id) is invalid.’
If intval, realval or strval is not an acceptable value to set for the property,
error.code, error.msg : 4, ’New value is invalid.’
The attributes of psat_comp_id structure that do not apply to the component type (e.g., bus2 for generator,
or DC buses for AC components) are ignored.
You may create the compid object for use as an argument for the get and set property functions by the
following statement:
Where
type Is the component type (string), which is one of the values described above
for the type attribute of psat_comp_id structure
bus number (integer) or name (string) of the bus of AC component, or the first-
bus of multi-bus AC components, or
name (string) of the DC bus of DC component, or the first DC bus of multi-
bus DC component
bus2 number (integer) or name (string) of the second AC bus of multi-bus AC
components, or
name (string) of the second DC bus of multi-bus DC component
bus3 number (integer) or name (string) of the third AC bus of multi-bus AC
components, or
number (integer) or name (string) of the first AC bus of DC converters
bus4 number (integer) or name (string) of the forth AC bus of multi-bus AC
components, or
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The arguments that do not apply to the component type should be omitted (as indicated by “[ ]” in the
above statement). See the examples below on how to specify the components, also refer to section 4.2 for
more details on the psat_comp_id structure.
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Note that although ctype.xxx and prop.xxx are “defined” integer values, you must leave them as
“constants” and do not assign values to them (don’t use them as variables).
For example,
error = psat_error()
comp = psat_comp_id (’gen’,123, ’1’)
# Note that bus2, bus3, bus4 and secno are omitted
p = get_real_prop (comp, ’mw’, error)
If the generator exists, p is the MW output of generator ’1’ at bus 123 and error.code is 0. If the generator
doesn’t exist, the returned value is unknown and error.code is1 and error.msg is ’Component is not
found.’
Another example,
error = psat_error()
set_int_prop (ctype.line, 101, 102, ’1’, 0, prop.status, 0, error)
# Note that bus3 and bus4 are omitted
If the line ’1’ from bus 101 to bus 102 exists, it is put out of service and error.code is 0.
If the line doesn’t exist, or if it is connected from bus 102 to 101 (instead of from bus 101 to bus 102),
error.code is 1 and error.msg is ’Component is not found.’ and no change is made to the powerflow data.
Where
compdat Is the data for the new component in the corresponding psat_*_dat structure
described for the set_*_dat functions above.
When the new component is bus, area, zone or owner, if you set its number
to 0 in compdat, it will change to 1 plus the last existing number in the
powerflow data. If you set its name to ’’ in compdat, it will change to an
automatically assigned name.
For other components, if you set the ID to ’’ in compdat, it will change to a
unique non-blank ID. For example as you add generators to one bus, their
ID is set to ’1’, ’2’, ’3’, etc.
Other attributes of the new component are set to the values specified in
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
compdat Is the data for the new component in the corresponding psat_*_dat structure
described for the set_*_dat functions above. Only the identifier attributes
(bus numbers and ID) are needed and other attributes (status, etc.) are
ignored.
compid Is the identifier of the component in psat_comp_id structure with the
attributes listed above for the Get and Set Properties functions.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
cmptype, Are the identifiers of the component (alternative for compid) similar to
bus, bus2, those for the Get and Set Properties functions described above.
bus3, bus4,
id, secno
error Is the returned error (psat_error class).
If the component is deleted from the powerflow data,
error.code, error.msg : 0, ’’
If compid.type does not have one of the values listed for Get and Set
Properties,
error.code, error.msg : 1, ’Component type is invalid.’
If the component does not exist,
error.code, error.msg : 2, ’Component is not found.’
If the component is a sectional branch and compid.secno does not have an
acceptable value (as described in the next section),
error.code, error.msg: 3, ’Section number is invalid.’
For example, to add generator ’2’ at bus 123 by duplicating the existing generator ’1’,
error = psat_error()
gndt = get_gen_dat (123, ’1’, error)
gndt.id = ‘2’ # or gndt.id = ‘’
add_comp (’gen’, gndt, error)
To add a section to an existing non-sectional branch, in compdat set secno to 2, and set frbus, tobus and id
the same as that of the existing branch. The existing branch becomes section 1. If, instead, you set secno
to 1, the existing branch becomes section 2.
Adding a branch with secno = k, and frbus, tobus and id in compdat the same as an existing sectional
branch that has n sections, places the new section after section k-1 of the existing branch and the existing
sections k:n become sections k+1:n+1. k must be between 1 and n+1.
Deleting a sectional branch when compid.scno is set to 0, deletes all sections of that branch.
To delete only section k of a sectional branch with n sections, set compid.secno to k. The remaining
sections k+1:n become sections k:n-1. k must be between 1 and n.
If the section number specified for adding or deleting a section does not correspond to the above
description, add_comp and delete_comp functions return ’Section number is invalid.’ in the error
message.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
get_count_sections (compdat)
get_count_sections (compid)
get_count_sections (bus1,bus2,id)
Where
compdat Is the data for one section of the branch in the corresponding psat_*_dat
structure described for the set_*_dat functions above. Only the identifier
attributes (bus numbers and ID) are needed and other attributes (section
number, impedance, etc.) are ignored.
compid Is the identifier of one section of the branch in psat_comp_id structure with
the attributes listed above for the Get and Set Properties functions.
compid.secno is ignored for this function.
bus, bus2, id Are the identifiers of the branch (alternative for compid) similar to those for
the Get and Set Properties functions described above.
get_section (compid)
get_section (bus1,bus2,id,secno,error)
Where
compid Is the identifier of one section of the branch in psat_comp_id structure with
the attributes listed above for the Get and Set Properties functions. The
compid.type attribute is ignored. This function will return the identifier of
the section that matches compid.secno
bus, bus2, id, secno Are the identifiers of the branch (alternative for compid) similar to those for
the Get and Set Properties functions described above. This function will
return the identifier of the section that matches secno.
error Is the returned error (psat_error class).
If the section identified exists in the powerflow data and there is no error,
error.code, error.msg : 0, ’’
If branch does not exist or is not a sectional branch,
error.code, error.msg : 1, ’Sectional Branch is not found.’
If the branch does not have a section matching secno,
error.code, error.msg : 2, ’Section is not found.’
Returned values Is the identifier of the section, including its type, in psat_comp_id
structure.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
get_solution_status()
Returned values An integer code representing the current solution status where:
1 Solved
0 Not solved
-1 Error during solution
-2 Did not converge
-3 Diverged
set_solution_failure_option (option)
Where
option Is an integer code to define the default action to take if a solution fails to
solve:
0: Prompt user with an option dialog,
1: Restore the pre-solution conditions,
2: Keep the current conditions.
The following optional codes may be added to the default codes (1&2):
8: Do opposite default action if solution status is 'Did not converge'
16: Do opposite default action if solution status is 'Diverged'
Returned values An integer code representing the current solution status where:
0 Failed to set the solution option (specify an option between 0 and 2)
1 Solution failure option set successfully
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
disable_engine_messages (bDisable)
Where
bDisable Is an boolean option to disable or re-enable PSAT engine message display.
true: Disable engine messages,
false: Re-enable engine messages.
Returned values An integer code representing the current solution status where:
true If the message state has been modified.
false If the message state has not changed.
46. Subsystems
This section describes the functions for defining a subsystem of buses, areas, zones, etc., and iterating on
the components in that subsystem.
There is always a main subsystem called “mainsub”. Initially (by default) it is set to <All> (the whole
powerflow data). This can be changed by subsys_inc/exc functions described below.
subsys_define (subname)
Where
Several subsystems can be defined, each with a different name. If a subsystem with the same name has
been defined previously, the above function will empty that subsystem (sets it to <None>).
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
subsys_delete (subname)
Where
The following functions add buses, areas, zones and kV levels to the subsystem.
The following functions remove buses, areas, zones and kV levels from the subsystem.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
Note that, as in the Composite Subsystem definition in PSAT, the final contents of the subsystem depend
on the order in which the above subsys_inc/exc functions are called. Think of the subsystem as a
container that every subsys_inc_* call puts components in it and every subsys_exc_* call removes
components that are previously put in it.
The functions subsys_inc_comp and subsys_exc_comp are capable of including or excluding multiple
components with a single command. By not specifying the ID parameter a wildcard ID (‘*’) is used.
For example:
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
subsys_inc_comp(123) #This will include bus 123 and all connected components
subsys_inc_comp(10,20) #This will include all components connected to both bus 10 and 20
To omit bus2 or bus3 when specifying buses by name you must specify an empty string (‘’). The
following example will exclude all components with an ID of ‘1’ that are connected to both bus ‘A’ and
‘B’:
subsys_exc_comp(‘A’,’B’,’’,’1’)
The first call to the following function after the subsystem is defined or modified by one of the subsys_*
functions above, returns the first component of a specified type in that subsystem.
Subsequent calls to this function return the next component in the subsystem.
Where
Note that after any change to the subsystem (call to subsys_inc/exc) the above function returns the first
component in the subsystem. Also, after returning “false” (passed the last component), the next call
returns the first component again.
Without defining the main subsystem, or after calling subsys_clear(), this subsystem is set to <All>, so
the first call without subname argument returns the first component in the powerflow data and the
following calls return the next components until the last component in the powerflow data.
The following function resets the pointer to the first component in the subsystem, so that the following
get_next_comp will return the first component.
Where
The following function returns the number of components of a specified type in the subsystem.
Where
These functions can be used to get the data of components using equipment name for lookups:
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
Returned values Data structure for the specified component. Refer to the non-equipment
name functions for details on the returned structure.
These functions can be used to set the data of components using equipment name lookups:
Where
These functions can be used to get individual properties of components using equipment name lookups:
The following three functions set the value of an integer property, a floating point property or a string
property, respectively, of a component in the powerflow data (they have no Returned value).
Where
cmptype Is the component type (string) or integer value (ctype). Refer to the
non-equipment name functions for details.
eqname Is the equipment name (string) of the component
prop Is the property name (string), which is the same as the name of one of
the attributes of the components data structure. This may also be an
integer value having one of the “defined” values prop.xxx. ). Refer to
the non-equipment name functions for details
intval, realval, Are the same as those in the first form of the non-equipment Get and
strval, error Set Property functions described above
Returned value Get functions return an integer, real, or string value respectively.
Set functions have no return value.
These functions can be used to include or exclude (wild-card capable) equipment name string filters to the
subsystems:
Where
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
Where
error Is the returned error (psat_error class) with error.msg set by the macro
command.
’OpenPowerflow:"PFB_name"’
Opens a saved PFB (binary powerflow) file. PFB_name (in double quotes) is the name of
the file, e.g., c:\temp\t1.pfb.
’Solve’
Solves the powerflow.
’Import:"powerflow_filename";frmt’
Imports a powerflow data (converts it to PFB). powerflow_filename (in double quotes) is
the name of powerflow data file and frmt (without quotes) is its format, e.g., PTI Rawd
30.
’RunMacroFile:"macro_filename"’
Runs a saved PSAT Macro file named macro_filename.
’SavePowerflow’
Saves the PFB data in the file that has been opened.
’SavePowerflowAs:"new_PFB_name"’
Saves the PFB data in a file named new_PFB_name.
psat_msg (msgtext)
Where
msgtext Is the message (string) which will appear in the message window.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function pops-up a window to display a message. Pressing the “OK” button will close this
window.
psat_msg_box (msgtext)
Where
msgtext Is the message (string) which will appear in the pop-up window.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
psat_read (prompt)
Where
prompt Is the prompt message (string) which will appear in the pop-up window.
The following function pops-up a window to display a prompt and have the user click the “Yes” or “No”
button, which will close the window.
psat_read_yn (prompt)
Where
prompt Is the prompt message (string) which will appear in the pop-up window.
The following function pops-up a windows dialog that allows the user to select from a specified list of
choices and returns a list of the users seletions to python.
Where
multi-select is a flag (boolean), where true indicates that multiple selections are
allowed, and false indicates only one selection can be made.
title the title (string) which will appear in the pop-up window.
choices is a list of choices (strings) that will be shown to the user, either in a combo
box for single selection, or a list box for multi selection.
selections is a returned list of selections (integers) that is updated with the indexes
into the choices list that reflect the users selections.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The following function pops-up windows file browse dialog that the user can use to browse for a file and
return the location of the selected file to python.
Where
title is the title (string) which will appear in the pop-up window.
filetype is the file type description (string) which will appear in the file type filter
dropdown box
extension is the file extension (string) that will be used when selecting the specified
file type in the file type filter dropdown box
Returned value The full path to the file opened through the windows file browse dialog, or
an empty string if the user cancels the open file operation.
Where [XX] is the version of python being used (25,27, etc). This is then followed by the “definition”
statement as in:
this is then followed by the rest of the code. For example if you use python 2.7 and wanted to create a
function that taps a line, you write:
# Specify the line's From-bus, To-bus, ID, percentage from From-bus, and New-bus
You then save this code in a Python file, e.g., TapLine.py, in the UserScripts folder located under the
PSAT\Bin\Python\ folder.
To call this function from within other scripts, you first import and then call it as in:
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.
The import statement specifies the folder where the file is located (“UserScripts”) and the filename
(“TapLine”), separated by a “.” . It then specifies the function name defined in this script file (“tapline”)
that you wish to make available to the calling script. You can specify “*” instead of the function name if
you want to load all the functions defined in the script file. Note that the folder, file and function names
are all case-sensitive in the above statements.
‘RunIdle.py’ provides the IDLE (Python’s Integrated Development Environment) interface with PSAT
environment embedded. Within the IDLE, the standard module (‘pdb’) can be called to set breadkpoints,
to watch variables, and to evaluate Python codes.
To use the module (‘pdb’), the following statement has to be added to the beginning of your Python script
file:
Import pdb;
The typical usage to break into the debugger from a running script is to insert:
pdb.set_trace();
at the location where you want to break into debugger. You can then check the variables or step through
the codes following this statement. For more information on debugging Python code, please refer to
Python official website: http://www.python.org.
This document contains proprietary information and shall not be reproduced in whole or in part without the prior written perm ission of Powertech.