0

Change all buses load P and Q injections

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

Ahmedkba's avatar
1
Ahmedkba
asked 2023-03-11 16:59:39 -0500, updated 2023-03-11 17:00:32 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

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

perolofl's avatar
3.8k
perolofl
answered 2023-03-13 03:19:05 -0500
edit flag offensive 0 remove flag delete 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's avatar Ahmedkba (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's avatar Ahmedkba (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's avatar perolofl (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's avatar Ahmedkba (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's avatar perolofl (2023-03-13 13:40:57 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer