Ask Your Question

jconto's profile - activity

2024-03-25 17:35:34 -0500 answered a question ACCC_solution not giving same line flows as load flow

Manual runs of PSSe use an AC load flow solution method, taking into account the reactive power effect on the MVA flow reported, while activity ACCC uses linear factors (like PTDF or OTDF) calculated by activity DFAX, to evaluate the effect of a contingency on the MVA flow monitored (kind of DC load flow). Both values will differ the most when the contingency creates large delta in P & Q flows.

2024-03-16 11:41:52 -0500 answered a question Small Signal Stability

With the add-on NEVA module.

2024-03-16 10:42:19 -0500 answered a question Change the python version or interpreter on pss/e command prompt

Expanding on my answer to the post "How to reload psspy to different PSSE version in same script?", the following setup applies to PSSe v.34.7, a 32-bit application and PSSe v.35.6, a 64-bit application:

I run python scripts for PSSe v34 with python 3.7 within a CMD prompt (=DOS window) by double-clicking on a link named '_dos3437'. This link will run a bat file named 'run3437.bat' as part of its starting process [right-click on the link and select properties, the 'Target' box allows for such full-path bat file name entry, like 'C:\WINDOWS\system32\cmd.exe /K "c:..\documents\code\dos\run3439.bat"'. Check the PSSe installed link "PSS®E 34 Command Prompt" for reference.] The bat file contains any valid DOS command and environ variables defined for the PSSe v34 with python 3.7 environment. Among those, the 'pythonhome' variable is the one that select the right python path for the python version! These environ variables together with other default environ variables defined by the Windows OS can be accessed with the python os.environ function. Type 'set'+ <enter> on the DOS window to get a list of all environ variables.

@rem run3437.bat
@echo OFF
Set PSSEVERSION=34
set PYVER=37
Set PYTHONCODE=%USERPROFILE%\Documents\Code\Python\
Set PYTHONHOME=c:\python%PYVER%\
SET PSSEROOT=%PROGRAMFILES(x86)%\PTI\PSSE%psseversion%
SET PSSEPATH=%PSSEROOT%\PSSBIN\
set PSSPLTPATH=%PSSEROOT%\pssbin\
SET PSSPYPATH=%PSSEROOT%\PSSPY%PYVER%\
SET PATH=%PYTHONHOME%;%PYTHONHOME%SCRIPTs;%PSSEPATH%;%JAVAPATH%;%PATH%
Set INCLUDE=%PSSEROOT%\PSSLIB;%INCLUDE%
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
echo   %USERNAME%                           
echo.                                        
echo   PATHs set for PSS/E-%PSSEVERSION% + python %PYVER%  
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo %date% %time%

Similarly, the '_dos3539' link for v.35.6 and python 3.9 will run a 'run3539.bat' while opening:

@rem run3539.bat
@rem psspath35=C:\Program Files\PTI\PSSE35\35.6\PSSBIN\psse35
@rem psspltpath35=C:\Program Files\PTI\PSSE35\35.6\PSSBIN32\pssplt35
@echo OFF
Set PSSEVERSION=35
set MINOR=.6
set PYVER=39
set appdata=
Set PYTHONCODE=C:\Users\jsm20\Documents\Code\Python\
@rem Set PYTHONHOME=C:\ProgramData\Anaconda3_64bit\
Set PYTHONHOME=%LOCALAPPDATA%\Programs\Python\Python%PYVER%\
SET PSSEROOT=C:\Program Files\PTI\PSSE%psseversion%\%psseversion%%MINOR%
SET PSSEPATH=%PSSEROOT%\PSSBIN
set psspltpath=%PSSEROOT%\PSSBIN32\
SET PSSPYPATH=%PSSEROOT%\PSSPY%PYVER%\
SET PATH=%PYTHONHOME%;%PYTHONHOME%SCRIPTs;%pssepath%;%tarapath%;%PYTHONCODE%;%PATH%
Set INCLUDE=%PSSEROOT%\PSSLIB;%INCLUDE%
@rem set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
echo   %USERNAME%                           
echo   %PYTHONCODE%                                     
echo   PSS/E-%psseversion%%MINOR% + python %PYVER%   
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo %date% %time%

