Ask Your Question
0

How to use python to read the bus number and voltage data to excel?

asked 2020-11-11 20:13:49 -0500

penny870718 gravatar image

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.

edit retag flag offensive close merge delete

Comments

You know that you can do it manually in Bus spreadsheet? Select the two columns, copy and paste into Excel.

perolofl gravatar imageperolofl ( 2020-11-12 11:03:11 -0500 )edit

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()

kota_ashish gravatar imagekota_ashish ( 2020-11-13 19:17:34 -0500 )edit

Yes, I know this way, but I still want to try to use python to finish this work. Thanks for your suggestion.

penny870718 gravatar imagepenny870718 ( 2020-11-13 19:36:15 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-11-13 19:50:39 -0500

penny870718 gravatar image

updated 2020-11-13 20:19:57 -0500

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

edit flag offensive delete link more

Comments

Move psspy.psseinit before psspy.read. You must start PSSE before using any activity!

perolofl gravatar imageperolofl ( 2020-11-14 01:26:33 -0500 )edit

Okey, I'll try it. Thanks for your helping.

penny870718 gravatar imagepenny870718 ( 2020-11-15 18:16:28 -0500 )edit
0

answered 2020-11-13 12:02:48 -0500

boat14 gravatar image

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:

  • abusint, with the string "NUMBER".
  • abusreal, with the string "BASE".

From there, you could write some additional python script to either:

  • Write a .csv file for importing into Excel.
  • Use one of the Excel Python libraries to write directly to an Excel file.

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2020-11-11 20:13:49 -0500

Seen: 1,875 times

Last updated: Nov 13 '20