File Exchange

image thumbnail

Newton-Raphson Loadflow

version 1.5 (7.54 KB) by

These matlab m files are used to calculate bus voltages and angles using Newton Raphson iterative me

3.94915
59 Ratings

132 Downloads

Updated

View License

These matlab m files are used to calculate bus voltages and angles, power flows using Newton Raphson iterative method

Comments and Ratings (132)

Can anyone help me in getting %thd at each bus after running load flow program.. I am interested to know about harmonics because I am considering non linear loads in the load flow program

Ahmadi Mike

Can anyone tell me for total power loss minimization using newton raphson load flow, what should be called inside optimization file if one of your objectives is power loss minimization?
I have tried "sum(Lpij)" which is introduced in load flow file of this code for power loss of the system, but it doesn't recognize it and says it is undefined.
Please let me know in advance!
My email: ahmadi.micaeil@gmail.com
Thank you!

Nida Riaz

Hello Sir,
I need a code for " Optimal location and parameters setting of UPFC using PSO"?
Please help me.
Regards;
NIDA
nidariaz0100@gmail.com

HUSEYIN BAKIR

hi, I am looking for matlab code for optimal FACTS allocation,if any body can help,please send it to hsynbakr@gmail.com
thanks

Pankaj Kumar

Hello,
I am getting this error please help.

??? Input argument "nb" is undefined.

Error in ==> loadflow at 5
Y = ybusppg(nb); % Calling Ybus program..

Please help : panks.kumar23@gmail.com

sai ram

we are doing main project on congestion management by facts devices.how to write matlab program on congestion management by 3bus system..pls send to my mail...my mail is saikiranpeddy251@gmail.com......pls send soon urgent

veta nasi

Hello,

One quastion please,

The length of the lines is taken into consideration or not, if so how?

thanks all

Katherine

Hi.
In the power flow equation i.e.
P(i) = P(i) + V(i)* V(k)*(G(i,k)*cos(del(i)-del(k)) + B(i,k)*sin(del(i)-del(k)));

shouldn't there be a summation from i=1 to n=number of buses before V(k)??

Noé Reyes

Thanks

great

Yes. This way the code works.
Copied.
Response to the Error:
2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

Answer: The code works well without any error in older MATLAB versions say for example: MATLAB R2008a.

If you are using latest version of MATLAB like for example, R2014a, R2015a you need to add "full" before the variables...
like this.....
loadflow(line 95)...ADD...

fprintf('%4g', full(p)); fprintf('%4g', full(q)); fprintf(' %8.3f', full(Pij(p,q))); fprintf(' %8.3f', full(Qij(p,q)));
fprintf(' %4g', full(q)); fprintf('%4g', full(p)); fprintf(' %8.3f', full(Pij(q,p))); fprintf(' %8.3f', full(Qij(q,p)));
fprintf(' %8.3f', full(Lpij(m))); fprintf(' %8.3f', full(Lqij(m)));
fprintf('\n');

Prasanna A

Megha dwivedi

is this code surely of Newton raphson or of fast decoupled load flow method ?

Megha dwivedi

It is not working for 14 bus system, showing error 1) Error using fprintf
Function is not defined for sparse inputs.

2) Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

3)Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

Shivashankar

Response to the Error:
2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

Answer: The code works well without any error in older MATLAB versions say for example: MATLAB R2008a.

If you are using latest version of MATLAB like for example, R2014a, R2015a you need to add "full" before the variables...
like this.....
loadflow(line 95)...ADD...

fprintf('%4g', full(p)); fprintf('%4g', full(q)); fprintf(' %8.3f', full(Pij(p,q))); fprintf(' %8.3f', full(Qij(p,q)));
fprintf(' %4g', full(q)); fprintf('%4g', full(p)); fprintf(' %8.3f', full(Pij(q,p))); fprintf(' %8.3f', full(Qij(q,p)));
fprintf(' %8.3f', full(Lpij(m))); fprintf(' %8.3f', full(Lqij(m)));
fprintf('\n');

Thanks!

Hasnae Bilil

Very well done. Thank you

Aaron M

will this code work for a 69 bus system?

abolfazl dht

Sir it is showing error like this while running nrlfppg.m file
1 2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

can you please help me, abolfazldht@gmail.com
thankyou

Sir it is showing error like this while running nrlfppg.m file
1 2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

can u help me to solve this error

hello sir ...here i am getting an error at loadflow 95 and the error " Error using printf , function is not defined for sparse inputs"... can anyone help me .... mail me at karthiksdkd@gmail.com

Urvee Sharma

can anyone pls tell me how to run load flow?? Thanks in advance

Hello,sir
can you please send me matlab code for newton raphson method with TCSC incorporated.i very need it, send on email eng.alazawi@yahoo.com

