Ask Your Question
0

get bus number using facts device name

asked Jan 2 '0

Ascegan gravatar image

I used the code below to get a list of FACTS device names (not dynamic model names). How can I retrieve the bus # for each loadflow model?

    ierr = psspy.inifax()
    ierr, nextfax = psspy.nxtfax()
    while ierr ==0:
        ierr, nextfax = psspy.nxtfax()
        print nextfax
    return      #exit out of the script

2 answers

Sort by » oldest newest most voted
0

answered Jan 6 '0

Ascegan gravatar image

I ended up using a loop. It cycles through all FACTS devices to match a bus # to the name but there are ~ 10 in the case so it is quick. Inelegant escape from the way it exits: either return the bus # or just "not found"

def getname(busnum):
    ierr = psspy.inifax()
    ierr, nextfax = psspy.nxtfax()
    nextbus = ""
    while ierr ==0:
        ierr, nextbus = psspy.fcdint_2(nextfax, 'SEND')         
        if nextbus == busnum:
            #print "found it " + str(nextfax)
            return str(nextfax)
        else:
            ierr, nextfax = psspy.nxtfax()
    return "notfound"
link
0

answered Jan 3 '0

drsgao gravatar image

Why not just the subsystem data retrieval APIs? Check chapter 8 of the API manual. It is either the "aFactsInt" or "aFactsBusInt" API.

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Jan 2 '0

Seen: 697 times

Last updated: Jan 06 '20