PSSE has two methods for retrieving information.
- A single element at a time; and
- A group of elements at once.
Now we will take you though how to create a subsystem: a numbered collection of buses, zones or areas from which you can collect information using the subsystem_info function.
Subsystems are a group of buses and can be assigned an id from 0 to 11. Eleven is the highest available subsystem id because PSSE only allows you to have a maximum of 12 subsystems.
Subsystems from areas
Here is the hypothetical situation: Your PSSE saved case has already been set up with 3 areas (0, 1 and 2). We will create a new subsystem with id 0 that contains all the buses in those three areas.psspy.bsys(sid=0, numarea=3, areas=[0, 1, 2])
You must remember to tell PSSE how many areas are in the list using the numarea = 3 keyword. The requirement to state the number of elements in the areas list is puzzling, because it can cause mistakes in your code if you forget to
change the numarea when you add extra areas.
# an error waiting to happen.. psspy.bsys(sid=0, numarea=3, areas=[0, 1, 2, 3])
Here is another example where we automatically calculate the number of areas:
areas = [0, 1, 2] psspy.bsys(sid=0, numarea=len(areas), areas=areas)
Subsystems from a list of buses
Now we have a list of bus numbers and want to create another subsystem with id 1:buses = [201, 202, 304, 305, 400] psspy.bsys(sid=1, numbus=len(buses), busnum=buses)
Rather than being hard coded like this example, the buses variable could be read from a CSV file or a settings file.
Using the subsystem_info function
Finally, we will create a new subsystem and grab some information about buses in that subsystem using the subsystem_info function.
# first create the subsystem. buses = [201, 202, 300, 304, 600] psspy.bsys(sid=1, numbus=len(buses), busnum=buses) # then collect bus number, name and voltage from the subsystem. strings = ["NUMBER", "NAME", "KV"] names_and_voltages = subsystem_info('bus', strings=strings, sid=1)