Code covered by the BSD License  

Highlights from
Adaptive Fault Masking With Incoherence Scoring

image thumbnail
from Adaptive Fault Masking With Incoherence Scoring by Baykant ALAGOZ
Matlab simulation environment for testing various voting algorithms

[AdaptiveVoterOutput,H,NoResult]=AdaptiveVoterOlderNBit(y1,y2,y3,y4,y5,H,a)
function [AdaptiveVoterOutput,H,NoResult]=AdaptiveVoterOlderNBit(y1,y2,y3,y4,y5,H,a)
[m n]=size(y1);
N=5; %5 Module
NoResult=0;

% Calculate yc majority voting output for modules outputs y1,y2,y3
% ,y4,y5 (Algorithm step 1)

[Vmax,Vind,T,MajorityVoterOutput]=MajorityVotingNBit(y1,y2,y3,y4,y5,a);

% Constitution of the V set that has the largest cardinality |V| and
% satisfy |V| is equal and greate (N+1)/2.

%***NOT: 1 bit iin adaptive majority voter klasik majority votura
%indirgeniyor. Aadaki V maxHIndex hesaplamasna gerek yok. 1 bitte
%sadece 1 k deeri var. Yani V grubun deerleri hep ayn. 2 ve daha
%fazla bitte fakl olabilir. Bu nedenle 1 bit iin klasik majority
%voter ile ayn sonucu retir.
[m1 VCardinality]=size(Vind);
maxHForVIndx=1;
maxHForVVal=-1;

for i=1:VCardinality
    if H(Vind(i))>maxHForVVal
      maxHForVIndx=Vind(i);
      maxHForVVal=H(Vind(i));
    end
end
if maxHForVIndx==1
    AdaptiveVoterOutput=y1;
elseif maxHForVIndx==2
    AdaptiveVoterOutput=y2;
elseif maxHForVIndx==3
    AdaptiveVoterOutput=y3;
elseif maxHForVIndx==4
    AdaptiveVoterOutput=y4;
elseif maxHForVIndx==5
    AdaptiveVoterOutput=y5;
end

CheckForNOResult=(N+1)/2;
if VCardinality >= CheckForNOResult
maxHForVIndx=1;
maxHForVVal=-1;

for i=1:VCardinality
    if H(Vind(i))>maxHForVVal
      maxHForVIndx=Vind(i);
      maxHForVVal=H(Vind(i));
    end
end
if maxHForVIndx==1
    AdaptiveVoterOutput=y1;
elseif maxHForVIndx==2
    AdaptiveVoterOutput=y2;
elseif maxHForVIndx==3
    AdaptiveVoterOutput=y3;
elseif maxHForVIndx==4
    AdaptiveVoterOutput=y4;
elseif maxHForVIndx==5
    AdaptiveVoterOutput=y5;
end
Sesik=(N-1)/2;
H(1)=H(1)+((T(1)-1)>=Sesik);
H(2)=H(2)+((T(2)-1)>=Sesik);
H(3)=H(3)+((T(3)-1)>=Sesik);
H(4)=H(4)+((T(4)-1)>=Sesik);
H(5)=H(5)+((T(5)-1)>=Sesik);
else
  NoResult=1;
  AdaptiveVoterOutput=MajorityVoterOutput;
end

Contact us at files@mathworks.com