Ask Your Question
0

Create DLL using Python

asked 2019-08-07 10:35:43 -0500

NunoFul gravatar image

updated 2019-08-08 12:20:24 -0500

Hello everyone!

Does anyone knows if it is possible to automate the Compilation and Link of user-defined models and respective DLL creation on the PSSE Environment Manager, using Python?

(using, in my case: PSSE v34, EM 8.1.0, IVF 19, Python 2.7, Visual Studio 2015)

Thanks, Nuno F.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-08-08 12:18:02 -0500

NunoFul gravatar image

updated 2019-08-08 12:19:44 -0500

Hi pschmurr!

Thank you very much for your reply. That actually helped a lot. Based on your response, I've adapted the psse_env_manager.create_dll function that worked well. The code goes as following:

import psse_env_manager
import os

psse_version = 34
conec_file = r"C:\\...\\conec.flx"
conet_file = r"C:\\...\\conet.flx"
objlibfiles = r"C:\\...\\mymodel.obj"
dllname = r"C:\\...\\dsusr.dll"
workdir = r"C:\\...\\"
ivf_version = 'latest'

psse_env_manager.create_dll(psse_version, conec_file, conet_file, objlibfiles=objlibfiles,
                   dllname=dllname, workdir=workdir, showprg=True, useivfvrsn=ivf_version,
                   shortname='DSUSR', description='', majorversion=1, minorversion=0,
                   buildversion=0, companyname='', mypathlib=False)

To be noted that I use Visual Studio 2015.

Best, Nuno F.

edit flag offensive delete link more
0

answered 2019-08-08 02:10:48 -0500

pschmurr gravatar image

updated 2019-08-08 02:12:34 -0500

You can use the python module of the environment manager.

import psse_env_manager
import os

psse_version = 34
src1 = 'model.f90'
modsources = ['module.f90']
dllname = 'dsusr.dll'
workdir = os.getcwd()
ivf_version = '19'

psse_env_manager.create_dll(psse_version, src1, modsources=modsources, dllname=dllname,
   workdir=workdir, showprg=True, useivfvrsn=ivf_version, shortname='DSUSR',
   description='description', majorversion=1, minorversion=0, buildversion=0, companyname='',
   mypathlib=False)

However, you will also need visual studio build tools to actually build the dll. This is the problematic part for me since psse_env_manager will not recognize my visual studio 2017 Installation when I import the module like above.

The error in my case is something like <"\vswhere.exe" file not found> I don't know why this happens in my case and why there is that strange backslash in front of the file path.

I still hope it works for you.

edit flag offensive delete link more

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

2 followers

Stats

Asked: 2019-08-07 10:35:43 -0500

Seen: 1,157 times

Last updated: Aug 08 '19