예제 #1
0
        public void FindAllUW_Turbines_Test()
        {
            WakeCollection    WakeModList = new WakeCollection();
            TurbineCollection turbineList = new TurbineCollection();

            turbineList.AddTurbine("Turb_1", 275000, 4553000, 1);
            turbineList.AddTurbine("Turb_2", 275000, 4553300, 1);
            turbineList.AddTurbine("Turb_3", 275000, 4553600, 1);
            turbineList.AddTurbine("Turb_4", 275000, 4553900, 1);
            turbineList.AddTurbine("Turb_5", 275000, 4554200, 1);
            turbineList.AddTurbine("Turb_6", 283000, 4553000, 1);
            turbineList.AddTurbine("Turb_7", 283000, 4553300, 1);
            turbineList.AddTurbine("Turb_8", 283000, 4553600, 1);
            turbineList.AddTurbine("Turb_9", 283000, 4553900, 1);
            turbineList.AddTurbine("Turb_10", 283000, 4554200, 1);

            Turbine[] UW_Turbs = WakeModList.FindAllUW_Turbines(45, 279000, 4553200, turbineList);
            Assert.AreEqual(UW_Turbs.Length, 5, "Wrong number of UW turbines in Test 1 Sector 45");
            Assert.AreSame(UW_Turbs[0].name, "Turb_10", "Wrong UW turbines in Test 1 Sector 45");
            Assert.AreSame(UW_Turbs[1].name, "Turb_9", "Wrong UW turbines in Test 1 Sector 45");
            Assert.AreSame(UW_Turbs[2].name, "Turb_8", "Wrong UW turbines in Test 1 Sector 45");
            Assert.AreSame(UW_Turbs[3].name, "Turb_7", "Wrong UW turbines in Test 1 Sector 45");
            Assert.AreSame(UW_Turbs[4].name, "Turb_6", "Wrong UW turbines in Test 1 Sector 45");

            UW_Turbs = WakeModList.FindAllUW_Turbines(180, 279000, 4553200, turbineList);
            Assert.AreEqual(UW_Turbs.Length, 2, "Wrong number of UW turbines in Test 2 Sector 180");
            Assert.AreSame(UW_Turbs[0].name, "Turb_1", "Wrong UW turbines in Test 2 Sector 180");
            Assert.AreSame(UW_Turbs[1].name, "Turb_6", "Wrong UW turbines in Test 2 Sector 180");

            UW_Turbs = WakeModList.FindAllUW_Turbines(337.5f, 279000, 4554900, turbineList);
            Assert.AreEqual(UW_Turbs.Length, 4, "Wrong number of UW turbines in Test 3 Sector 337.5");
            Assert.AreSame(UW_Turbs[0].name, "Turb_5", "Wrong UW turbines in Test 3 Sector 180");
            Assert.AreSame(UW_Turbs[1].name, "Turb_4", "Wrong UW turbines in Test 3 Sector 180");
            Assert.AreSame(UW_Turbs[2].name, "Turb_3", "Wrong UW turbines in Test 3 Sector 180");
            Assert.AreSame(UW_Turbs[3].name, "Turb_2", "Wrong UW turbines in Test 3 Sector 180");

            UW_Turbs = WakeModList.FindAllUW_Turbines(225, 275500, 4553200, turbineList);
            Assert.AreEqual(UW_Turbs.Length, 3, "Wrong number of UW turbines in Test 4 Sector 225");
            Assert.AreSame(UW_Turbs[0].name, "Turb_1", "Wrong UW turbines in Test 3 Sector 180");
            Assert.AreSame(UW_Turbs[1].name, "Turb_2", "Wrong UW turbines in Test 3 Sector 180");
            Assert.AreSame(UW_Turbs[2].name, "Turb_3", "Wrong UW turbines in Test 3 Sector 180");
        }
