How to run a Static DC powerflow?
Hi y'all, I'm attempting to run a DC power flow using just a Python script. From my understanding using psspy.fnsl() is running an AC powerflow. I feel like I'm missing an obvious function call. please help if you can :^)
here's my code for reference:
import os,sys
# Path stuff
sys.path.append(r"C:\Program Files\PTI\PSSE35\35.3\PSSPY37")
sys.path.append(r"C:\Program Files\PTI\PSSE35\35.3\PSSBIN")
sys.path.append(r"C:\Program Files\PTI\PSSE35\35.3\PSSLIB")
sys.path.append(r"C:\Program Files\PTI\PSSE35\35.3\EXAMPLE")
os.environ['PATH'] = (r"C:\Program Files\PTI\PSSE35\35.3\PSSPY37;"
+ r"C:\Program Files\PTI\PSSE35\35.3\PSSBIN;"
+ r"C:\Program Files\PTI\PSSE35\35.3\EXAMPLE;" + os.environ['PATH'])
# imports all the GOOOOOOD stuff we need for our program / automation stuff
import glob
from pathlib import Path
import pandas as pd
import psse35
psse35.set_minor(3)
import math
import numpy as np
import psspy
psspy.psseinit(50)
case_file = '../input_files/case14.raw'
psspy.read(1, case_file)
psspy.fnsl()
injection_file = ('../input_files/WECgen_data.csv')
injection = pd.read_csv(injection_file)
for i in range(len(injection)):
print("Time: {}".format(injection.iloc[i].time))
print("P setpoint: {}".format(injection.pg.iloc[i]))
ierr = psspy.machine_chng_3(3, "1", [], [injection.pg.iloc[i]])
if ierr > 0:
print("Failed | machine_chng_3 code = {}".format(ierr))
psspy.fnsl() # needs to be DC solver not AC
print("========================")
UPDATE: seems like PSSe isn't actually solving the DC powerflow, I feel like I'm missing something simple. using these function parameters
psspy.dclf(1, 1, [1,0,1,2,1,1],[0,0,0], '1')