?? tscsequentialim.java
字號:
{
Point currFault = ( Point ) faultModel.nextElement();
if( usedForYZ[ currFault.x ] ) // Skipping faults in unused elements.
{
circuit.setFault( currFault );
SampleData[] currStateFaultQs = circuit.run( currTPS );
int[] eBehaviour = new int[ nrInputCombinations ];
int newInstances = BISTLib.countDiagnoses( currStateQs, currStateFaultQs, eBehaviour, eSize, nrZs, inputSampleSeparation, EStartAt, DQTol );
Vector currStateFaultKey = new Vector();
currStateFaultKey.add( currNode );
currStateFaultKey.add( currFault );
EBehaviour.put( currStateFaultKey, eBehaviour );
diagInstances += newInstances;
nrInstances += nrInputCombinations;
// TI // longStory += currFault + ": " + newInstances + " out of " + nrInputCombinations;
circuit.removeFault( currFault );
circuit.setState( currentState );
}
}
}
f_fs = 1d / ( ( nrInstances - diagInstances ) / 25d + 1d );
// 3) Compute f_st
int nrFaults = 0;
int detectableFaults = 0;
faultModel.reset();
while( faultModel.hasMoreElements() )
{
Point currFault = ( Point ) faultModel.nextElement();
if( usedForYZ[ currFault.x ] ) // Skipping faults in unused elements.
{
nrFaults++;
if( STMode == ST_MODE_ANY_STATE )
{
boolean someStateInputDetects = false;
for( int sl = 0; !someStateInputDetects && ( sl < nrStates ); sl++ )
{
MealyFSMNode currNode = stateEnterNodes[ sl ];
Vector stateFaultKey = new Vector();
stateFaultKey.add( currNode );
stateFaultKey.add( currFault );
int[] eBehaviour = ( int[] ) EBehaviour.get( stateFaultKey );
for( int dl = 0; !someStateInputDetects && ( dl < eBehaviour.length ); dl++ )
{
if( eBehaviour[ dl ] == BISTLib.E_BEHAVIOUR_HIGH )
{
someStateInputDetects = true;
}
}
}
if( someStateInputDetects )
{
detectableFaults++;
}
}else
{
boolean allStatesDetect = true;
for( int sl = 0; allStatesDetect && ( sl < nrStates ); sl++ )
{
MealyFSMNode currNode = stateEnterNodes[ sl ];
Vector stateFaultKey = new Vector();
stateFaultKey.add( currNode );
stateFaultKey.add( currFault );
int[] eBehaviour = ( int[] ) EBehaviour.get( stateFaultKey );
boolean someInputDetects = false;
for( int dl = 0; !someInputDetects && ( dl < eBehaviour.length ); dl++ )
{
if( eBehaviour[ dl ] == BISTLib.E_BEHAVIOUR_HIGH )
{
someInputDetects = true;
}
}
allStatesDetect &= someInputDetects;
}
if( allStatesDetect )
{
detectableFaults++;
}
}// end if self testing mode
}// end if used fault.x
}// end while faults
f_st = 1d / ( ( nrFaults - detectableFaults ) / 25d + 1d );
// 4) Compute f_t transitions
// For now only evalaute f_t if f_t = f_fs = 1
if( f_e > 0.9999 && f_fs > 0.9999 )
{
int incorrectTransitions = 0;
// 4.1) At every state
for( int sl = 0; sl < nrStates; sl++ )
{
MealyFSMNode currNode = stateEnterNodes[ sl ];
BitSet[] TP = ( BitSet[] ) shuffledTPS.get( currNode );
CircuitState currState = ( CircuitState ) circuitStates.get( currNode );
// 4.2 Under each fault
faultModel.reset();
while( faultModel.hasMoreElements() )
{
java.awt.Point currFault = ( java.awt.Point ) faultModel.nextElement();
if( usedForYZ[ currFault.x ] ) // Skipping faults in unused elements.
{
//TI//longStory += "\nChecking transitions from state " + sl + " under fault " + currFault + " node is " + currNode;
Vector stateFaultKey = new Vector();
stateFaultKey.add( currNode );
stateFaultKey.add( currFault );
int[] eBehaviour = ( int[] ) EBehaviour.get( stateFaultKey );
for( int itpl = 0; itpl < eBehaviour.length; itpl++ )
{
switch( eBehaviour[ itpl ] )
{
case BISTLib.E_BEHAVIOUR_LOW_ERROR:
incorrectTransitions++; break;
case BISTLib.E_BEHAVIOUR_HIGH:
break;
case BISTLib.E_BEHAVIOUR_LOW_OK:
{
//TI//longStory += "\nInput Pattern " + itpl + " was E_LOW_OK";
// 1. Restore state & Set Fault
circuit.setState( currState );
circuit.setFault( currFault );
// 2. Clock in the input for which E was low to force state transition
int nrInputs = TP.length;
SampleData[] clockInWithCurrInput = new SampleData[ nrInputs ];
for( int il = 0; il < nrInputs; il++ )
{
clockInWithCurrInput[ il ] = new SampleData( inputSampleSeparation, 2 );
}
int currInputPattern = ESLib.getLine( TP, itpl );
ESLib.setLine( clockInWithCurrInput, 0, currInputPattern );
ESLib.setLine( clockInWithCurrInput, 1, currInputPattern + 1 ); // with clock high
SampleData[] transitionQ = circuit.run( clockInWithCurrInput ); // should now be at next state
circuit.removeFault( currFault );
//TI//longStory += "\nJust ran" + ESLib.sampleDatasToString( clockInWithCurrInput, transitionQ );
if( !BISTLib.getE( transitionQ, eSize, nrZs, inputSampleSeparation, EStartAt ) )
{
// 3. Test to see if we have really moved to this new state
MealyFSMNode nextNode = currNode.nextStates[ currInputPattern / 2 ].dest;
BitSet[] TPNS = ( BitSet[] ) shuffledTPS.get( nextNode );
SampleData[] TPQNS = ( SampleData[] ) TPQS.get( nextNode );
SampleData[] nextTPS = ExperimentLib.generateInputFromTest( TPNS, 1, TPNS[ 0 ].length(), inputSampleSeparation );
int nrInputCombinations = nextTPS[ 0 ].length();
SampleData[] TPQNS2 = circuit.run( nextTPS );
int[] nextEBehaviour = new int[ nrInputCombinations ];
int correctDiagnoses = BISTLib.countDiagnoses( TPQNS, TPQNS2, nextEBehaviour, eSize, nrZs, inputSampleSeparation, EStartAt, DQTol );
if( correctDiagnoses < nrInputCombinations )
{
incorrectTransitions++;
//TI//longStory += "\nBad transition at state " + sl + " fault " + currFault + " ins " + currInputPattern;
//TI//shortStory += "\nBad transition at state " + sl + " fault " + currFault + " ins " + currInputPattern;
//TI//longStory += "\nQ vs Q2\n " + ESLib.sampleDatasToString( TPQNS, TPQNS2 );
}
} // end if E low
} // end case LOW_OK
} // end switch
} // end for input patterns of e behaviour
} // end if fault used
} // end while fault loop
} // end for state loop
f_t = 1d / ( incorrectTransitions / 50d + 1d );
} // end F_T if
}
ind.setProperty( 0, new Double( f_st ) );
ind.setProperty( 1, new Double( f_fs ) );
ind.setProperty( 2, new Double( f_t ) );
houseWork( ind, f_e );
double[] rv = { f_e };
return rv;
}
public String toString()
{
String narrator = "BIST Sequential Online Full Test Interaction Model with:";
narrator += "\n Threshold = " + threshold;
narrator += "\n Error Signal = " + BISTLib.getEModeStrings[ BISTLib.getEMode ];
narrator += "\n Error Line Start At = " + EStartAt;
narrator += "\n Error High Minimum Size = " + eSize;
narrator += "\n Input Reset Pattern Length = " + inputResetLength;
narrator += "\n Fault Model: " + faultModel;
narrator += "\n\nExperiment: " + experiment;
narrator += "\n\nDeployment: " + deployment;
narrator += "\n\nEvolver: " + evolver;
narrator += "\n";
return narrator;
}
public Genotype getMaxFitness()
{
Genotype rv = super.getMaxFitness();
rv.setProperty( 0, new Double( 1 ) );
rv.setProperty( 1, new Double( 1 ) );
return rv;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -