Ask Your Question
0

Sensitivity factors report

asked 2024-09-26 12:49:54 -0500

ram0199 gravatar image

updated 2024-09-26 12:56:02 -0500

How can we access the sensitivity factors report using python API in PSS/E.

The following code is just to run the sensitivity analysis but I couldn't find a way to access the results:

ierr = psspy.sensitivity_flows(flwopt, options, values, labels, dfxfile)
if ierr != 0:
  print(f"Error calculating sensitivity flows, error code: {ierr}")
  return
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2024-09-29 15:03:16 -0500

jconto gravatar image

updated 2024-09-30 18:03:46 -0500

The sensitivity_flows report is automatically output if the run is free of error.

The code below can be run within the PSSe GUI or in a CMD window (DOS window). In the working folder a SAV case and its corresponding DFAX file must exist. The 'labels' var uses names defined in the subsystem file used to create the dfax file. Added explicitly the path to psspy. Tested wih PSSe v35.6 + python 3.9

import os, sys
psspypath = r'C:\Program Files\PTI\PSSE35\35.6\PSSPY39'
sys.path.append(psspypath)

psseversion = 35     #default

try:
    psspy
except:
    exec('import psse%s'%psseversion)
    import psspy
    psspy.psseinit(15000)
#_________________________________________________________
savmem,snpmem = psspy.sfiles()
if not savmem:
   print('loading case')
   psspy.case(r"""savnw.sav""")
#_________________________________________________________
# vars for sensitivity_flows function
flwopt      = [0,0]
options     = [0,1,0,0,0,0,0,0,0]
values      = [0.0,0.03]
labels      = ['CENTRAL','','CENTRAL']
dfxfile     = 'savnw.dfx'
print('\nsensitivity_flows') 
ierr = psspy.sensitivity_flows(flwopt,options,values,labels,dfxfile)   
print(ierr,'= error code')
edit flag offensive delete link more

Comments

Appreciate your response & thanks for this information, @jconto! I am trying to access the report from external IDE(not from PSS/E GUI or CMD). Do you know how can I do that ?

ram0199 gravatar imageram0199 ( 2024-09-30 08:39:53 -0500 )edit

For visual Code or Idle, add the following three lines to the top of the code above.

jconto gravatar imagejconto ( 2024-09-30 18:02:01 -0500 )edit

Thanks for the clarification! I was able to generate the report and parse the report to get the sensitivity factors. It is very unfortunate that this function doesn't have any data frame to directly extract the results.

ram0199 gravatar imageram0199 ( 2024-10-03 13:14:22 -0500 )edit

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: 2024-09-26 12:49:54 -0500

Seen: 103 times

Last updated: Sep 30