First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
First define a function to return the wanted information:
# Function to return ibus, id and wmod in three lists
def get_wmod(sid=-1, flag=4):
ierr, iarray = psspy.amachint(sid,flag, ['NUMBER','WMOD'])
ierr2, idarray = psspy.amachchar(sid,flag, ['ID'])
return iarray[0],idarray[0],iarray[1]
Call get_wmod
to get three lists with ibus, id and wmod for all generators and loop through the lists.
ibusl,idl,wmodl = get_wmod()
# Loop through the lists and perform action
for ibus,id,wmod in zip(ibusl,idl,wmodl):
# do some stuff