예제 #2
0
        public void CalcWakeLosses_Test()
        {
            WakeCollection    WakeModList = new WakeCollection();
            TurbineCollection turbineList = new TurbineCollection();

            double[]     power      = new double[31];
            string       Power_file = testingFolder + "\\CalcWakeLosses\\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 + "\\CalcWakeLosses\\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");

            MetCollection metList = new MetCollection();

            metList.metItem    = new Met[1];
            metList.metItem[0] = new Met();

            // Load sectorwise wind speed distribution
            string Sect_WS_file = testingFolder + "\\CalcWakeLosses\\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]);
                }
            }

            string WR_file = testingFolder + "\\CalcWakeLosses\\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_AEP_file = testingFolder + "\\CalcWakeLosses\\Sect_AEP.txt";

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

            double[] R_RD = new double[21];

            for (int i = 0; i <= 20; i++)
            {
                R_RD[i] = i * 0.025f;
            }

            WakeCollection.WakeLossCoeffs[] These_Coeffs = new WakeCollection.WakeLossCoeffs[140]; // 5 (DW_RDs) x 28 (WS > 3)
            int Ind_Count = 0;

            for (double DW_RD = 5.5f; DW_RD <= 5.9; DW_RD = DW_RD + 0.1f)
            {
                int DW_ind = (int)Math.Round((DW_RD - 2) / 0.1, 0);

                for (int i = 3; i <= 30; i++)
                {
                    double[] Vel_Def_Rad = new double[21];   // Velocity Deficit profile at X_Length_RD
                    double[,] WS_Def_EV_Grid = WakeModList.CalcWS_DeficitEddyViscosityGrid(2f, 6f, 0.1f, 0.025f, i, WakeModList.wakeModels[0], metList);
                    for (int radiusInd = 0; radiusInd <= 19; radiusInd++)
                    {
                        Vel_Def_Rad[radiusInd] = WS_Def_EV_Grid[DW_ind, radiusInd]; // index = 37 corresponds to DW dist = 5.7 (i.e. 2 + 0.1 * 37 = 5.7)
                    }
                    Vel_Def_Rad[20] = 0;
                    double[] Coeffs = WakeModList.CalcWakeProfileFit(Vel_Def_Rad, R_RD);
                    These_Coeffs[Ind_Count].freeStream = i;
                    These_Coeffs[Ind_Count].X_LengthRD = DW_RD;

                    These_Coeffs[Ind_Count].linRegInt = Coeffs[0];
                    These_Coeffs[Ind_Count].linCoeff4 = Coeffs[1];
                    These_Coeffs[Ind_Count].linCoeff3 = Coeffs[2];
                    These_Coeffs[Ind_Count].linCoeff2 = Coeffs[3];
                    These_Coeffs[Ind_Count].linCoeff1 = Coeffs[4];
                    Ind_Count++;
                }
            }
            turbineList.AddTurbine("Target Site", 280050, 4552500, 1);
            turbineList.AddTurbine("UW Site", 280000, 4553000, 1);
            Continuum thisInst = new Continuum("");

            thisInst.turbineList         = turbineList;
            thisInst.metList.WS_FirstInt = 0.5;
            thisInst.metList.WS_IntSize  = 1;
            thisInst.metList.numWS       = 30;
            thisInst.metList.AddMetTAB("dummy", 0, 0, 0, windRose, sectorWS, 0.5, 1, thisInst);

            // Need to define exceed model
            thisInst.turbineList.exceed = new Exceedance();
            thisInst.turbineList.exceed.compositeLoss          = new Exceedance.Monte_Carlo();
            thisInst.turbineList.exceed.compositeLoss.pVals1yr = new double[100];

            for (int i = 0; i < 100; i++)
            {
                thisInst.turbineList.exceed.compositeLoss.pVals1yr[i] = 1.0;
            }

            WakeCollection.WakeCalcResults WakeResults = WakeModList.CalcWakeLosses(These_Coeffs, 280050, 4552500, sectorWS, 4130, Sect_AEP, thisInst, WakeModList.wakeModels[0], windRose);

            Assert.AreEqual(WakeResults.sectorNetEnergy[0], 79.1604, 0.1, "Wrong net AEP");
            Assert.AreEqual(WakeResults.sectorWakedWS[0], 4.2851, 0.1, "Wrong waked wind speed");
            Assert.AreEqual(WakeResults.sectorWakeLoss[0], 0.2278, 0.1, "Wrong wake loss");
        }