function [Pindex,Qindex,Pflowindex,Qflowindex] = ...
   get_convindex(bus,line,z_Pinj,z_Qinj,z_Pflow,z_Qflow)
% Syntax:
% [PMUindex,PMUAngleindex,PMUcurrentindex,Pindex,Qindex,Pflowindex,
%   Qflowindex] = measurement(bus_sol,line_flow,bus,line)
% 
% Purpose:   To get the index for conventional measurement 
%            
% Input:    bus_sol       - bus data actual meas
%           line_flow     - line flow data actual meas
%           bus           - bus data of system
%           line          - line data of system
%           
% Output:   Pindex - bus no where P injection measurements present
%           Qindex - bus no where Q injection measurements present
%           Pflowindex - line no where P flow measurements present
%           Qflowindex - line no where Q flow measurements present
%
% Calls:     
% Called by  
%
Pindex=[];Qindex=[];
Pflowindex=[];Qflowindex=[];

nob_l=length(bus(:,1)); %no. of bus
nol_l=length(line(:,1));  %no. of lines

%index for P and Q injection
for i=1:nob_l
    if (bus(i,14)==1) && (is_element_present(z_Pinj,i)==0)
        [Pindex]=[Pindex;i];
    end
    if (bus(i,14)==1) && (is_element_present(z_Qinj,i)==0)
        [Qindex]=[Qindex;i];
    end
end

%index for line real and reactive power flow
for i=1:nol_l
    if line(i,8)==1 || line(i,8)==3
        if is_element_present(z_Pflow,i)==0
            [Pflowindex]=[Pflowindex;i];
        end
        if is_element_present(z_Qflow,i)==0
            [Qflowindex]=[Qflowindex;i];
        end
    end
    if line(i,8)==2 || line(i,8)==3
        if is_element_present(z_Pflow,i+nol_l)==0
            [Pflowindex]=[Pflowindex; i+nol_l];
        end
        if is_element_present(z_Qflow,i+nol_l)==0
            [Qflowindex]=[Qflowindex;i+nol_l];
        end
    end
end
Pflowindex=sort(Pflowindex);
Qflowindex=sort(Qflowindex);
