Exemple #1
0
    void UpdateCalculator(LightSourceData ls, PVCellData pv)
    {
        /* CALCULATION OF SPLIT EFFICIENCIES AND TOTAL POWER*/

        float wavelength;

        totalPowerIn  = 0;
        totalPowerOut = 0;

        for (int i = 0; i < ls.spectralIrradiance.Length; i++)
        {                                                                                //for every interval in the observed light source's Spectral Irradiance
            wavelength = 325 + wavelengthDelta * i;                                      //the wavelength starts at 325nm and increments in steps of 50

            totalPowerIn += ls.spectralIrradiance[i] * wavelengthDelta * pv.surfaceArea; //add power in from interval to total power in
        }
        for (int i = 0; i < pv.EQE.Length; i++)
        {                                                                                                                      //for every interval in the observed cell's External Quantum Efficiency
            wavelength = 325 + wavelengthDelta * i;                                                                            //the wavelength starts at 325nm and increments in steps of 50

            if (i < ls.spectralIrradiance.Length)                                                                              //sets Spectral Irradiation value to 0 if no value found at specified wavelength interval
            {
                totalPowerOut += ls.spectralIrradiance[i] * wavelengthDelta * pv.surfaceArea * pv.EQE[i] * pv.correctiveRatio; //add power out from interval to total power out
            }
        }

        float intensitySliderVal = intensitySlider.normalizedValue;
        float pvCellSliderVal    = pvCellSlider.normalizedValue;

        size.text = ("Size:\n" + selectedPVCell.surfaceArea * pvCellSliderVal * 10000 + " cm²");
        pOut.text = ("Power Out:\n" + totalPowerOut * intensitySliderVal * pvCellSliderVal + " Watts");
        pIn.text  = ("Power In:\n" + totalPowerIn * intensitySliderVal + " Watts");
        pEff.text = ("Efficiency:\n" + 100 * totalPowerOut / totalPowerIn + " %");

        Debug.Log("Size of Cell = " + selectedPVCell.surfaceArea * pvCellSliderVal * 10000 + " cm²");
        Debug.Log("Total Power OUT = " + totalPowerOut * intensitySliderVal * pvCellSliderVal + " Watts");
        Debug.Log("Total Power IN  = " + totalPowerIn * intensitySliderVal);
        Debug.Log("Efficiency = " + 100 * totalPowerOut / totalPowerIn + " %");
    }
Exemple #2
0
 void UpdateGraph(LightSourceData ls, PVCellData pv)
 {
     if (graphView.isOn)
     {
     }
 }
Exemple #3
0
    void Update()
    {
        /* SETS VIEW */

        Transform cameraTrans = camera.GetComponent <Transform>();

        if (graphView.isOn && cameraTrans.position.x > -13.5f)
        {
            cameraTrans.position = new Vector3(-13.5f, 1, -22);
            UpdateGraph(selectedLightSource, selectedPVCell);
        }
        else if (!graphView.isOn && cameraTrans.position.x < 0)
        {
            cameraTrans.position = new Vector3(0, 1, -10);
        }



        /* SLIDER CHANGE */
        if (Input.GetMouseButtonUp(0))
        {
            intensitySlider.onValueChanged.AddListener(delegate
            {
                UpdateCalculator(selectedLightSource, selectedPVCell);
                UpdateGraph(selectedLightSource, selectedPVCell);
            });

            pvCellSlider.onValueChanged.AddListener(delegate
            {
                Transform pvCellTrans  = pvCell.GetComponent <Transform>();
                pvCellTrans.localScale = new Vector3(
                    4 * (pvCellSlider.normalizedValue / 1.2f) + 2f,
                    .2f * (pvCellSlider.normalizedValue / 1.2f) + .1f,
                    4 * (pvCellSlider.normalizedValue / 1.2f) + 2f
                    );
                UpdateCalculator(selectedLightSource, selectedPVCell);
                UpdateGraph(selectedLightSource, selectedPVCell);
            });
        }



        /* ON DROPDOWN CHANGE */

        if (pvCellDropdown.value != pvDDVal)
        {
            pvDDVal = pvCellDropdown.value;

            Renderer pvCellRend = pvCell.GetComponent <Renderer>();

            switch (pvCellDropdown.captionText.text)
            {
            case "Solexel":
                selectedPVCell      = solexel;
                pvCellRend.material = solexelMat;
                //pvCell.GetComponent<Renderer>().color = new Color(1, 1, 1);
                break;

            case "First Solar":
                selectedPVCell      = firstSolar;
                pvCellRend.material = FirstSolarMat;
                break;

            case "Fujikura":
                selectedPVCell      = fujikura;
                pvCellRend.material = FujikuraMat;
                break;

            case "AIST":
                selectedPVCell      = amorphAIST;
                pvCellRend.material = AISTMat;
                break;

            case "FhG-ISE":
                selectedPVCell      = fhgIseConcentr;
                pvCellRend.material = HfGISEMat;
                break;
            }
            Debug.Log(selectedPVCell.name + " selected. Updating.");
            UpdateCalculator(selectedLightSource, selectedPVCell);
            UpdateGraph(selectedLightSource, selectedPVCell);
        }

        if (lightSourceDropdown.value != lsDDVal)
        {
            lsDDVal = lightSourceDropdown.value;

            SpriteRenderer lightSourceRend = lightSource.GetComponent <SpriteRenderer>();

            switch (lightSourceDropdown.captionText.text)
            {
            case "AM 1.5":
                selectedLightSource    = AM1p5;
                lightSourceRend.sprite = AM1p5Spr;
                break;

            case "Incandescent":
                selectedLightSource    = blackBody;
                lightSourceRend.sprite = IncandescentSpr;
                break;

            case "Warm LED":
                selectedLightSource    = warmLED;
                lightSourceRend.sprite = WarmLEDSpr;
                break;

            case "Cool LED":
                selectedLightSource    = coolLED;
                lightSourceRend.sprite = CoolLEDSpr;
                break;

            case "Broadband Fluo":
                selectedLightSource    = broadBandFluo;
                lightSourceRend.sprite = BroadbandFluoSpr;
                break;

            case "Tri-Band Fluo":
                selectedLightSource    = narrowTriBandFluo;
                lightSourceRend.sprite = TribandFluoSpr;
                break;

            case "Cool White Fluo":
                selectedLightSource    = coolWhiteFluo;
                lightSourceRend.sprite = CoolWhiteFluoSpr;
                break;
            }
            Debug.Log(selectedLightSource.name + " selected. Updating.");
            UpdateCalculator(selectedLightSource, selectedPVCell);
        }
    }
