In DSTATCOM there is requirement to calculate phase difference of two analog signals to find the phase lead or phase lag so how can we directly calculate it in Matlab Simulink model. As after calculation of phase difference we can apply a control on that error signal which is phase difference of two signals