How to trip a line in power flow using pssuserpf.py?
asked 2023-06-12 07:15:53 -0600
Anonymous
I have a line that I monitor. During normal power flow I want to trip it if its current exceeds a certain value. RAS and pssuserpf load correctly, but when I call pfcontrol functions inside post_iteration() i receive ierr=2, which means that
not called from allowable PCI automation function
My post_iteration() funtion in pssuserpf.py looks like this:
def post_iteration():
_, flow = psspy.brnmsc(1, 2, "1", "AMPS")
if flow > 50.0:
print("MUST TRIP LINE")
ierr1 = pfcontrol.pfbrchint(1, 2, "1", "STATUS", 0)
ierr2 = pfcontrol.pfdscnbus(2)
print(ierr1, ierr2)
# both ierr1 and ierr2 are always 2.
return False
else:
return True