Ask Your Question
0

I imported PSSE 33 into python in order to change area and zone in file sav but error. How can i fix it?

asked 2021-12-04 03:13:30 -0500

Vo Doan Do gravatar image

updated 2021-12-06 02:23:42 -0500

perolofl gravatar image
import os
import sys
import math
PSSE_LOCATION=r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN'
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' + PSSE_LOCATION
import psspy
import redirect
redirect.psse2py()
psspy.psseinit(10000)
psspy.case(r'E:\PSSE Programming\Basic Literature\Vidu2.2.7\htdA3.sav')
psspy.bus_chng_3(101,[0,0,2,0],[0, 1.052,-5.1561,0,0,0,0],0)
psspy.bus_chng_3(102,[0,0,2,0],[0, 1.0885,0,0,0,0,0],0)
psspy.bus_chng_3(103,[0,0,2,0],[0, 1.0381, 1.0795,0,0,0,0],0)
psspy.bus_chng_3(110,[0,_i,2,0],[0,0,0,0,0,0,0],0)
psspy.bus_chng_3(110,[0,0,5,0],[0,0,0,0,0,0,0],0)
psspy.bus_chng_3(103,[0,0,5,0],[0, 1.0381, 1.0795,0,0,0,0],0)
psspy.bus_chng_3(102,[0,0,5,0],[0,0,0,0,0,0,0],0)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2021-12-06 02:34:37 -0500

perolofl gravatar image

updated 2021-12-07 09:51:10 -0500

You should show the error message!!!!

Both case and bus_chng_3 are returning error codes. Print those codes for debugging.

Your arguments to API buschng3 are completely wrong. Use the defaults _i, _f, _s instead of zeroes.

EDIT:

In scripts you may need to import the defaults with the following:

import psspy
_i = psspy.getdefaultint()
_f = psspy.getdefaultreal()
_s = psspy.getdefaultchar()
edit flag offensive delete link more

Comments

I used defaults _i in some of programs and it wrong. so i fix them to Zeros and it can run finely

Vo Doan Do gravatar imageVo Doan Do ( 2021-12-07 06:23:45 -0500 )edit

No, it is completely wrong to insert zeros instead of _i! This is the reason why you have the errors above. Just follow the rulebook. You can never use zeros for default values. For example, you force the area number to 0 which is an illegal number.

perolofl gravatar imageperolofl ( 2021-12-07 09:49:00 -0500 )edit

See my edited answer how to define _i, _f and _s.

perolofl gravatar imageperolofl ( 2021-12-07 09:52:10 -0500 )edit

oh. Thank you

Vo Doan Do gravatar imageVo Doan Do ( 2021-12-10 18:17:02 -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: 2021-12-04 03:13:30 -0500

Seen: 266 times

Last updated: Dec 07 '21