Ask Your Question
0

Change all buses load P and Q injections

asked 2023-03-11 16:59:39 -0500

Ahmedkba gravatar image

updated 2023-03-11 17:00:32 -0500

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2023-03-13 03:19:05 -0500

perolofl gravatar image

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

edit flag offensive delete link more

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 ( 2023-03-13 10:31:42 -0500 )edit

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 ( 2023-03-13 10:33:41 -0500 )edit

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 ( 2023-03-13 12:14:36 -0500 )edit

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 ( 2023-03-13 12:48:36 -0500 )edit

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 ( 2023-03-13 13:40:57 -0500 )edit

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

Stats

Asked: 2023-03-11 16:59:39 -0500

Seen: 263 times

Last updated: Mar 13 '23