function f = myfun_24bus(x)

TDS = x(1,:);

load('Ip.mat');
Ip=Ipp;

load('Fault_analysis_24bus_8dfig.mat')

first_fl=1;
last_fl=29;
 time_sum=0;
 
 
for i=1:4
    for j=1:3
        
clear ISC t ISCb ISCc 
 
 if i==1 || i==4
  ISC=Fault_analysis.(['ISCa' num2str(i) num2str(j)]);
 elseif i==2 || i==3
     
    ISCb=Fault_analysis.(['ISCb' num2str(i) num2str(j)]);
      ISCc=Fault_analysis.(['ISCc' num2str(i) num2str(j)]);
      ISC=max(ISCb,ISCc);
 end
 
 for fl=first_fl:last_fl
     
      
  MAP=MAPPING(fl,first_fl);   
     for k=1:2 
         indp(k)=MAP(k,1);
          indb1(k)=MAP(k,2);
          indb2(k)=MAP(k,3);
          indb3(k)=MAP(k,4);
          indb4(k)=MAP(k,5);
          
         
           if indp(k)~=0 
  
                    t(indp(k),fl)=0.14*TDS(indp(k))/(-1 + (ISC(indp(k),fl)/Ip(indp(k)))^.02 );
                    time_sum=time_sum+ t(indp(k),fl);
                end

           
           if indb1(k)~=0 

                       
                    t(indb1(k),fl)=0.14*TDS(indb1(k))/(-1 + (ISC(indb1(k),fl)/Ip(indb1(k)))^.02 );
                    time_sum=time_sum+ t(indb1(k),fl);
                end

           
           if indb2(k)~=0 
    
                    t(indb2(k),fl)=0.14*TDS(indb2(k))/(-1 + (ISC(indb2(k),fl)/Ip(indb2(k)))^.02 );
                    time_sum=time_sum+ t(indb2(k),fl);
                end
                
      if indb3(k)~=0 
    
                    t(indb3(k),fl)=0.14*TDS(indb3(k))/(-1 + (ISC(indb3(k),fl)/Ip(indb3(k)))^.02 );
                    time_sum=time_sum+ t(indb3(k),fl);
                end
           
           
            if indb4(k)~=0 
    
                    t(indb4(k),fl)=0.14*TDS(indb4(k))/(-1 + (ISC(indb4(k),fl)/Ip(indb4(k)))^.02 );
                    time_sum=time_sum+ t(indb4(k),fl);
                end
            
           
     end
 end
    end
end
f=time_sum;
  
  
 
 