function [ZII_V,RII_V,HII_V]=eval_voltage_sequential(m_VMA,nob,slack)

%INPUT:
%   m_VMA  :  voltage meas in polar column as (bus_no, VM, VA, RM, RA)
%   slack  :  slack bus number

%OUTPUT:
%   ZII_V  :  measurement [Vreal;Vimag];
%   RII_V  :  variance [R_Vreal;R_Vimag]
%   HII_V  :  Voltage jacobian wrt real and reactive voltage
%             [dVreal/dVreal dVreal/dVimag;dVimag/dVreal dVimag/dVimag]

if isempty(m_VMA)==0
    m_real=[];m_imag=[];J_real=[];J_imag=[];
    for i=1:length(m_VMA(:,1))
        VM=m_VMA(i,2);VA=m_VMA(i,3);Rm=m_VMA(i,4);Ra=m_VMA(i,5);
        temp=zeros(1,nob);temp(1,m_VMA(i,1))=1;
        
        if m_VMA(i,1)==slack
            [m_real]=[m_real;VM Rm];
            [J_real]=[J_real;temp zeros(1,nob)];
        else
            [m_real]=[m_real;VM*cos(VA) Rm*cos(VA)^2+Ra*(VM*sin(VA))^2];
            [m_imag]=[m_imag;VM*sin(VA) Rm*sin(VA)^2+Ra*(VM*cos(VA))^2];
            
            [J_real]=[J_real;temp zeros(1,nob)];
            [J_imag]=[J_imag;zeros(1,nob) temp];
        end
    end
    
    ZII_V=[m_real(:,1);m_imag(:,1)];
    RII_V=[m_real(:,2);m_imag(:,2)];
    
    if slack==nob
        HII_V=[J_real(:,1:2*nob-1);J_imag(:,1:2*nob-1)];
    else
        HII_V=[J_real(:,1:nob+slack-1) J_real(:,nob+slack+1:2*nob)];
        [HII_V]=[HII_V;J_imag(:,1:nob+slack-1) J_imag(:,nob+slack+1:2*nob)];
    end
    clear i m_real m_imag J_real J_imag VM VA Rm Ra temp ;
else
    ZII_V=[];RII_V=[];HII_V=[];
end

