Ask Your Question
0

Python API unable to load dsusr.dll?

asked 2020-09-28 06:48:20 -0500

bronco7TX gravatar image

Hello all, I'm getting an intermittent bug that I can't explain. I have a python script that updates a snapshot, then loads all the adds all model library dll files in a folder and then runs a flatrun.

For some cases when I run the add model library code:

import psspy
workdir = os.getcwd()
print("Current Dir: {}".format(workdir))
liblist = []
for files in os.listdir(workdir):
    if files[-4:].lower() == '.dll':
        liblist.append(files)
for library in liblist:
    ierr = psspy.addmodellibrary(workdir + "\\" + library)

I get the following error:

Current Dir: C:\Users\sjudd\Documents_CodeDev\Model Acceptance Tool\MATLocalMASv33v34200928\PreProj Messages for api ADDMODELLIBRARY Library not found (004183) "C:\Users\sjudd\Documents_CodeDev\Model Acceptance Tool\MATLocalMASv33v34200928\PreProj\dsusr.dll"

The code loads in all other dlls without issue and for some cases it even loads dsusr.dll without issue.

I've run the stability package within the PSSE GUI and don't have issues loading dsusr.dll for the stability package in question.

Is there some pathing issue that causes it to not always recognize dsusr.dll?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-09-28 12:59:09 -0500

bronco7TX gravatar image

After many internal discussions with engineers in my group, I have found out it is an issue with v33.12.1 and the library GVCA02v33.dll. When you open psse via the psspy.psseinit() function, dsusr.dll will automatically be loaded from the current working directory in python and in 2017 vintage MMWG models, the dll GVCA02v33.dll also needs loaded at the same time. I double and triple-checked my pathing to make sure I was in the current working directory but it would not recognize dsusr.dll.

The fix was to go back to v33.12.0 and everything worked without error.

If you are having the same problem with v33.12.1 and dsusr.dll, I suggest asking your IT dept to downgrade you back to v33.12.0 and retry to see if that solves the problem.

edit remove flag flag offensive (1) delete link more

Comments

would the problem happen (or not) in latest v.33.12.2?

jconto gravatar imagejconto ( 2020-09-28 17:36:54 -0500 )edit
0

answered 2020-09-28 07:49:41 -0500

jfconroy gravatar image

Do you get the same issue if you load the DLL manually in PSS/E, using the "Dynamics->Model Library->Load Model Library" drop-down menu option?

edit flag offensive delete link more

Comments

I do not, when I load the case/snap then add libraries within the GUI, it all works without error.

bronco7TX gravatar imagebronco7TX ( 2020-09-28 07:55:25 -0500 )edit

You might be having an issue with the "\\" being used as a folder separator. Try this instead. ierr = psspy.addmodellibrary(os.path.join(workdir, library)) Also add some print messages to try to get the bug out.

jfconroy gravatar imagejfconroy ( 2020-09-28 08:33:30 -0500 )edit

Thanks for the tip. I tried that and still get the same error. I get ierr=1 when running it but I know the path and file name appear to be correct from what I've entered. That part that makes this so hard to pinpoint is this same code works fine for other stability case packages.

bronco7TX gravatar imagebronco7TX ( 2020-09-28 09:03:45 -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

1 follower

Stats

Asked: 2020-09-28 06:48:20 -0500

Seen: 76 times

Last updated: Sep 28