if ((strcmp(InputPort1.TypeSignal ,'Optical')) &&  (strcmp(InputPort1.TypeSignal ,'Optical')) && (strcmp(InputPort1.TypeSignal ,'Optical')) && strcmp(InputPort1.TypeSignal ,'Optical'))
 OutputPort1 = InputPort1;
 
    a = InputPort1.Parameterized.Power;
  b = InputPort2.Parameterized.Power;
  c = InputPort3.Parameterized.Power;
  d= InputPort4.Parameterized.Power;
 



if ((a>b) && (a>c) && (a>d))
    [ls, cs] = size(InputPort1.Sampled);
    if( ls > 0 )

         for counter1=1:cs
           OutputPort1.Sampled(1, counter1).Signal = InputPort1.Sampled(1, counter1).Signal; 
         end;
     end;
   
   [lp, cp] = size(InputPort1.Parameterized);
   if( lp > 0 )

           OutputPort1.Parameterized.Power = InputPort1.Parameterized.Power; 
   end;
% end;
    

elseif ((b>a) && (b>c) && (b>d))
    
      [lt, ct] = size(InputPort2.Sampled);
       if( lt > 0 )

               for counter2=1:ct
               OutputPort1.Sampled(1, counter2).Signal = InputPort2.Sampled(1, counter2).Signal;
               end;
       end;
       [lr, cr] = size(InputPort2.Parameterized);
       if( lr > 0 )
           OutputPort1.Parameterized.Power = InputPort2.Parameterized.Power;
       end;

    
elseif ((c>a) && (c>b) && (c>d))
     [lq, cq] = size(InputPort3.Sampled);
     if( lq > 0 )

         for counter3=1:cq
              OutputPort1.Sampled(1, counter3).Signal = InputPort3.Sampled(1, counter3).Signal;
         end;
     end;
     [lv, cv] = size(InputPort3.Parameterized);
     if( lv > 0 )

         OutputPort1.Parameterized.Power = InputPort3.Parameterized.Power;
         % OutputPort1.Parameterized.Power = a.*2;

     end;
else 
    [ln, cn] = size(InputPort4.Sampled);
     if( ln > 0 )

         for counter4=1:cn
              OutputPort1.Sampled(1, counter4).Signal = InputPort4.Sampled(1, counter4).Signal;
         end;
     end;
     [lm, cm] = size(InputPort4.Parameterized);
     if( lm > 0 )

         OutputPort1.Parameterized.Power = InputPort4.Parameterized.Power;
     end
    
 end;
    
end;



    
    
   
 