Exemple #4
0
    void Start()
    {
        /* FETCHING DROPDOWNS */
        pvCellDropdown      = GameObject.Find("PV Cells Dropdown").GetComponent <Dropdown>();
        lightSourceDropdown = GameObject.Find("Light Sources Dropdown").GetComponent <Dropdown>();



        /* ADDING PV CELL AND LIGHT SOURCE DATA TO LIST */

        PVCells.Add(solexel);
        PVCells.Add(firstSolar);
        PVCells.Add(fujikura);
        PVCells.Add(amorphAIST);
        PVCells.Add(fhgIseConcentr);

        LightSources.Add(AM1p5);
        LightSources.Add(blackBody);
        LightSources.Add(warmLED);
        LightSources.Add(coolLED);
        LightSources.Add(broadBandFluo);
        LightSources.Add(narrowTriBandFluo);
        LightSources.Add(coolWhiteFluo);

        List <string> PVCellNames      = new List <string>();
        List <string> LightSourceNames = new List <string>();

        foreach (PVCellData pv in PVCells)
        {
            Debug.Log(PVCells.Find(PVCellData => PVCellData == pv).name + " online");
            PVCellNames.Add(pv.name);
        }

        foreach (LightSourceData ls in LightSources)
        {
            Debug.Log(LightSources.Find(LightSourceData => LightSourceData == ls).name + " online");
            LightSourceNames.Add(ls.name);
        }

        pvCellDropdown.AddOptions(PVCellNames);
        lightSourceDropdown.AddOptions(LightSourceNames);



        /* ASSIGNING SPECTRAL IRRADIANCE VALUES */

        AM1p5.AssignSI(AM1p5SI);
        blackBody.AssignSI(blackBodySI);
        warmLED.AssignSI(warmLEDSI);
        coolLED.AssignSI(coolLEDSI);
        broadBandFluo.AssignSI(broadBandFluoSI);
        narrowTriBandFluo.AssignSI(narrowTriBandFluoSI);
        coolWhiteFluo.AssignSI(coolWhiteFluoSI);



        /* EQE CONCATENATION OF MULTIJUNCTION CELLS */

        for (int i = 0; i < fhgIseConcentrBotEQE.Length; i++)
        {                                         //Combination of Top and Bottom Concentrator Cells
            float EQETopVal;
            if (i >= fhgIseConcentrTopEQE.Length) //sets Top Concentrator EQE value to 0 if no value found at specified wavelength interval
            {
                EQETopVal = 0;
            }
            else
            {
                EQETopVal = fhgIseConcentrTopEQE[i];
            }

            fhgIseConcentrEQE[i] = fhgIseConcentrBotEQE[i] + EQETopVal; //sets combined values of Top and Bottom Concentrator Cells
        }



        /* GRAPH ARRAY CREATION */

        int   xAxisSize = 10;
        int   yAxisSize = 8;
        float xAxisUnit, yAxisUnitEQE, yAxisUnitSI;

        //Find the biggest array between SI and EQE, use as baseline for x axis scale.
        if (selectedLightSource.spectralIrradiance.Length < selectedPVCell.EQE.Length)
        {
            xAxisUnit = xAxisSize / selectedPVCell.EQE.Length;
        }
        else
        {
            xAxisUnit = xAxisSize / selectedLightSource.spectralIrradiance.Length;
        }

        //Find the biggest value in the SI array to set as maximum for its y axis
        float max = selectedLightSource.spectralIrradiance[0];

        for (int i = 1; i < selectedLightSource.spectralIrradiance.Length; i++)
        {
            if (selectedLightSource.spectralIrradiance[i] > max)
            {
                max = selectedLightSource.spectralIrradiance[i];
            }
        }

        yAxisUnitEQE = yAxisSize / 100;
        yAxisUnitSI  = yAxisSize / max;


        //DONE
        //Divide set space by number of items
        //set left scale from 0-100% for EQE
        //set right scale from 0-highest value in SI array
        //place EQE points at (x = currentWavelength, y = EQEVal), adjusted to scale
        //place SI points at (x = currentWavelength, y = SIVal), adjusted to scale

        GameObject test = (GameObject)Instantiate(Resources.Load("EffeciencyPointPrefab"));

        /* ASSIGNING EXTERNAL QUANTUM EFFICIENCY VALUES */

        solexel.AssignEQE(solexelEQE);
        firstSolar.AssignEQE(firstSolarEQE);
        fujikura.AssignEQE(fujikuraEQE);
        amorphAIST.AssignEQE(amorphAISTEQE);
        fhgIseConcentr.AssignEQE(fhgIseConcentrEQE);



        /* UPDATING CALCULATOR FOR FIRST TIME */

        selectedPVCell      = solexel;
        selectedLightSource = AM1p5;
        UpdateCalculator(selectedLightSource, selectedPVCell);
        UpdateGraph(selectedLightSource, selectedPVCell);
    }