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

Ask Your Question
1

Use multiple Processor for PSSE Dynamics Run

asked Aug 26 '19

ddhungana gravatar image

Is there an easy way via python scripting to use multiple cores on a single computer for PSSE Dynamics Run. It is taking too long to complete dynamics runs, and I suspect the default system is only using a single core. Any help will be appreciated.

Comments

Thank you all for your responses. This is adequate information for me to get started.

ddhungana gravatar imageddhungana (Aug 29 '19)

3 answers

Sort by » oldest newest most voted
1

answered Aug 29 '19

bronco7TX gravatar image

updated Aug 29 '19

Python also has the ability to split work across multiple cores. Some sample code below on how we run multiple dynamic simulations on the same machine in parallel. Be careful on how many workers you add. The problem can become I/O with all the data from the multiple runs and running 4 in parallel will not be 400% faster than running 1. You get a diminishing rate of return the more cores you add. With this code, you can easily play around with how many cores you want to use and find the optimal number for your machine.

Sample code:

import multiprocessing
from multiprocessing import Process
from multiprocessing import Pool

workers = multiprocessing.cpu_count() - 1 # Run on N-1 cores on local machine
p = Pool(workers)
p.map(run_test, tests) # run_test is a function you call in parallel, tests is an array of data that gets passed to the function (could be case name, snapshot, fault name, etc...)

def run_test(test):
    # Run you stability run here...
link
0

answered Aug 26 '19

jconto gravatar image

Check the post "Python Parallel Dynamics Simulations", with a link to my python tool MPjobs.

link

Comments

Hi jconto, I'm trying to do a 2D run with two cases and 1 contingency. Would you know why instead of running the simulations in parallel, it waits for the first one to finish, and then runs the second simulation. Your help would be appreciated!

Type1_bus gravatar imageType1_bus (Sep 22 '0)

Usually the OS control what task goes to what CPU. In PSSe dynamic runs of small networks, the communication needs imposed by the OS usually are bigger or comparable with the actual running time. Parallel time gains are expected for large system or longer run times. BTW, your scenario seems a 1D.

jconto gravatar imagejconto (Sep 22 '0)

Thanks jconto! I was assuming the 1D.ini file will not let me run it if there are 2 cases (1D only allows 1 case and multiple contingencies?). Am I wrong?

Type1_bus gravatar imageType1_bus (Sep 25 '0)

1D studies allows 1 independent variable (Xvar) in a study, like multiple contingencies, but everything else the same or multiple cases with same contingency. For multiple cases, multiple contingencies, use the 2D.ini example, where 2D studies allows for 2 independent variables (Xvar, Yvar).

jconto gravatar imagejconto (Sep 25 '0)

Thanks jconto! I'm now using multiple cases and contingencies using mp2D.ini. I'm running dynamic simulations for large networks and still noticing that the runs are happening one by one as opposed to running in parallel. Do you think I'm missing something? Your help is much appreciated!

Type1_bus gravatar imageType1_bus (Sep 26 '0)

It seems your runs are in "mptype=MPP" mode, the default parallel mode, an entry in the INI file. The second option is "mptype=MPAA". In MPAA, a run is given to available CPU until all jobs are done. In MPP, jobs groups are formed before each group is given to a CPU, runs are 1x1 within a group.

jconto gravatar imagejconto (Sep 26 '0)

Thanks jconto! This solved the problem of running multiple instances simultaneously. Appreciate your help on this. I'm now running into issues where after a few runs (2-3 simulations later) it gets stuck somewhere during initialization and only works if I restart mpjobs again. Did you run into this?

Type1_bus gravatar imageType1_bus (Sep 29 '0)

Try increasing the delay between runs to avoid 'collision'. In INI file: poolDelay = 20 / time delay to start next run. default for poolDelay is 0. For real network of 7000 buses, I use between 10 to 20 sec for pooldelay.

jconto gravatar imagejconto (Sep 29 '0)

Thanks jconto! This seemed to fix the issues.

Type1_bus gravatar imageType1_bus (Sep 29 '0)
0

answered Aug 26 '19

acd1 gravatar image

You may know this already, but Siemens sells a "Parallel Dynamics Module," which I'm sure will fit your needs. There is a 1-month free trial available by the looks of it. I'm sure it's quite expensive after that.

I couldn't tell you if there's a good way of parallelizing a dynamics run with Python.

link

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: Aug 26 '19

Seen: 1,313 times

Last updated: Aug 29 '19