Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to set a custom value of the .sav file using psspy

I have a program in python and I'd like to know if there are a sort of setters to set a value of a custom quantity or column given the corresponding id (targeting such device is not a problem).

Let's consider I want to change the value of bus base voltage (BASKV) but don't want to modify the rest. The most approachable way I've found is by invoking:

ierr = psspy.bus_data_3(ibus, intgar, realar, '')

but intgar and realar are arrays in python, and I would not like to put again the arrays with all of their values, but just modifying one. (BASKV, localed in REALAR(2)).

Can anyone shed some light on this? Thank you in advance.

According to the API of psspy

2.7. BUSDATA3 Use this API routine to modify the data of an existing bus in the working case, or to add a new bus to the working case (see PSSE Program Operation Manual, Bus Data).

Where:

Integer IBUS bus number (input; no default allowed).

Integer INTGAR (4) array of 4 elements specifying (input). INTGAR(1) IDE, bus type code (1 by default) INTGAR(2) AREA, area number (1 by default) INTGAR(3) ZONE, zone number (1 by default) INTGAR(4) OWNER, owner number (1 by default)

Real REALAR (7) array of 7 elements specifying (input). REALAR(1) BASKV, bus base voltage in kV (0.0 by default) REALAR(2) VM, bus voltage magnitude in pu (1.0 by default) REALAR(3) VA, bus voltage phase angle (0.0 by default) REALAR(4) NMAXV, normal bus voltage magnitude high limit in pu (1.1 by default) REALAR(5) NMINV, normal bus voltage magnitude low limit in pu (0.9 by default) REALAR(6) EMAXV, emergency bus voltage magnitude high limit in pu (1.1 by default) REALAR(7) EMINV, emergency bus voltage magnitude low limit in pu (0.9 by default)

Character*12 NAME bus name (input; blank by default).

Integer IERR error code (output). IERR = 0 no errors occurred IERR > 0 fatal error occurred IERR = 1 invalid bus number IERR = 2 bus table is full IERR = 3 working case is not initialized IERR = 5 prerequisite requirements for API are not met IERR = -1 data error, warning and information messages; one or more of: - Invalid base voltage. - Invalid bus type code. - Invalid area, zone or owner number. - Bus name is more than 12 characters. - New area number but bus is the area swing for its old area. - Bus type code is 3 but is not the swing bus for its area. - Area table is full. - Zone table is full. - Owner table is full. - High voltage limit is not greater than the low voltage limit. - Normal voltage limit is less restrictive than the emergency limit