hi, I am looking for matlab code for optimal FACTS allocation,if any body can help,please send it to rmt_222003@yahoo.com
thanks

can you please send a matlab code for newton raphson method with UPFC incorporated to my email- ogochukwuchuks@gmail.com. Thanks for your anticipated cooperation

Hi, I am calculeting PTDFs for 30 bus system, both with DC and AC method and now I am stack in formation of transaction matrix, apparently for both of these methods they are the same size 41*870 but they are not suppposed (in theory) equally filled and I can't understand why, and I am wandering if PQ bus can also inject some power in the network?

hi....i need the IEEE 33-bus system line data and bus data... Ive been searching for them for a while and i can't find them....could anyone help...thanx

Saurav Raj

Thankyou sir.....

BAVA Robert

Good job

ahmet tan

Berny Rox

amanda tadros

please can you send me matlab newton raphson power flow with UPFC
tadros.amanda@hotmail.com

sir , i am getting function undefined error in this code .where should i define this

Thank you it worked.
Thanks Erik for correction.

wError in ==> nrlfppg at 160

loadflow(nbus,V,del,BMva); %

Calling Loadflow.m..
after running all i am getting this error
can anyone help please?

which program we need to run at first i am getting error if i am running busdat

tabia

tabia (view profile)

Error in loadflow.m
Attempted to access Vm(2); index out of bounds because numel(Vm)=1.

Error in loadflow (line 28)
Iij(p,q) = -(Vm(p) - Vm(q))*Y(p,q); % Y(m,n) = -y(m,n)..
How to correct this?

t s

t s (view profile)

It work successfully.
Thank you very much Praviraj.
Thank you Erik for correction.

I want load flow analysis program for 15 bus.

i want the newton raphson code with L-index formulation for voltage stability analysis

plz give 33 IEEE bus data and line data plzzzzzzz

function Y = ybusppg(num) % Returns Y
|
Error: Function definitions are not permitted in this context.

sir plz tell how to overcome this error

thank you Thomas, thanks a looooooot.

Zahid Abbas

Thomas

Thomas (view profile)

For anyone getting 'Function is not defined for sparse' type errors:

You need to converter spare matrix element to full matrix so 'fprintf' can display it. eg:

fprintf('%8.3f', full(Pij(p,q)))

A similar update to the code is need for all sparse matrix elements being displayed by 'fprintf'.

Alternatively, you can go further back in the code and change the sparse matrix to full versions, thought this is at expense of increased memory requirement.

hey..i m working on 33 bus test system and i want the ideal bus data...plz help me

Naem

Naem (view profile)

thus is the error that I've faced with:

??? Error using ==> fprintf

Function is not defined for sparse

inputs.

Error in ==> loadflow at 97

fprintf('%8.3f', Pij(p,q));

Error in ==> nrlfppg at 160

loadflow(nbus,V,del,BMva); %

Calling Loadflow.m..

can anyone help please?

shijith pt

sir after running the program it showing the following errors

Error in ==> loadflow at 2
Y = ybusppg(nb); % Calling Ybus progra
please help me correct it...

shijithpala@gmail.com

hi everybody
can anybody send me code for generating
gui for 30 bus bar ieee through newton raphson method at
s.ahil@kimo.com

juliana Klas

Very nice, congrats and many thanks!

i am doing project on the congestion management power system using differential evolution algorithm.the equality constraints are handled by NR method,but the program showing the error as follows
Line FLow and Losses
-------------------------------------------------------------------------------------
|From|To | P | Q | From| To | P | Q | Line Loss |
|Bus |Bus| MW | MVar | Bus | Bus| MW | MVar | MW | MVar |
so please send me the matlab coding,which is helpful for my project.send coding to this mail nageshbv13@gmail.com

Hello everyone;
Anyone who have experience to work on "Power System Improvement using UPFC" (Newton Raphson algorithm used in it and MATLAB used as a Tool).
If we take 3 bus system and find the power flow using Newton Raphson Method, and again take this system by improve power system stability by using UPFC with same algorithm (Newton Raphson Method) used.
Kindly guide me about following points;
a) Parameters used for UPFC in this?
b) What important things should be kept in mind while load flow calculations using UPFC??
Please guide me guys.....urgent please

Ahmad Farhan

hello sir... after executing the program the command shows the following error:

-------------------------------------------------------------------------------------
Line FLow and Losses
-------------------------------------------------------------------------------------
|From|To | P | Q | From| To | P | Q | Line Loss |
|Bus |Bus| MW | MVar | Bus | Bus| MW | MVar | MW | MVar |
-------------------------------------------------------------------------------------
1 2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf(' %8.3f', Qij(p,q));

can you help me to solve this problem?

killu bhashna

good work mam...
plz.. can any 1 help me how to install dg (distributed generation) in load flow solution by NR method ..sonia.bhashu@gmail.com

bhawana

??? Input argument "nb" is undefined.

Error in ==> loadflow at 2
Y = ybusppg(nb); % Calling Ybus program..
please help me..

CHAN ROY

Can you send me matlab code?
email: benmilous@hotmail.com

can you please send me matlab code for newton raphson method with UPFC incorporated.please kindly help me at bhasker.31121993@gmail.com

can i have the newton raphson program that has been successfully compiled,i am using STATCOM in the load flow analysis for a IEEE 30 bus system to reduce reactive power,i need the code of newton raphson method.
if anyone has it kindly reply to konathalaajay57@gmail.com

can i have the newton raphson program that has been successfully compiled,i am using STATCOM in the load flow analysis for a IEEE 30 bus system to reduce reactive power,i need the code of newton raphson method.

Hello,can you give me matlab code for newton raphson load flow with UPFC at pieceyo_xoxo@yahoo.com

Tq 4 the reply.

Ahmed Hussain

can you please give me code for nr method using UPFC

at
AHMEDSSUET@hotmail.com

boat bodin

thankyou

your work is very nice , but am in need of calculation of switching angles alpha1,alpha2 etc in 5 level multilevel inverters using newton- raphson method. please send me this file

mohamed

very nice work that help me
thank you

Kumar Mahesh

hello dear i need Matlab IEEE 33 code, if anyone can help

Aakash

Aakash (view profile)

Can i get the matlab code for incorporating upfc in newton raphson algorithm for ieee 30 bus system...
plz mail me it at aakash274@gmail.com

Ishan Purohit

Hey can anybody tell em how to copy the complete Newton Raphson Loadflow Analysis and line losses data in excel sheet

khalaf

khalaf (view profile)

I have changed the 33-bus code (mesh system) to 34-bus(radial system) and i have added the 34th bus data and changed the line data.

when i run, it works but never close to converge. it means the tolerance is very high in kilos and the results are unstable( goes from zeros to kilos and never stop).

anybody can help. is it ok to run the code for radial system is staid of mesh system? please help me if you can

sandeep

hello mr. hossein. I read your paper on distributed generation. I am also working on same topic is it possible for you to help me?

Erik

Erik (view profile)

Hanumant, change lines 44 and 45 of loadflow.m to read:

Pij = full(real(Sij));
Qij = full(imag(Sij));

hi my freinds...
i need to your help for using matlab to run newton raphson load flow by using genetic algorithm...
my problem is in 30 & 33 bus IEEE ...!!
thanks for your participation for solving the problem, with me...!!
god bless yo...

J Gunda

Sorry I just had a rough look and did not checked the program completely. I understood you have rearranged the equations while calculating Jacobian elements. Please ignore my last comment.

J Gunda

I think there was a mistake in calculation of Jacobian elements in your program. When m=n, if you do the differentiation you will get 2*Vm but you have used only Vm. Anyway good job....

I want to perform
"LOAD FLOW STUDIES WITH UPFC POWER
INJECTION MODEL FOR 30 BUSES",
Kindly help me coding(MATLAB simulation).
Can i get complete code for 30 buses.

PLEASE HELP ME .
SINCERE REGARDS;
Zaid

how can i watch PRAVI posts......i have already made account....kindly guide me ...i am new user

Mohsen

Mohsen (view profile)

Thank you very much

mourad

mourad (view profile)

How to insert a photovoltaic source and estimat its impact in the distribution network ?

Merah ahmede

Nice Joooob.

hello sir after executing the program the command shows the following error

1 2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf(' %8.3f',
Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

can u please make me understand why the error occured

pruthvi

hello sir after executing the program the command shows the following error

1 2Error using fprintf
Function is not defined for sparse inputs.

Error in loadflow (line 95)
fprintf('%4g', p); fprintf('%4g', q); fprintf(' %8.3f', Pij(p,q)); fprintf(' %8.3f',
Qij(p,q));

Error in nrlfppg (line 160)
loadflow(nbus,V,del,BMva); % Calling Loadflow.m..

can u please make me understand why the error occured

Hai im in need of Newton-Raphson load flow analysis Matlab code for contingency analysis in power system..I want to apply the line outages,load outages, generation outages randomly..i need your help..please help me..

azri zawawi

ello..i'm azri...I want to do power system load flow analysis using matlab by fast decoupled method....can u help me....???please help me...

Mahdi

Mahdi (view profile)

Hi every body
I want to do load flow analysis for IEEE 13 bus (unbalance distribution network).
How can I perform it?
Please help me.
Thanks a lot.

Waleed

Waleed (view profile)

Hi all,

I am running this code for fixed real powers at generator buses but it changes the values after execution, from those values that I have input. PV (generator) buses are supposed to have a fixed P and V, and Q and angle get calculated from them by Newton Raphson. Now I don't know what to do. Kindly look into my issue urgently, I have a project that is due in a day.

Meshal AM

In NRLF simulation, I got most of the results as NaN. How can I solve the problem?
Does anyone has solution to this problem?

do you consider the limit of reactive power of generators?

Error in ==> at 81
G = real(Y); please help me i you help me it really use full to my project

JAIME MORONI

the solution for the fprintf...
fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));....

