Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ok, first you need to know what buses exist in the system already. Then work out a bus that fits into one of the gaps.

ierr, buses = psspy.abusint(-1, string="NUMBER")
# convert to a simple set of buses
taken_buses = set(zip(*buses)[0])

# now find the first available gap between 1 and 10,000:
# 10,000 - or any suitably high number.
available_bus = None
for bus in range(1, 10000):
   if bus not in taken_buses:
       available_bus = bus
       break

print "You can use bus=%d if you want." % available_bus
click to hide/show revision 2
inservice and out of service.

Ok, first you need to know what buses exist in the system already. Then work out a bus that fits into one of the gaps.

ierr, buses = psspy.abusint(-1, flag=2, string="NUMBER")
# convert to a simple set of buses
taken_buses = set(zip(*buses)[0])

# now find the first available gap between 1 and 10,000:
# 10,000 - or any suitably high number.
available_bus = None
for bus in range(1, 10000):
   if bus not in taken_buses:
       available_bus = bus
       break

print "You can use bus=%d if you want." % available_bus