This guide walks through setting up PSSE 35.3.0 with compatible Python versions, including path configuration and initializing the simulator using psspy.
Use the following script to configure Python and PSSE paths automatically, and initialize PSSE:
import sys
import os
psseversion = 35
pythonversion = '{}.{}'.format(sys.version_info[0], sys.version_info[1])
if psseversion == 35:
if pythonversion in ['2.7', '3.7', '3.8', '3.9']:
pyver_short = int(pythonversion.replace('.', ''))
psse_path = r"C:\Program Files\PTI\PSSE35\35.3\PSSPY{}".format(pyver_short)
sys.path.append(psse_path)
os.environ['PATH'] = psse_path + ";" + os.environ['PATH']
import psse35
else:
print("Unsupported Python version for PSSE 35.")
sys.exit()
elif psseversion == 34:
if pythonversion in ['2.7', '3.4', '3.7', '3.9']:
pyver_short = int(pythonversion.replace('.', ''))
psse_path = r"C:\Program Files (x86)\PTI\PSSE34\PSSPY{}".format(pyver_short)
sys.path.append(psse_path)
os.environ['PATH'] = psse_path + ";" + os.environ['PATH']
import psse34
else:
print("Unsupported Python version for PSSE 34.")
sys.exit()
elif psseversion == 33:
if pythonversion == '2.7':
psse_path = r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN"
sys.path.append(psse_path)
os.environ['PATH'] = psse_path + ";" + os.environ['PATH']
else:
print("Unsupported Python version for PSSE 33.")
sys.exit()
else:
print("Invalid PSSE version selected.")
sys.exit()
# Initialize
import psspy
psspy.psseinit(buses=150000)