you have to change fprintf('
%8.3f', Qij(p,q)) by fprintf('
%8.3f', full(Qij(p,q))) ....

you must do the same for Pij Qij any vector...

i have a cuestion the results are a little diferents. that a flow

http://catedrasempresa.esi.us.es/endesared/documentos/Tesis_Marano.pdf

Mamta

Mamta (view profile)

Mamta

Mamta (view profile)

Hi, I am having the the same problem as
Munibullah. Please help us urgently.

Munibullah

hey im having the same problem.

1 2??? Error using ==> fprintf
Function is not defined for sparse inputs.

Error in ==> loadflow at 96
fprintf('%4g', p); fprintf('%4g', q);
fprintf(' %8.3f', Pij(p,q)); fprintf('
%8.3f', Qij(p,q));

Error in ==> nrlfppg at 160
loadflow(nbus,V,del,BMva); %
Calling Loadflow.m..

HOw to fix this? i need to get the results its very imp.

Umar

Umar (view profile)

How to determine line current flow, the commands are given in loadflow.m but this m file does not execute. Please Help!!!!!!!!

mary

mary (view profile)

hi, thanks for it,
i need to calculate jacobian matrix 1 time in distribution system but i dont know how do it, can u help me?

vikram singh

thanks

Houssemus

@leonardo: yes it does!!

sumit verma

v.helpful program ......thanx pravi...

leonardo

I wonder if this script calculates the number of iterations performed, and if they do not calculate whether there is any way to calculate. Thanks in advance.

leonardo

first time thank for your attention.

leonardo

hi, i'm have some problem with this script, you could help me?
Error in ==> Untitled at 4
Y = ybusppg(nbus); % Calling
ybusppg.m to get Y-Bus Matrix..

Thanks

reygen oraiz

hi..i have the same mistake with omar and as you said, make this "Sij = sparse(Sij);" be commented at line 60..(its line 43) but an error occur again, it says:

??? Input argument "nb" is undefined.

Error in ==> loadflow at 5
Y = ybusppg(nb);

---------please help------------
i really need to have this right! thanks

Fabián

Why do you add .01 to voltage magnitude when a pv bus is out of mvar limits??

balaji

balaji (view profile)

When i run for 69 bus i get the error ""??? Attempted to access V(66); index out of bounds because numel(V)=65."
can anyone help

it works properly but why the results are far from the real ones even with too many iterations?

rasoul bayani

thanks .very much

Ali

Ali (view profile)

gmrit

gmrit (view profile)

PLEASE SEND NR METHOD LOADFLOW STUDY WITH UPFC. I LIKE THIS PROGRMME SOMUCH.IT IS FANTASTICK.PLEASE SEND UPFC PROGRAM TO ramesh.eee44@gmail.com

Praviraj PG

Praviraj PG (view profile)

@Omar: I guess, this is error is bcs of the different versions of matlab. Keep the line 60 (loadflow.m) commented.

%Sij = sparse(Sij);

And try again.

Omar

Omar (view profile)

i have one mistake in the display Line Flow and losses:
error in loadflow at 95(Function is not defined for sparse inputs.) and nrlfppg at 160 , i need help

senthil

please provide me the FAST DECOUPLED load flow method

senthil

thank you to provide this

Raju C V

Simple steps,Good program for novice programmers. Thanks

Husam Aldahiyat

prasert limsakun

very good for program loadflow

S F

best

Randhir Soni

if u ve made this prog with including Tap changing transformer then it will be better for someone to have complete practical idea about load flow problem

sougata mandal

we need the programme such a simple steps,which is better 2 understand for the new learners. thank u........

Jayanti Bhattacharjee

needs excellent speed

saloman danaraj

This program does not include the effect of tap changing transformers on powerflow which very much essential for modelling the problem.
The IEEE 30 bus system has 3 transformers .The author simply ignores that.

B. Roossien

- C-type of programming instead of Matlab-style (vectorised) programming.

- Script files instead of functions

- Very little documentation is provided making this contribution only useful for the author.

Author please remove this submission as it has no value to anyone but you. Why submit a file that no one else can understand?

Updates

1.5

Included files for calculating power flows

1.4

corrected the error with loadflow.m

1.3

Updated busdata

1.2

Updated busdata

1.1

Updated for Tap changing transformers and Q-limit violations

MATLAB Release
MATLAB 7 (R14)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video