How to interrupt loads below a given bus voltage threshold in PSS\E using python
How can I interrupt loads at a bus when the voltage is below a given threshold in PSS\E using python during dynamic simulations? The load is then reconnected back after a certain period of time. Below is a sample of the code that I am trying to develop. Let me know if there’s a better way to do it or how I can make this code to work.
#Check the bus voltages that are higher than 1.1 p.u and lower than 0.9 p.u
psspy.set_vltscn(1,1.1,0.9)
#Run a command which interrupts loads if the voltage is below 0.9 p.u by changing the status of the load model from in service to out of service
for n in range(1,20): # list of bus numbers
if psspy.set_vltscn(1,1.1,0.9) < 0.9: # if voltage is below 0.9
psspy.ldmod_status2(i,'id',1,0) # interrupt load at that bus. Where i is bus number, 'id' is the load identifier, 1 is the load model type and 0 is the new model status indicating out of service
#Run to 1 second
psspy.run(0,1,1000,1,0)
#Reconnect the load after a certain period of time (1 sec in this case)
psspy.ldmod_status2(i,'id',1,1)
#Run to 10 seconds
psspy.run(0,10,1000,1,0)
# Halt pss\e
psspy.pssehalt_2()