First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
2018-09-13 13:55:55 -0500 | received badge | ● Nice Question (source) |
2017-10-30 20:29:23 -0500 | answered a question | ImportError: DLL Load failed:... Troubleshooting DLL importsIn general the error message:
Indicates that the python interpreter can not find the library it is looking for. There are a couple steps I take to debug this issue. Does the path actually existBe paranoid and check in the python script that the path actually exists: Is the dll/pyd in the path?There is a file out there called Broken librariesThis is not what is happening to you, but I include it because it is another common class of problems you have when importing a compiled library. You may get an error message which indicates that the library load failed for another reason, like: In most cases these are caused by a 32/64 bit issue. |
2017-10-30 20:08:20 -0500 | commented question | ImportError: DLL Load failed:... Is that the correct path? I would expect it to be `C:\Program Files (x86)\PTI\PSSExplore34\PSSBIN`. And there should be a some libraries in it (`.pyd` or `.dll` files) |
2016-05-09 21:11:38 -0500 | marked best answer | Interacting with PSSE GUI I'm trying to determine what hooks the PSSE API has into the PSSE GUI. The only API functions I can find are related to the Graphical Analysis Output. I would like to:
Actually, any flow[1] that lets a user choose something in PSSE and use that choice in the API would be appreciated. Is anything like this possible with PSSE? EDIT: [1] Detecting selected items from the network spreadsheets (bus, branch, machine, etc) would also be helpful, but that ability seems even more unlikely. |
2016-04-11 00:40:02 -0500 | marked best answer | No API for pssplt? I can't find any documentation in the PSSE32 docs about an API for pssplt, so I can only conclude that there isn't one. Does anyone know any differently? Which means I'll be using from a larger python script. Which really isn't that bad, but I'd rather not spawn a |
2016-04-11 00:39:58 -0500 | marked best answer | How to detect if Python or PSSE is running the show. I have a script that is normally launched from the shell with PSSE on top like so: I am converting the script to run with Python on top as part of a larger python program. Does anyone know how to detect if I am running as an embedded session in PSSE or standalone? I found have an indirect route by explicitly setting the mode: And invoke the script using: |
2016-04-11 00:39:57 -0500 | marked best answer | Silencing PSSE STDOUT PSSE is rather talkative and makes liberal use of STDOUT just to let you know its happy. Does anyone know how to silence PSSE and just make it report important things like errors? For example just setting up psse with the command: Causes PSSE to dump a copyright notice and other info to STDOUT: Other common operations like reading a raw file behave in the same way. Now I know I could redirect all STDOUT in Python, but that seems rather drastic. Any ideas? |
2015-06-14 17:52:05 -0500 | commented question | can someone please share the IEEE 9 bus system^s matlab code finding any fault current I think the source code for MATPOWER (or it's python port) has some test systems including the IEEE cases. |
2015-04-22 17:51:31 -0500 | commented question | Debugging the Python code during PSSe dynamic simulation pdb is a full debugger, you can set breakpoints. If you want a pretty IDE give PyCharm or Spyder a try. If you go the Spyder route, I recommend you get it via PythonXY. |
2015-04-15 21:02:23 -0500 | commented question | Debugging the Python code during PSSe dynamic simulation ''pdb.set_trace()'' may work. It may not work depending how your output is being redirected. |
2015-03-06 10:12:55 -0500 | answered a question | Suppress PSSE output entirely I prefer to redirect STDOUT using a contextmanager so that I am sure that STDOUT goes back to normal after I am done capturing/ignoring it. The contextmanger will do the right thing if there is an exception, and plays nicely with Usually if redirecting STDOUT is failing it is because I forget the line And the results from running it in the CLI: Without redirect.psse2py()If you do not run the If we use our example code above and leave out the But PSSE is still noisy: |
2015-03-05 13:43:39 -0500 | commented question | Suppress PSSE output entirely My favorite way by far is to redirect with a contextmanger like this [example](https://psspy.org/psse-help-forum/question/93/silencing-psse-stdout/). Here is my [gist](https://gist.github.com/cwebber314/0b09f870f62f96ddc57a) I created as another example. |
2015-02-12 14:14:25 -0500 | commented answer | PSSE custom output device with python It can be helpful to use a contextmanager for method2 when you want to make sure STDOUT always restored to the previous location. http://stackoverflow.com/a/28486632/653689 |
2014-08-15 15:42:13 -0500 | commented question | MemoryError for running module "pssarrays.accc_violations_report" You can use the Resource Monitor and watch as the python process creeps up to 2GB and then throws the ``MemoryError`` exception. It's not that hard to hit the 2GB limit (32bit python). |
2014-02-12 11:24:35 -0500 | answered a question | Please help me fix an error Check out the variables in the line of code which is giving you problems: It looks like one of the arrays is empty. You can see this problem in a distilled case like: Which gives the error: A couple more examples: |
2014-02-12 11:14:58 -0500 | edited question | Please help me fix an error I'm getting an error in python: The code is posted below. does anybody know how i can fix this?: |
2014-02-03 13:58:53 -0500 | edited question | Reading PSSE output files (*.dat) and saving in a useful format (CSV) Hi I need some guidance/help on Python – Esp reading a text data file and re-arranging the information in a tabular form (probably in an Excel/CSV file) Please refer to the output of the ”Report.dat” file given below For each branch, there is a sensitivity list for buses ( the number of buses are not fixed for all contingencies) I would like to get these information in the following format. Bus, Branch, Sensitivity Appreciate your help to get this done in a Pythonic way Ta Output of the Report.Dat file |
2014-01-31 12:16:56 -0500 | commented answer | import pssexcel you should post this as new question. Also how do you try to import pssecel? From system python? Are you invoking psse with a script as an argument? From within PSSE? |
2013-12-16 14:03:18 -0500 | commented answer | import pssexcel Regarding python on top see the Whit [post](http://www.whit.com.au/blog/2012/10/import-psse-into-your-python-script/) for a nice description of how/why to run python on top |
2013-10-03 17:56:36 -0500 | commented answer | Can I run PSSE on mac or Linux? Out of curiosity, are you using a network license? |
2013-09-17 16:45:20 -0500 | received badge | ● Great Answer (source) |
2013-08-09 11:34:09 -0500 | commented answer | Help Refining Multiple ACCC Excel Report
|
2013-08-05 14:35:08 -0500 | answered a question | Help Refining Multiple ACCC Excel Report I ran the tool on a accc file I had lying around and here's the profile dump: Things i noticed:
I'm not sure what is hammering the |
2013-04-22 20:36:46 -0500 | commented question | ACCC Output to Excel Are you on the latest point release of PSSE? I ran into some win32com bugs with the early versions of the v33 releases while working with the accc functions. An upgrade to the latest PSSE release fixed it up. |
2013-01-14 04:13:19 -0500 | received badge | ● Famous Question (source) |
2012-11-30 13:15:50 -0500 | commented answer | Import matlab model in PSS/E Porting MATLAB models to another simulator seems to be a chore you just have to deal with. I've validated my share of models against their MATLAB equivalents. |
2012-11-21 09:04:46 -0500 | answered a question | Can you call python functions from VBA? Calling python from VBA-landYou asked about calling python from a macro, but anything that's in VBA you should be able to get to from a macro or provide a functional equivalent. Using win32com you can implement a COM object and through some machinations add this as a reference to your VBA code. Even thinking about this is a bit painful for me. Instead treat your python program as a separate tool that does one thing, and does it well. The excel spreadsheet is a easy-to-use front-end for you python script. Maybe one day you'll want to grab data directly from a PSSE run and shove it into your script and just skip excel? Moving data aroundYou have a couple options gluing your python scripts to your MSOffice VBA:
From past investigations, STDIO is too much of a pain to use in VBA so we can ignore that option. Options 1 and 2 are good ways to get data into your script. For example if you want to run some python math on data in excel you might invoke your python program like this I like to use standard windows environment variables like For other usersIf you are the only one using your VBA-python spreadsheet, then you can invoke the python script with python. You may also be able to get away with this if everyone you are working with has a similar environment. If your spreadsheet users don't have python installed you can build your python script as an executable and place it in a shared location. ReferenceHelpful functions on the VBA side to call external programs: |
2012-11-20 16:24:56 -0500 | commented question | Can you call python functions from VBA? Is there anything stopping you from using ``shell()`` to call the python script (compiled as an .exe if needed) and use command-line args + fileio to move data back and forth? |
2012-11-13 13:16:11 -0500 | received badge | ● Famous Question (source) |
2012-11-13 13:16:11 -0500 | received badge | ● Notable Question (source) |
2012-11-13 12:36:14 -0500 | answered a question | excelpy reading excel files I actually prefer to work with xlrd if I need to muck about with excel spreadsheets. It's also much easier to use than the COM API from win32com. xlrd Pros:
xlrd Cons:
I know this isn't a direct answer to your question. I went to grab an excelpy example from my scripts, but I realized I am not using it because of the other tools available. If memory serves, I tried once and decided to stick with xlrd/xlwt. There is also openpyxl. It looks like a nice package, but I haven't tried it yet. xlrd ExampleHere's an example of workbook navigation from the docs:: |
2012-11-10 09:07:35 -0500 | received badge | ● Taxonomist |
2012-10-26 09:41:51 -0500 | commented answer | Can we create a single line diagram(sld) from raw data using python? |
2012-10-10 10:48:13 -0500 | received badge | ● Citizen Patrol (source) |
2012-09-07 15:15:40 -0500 | commented answer | What is SID Don't forget about the useful sid=-1 which includes all elements in a case. |
2012-08-12 13:30:45 -0500 | commented answer | what is psspy ierr @amaity, that is my assumption too - the prefix `i` indicates the data type of `integer` which is the essence of systems Hungarian notation. It's not very pythonic, but the PSSE API docs use `ierr` all over the place so I'm still conflicted about the right name to give the variable. |
2012-08-11 18:05:01 -0500 | answered a question | what is psspy ierr The PSSE API documentation uses a variable named You can call the variable whatever you want, I suspect the It's usually a good idea to check the error code. By convention (not just in PSSE) if an operation completes without an error a zero is returned. So you can do something like: You can send the error code all the way up to the top level of you program and return it exit which can be useful if your program is part of a larger flow: Now a batch file calling your script can know that something went awry too. |
2012-07-27 11:21:56 -0500 | edited answer | Problem with numpy and matplotlib PSSE ships with its own Python distribution which doesn't include numpy and matplotlib. In this case you probably want to run with Python on top. The Whit guys have also written a nice article on doing this. It's possible to get a version of numpy and matplotlib to run with the PSSE Python distribution For me, running the system Python on top is usually more convenient.
|