How to use python to read the bus number and voltage data to excel?
I want to read the .raw data, and export the bus number and bus voltage to excel, please help me. I use PSS/E 33 version, thanks.
First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
I want to read the .raw data, and export the bus number and bus voltage to excel, please help me. I use PSS/E 33 version, thanks.
This is my code can someone tell me why I always have this error.
import os
import sys
import numpy as np
PYTHONPATH = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN'
sys.path.append(PYTHONPATH)
os.environ['PATH'] += ' ; ' + PYTHONPATH
import psspy
import excelpy
import redirect
redirect.psse2py()
psspy.read(0,r'C:\Users\Desktop\test.raw')
psspy.fnsl([1,0,0,0,1,1,-1,0])
psspy.fnsl([0,0,0,0,0,0,0,0])
ierr = psspy.psseinit( 100000 )
ierr, (a,) = psspy.abusint(string = ["NUMBER"])
print(a)
This is my error :
Messages for api CASE PSS(R)E not properly initialized (004288)
PSS(R)E Version 33 Copyright (c) 1976-2020 Siemens Industry, Inc., Power Technologies International (PTI) This program is a confidential unpublished work created and first licensed in 1976. It is a trade secret which is the property of PTI. All use, disclosure, and/or reproduction not specifically authorized by PTI is prohibited. This program is protected under copyright laws of non-U.S. countries and by application of international treaties. All Rights Reserved Under The Copyright Laws.
SIEMENS POWER TECHNOLOGIES INTERNATIONAL
100000 BUS POWER SYSTEM SIMULATOR--PSS(R)E-33.4.0
INITIATED ON SAT, NOV 14 2020 10:38
None
Do what perolofl suggested if you're doing one-shot actions.
If you want to automate it Python, you could use PSS/e API's Subsystem Data Retrieval commands:
From there, you could write some additional python script to either:
The scripting is a little bit of work, so unless you're doing it a lot, it may be easier just to do it manually.
Asked: 2020-11-11 20:13:49 -0500
Seen: 1,872 times
Last updated: Nov 13 '20
You know that you can do it manually in Bus spreadsheet? Select the two columns, copy and paste into Excel.
busnum100001=100001 fvolt = open('Report_Summary.csv','w') psspy.read(0,"""ABC.raw""") ierr, busva100001 = psspy.busdat(busnum100001,'PU') fvolt.write('%10i,%7.3f,\n' %(busnum100001,busva100001)) fvolt.close()
Yes, I know this way, but I still want to try to use python to finish this work. Thanks for your suggestion.