Source Code
Infrared Signal Coding Schemes
home top contents previous up next

import java.awt.Dimension;
import java.awt.Image;
import java.awt.Color;


final public class Multipath_TestCase extends MultiPathConvolution{
	public Multipath_TestCase(Dimension dim, Image img, String problemName){
		super(dim,img,problemName);
    }

	//////////////////////////////////////////////////
	// Initializers
	//================================================
    //Overriding:
	//------------------------------------------------
    protected void spawnParametersAfterUserApplied(){
	 spanParsInMPLevel();
	 displySpawnedParsInMPLevel();
     simulationBlocked=false;
	 simulateThresholding();
    }
    //================================================
    
    //================================================
	//Overriding:
	//------------------------------------------------
	protected void initPreconstructor_Variables(){
		initPreconstructorInMPLevel();
		ceilingHeight=10.0;
    	modelDescription=new String[200];
		modelDescription[0]="Program 3: Dispersion Function h and failed signals.  Model: MultiPath Indoor Dispersion.";

		tapsSimulationLimit=31;
		
		dmnStartF=0.0;
		dmnRangeF=8.0;
		dmnRangeFDown=1.0;

		dmnStartX=0.0;
		dmnRangeX=3.0;
		grPoints=400;
		grStartF=600;

		functionCOUNT=7;
    	functionColor=new Color[]{
    			new Color(255,0,0),
    			new Color(220,100,0),
    			new Color(0,0,200),
    			new Color(150,0,150),
    			new Color(0,150,0),
    			new Color(0,255,0),
    			new Color(100,100,100,50),
    			new Color(200,0,0,50),
    			new Color(222,0,200,50)
    	};
        functionTitle=new String[]{
        	"h",
        	"beta",
        	"Origin",
        	"Loss",
        	"Origin",
        	"Gain",
        	"FirstLossThreshold"
        };
	}
	//------------------------------------------------
	//Overriding:
    //================================================
	
	//-----------------------------------------------
    // User Input Prompts
    //- - - - - - - - - - - - - - - - - - - - - - - - 
    protected int setParsToStrings(){
         int i=0;
        
         String decription="";
         for(int j=0; j<subModelTitle.length; j++){
        	 decription += ", "+j+" - " + subModelTitle[j];
         }
         
         strParsCrr[i][0]=String.valueOf(subModel);   strParsCrr[i][1]="Sub Model: "+decription; strParsCrr[i++][2]="int"; 
         strParsCrr[i][0]=String.valueOf(shotNoisePresented);   strParsCrr[i][1]="shotNoisePresented, 0 or 1"; strParsCrr[i++][2]="int"; 
         strParsCrr[i][0]=String.valueOf(SNR);  strParsCrr[i][1]="SNR, dB"; strParsCrr[i++][2]="double"; 
         strParsCrr[i][0]=String.valueOf(amSAR);  strParsCrr[i][1]="SAR, Signal to Ambient Light Ratio"; strParsCrr[i++][2]="double"; 
         strParsCrr[i][0]=String.valueOf(amInterferencePeriodTi);  strParsCrr[i][1]="Ti, Ambient Light Interference Period, sec"; strParsCrr[i++][2]="double"; 
		 strParsCrr[i][0]=String.valueOf(amInteferenceSummationPoints);   strParsCrr[i][1]="NTi, Ambient Light Interf. Sum. Points Numb., 1 for no Interference."; strParsCrr[i++][2]="int";
         
         strParsCrr[i][0]=String.valueOf(dmnRangeX);  strParsCrr[i][1]="Argument Range"; strParsCrr[i++][2]="double"; 
         strParsCrr[i][0]=String.valueOf(dmnRangeF);  strParsCrr[i][1]="Function Range"; strParsCrr[i++][2]="double";
         strParsCrr[i][0]=String.valueOf(dmnStartF);  strParsCrr[i][1]="Function Start"; strParsCrr[i++][2]="double";

         strParsCrr[i][0]=String.valueOf(Rb);   strParsCrr[i][1]="Bit Rate, Rb"; strParsCrr[i++][2]="double";
         strParsCrr[i][0]=String.valueOf(ceilingHeight);   strParsCrr[i][1]="Room Height, meters"; strParsCrr[i++][2]="double";

         strParsCrr[i][0]=String.valueOf(L);   strParsCrr[i][1]="Maximum symbol length, L"; strParsCrr[i++][2]="int"; 
         strParsCrr[i][0]=String.valueOf(Amax);   strParsCrr[i][1]="Non-zero levels in chip amplitude, A"; strParsCrr[i++][2]="int";
         
         return i;
    }
    public String setParsFromStrings(){
         int i=0;
         try{
        	 subModel =Integer.parseInt(strParsCrr[i][0]);  i++;
        	 shotNoisePresented =Integer.parseInt(strParsCrr[i][0]);  i++;
        	 SNR =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 amSAR =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 amInterferencePeriodTi = Double.parseDouble(strParsCrr[i][0]);  i++;
        	 amInteferenceSummationPoints = Integer.parseInt(strParsCrr[i][0]);  i++;
        	 
        	 dmnRangeX =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 dmnRangeF =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 dmnStartF =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 Rb =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 ceilingHeight =Double.parseDouble(strParsCrr[i][0]);  i++;
        	 L =Integer.parseInt(strParsCrr[i][0]);  i++;
        	 Amax =Integer.parseInt(strParsCrr[i][0]);  i++;
         }catch(Exception e){
            return "Exception when (re)setting parameters.\n" + e;    
         }
         return "";
    }
    //- - - - - - - - - - - - - - - - - - - - - - - - 
    // User Input Prompts
	//================================================================

    protected double functionSwitch(int fIx, double x){
	    switch(fIx){
	    case 0: return hh(x);
	    case 1: return drawSignal(x,beta)/scaled_chip_length;
	    case 2: return drawSignal(x,inputChipLost);
	    case 3: return drawSignal(x,resultChipLost);
	    case 4: return drawSignal(x,inputChipGained);
	    case 5: return drawSignal(x,resultChipGained);
	    case 6: return firstLossThreshold;
	    }
	    return 0;
    }
	protected double functionSwitchX(int fIx, double t) {return 0;}
}


Copyright (C) 2009 Konstantin Kirillov