First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Python API unable to load dsusr.dll?

asked Sep 28 '0

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?

2 answers

Sort by » oldest newest most voted
0

answered Sep 28 '0

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.

link

Comments

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

jconto gravatar imagejconto (Sep 28 '0)
0

answered Sep 28 '0

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?

link

Comments

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

bronco7TX gravatar imagebronco7TX (Sep 28 '0)

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 (Sep 28 '0)

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 (Sep 28 '0)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Sep 28 '0

Seen: 1,193 times

Last updated: Sep 28 '20