Ask Your Question
0

Change all buses load P and Q injections

asked Mar 11 '3

Ahmedkba gravatar image

updated Mar 11 '3

Hi,

I have two csv files; one has 10k rows and 16k columns represent samples of P injections.

The other has the same size but represents samples of Q injections.

I have a .raw file (working case) that I wish to change the bus load injections (P and Q one row at a time) for all the buses and then run OPF to save the buses voltages and branch currents mag and angles in spreadsheets.

In the sampled data files, each row represents a an OPF run. Thus, each element in the row is a bus injection.

I could not find an API function that changes all the buses power injections at once. Can anyone help me with this please? I need to write this in a python script that changes all the buses loads at once then run an OPF.

Thanks in advance

1 answer

Sort by » oldest newest most voted
0

answered Mar 13 '3

perolofl gravatar image

Loop all buses with power injection and use e.g. API load_chng_4 to update the load at each bus.

link

Comments

Now I have 2 nested for loops, one goes though the rows and the other goes through the columns, my issue is with the change function: psspy.load_chng_6(Bus_Number,r"""Load_Number""",[_i,_i,_i,_i,_i,_i,_i],[P_inject, Q_inject,_f,_f,_f,_f,_f,_f],"") I need to be able to insert a new value each time

Ahmedkba gravatar imageAhmedkba (Mar 13 '3)

I have a CSV file for each variable (Bus_Number, Load_Number, P_inject, Q_inject). I need a command to allow me to input the next value into the load change function in each for loop iteration. Please help

Ahmedkba gravatar imageAhmedkba (Mar 13 '3)

If Load_Number is a variable there shouldn't be """ around it, i.e. psspy.load_chng_6(Bus_Number, Load_Number, [], [P_inject, Q_inject])

perolofl gravatar imageperolofl (Mar 13 '3)

there must be """str""" in it, I get an error when I remove it. I need help know how to call the next item in the csv file I guess. But first, I need to convert my Load_Number csv list into a string rather than numbers

Ahmedkba gravatar imageAhmedkba (Mar 13 '3)

Load_number must be a string variable with id of the load. You must read the CSV-file and assign variables Bus_Number, Load_Number, P_inject and Q_inject before calling the API.

perolofl gravatar imageperolofl (Mar 13 '3)

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: Mar 11 '3

Seen: 305 times

Last updated: Mar 13 '23