The following python script can run on either "environment", after opening the corresponding link:

psseversion = int(os.environ['PSSEVERSION'])
exec('import psse%s'%psseversion)
import psspy
psspy.psseinit(0)
'more code...'
if psseversion == 34:          # for code unique to PSSe v34
   'do..'
elif psseversion == 35:
     'do..'

Difference in python sintax versions can be selected with an 'if' on 'PYVER':

pyver = int(os.environ['pyver'])
if pyver == 37:
   'do..'
elif pyver == 39:
     'do..'

All these links ('_dos3437', '_dos3539') are on the Desktop, and copied to the working folder.

2024-03-15 22:03:41 -0500 edited question Channels - tool to process outs files

Channels is a python code that uses dyntools to process out files from a PSSe dynamic simulation. It runs in PSSe v33, v34 & v35. The tool allows to export any type of channels the user select to an excel file; request information about channels names & numbers; plot selected channels, plotting same channels from multiple outs files (=compare channels performance); and rank channel performance based on user criteria with option to plot (which voltage channels goes below a certain threshold...).

You can download the channels tool with a demo set from [copy the link into your browser if it does not connect when clicking on it]:JConto_google drive

Once you select “channelsxxxxx.zip”, an icon on the top-center screen will perform the download.

Once downloaded & unzipped, rename *.tab to *.bat, open a DOS window on the channels' folder and run the following [it will export volt channels to a excel file]: c:..>channels chan_V_exp

Follow the instruction in the read.me file to run the other demos included.

2024-03-14 08:42:32 -0500 answered a question Not open for physical access - PSSE

can you confirm if another case works ok? The demo savnw data set (in the 'example' folder of the PSSe installation path) should run ok. If it does not, a re-installation of PSSe is recommended. If it does, then the problem may be with a model in your dynamic data set. Remove or replace models with equivalents from the savnw set and test again. If you are using a script to drive the simulation, post it.

2024-03-13 22:04:46 -0500 edited question Psspy Python Script Issues

Hello,

I am trying to updated some python scripts to be compatible with the new PSSe version 35. However, when I try to run the python script in an IDE (PyCharm), the script wold not execute and would give a "no module named excelpy" and "no module named psspy". Please give any advice on how to resolve this.

Library Import Statements:

import os, sys
import win32com.client
import string, pywintypes
import excelpy
import psspy as pp
from datetime import date
from datetime import datetime

mypath = os.path.dirname(os.path.abspath(__file__))
pp.psseinit(80000)
pp.lines_per_page_one_device(1, 60)

_i, _f = pp.getbatdefaults()
_s = pp.getdefaultchar()

