Пример #1
0
    void Update()
    {
        float[] rt60 = new float[6];
        float[] w1a  = new float[6];
        float[] w2a  = new float[6];
        float[] w3a  = new float[6];
        float[] w4a  = new float[6];
        float[] fa   = new float[6];
        float[] ca   = new float[6];



        for (int i = 0; i < 6; i++)
        {
            w1a[i] = list[w1menu.value][i];
            w2a[i] = list[w2menu.value][i];
            w3a[i] = list[w3menu.value][i];
            w4a[i] = list[w4menu.value][i];
            fa[i]  = list[fmenu.value][i];
            ca[i]  = list[cmenu.value][i];
        }
        w1avg = (list[w1menu.value][0] + list[w1menu.value][1] + list[w1menu.value][2] + list[w1menu.value][3] + list[w1menu.value][4] + list[w1menu.value][5]) / 6;
        w2avg = (list[w2menu.value][0] + list[w2menu.value][1] + list[w2menu.value][2] + list[w2menu.value][3] + list[w2menu.value][4] + list[w2menu.value][5]) / 6;
        w3avg = (list[w3menu.value][0] + list[w3menu.value][1] + list[w3menu.value][2] + list[w3menu.value][3] + list[w3menu.value][4] + list[w3menu.value][5]) / 6;
        w4avg = (list[w4menu.value][0] + list[w4menu.value][1] + list[w4menu.value][2] + list[w4menu.value][3] + list[w4menu.value][4] + list[w4menu.value][5]) / 6;
        cavg  = (list[cmenu.value][0] + list[cmenu.value][1] + list[cmenu.value][2] + list[cmenu.value][3] + list[cmenu.value][4] + list[cmenu.value][5]) / 6;
        favg  = (list[fmenu.value][0] + list[fmenu.value][1] + list[fmenu.value][2] + list[fmenu.value][3] + list[fmenu.value][4] + list[fmenu.value][5]) / 6;

        wall1SA     = length * height;
        wall2SA     = width * height;
        wall3SA     = length * height;
        wall4SA     = width * height;
        floorSA     = length * width;
        ceilingSA   = length * width;
        surfaceArea = 2 * (length * width) + 2 * (length * height) + 2 * (width * height);
        volume      = length * width * height;
        for (int i = 0; i < 6; i++)
        {
            rt60[i] = calc.RT60(wall1SA, wall2SA, floorSA, w1a[i], w2a[i], w3a[i], w4a[i], fa[i], ca[i], volume, unit);
            //	Debug.Log (rt60[i]);
        }
        rtOutput1.text = rt60[0].ToString("f2");
        rtOutput2.text = rt60[1].ToString("f2");
        rtOutput3.text = rt60[2].ToString("f2");
        rtOutput4.text = rt60[3].ToString("f2");
        rtOutput5.text = rt60[4].ToString("f2");
        rtOutput6.text = rt60[5].ToString("f2");


        //calculates modes
        mode = new float[3][];
        for (int i = 0; i < 3; i++)
        {
            mode[i] = new float[10];
            int counter = 1;
            for (int j = 0; j < 10; j++)
            {
                if (i == 0)
                {
                    mode[i][j] = calc.modeFreq(counter, 0, 0, length, width, height, sos);
                }
                if (i == 1)
                {
                    mode[i][j] = calc.modeFreq(0, counter, 0, length, width, height, sos);
                }
                if (i == 2)
                {
                    mode[i][j] = calc.modeFreq(0, 0, counter, length, width, height, sos);
                }


                counter++;
            }
        }
        modeTan = new float[3][];
        for (int i = 0; i < 3; i++)
        {
            modeTan[i] = new float[10];
            int counter = 1;
            for (int j = 0; j < 10; j++)
            {
                if (i == 0)
                {
                    modeTan[i][j] = calc.modeFreq(counter, counter, 0, length, width, height, sos);
                }
                if (i == 1)
                {
                    modeTan[i][j] = calc.modeFreq(0, counter, counter, length, width, height, sos);
                }
                if (i == 2)
                {
                    modeTan[i][j] = calc.modeFreq(counter, 0, counter, length, width, height, sos);
                }


                counter++;
            }
        }

        schroederFreq = calc.SchroederFreq(rt60, length, width, height, unit);
        MFP           = calc.MFP(length, width, height, unit);
        CD            = calc.CriticalDistance(rt60, length, width, height, unit);

        schroederOut.text = schroederFreq.ToString("f2");
        mfpOut.text       = MFP.ToString("f2");
        cdOut.text        = CD.ToString("f2");
    }