Пример #1
0
Spectrum CaluclateBlackBody(double CCT){

/*
 * h = 6.62607E-34
 * c= 3*10E8
 * kB = 1.38065E-23; -- Boltzman constant
 * 2hc^2 = 1.1926926E-14
 * hc/kB = 0.0143977184659399558179118531126643247745627059718248
 *
 */
    double hc  = 1.1926926E-16;
    double hckB =0.0143977;
    vector <double> tab;

    double mianownik;
    for (int i=0;i<SIZE;i++) {
        mianownik = pow(Wavelength.getData()[i]*0.000000001,5)*(exp(hckB/(Wavelength.getData()[i]*0.000000001*CCT))-1);

        tab.push_back(hc/(mianownik));
    }
    Spectrum BlackBody;
    BlackBody.setData(&tab);
    return BlackBody;
    //$I$2/((A5*0,000000001)^5)/(EXP($I$3/(A5*0,000000001*$I$1))-1)

/*
     * 2hc^2/(lambda^5 * e^(hc/lambda*kBT)-1)
    */
}
Пример #2
0
double calculateCCT(Spectrum &normalizeData){
    double CCT;
    double X=0,Y=0,Z=0,u=0,v=0;
    for(int i=0;i<SIZE;i++)
    {
        X+=normalizeData.getData()[i]*xyz_bar[0].getData()[i];
        Y+=normalizeData.getData()[i]*xyz_bar[1].getData()[i];
        Z+=normalizeData.getData()[i]*xyz_bar[2].getData()[i];
    }
    u = 4*X/(X+15*Y+3*Z);
    v = 6*X/(X+15*Y+3*Z);
    double x = X/(X+Y+Z);
    double y = Y/(X+Y+Z);
    double xe = 0.3320;
    double ye = 0.1858;
    double n = ((x-xe)/(y-ye));
    double CCT_value = -449*pow(n,3)+3524*pow(n,2)-6823.3*n+5520.33;
    return CCT_value;
    //Approximation:
    //CCT(x, y) = ?449n3 + 3525n2 ? 6823.3n + 5520.33,
    // n = (x ? xe)/(y ? ye) is the inverse slope line, and (xe = 0.3320, ye = 0.1858) is the "epicenter"
}
Пример #3
0
Spectrum normalizeSpectrum(Spectrum data){

    Spectrum output;
    double sum = 0;
    vector <double> dataValue = data.getData();
    vector <double> xyzValue = xyz_bar[1].getData();

    for (int i=0;i<SIZE;i++) {
        sum += dataValue[i] * xyzValue[i];
    }
    for(int i = 0; i<SIZE; i++){
        dataValue[i] = (dataValue[i]/sum)*100;
    }
    //vector <double> tab[SIZE];
    output.setData(&dataValue);
    return output;
}
Пример #4
0
void calculate_uv(Spectrum &Data, double (&uvY)[3][SIZE_TSC]){
    double tab[3][SIZE];
    double x, y;
    double xyz[3][SIZE_TSC];
    for(int i=0;i<SIZE_TSC;i++)
    {
        for (int k = 0; k<3;k++) {
            xyz[k][i]=0;
            for(int j=0;j<SIZE;j++){
                tab[k][j] = TSC[i].getData()[j]*Data.getData()[j]*xyz_bar[k].getData()[j];
                xyz[k][i]+=tab[k][j];
            }

        }
        x=xyz[0][i]/(xyz[0][i]+xyz[1][i]+xyz[2][i]);
        y=xyz[1][i]/(xyz[0][i]+xyz[1][i]+xyz[2][i]);

        uvY[0][i]=4*x/(-2*x+12*y+3);
        uvY[1][i]=6*y/(-2*x+12*y+3);
        uvY[2][i]=xyz[1][i];
    }
}