_PSSBINPATH = r"C:\Program Files\PTI\PSSE35\35.6\PSSBIN"
os.environ['PATH'] = _PSSBINPATH + ';' + os.environ['PATH']
sys.path.append(_PSSBINPATH`enter code here`
2024-03-13 21:55:21 -0500 edited question OPF: Unrecoverable error, solution diverging

I'm studying about OPF in psse v35.0. I want to use savnw file (.raw, .rop) given by PSSE example. I didn't change anything of savnw file, but, there is error like "ERROR: Unrecoverable error, solution diverging" Also, there is output bar "All data appears to be okay

Note: There were 3 infeasible variables found. The sum of the violations is .205502 The largest violation is variable Efd 206, value: .193442"

I'm really urgent, please help me....

2024-03-13 21:54:14 -0500 answered a question OPF: Unrecoverable error, solution diverging

Check that the *.rop file is loaded correctly, no error messages!. I have to copy the savnw.rop from v.34 into the v.35 folder, load the sav case and then the *.rop file, and then the OPF gave no errors

2024-03-12 09:34:10 -0500 answered a question how to recalculate dynamic with other scenarios when sav file was converted

On a sav case, you can save it as a 'converted' case after performing the TYSL activity. After loading a dyre file (option to set add channels here), save it as a snap file (*.snp). For scenarios where the case and the dynamic data does not need to be updated, use the converted sav case and the snap file (activity CASE to load the converted *.sav file and RSTR to load the *.snp file) for all the running scenarios (different contingencies?!). Consider python scripts to automate your runs.

2024-03-05 11:42:25 -0500 answered a question Simulation time of Doing Power Flow Cyclically

Can you post the code? The time to create a report should be the 'same' for every iteration, and the size of the report file be also the same. Are you logging? A log file would show if 'past' activities are being repeated.

2024-03-01 10:36:45 -0500 answered a question ESAC8B at SMIB unstable system.

I guess in your case the machine model (GENSAL or GENSAE) is not good. The ESAC8B model behaves well in a simple SMIB test (machine at bus 2). Using a GENSAL model from the savnw data set, set inertia at 1.0, I did a flat run then a fault run and the plots came OK. dyr data used:

// smib.dyr
// infinite bus: bus 1
// test machine: bus 2 
1 'GENCLS' 1   8.0  0.01 /
2,'GENSAL',1, 5.0,0.05,0.20,1.0,0.0,1.0,0.75,0.4,0.26,0.10,0.11,0.62,/
//2 'GENROU' 1   6 .05 1 .05 3 0 1.4 1.35 .3 .6 .2 .1 .03 .4 /
//2 'SEXS'   1   .1 .1 100 .1 0 3 /
2 'ESAC8B' 1   0.0 28.5 18.0 3.66 0.3E-01 1.0   0.0 27.19 0.0 0.72 1.0 1.0  0.0  1.2  0.0 /
//2 'TGOV1'  1   .05 .5 1. .3 1. 1. 0. /
//2, 'PSS2A',1, 1,0,3,0,5,1,  2,2,0.02,2,4,2,0.25 ,1,0.5,0.1,30,0.15,0.03,0.15,0.03,0.1,-0.1,/

image description image description

2024-02-26 00:11:24 -0500 received badge  Stellar Question (source)
2024-02-19 13:46:57 -0500 commented answer Import psse34 and psspy

After psspy is loaded, add the following code lines: _i = psspy.getdefaultint(); _f = psspy.getdefaultreal(); _s = psspy.getdefaultchar()

2024-02-16 10:41:05 -0500 answered a question Import psse34 and psspy

The above code runs ok in VSC!

In VSC, load your code and then under 'View', select 'Terminal'. Now in the lower right corner, check that 'python' and the right python version (like 2.7.18 32 bit) is being displayed. If not, click on the python version and enter the path to the python 2.7 32-bit in your pc. Run the script using the play button on the top right corner (do not use a debugger).

2024-02-09 09:46:11 -0500 commented answer Dynamic simulation in a for loop using PSSE35

var sys_path_PSSE is set for v.34, so update such path for v.35 (same for os_path_PSSE). vars t1, t2 are defined but not used. var num_steps is not defined. vars param[0], param[1] would change on each iteration (?). The loop code is missing. Test if the passing vars are changing within the loop.

2024-02-08 08:23:40 -0500 answered a question Dynamic simulation in a for loop using PSSE35

If the same python version is used for both v.34 and v.35, there is no need to change the code (except the obvious, psse35 instead of psse34...). And the psspy API functions should works the same way. Check the log files for errors during running time.

If possible, post your code for other to comment on it (and learn from it). I recommend to update the code to python 3.9 for v.35

2024-02-02 11:16:39 -0500 answered a question while using python code in psse, psse is not able to recognize other libraries like "xlsxwriter"

Check if errors were printed during installation. Check list of modules installed in CMD window with "pip list"

Test import command in python, in CMD window:

c:\..>python
>>import xlsxwriter

No error messages if able to import.

Test a simple code (works in python 3.9):

import xlsxwriter

workbook = xlsxwriter.Workbook('arrays.xlsx')
worksheet = workbook.add_worksheet('test')

array = [['a1', 'a2', 'a3'],
         ['a4', 'a5', 'a6'],
         ['a7', 'a8', 'a9'],
         ['a10', 'a11', 'a12', 'a13', 'a14']]

row = 0

for col, data in enumerate(array):
    worksheet.write_column(row, col, data)

workbook.close()
2024-01-29 17:11:45 -0500 answered a question Automate short circuit current calculations in PSSE

Use module pssarrays (or replacement module arrbox) to run faults and create results in dictionary format. Specific keyworks will help extracting data like (code below is modified from a related answer posted at "Retrieve ASCC result and process it in Python" by @perolofl):

 # ascc_t1.py - run in PSSe GUI
import pssarrays
psspy.case('savnw.sav')
psspy.bsys(0,0,[ 1., 500.],0,[],1,154,0,[],0,[])
rlst = pssarrays.ascc_currents(0,0,flt3ph=1)
f3ph = rlst.flt3ph[0].ia1
z1 = rlst.thevz[0].z1
print('f3ph=',f3ph)
print('z1=',z1)

To know what keywords to use on the 'rlst' variable, check the post "Where can i find the different functions that I can use to export data from PSSE to excel?" and apply it to the module 'arrbox'

2024-01-17 14:45:46 -0500 commented answer How can i use PSS/E 33 to calculate critical clear time through Python

Data is given in the cct_1d.ini file (a text file). For your case, create a converted case and a snp file using the code above (updated) and copy them to the 'CASEs' folder and update ini variables in line 4, 5,6, 13, 17, 18, 19, 24, 25, 27 to match your filenames, variables.

2024-01-11 07:32:07 -0500 received badge  Nice Answer (source)
2024-01-04 12:05:33 -0500 received badge  Nice Answer (source)
2024-01-03 10:27:30 -0500 answered a question PSS\E environment manger fails

Re-install. I know it is painful but usually works. I would install first IVF then PSSe. My setup works ok with PSSe v.34, v.35:

PSS(R)E User Model Compile/Link - Environment Manager 9.2.1, Python 3.7.9 [x86] Wed Jan 3 10:28:44 2024

------------- PSS(R)E 35.6.0 Environment settings, EM 9.2.1, Py 3.7.9 [x86]

Fortran PATH paths (IVF 19.2.3787): c:\program files (x86)\intel\oneapi\compiler\2022.1.0\windows\bin\intel64 c:\program files (x86)\intel\oneapi\compiler\2022.1.0\windows\redist\intel64_win\compiler

Visual Studio PATH paths (VS 2019): C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64 C:\Program Files (x86)\windows kits\10\bin\10.0.18362.0\x64

Fortran LIB paths (IVF 19.2.3787): c:\program files (x86)\intel\oneapi\compiler\2022.1.0\windows\compiler\lib\intel64

Visual Studio LIB paths (VS 2019): C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64 C:\Program Files (x86)\windows kits\10\Lib\10.0.18362.0\um\x64 C:\Program Files (x86)\windows kits\10\Lib\10.0.18362.0\ucrt\x64

Successfully added PSSE paths to local PATH and LIB environment.

2024-01-02 13:42:30 -0500 commented answer How can i use PSS/E 33 to calculate critical clear time through Python

Sorry for the missing files. Please download the updated zip file MPjobs_jconto_20240102 and follows the instructions given above.

2023-12-18 10:07:00 -0500 commented answer How can i use PSS/E 33 to calculate critical clear time through Python

The link to download MPjobs is in the third paragraph of that post. CCT is an example included in the install.

2023-12-15 15:12:55 -0500 answered a question How can i use PSS/E 33 to calculate critical clear time through Python

Check the post "MPjobs tool for PSSe runs in Parallel". It has a link to download my tool, MPjobs and it includes a critical clearing time (CCT) study example. Follow the instruction in the readme.txt file.
The CCT data input is in cct_1d.ini and the code that runs the study is in scripts\cct_1d.py. In this example, MPjobs runs multiple instances of cct_1d.py according to data defined in cct_1d.ini. The corresponding *.out and *.log created will have to be analyzed to assert CCT outcome.

The cct_1d.py expects to find a converted case and a snap file in the path specified in the ini file. When you have a non-converted case and a dyr file, the converted case and snap file can be created with the following script:

psspy.case('my.sav')
psspy.conl(0,1,1,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,2,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.conl(0,1,3,[0,0],[ 100.0,0.0,0.0, 100.0])
psspy.cong()
psspy.ordr(0)
psspy.fact()
psspy.tysl(0)
psspy.tysl(0)
psspy.save('my_cnv.sav')

#** Read DYRE records -  system dynamics + solar PV dynamics
psspy.dyre_new([1,1,1,1],'my.dyr','','','')
#** Save snapshot for dynamics
psspy.snap([-1,-1,-1,-1,-1],'my.snp')

If specific channels are monitored, plots of those channels for the multiple *.out files can be done to visualize the CCT outcome (for plotting check the post "Channels - tool to process outs files").

2023-12-15 14:53:50 -0500 answered a question psspy couldnt be resolved

The code works fine. The error could be related to the selection of python version in your set-up.
On the Visual Studio Code screen, click on the word "TERMINAL" on the lower menu, to activate the terminal box (behaves as a DOS windows) and then click on the version number next to "Python" on the 'new' menu on the bottom right side of the screen. Now you will see and select the right python version. For PSSe35, select python 3.7.x 64-bit. [In my setup, I use PSSe v.35.6 with python 3.9]

image description

2023-12-15 10:13:55 -0500 edited question psspy couldnt be resolved

hi, I am trying to run a python code in visual studio. I am getting an error 'import psspy could not be resolved'. Although my code is running. Then why I am seeing this issue? used the following:

import os
import sys
psse_dir = r"C:\Program Files\PTI\PSSE35\35.5\PSSBIN"
sys.path.append(psse_dir)
os.environ['PATH'] = os.environ['PATH'] + ';' +  psse_dir

py_dir = r"C:\Program Files\PTI\PSSE35\35.5\PSSPY37"
sys.path.append(py_dir)
os.environ['PATH'] = os.environ['PATH'] + ';' +  py_dir

import psse35
import psspy
2023-12-11 18:09:10 -0500 commented answer Channels - tool to process outs files

Jeff, thanks for sharing your experience with Channels. I will look into the pandas version issue and update the tools as needed.

2023-12-05 04:26:31 -0500 received badge  Good Answer (source)
2023-12-03 13:54:43 -0500 commented answer Output table to Excel file through python

I think pywin32 is used by dyntools. "psse34" and "dyntools" are part of the PSSe installation.

2023-12-01 08:50:12 -0500 answered a question Output table to Excel file through python

Re-install modules that behave unreliably (extreme: re-install PSSe). I simplified your code below, using an existing out file and able to create a XLS file:

import psse34
import dyntools

#outfile = r"""SMIB_BESS_fault.out"""
outfile = r'outs\\bess_A_Qp_load_trip.out'
chnfobj = dyntools.CHNF(outfile)
short_title, chanid, chandata = chnfobj.get_data()
chnfobj.xlsout(channels=[1,2,5,6],show=False)
2023-11-29 10:35:10 -0500 answered a question I don't have psspy, in my files of PSS/E. Can anyone send it to me?

An incomplete install of PSSe might not install psspy. Re-install PSSe. If problem persist, your install binary may be corrupt so (download) use a new install set.

2023-11-27 15:07:52 -0500 edited question PyPSSE Set up

Hi, sorry for the basic question...I cloned PyPSSE from github, as per these instructions:

-Clone this repository 
-Open up a Anaconda command prompt and execute command set CONDA_FORCE_32BIT=1. 
-Create a virtual environment by executing conda create -n python=3.7 in anaconda prompt 
-Activate environment by executing conda activate 
-From the cloned PyPSSE directory execute command python install -e. to install PyPSSE in the same environment

The last step is not working...could someone break it down please? After I change directory (while in the conda env I created) and type: python install -e. I get: python: can't open file 'install': [Errno 2] No such file or directory with pip install -e. I get: ERROR: File "setup.py" or "setup.cfg" not found. Directory cannot be installed in editable mode

there is not 'set up file' in the cloned evn.

Thanks!

2023-11-27 08:36:11 -0500 answered a question PyPSSE Set up

I have Anaconda-32 bit with python 3.9, also 32-bit version. I used PIP to install pypsse within a CONDA environment window as follows:

C:\Users\..>python
Python 3.9.7 (default, Sep 16 2021, 16:58:32) [MSC v.1916 32 bit (Intel)] :: Anaconda, Inc. on win32
...
C:\Users\..\Python>pip install pypsse
Collecting pypsse
  Using cached pypsse-0.1.9-py3-none-any.whl
Requirement already satisfied: numpy in c:\programdata\anaconda3_32bit\lib\site-packages (from pypsse) (1.20.3)
Requirement already satisfied: pandas in c:\programdata\anaconda3_32bit\lib\site-packages (from pypsse) (1.4.1)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\programdata\anaconda3_32bit\lib\site-packages (from pandas->pypsse) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\programdata\anaconda3_32bit\lib\site-packages (from pandas->pypsse) (2021.3)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3_32bit\lib\site-packages (from python-dateutil>=2.8.1->pandas->pypsse) (1.16.0)
Installing collected packages: pypsse
Successfully installed pypsse-0.1.9

C:\Users\..\Python>
2023-11-08 13:55:46 -0500 answered a question PSSPY on WSL with Ubuntu?

UBuntu or not Ubuntu, the PSSe setup for a windows OS does not change:

- Item 1- install PSSe 35.6 latest
- Item 2- Not needed.  PSSe 35 install python 3.9 64-bit  version and it works fine with it.
- Item 3- Not needed.
- Item 4- do it after a 'normal' set up works ok.
- Item 5- Test the following:

import os, sys
import psse35
import psspy
2023-11-06 14:27:50 -0500 commented answer Maximun incremental transfer (MW) in PV analysis

Try a max transfer value = 10000 MW. The power transfer is between two regions, so buses in the sink region would have the same number of transfer points or same "Max incre. transfer" when a voltage collapse condition is not reached yet.

2023-11-03 11:15:26 -0500 commented answer Maximun incremental transfer (MW) in PV analysis

Updated my answer above. There no 'expected value is 3000MW', since the process will find the max MW transfer (usually below the max value) that is marked as voltage collapse.

2023-11-02 09:15:30 -0500 answered a question Maximun incremental transfer (MW) in PV analysis

Choose the "no limits" option for the source and sink.

I suggest to set your source to generation by selecting "Subsystem machines MW" and your sink to load by selecting "Subsystem load" and set "Min monitored bus voltage in PU for terminating analysis" to 0.1

To get a script: on the GUI, record to python while selecting the option in the 'PV Analysis' screen.

2023-11-02 08:48:02 -0500 answered a question Open PSSE35.0 in Python3.7

In my set up, the installation of PSSe35 installed psspy39, psspy37, psspy27 but only installed python 3.9 Other python versions are left to the user to install them. But they have to be 64-bit version!

As @jbonilla stated:

import os, sys
import psse35
import psspy
2023-11-02 08:39:00 -0500 edited question Open PSSE35.0 in Python3.7

Hi! I tried following script to open PSSE35.0 in Python 3.7:

import os, sys

PSSE_LOCATION = r"C:\Program Files\PTI\PSSE35\35.0\PSSPY37"

sys.path.append(PSSE_LOCATION)

os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION 

import psspy

But it gave following error:

DLL load failed: The specific module could not be found.

How can i fix this issue?

I tried to use Python 2.7 as well but the error is same.

2023-10-26 17:09:45 -0500 commented answer I can´t generate .dll file when Compile in PSS34

Take "MODELOSGOV.obj". It is the compile version of a source code (*.flx or *.f) Open the source code file with a text editor and check for that statement. Whoever provided the *.obj or *.lib files might have access to the corresponding source files.