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

Ask Your Question
0

Loadflow Automation

asked Feb 24 '18

PSSE_ABCD gravatar image

Hi I have over 48 load flow dispatches to analyse of various generation & load profiles, and I would like to automate the run in one go by looping all the cases in my folder. At the moment the cases are in separate .csv files, and I have manage to automate one simulation and export the results. At the moment for every dispatch case I have given a number i.e. G1.csv & D1.csv all the way to G48.csv & D48.csv in my folder. How do I automate it this? or loop it through my folder ? Any existing python code you can share will be the ultimate help.

Thanks

1 answer

Sort by » oldest newest most voted
0

answered Feb 25 '18

Ali gravatar image

updated Feb 25 '18

Your question is mainly concerned on how to read all of the files in a loop. You need to construct file names in a loop and read each file. The following code snippet may be helpful:

for i in range(1,49): 
    loadFileName = 'D'+str(i)+'.csv'
    load = pd.read_csv(loadFileName)
    genFileName = 'G'+str(i)+'.csv'
    gens = pd.read_csv(genFileName)

and then you can do whatever you want with the data in dataframe format.

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

Stats

Asked: Feb 24 '18

Seen: 510 times

Last updated: Feb 25 '18