File Exchange

image thumbnail

Three Phase Shunt Active Power Filter using pq theory

version (40.2 KB) by Niranjan Bhujel
This simulation contains MATLAB modelling of three phase shunt active power filter using pq theory


Updated 19 Aug 2017

View License

It solves the problem of harmonic current in power system. It also compensate reactive power and balances load on three phase(if load is unbalanced). It uses Clarke transformation to calculate value of p0,p and q, filters out constant part of p and thus finding the compensating part of p0,p and q. Then, it calculates compensating current by inverse-Clarke transformation. The compensating current is injected to the network via three phase inverter using hysteresis band current control(HBCC) method. In this way, harmonic and reactive compnent of load is supplied by this shunt active power filter.Also, compensating p0 means balancing load on three phase.

Comments and Ratings (43)

do you have a email address ?

Muza Iqbal

i need the analysis of this model (Report) , pleas at >

i need the analysis of this model (Report) , pleas at >

Hey,really good simulation,being of great help. I had a few queries regarding PI control in conjunction with SPWM controller and a few more. If you could revert back at '' it would be of great help. Thanks in advance.

how to insert it in matlab?


For Latest Simulation Projects,Please Contact


Can u pls send me model in .mdl matlab 2010R version at mail

Sir i wants this model in 2016b. can you please provide a link or send to my

Sir i also wants this model in 2016a. can you please provide a link or send to my

Shubh Yadav

Shubh Yadav

sir please send me 2015 or 2013 model

Sir Niranjan Bhujel. sorry sir. can I know your email sir ? Or this is my Email sir . I want ask you something urgent sir. I hope sir.

Only 6 mosfets are used (6 IGBTs can also be used). Fourth leg of inverter is connected to neutral of the system at the point of common coupling. G1, G2 and G3 are gate signals for the mosfets (or IGBTs) of the inverter.

fourth leg inverter sir (8 IGBT) and what is the function of G sir. For G1, G2,G3 in the inverter. TQ for answering my questions sir.

Do you mean complete inverter or fourth leg of inverter?

Done run sir Niranjan Bhujel. Btw, where can I put the voltage source inverter (VSI) with fourth leg ?


Could anyone send me the model in R2015a.

R2016b or latest.

what version of matlab can I use to run this simulation sir ?

is not working in matlab 2013a it givs this Msg "object[id]!=NULL" how can i solve this pb thak's so much

hai sir, would you please send this to me but in r2016a . my email

Could you please update how we are selecting the values of P and I for the PI controller for the calculation of Ploss ( Loss component) to keep the DC link voltage constant

Venkat Montu.... I have forwarded 2016a file

thanks a lot sir...its working fine

sir , please send it to my email....i cn't download it.

Sir, I have implemented the model but facing issue with respect to controller part. Could you please provide me the model in 2016a will be very helpful for me.

my mail id:

Which file??? This file can be downloaded by clicking download button.

sir ,pliz mail me this file.....

Could you please update how we are selecting the values of P and I for the PI controller for the calculation of Ploss ( Loss component) to keep the DC link voltage constant.

Niranjan :Could you please forward the same. Thank you

Thank you . Mail id is


Thank you . Mail id is

The fundamental freq of oscilation is twice the supply frequency. Supply freq is 50 Hz. So, it is 100 Hz. Check your mail for R2016a version of this file.

Niranjan Bhujel.

Could you please pass the link of model in 2016a Version?
1) The fundamental freq of oscillation of instantaneous power is 100 HZ. Is that fixed?

1) Total q needs to be compensated because we are compensating harmonics as well as reactive component of current.
2) There is no gain of -1.
3) The fundamental freq of oscillation of instantaneous power is 100 HZ. There is no component with frequency between dc(0 Hz) and 100 Hz. So, cut off frequency of 50 Hz works fine.
4) We need to calculate oscillating part but LPF gives constant part. So, constant part is subtracted from total part of p to obtain oscillating part. Ploss has been subtracted because it is to be drawn.

Could you please provide a link to open the model 2016a version.

Thank you, I have few more queries on this.
Vabc converted to VAlpha and Vbeta then P and Q calculated.P = Paverage + Pharmonic. Similarlly Q=Q average+ Qharmonic. In this model LPF is applied only to separate P so that P harmonic need to compensate.Iwould like to get some clarifications from the model.

1) No need to filter Q? Total Q needs to compensate and directly taken for calculation of Ic1 and Ic2.
2) Why a gain of -1 is placed after Q?
2) Why Cut off frequency of LPF is 50? to separate the dc component it should be low like 5 Hz or 10 Hz. Comment please
3) After Low pass Filtering of P , DC component (Paverage ) is added with Loss component (Ploss )and subtracted from P to get AC component of real power. (Pharmonic) . So here it is coming negative right. Please comment on this.

mail :

Yes, q can be negative. It is instantaneous imaginary power. It is different than conventional reactive power. We are fitering p because only oscillating part of p is to be supplied by SAPF. So total p0,oscillating part of p and total q is used to calculate reference current.

Hello, Voltage and current transformed to Alpha Beta co-ordinates and corresponding P and Q calculated. Will Q is negative?
Why we are filtering P and Q anf after filter out what value we will use for computation of reference current? Thank you

How to control voltage and frequency for parallel operated generators

Mail *:


Exported to run on older version.

Exported for previous version (R2013a or latest).

Some bug fixed.



Made more informative.

Problem on PI controller has been fixed.

Problems of unbalanced load fixed.

Change in description.

Preview image is added.

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux