Example #1
0
        public void CalcNetSectEnergy_Test()
        {
            WakeCollection    WakeModList = new WakeCollection();
            TurbineCollection turbineList = new TurbineCollection();

            double[]     power      = new double[31];
            string       Power_file = testingFolder + "\\CalcNetSectEnergy\\Power.txt";
            StreamReader sr         = new StreamReader(Power_file);

            for (int i = 0; i <= 22; i++)
            {
                power[i] = Convert.ToSingle(sr.ReadLine());
            }

            double[] Thrust      = new double[31];
            string   Thrust_file = testingFolder + "\\CalcNetSectEnergy\\Thrust.txt";

            sr = new StreamReader(Thrust_file);

            for (int i = 0; i <= 22; i++)
            {
                Thrust[i] = Convert.ToSingle(sr.ReadLine());
            }

            turbineList.AddPowerCurve("GW 1500/87", 3, 22, 1500, power, Thrust, 87, 16, 10, 1, 0);
            WakeModList.AddWakeModel(0, 5, 10, turbineList.powerCurves[0], 10, 3.5f, 0.03f, "Linear");

            string WR_file = testingFolder + "\\CalcNetSectEnergy\\Wind_Rose.txt";

            sr = new StreamReader(WR_file);
            double[] windRose = new double[16];
            for (int i = 0; i <= 15; i++)
            {
                windRose[i] = Convert.ToSingle(sr.ReadLine()) / 100;
            }

            string Sect_WS_file = testingFolder + "\\CalcNetSectEnergy\\Sect_WS.txt";

            sr = new StreamReader(Sect_WS_file);
            double[,] sectorWS = new double[16, 31];
            for (int i = 0; i <= 15; i++)
            {
                string   This_WS_Array    = sr.ReadLine();
                string[] This_Array_Split = This_WS_Array.Split('\t');
                for (int j = 0; j <= 30; j++)
                {
                    sectorWS[i, j] = Convert.ToSingle(This_Array_Split[j]);
                }
            }

            Continuum thisInst = new Continuum("");

            thisInst.metList.WS_FirstInt = 0.5;
            thisInst.metList.WS_IntSize  = 1;
            thisInst.metList.numWS       = 30;
            Met met = new Met();

            thisInst.metList.AddMetTAB("dummy", 0, 0, 0, windRose, sectorWS, 0.5, 1, thisInst);
            double noLoss = 1.0;

            double[] This_Net_Energy = WakeModList.CalcNetSectEnergy(WakeModList.wakeModels[0], sectorWS, windRose, thisInst, noLoss);
            Assert.AreEqual(This_Net_Energy[0], 102.5134, 0.1, "Wrong net energy calculated Sector 0");
            Assert.AreEqual(This_Net_Energy[6], 96.69486, 0.1, "Wrong net energy calculated Sector 6");
            Assert.AreEqual(This_Net_Energy[14], 223.3589, 0.1, "Wrong net energy calculated Sector 14");
            Assert.AreEqual(This_Net_Energy[15], 124.5820, 0.1, "Wrong net energy calculated Sector 15");
        }