示例#1
0
        public void GetAvgAlpha_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter Archbold testing.cfm";

            thisInst.Open(Filename);

            Met thisMet = thisInst.metList.metItem[0];

            double[] theseAvgAlphas = thisMet.metData.GetAvgAlpha(0, 24, 1);
            Assert.AreEqual(theseAvgAlphas[0], 0.297582647, 0.001, "Wrong average alpha for Test 1");

            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            string[] filtsToApply = new string[1];
            filtsToApply[0] = "All";
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("8/1/2008");
            thisMet.metData.endDate   = Convert.ToDateTime("10/31/2008");
            thisMet.metData.EstimateAlpha();
            theseAvgAlphas = thisMet.metData.GetAvgAlpha(0, 24, 1);
            Assert.AreEqual(theseAvgAlphas[0], 0.320117958, 0.001, "Wrong average alpha for Test 2");

            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("6/25/2008");
            thisMet.metData.endDate   = Convert.ToDateTime("6/24/2009 23:50");
            thisMet.metData.EstimateAlpha();
            theseAvgAlphas = thisMet.metData.GetAvgAlpha(7, 9, 1);
            Assert.AreEqual(theseAvgAlphas[0], 0.33187482, 0.001, "Wrong average alpha for Test 3");

            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("6/25/2008");
            thisMet.metData.endDate   = Convert.ToDateTime("6/24/2009 23:50");
            thisMet.metData.EstimateAlpha();
            theseAvgAlphas = thisMet.metData.GetAvgAlpha(12, 23, 16);
            Assert.AreEqual(theseAvgAlphas[2], 0.160170555, 0.001, "Wrong average alpha for Test 4");

            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("1/1/2009");
            thisMet.metData.endDate   = Convert.ToDateTime("3/15/2009");
            thisMet.metData.EstimateAlpha();
            theseAvgAlphas = thisMet.metData.GetAvgAlpha(0, 2, 1);
            Assert.AreEqual(theseAvgAlphas[0], 0.347682384, 0.001, "Wrong average alpha for Test 5");

            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("12/30/2008");
            thisMet.metData.endDate   = Convert.ToDateTime("2/1/2009");
            thisMet.metData.EstimateAlpha();
            theseAvgAlphas = thisMet.metData.GetAvgAlpha(3, 3, 16);
            Assert.AreEqual(theseAvgAlphas[15], 0.400452263, 0.001, "Wrong average alpha for Test 6");

            thisInst.Close();
        }
示例#2
0
        public void CalcMeas_WSWD_Dists_Test()
        {
            Continuum thisInst = new Continuum("");

            string fileName = testingFolder + "\\Met testing.cfm";

            thisInst.Open(fileName);

            Met thisMet = thisInst.metList.metItem[0];

            thisMet.metData.GetSensorDataFromDB(thisInst, thisMet.name);

            // Test 1
            Met.WSWD_Dist thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.All, Met.Season.All, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));

            Assert.AreEqual(thisDist.WS, 6.617531, 0.01, "Wrong WS Test 1");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[0], 4.842588, 0.01, "Wrong WS Test 1");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[5], 5.461858, 0.01, "Wrong WS Test 1");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[15], 5.159092, 0.01, "Wrong WS Test 1");

            // Test 2
            thisInst.metList.numTOD = 2;
            thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.Day, Met.Season.All, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));
            Assert.AreEqual(thisDist.WS, 6.374398, 0.01, "Wrong WS Test 2");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[0], 4.51033, 0.01, "Wrong WS Test 2");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[3], 5.039229, 0.01, "Wrong WS Test 2");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[10], 7.798786, 0.01, "Wrong WS Test 2");

            // Test 3
            thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.Night, Met.Season.All, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));
            Assert.AreEqual(thisDist.WS, 6.8643, 0.01, "Wrong WS Test 3");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[1], 5.241824, 0.01, "Wrong WS Test 3");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[7], 7.063508, 0.01, "Wrong WS Test 3");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[15], 5.41911, 0.01, "Wrong WS Test 3");

            // Test 4
            thisInst.metList.numTOD    = 1;
            thisInst.metList.numSeason = 4;
            thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.All, Met.Season.Winter, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));
            Assert.AreEqual(thisDist.WS, 8.033652, 0.01, "Wrong WS Test 4");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[0], 4.493193, 0.01, "Wrong WS Test 4");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[11], 9.351834, 0.01, "Wrong WS Test 4");

            thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.All, Met.Season.Summer, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));
            Assert.AreEqual(thisDist.WS, 5.437018, 0.01, "Wrong WS Test 5");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[4], 4.760074, 0.01, "Wrong WS Test 5");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[15], 4.57385, 0.01, "Wrong WS Test 5");

            // Test 6
            thisInst.metList.numTOD = 2;
            thisDist = thisMet.CalcMeas_WSWD_Dists(80, Met.TOD.Day, Met.Season.Spring, thisInst, thisMet.metData.GetSimulatedTimeSeries(80));
            Assert.AreEqual(thisDist.WS, 6.733493, 0.01, "Wrong WS Test 6");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[1], 5.530139, 0.01, "Wrong WS Test 6");
            Assert.AreEqual(thisDist.WS * thisDist.sectorWS_Ratio[15], 5.760701, 0.01, "Wrong WS Test 6");

            thisInst.Close();
        }
示例#3
0
        public void DoWS_EstAlongNodes_Test()
        {
            Continuum thisInst = new Continuum("");

            double thisUTMX = 823500;
            double thisUTMY = 4500400;
            int    numWD    = 16;

            string Filename = testingFolder + "\\Turbine testing.cfm";

            thisInst.Open(Filename);
            thisInst.turbineList.ClearAllTurbines();
            thisInst.turbineList.AddTurbine("Test", thisUTMX, thisUTMY, 1);
            thisInst.topo.GetElevsAndSRDH_ForCalcs(thisInst, null, false);
            thisInst.turbineList.CalcTurbineExposures(thisInst, 4000, 1.0f, 1);
            double[] windRose = thisInst.metList.GetInterpolatedWindRose(thisInst.metList.GetMetsUsed(), thisUTMX, thisUTMY, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            thisInst.turbineList.turbineEsts[0].gridStats.GetGridArrayAndCalcStats(thisInst.turbineList.turbineEsts[0].UTMX, thisInst.turbineList.turbineEsts[0].UTMY, thisInst);
            Model[] models  = thisInst.modelList.GetModels(thisInst, thisInst.metList.GetMetsUsed(), Met.TOD.All, Met.Season.All, thisInst.modeledHeight, false);
            Met     thisMet = thisInst.metList.metItem[0];

            Turbine.WS_Ests New_WS_Est = new Turbine.WS_Ests();
            New_WS_Est.predictorMetName = thisMet.name;
            New_WS_Est.model            = models[0];

            NodeCollection nodeList = new NodeCollection();

            thisInst.turbineList.turbineEsts[0].AddWS_Estimate(New_WS_Est);
            Nodes startNode  = nodeList.GetMetNode(thisMet);
            Nodes targetNode = nodeList.GetTurbNode(thisInst.turbineList.turbineEsts[0]);

            Nodes[]         pathOfNodes = nodeList.FindPathOfNodes(startNode, targetNode, models[0], thisInst);
            Turbine.WS_Ests thisWS_Est  = thisInst.turbineList.turbineEsts[0].DoWS_EstAlongNodes(thisMet, models[0], pathOfNodes, thisInst, windRose);

            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[0, 0], 0, 0, "Didn't calculate WS at Node 1");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[1, 0], 0, 0, "Didn't calculate WS at Node 2");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[2, 0], 0, 0, "Didn't calculate WS at Node 3");

            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[0, 8], 0, 0, "Didn't calculate WS at Node 1");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[1, 8], 0, 0, "Didn't calculate WS at Node 2");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[2, 8], 0, 0, "Didn't calculate WS at Node 3");

            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[0, numWD - 1], 0, 0, "Didn't calculate WS at Node 1");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[1, numWD - 1], 0, 0, "Didn't calculate WS at Node 2");
            Assert.AreNotEqual(thisWS_Est.sectorWS_at_nodes[2, numWD - 1], 0, 0, "Didn't calculate WS at Node 3");

            Assert.AreNotEqual(thisWS_Est.WS_at_nodes[0], 0, 0, "Didn't calculate WS at Node 1");
            Assert.AreNotEqual(thisWS_Est.WS_at_nodes[1], 0, 0, "Didn't calculate WS at Node 1");
            Assert.AreNotEqual(thisWS_Est.WS_at_nodes[2], 0, 0, "Didn't calculate WS at Node 1");

            Assert.AreNotEqual(thisWS_Est.sectorWS[0], 0, 0, "Didn't calculate WS at Target site");
            Assert.AreNotEqual(thisWS_Est.sectorWS[numWD - 1], 0, 0, "Didn't calculate WS at Target site");
            Assert.AreNotEqual(thisWS_Est.WS, 0, 0, "Didn't calculate WS at Target site");


            thisInst.Close();
        }
        public void FindSectorsForGrid_Test()
        {
            Continuum thisInst = new Continuum("");

            StreamReader sr = new StreamReader(testingFolder + "\\WindRose 1.txt");

            double[] windRose = new double[16];

            for (int i = 0; i < 16; i++)
            {
                string thisData = sr.ReadLine();
                windRose[i] = Convert.ToDouble(thisData);
            }

            sr.Close();
            Grid_Info gridStats = new Grid_Info();

            bool[] Sectors_to_use = gridStats.FindSectorsForGrid(windRose);

            // All sectors should be included (true)
            for (int i = 0; i < 16; i++)
            {
                Assert.AreEqual(true, Sectors_to_use[i], "Wrong Sector " + i);
            }

            // Test 2
            sr = new StreamReader(testingFolder + "\\WindRose 2.txt");

            for (int i = 0; i < 16; i++)
            {
                string thisData = sr.ReadLine();
                windRose[i] = Convert.ToDouble(thisData);
            }
            sr.Close();

            Sectors_to_use = gridStats.FindSectorsForGrid(windRose);

            Assert.AreEqual(true, Sectors_to_use[0], "Wrong Sector 0");
            Assert.AreEqual(true, Sectors_to_use[1], "Wrong Sector 1");
            Assert.AreEqual(true, Sectors_to_use[2], "Wrong Sector 2");
            Assert.AreEqual(false, Sectors_to_use[3], "Wrong Sector 3");
            Assert.AreEqual(false, Sectors_to_use[4], "Wrong Sector 4");
            Assert.AreEqual(false, Sectors_to_use[5], "Wrong Sector 5");
            Assert.AreEqual(true, Sectors_to_use[6], "Wrong Sector 6");
            Assert.AreEqual(true, Sectors_to_use[7], "Wrong Sector 7");
            Assert.AreEqual(true, Sectors_to_use[8], "Wrong Sector 8");
            Assert.AreEqual(true, Sectors_to_use[9], "Wrong Sector 9");
            Assert.AreEqual(true, Sectors_to_use[10], "Wrong Sector 10");
            Assert.AreEqual(false, Sectors_to_use[11], "Wrong Sector 11");
            Assert.AreEqual(false, Sectors_to_use[12], "Wrong Sector 12");
            Assert.AreEqual(false, Sectors_to_use[13], "Wrong Sector 13");
            Assert.AreEqual(true, Sectors_to_use[14], "Wrong Sector 14");
            Assert.AreEqual(true, Sectors_to_use[15], "Wrong Sector 15");

            thisInst.Close();
        }
示例#5
0
        public void CalcTurbineWakeLosses_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\Turbine testing.cfm";

            thisInst.Open(Filename);

            thisInst.wakeModelList.AddWakeModel(0, 5, 12, thisInst.turbineList.GetPowerCurve("GW 87/1500 1.205 kg/m^3,,"), 10, 3, 0.05f, "Linear");

            int minDist = 10000000;
            int maxDist = 0;

            for (int i = 0; i <= thisInst.turbineList.TurbineCount - 1; i++)
            {
                int[] Min_Max_Dist = thisInst.turbineList.CalcMinMaxDistanceToTurbines(thisInst.turbineList.turbineEsts[i].UTMX, thisInst.turbineList.turbineEsts[i].UTMY);
                if (Min_Max_Dist[0] < minDist)
                {
                    minDist = Min_Max_Dist[0];                            // this is min distance to turbine but when WD is at a different angle (not in line with turbines) the X dist is less than this value so making this always equal to 2*RD
                }
                if (Min_Max_Dist[1] > maxDist)
                {
                    maxDist = Min_Max_Dist[1];
                }
            }

            minDist = (2 * 87);
            if (maxDist == 0)
            {
                maxDist = 15000;               // maxDist will be zero when there is only one turbine. Might be good to make this value constant
            }
            WakeCollection.WakeLossCoeffs[] Wake_coeffs = thisInst.wakeModelList.GetWakeLossesCoeffs(minDist, maxDist, thisInst.wakeModelList.wakeModels[0], thisInst.metList);

            thisInst.turbineList.turbineEsts[0].CalcTurbineWakeLosses(thisInst, Wake_coeffs, thisInst.wakeModelList.wakeModels[0]);

            Assert.AreNotEqual(thisInst.turbineList.turbineEsts[0].AvgWSEst_Count, 0, "Didn't add average WS est");
            int avgWS_Ind = thisInst.turbineList.turbineEsts[0].AvgWSEst_Count - 1;

            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].avgWS_Est[avgWS_Ind].wakeModel, null, "Didn't save wake model");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].avgWS_Est[avgWS_Ind].waked.sectorWS, null, "Didn't save sectorwise wind speeds");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].avgWS_Est[avgWS_Ind].waked.WS, null, "Didn't save wind speeds");

            int Net_AEP_ind = thisInst.turbineList.turbineEsts[0].NetAEP_Count - 1;

            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].wakeLoss, 0, "Didn't calculate wake loss");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].wakeModel, null, "Didn't save wake model");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].CF, null, "Didn't calculate CF");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].AEP, null, "Didn't calculate AEP est");
            //       Assert.AreNotEqual(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].P90, 0, "Didn't calculate P90"); P90/P99 not currently calculated in net AEP
            //       Assert.AreNotEqual(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].P99, 0, "Didn't calculate P99");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].sectorEnergy, null, "Didn't calculate sectorwise WS dists");
            Assert.AreNotSame(thisInst.turbineList.turbineEsts[0].netAEP[Net_AEP_ind].sectorWakeLoss, null, "Didn't calculate sectorwise wake loss");

            thisInst.Close();
        }
示例#6
0
        public void FindPathOfNodes_Test()
        {
            Continuum thisInst = new Continuum("");

            NodeCollection nodeList = new NodeCollection();

            string Filename = testingFolder + "\\Ashley.cfm";

            thisInst.Open(Filename);
            thisInst.topo.GetElevsAndSRDH_ForCalcs(thisInst, null, false);

            // Clear met pairs nad models
            thisInst.metPairList.ClearAll();
            thisInst.metPairList.CreateMetPairs(thisInst);
            thisInst.modelList.ClearAll();
            thisInst.modelList.FindSiteCalibratedModels(thisInst, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            double[] windRose = new double[16];

            // Find path of nodes in between mets for R = 4000
            for (int i = 0; i < thisInst.metPairList.PairCount; i++)
            {
                windRose = new double[16];
                Met.WSWD_Dist thisDist1 = thisInst.metPairList.metPairs[i].met1.GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All);
                Met.WSWD_Dist thisDist2 = thisInst.metPairList.metPairs[i].met2.GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All);

                for (int WD = 0; WD < 16; WD++)
                {
                    windRose[WD] = (thisDist1.windRose[WD] + thisDist2.windRose[WD]) / 2;
                }

                Nodes Met1_Node = nodeList.GetMetNode(thisInst.metPairList.metPairs[i].met1);
                Nodes Met2_Node = nodeList.GetMetNode(thisInst.metPairList.metPairs[i].met2);

                Nodes[] pathOfNodes = nodeList.FindPathOfNodes(Met1_Node, Met2_Node, thisInst.metPairList.metPairs[i].WS_Pred[0, 0].model, thisInst);
                thisInst.metPairList.metPairs[i].WS_Pred[0, 0].nodePath = pathOfNodes;
            }

            Assert.AreEqual(thisInst.metPairList.metPairs[4].WS_Pred[0, 0].nodePath.Length, 1, "Didn't find node between Met 2 and Met 3");

            // Confirm that Met 2 and Met 3 have terrain exposure that is outside acceptable range
            Nodes Met_2_Node = nodeList.GetMetNode(thisInst.metList.metItem[1]);
            Nodes Met_3_Node = nodeList.GetMetNode(thisInst.metList.metItem[2]);

            windRose = thisInst.metList.GetAvgWindRose(thisInst.modeledHeight, Met.TOD.All, Met.Season.All);

            bool isTerrainSame = nodeList.TerrainSame(Met_2_Node, Met_3_Node, thisInst.modelList.models[0, 0], 1, windRose, 0);

            Assert.AreEqual(isTerrainSame, false, "Didn't find terrain different between Met 2 and Met 3");

            // Confirm that Met 1 and Met 2 don't need a node in between
            Assert.AreEqual(thisInst.metPairList.metPairs[0].WS_Pred[0, 0].nodePath.Length, 0, "Found node between Met 1 and Met 2");

            thisInst.Close();
        }
示例#7
0
        public void CalcAvgExtrapolatedWS_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter Archbold testing.cfm";

            thisInst.Open(Filename);

            Met thisMet = thisInst.metList.metItem[0];

            string[] filtsToApply = new string[1];
            filtsToApply[0] = "All";

            thisMet.metData.startDate = Convert.ToDateTime("6/24/2008 15:00");
            thisMet.metData.endDate   = Convert.ToDateTime("1/22/2009 18:30");
            thisMet.metData.EstimateAlpha();

            // Test 1
            thisMet.metData.ExtrapolateData(80);
            double thisAvgWS = thisMet.metData.CalcAvgExtrapolatedWS(thisMet.metData.GetSimulatedTimeSeries(80));

            Assert.AreEqual(thisAvgWS, 5.67062, 0.001, "Wrong WS Test 1");

            // Test 2
            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("10/13/2008 21:30");
            thisMet.metData.endDate   = Convert.ToDateTime("6/30/2009 23:50");
            thisMet.metData.EstimateAlpha();
            thisMet.metData.ExtrapolateData(100);
            thisAvgWS = thisMet.metData.CalcAvgExtrapolatedWS(thisMet.metData.GetSimulatedTimeSeries(100));
            Assert.AreEqual(thisAvgWS, 6.69379, 0.001, "Wrong WS Test 2");

            // Test 3
            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("1/6/2009");
            thisMet.metData.endDate   = Convert.ToDateTime("6/1/2009");
            thisMet.metData.EstimateAlpha();
            thisMet.metData.ExtrapolateData(20);
            thisAvgWS = thisMet.metData.CalcAvgExtrapolatedWS(thisMet.metData.GetSimulatedTimeSeries(20));
            Assert.AreEqual(thisAvgWS, 4.6989779, 0.001, "Wrong WS Test 3");

            // Test 4
            thisMet.metData.ClearFilterFlagsAndEstimatedData();
            thisMet.metData.FilterData(filtsToApply);
            thisMet.metData.startDate = Convert.ToDateTime("1/1/2009 13:00");
            thisMet.metData.endDate   = Convert.ToDateTime("1/2/2009 12:00");
            thisMet.metData.EstimateAlpha();
            thisMet.metData.ExtrapolateData(43);
            thisAvgWS = thisMet.metData.CalcAvgExtrapolatedWS(thisMet.metData.GetSimulatedTimeSeries(43));
            Assert.AreEqual(thisAvgWS, 6.422621015, 0.001, "Wrong WS Test 4");

            thisInst.Close();
        }
示例#8
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary> Gen_WakeModel class initializer </summary>
        public Gen_WakeModel(Continuum continuum)
        {
            InitializeComponent();
            thisInst = continuum;

            if (thisInst.topo.useSepMod)
            {
                txt_FlowSep_Used.Text      = "Flow Sep. model used";
                txt_FlowSep_Used.BackColor = Color.LightBlue;
            }
            else
            {
                txt_FlowSep_Used.Text      = "Flow Sep. model NOT used";
                txt_FlowSep_Used.BackColor = Color.LightCoral;
            }

            if (thisInst.topo.useSR)
            {
                txtLC_Used.Text      = "Roughness model used";
                txtLC_Used.BackColor = Color.MediumSeaGreen;
            }
            else
            {
                txtLC_Used.Text      = "Roughness model NOT used";
                txtLC_Used.BackColor = Color.LightCoral;
            }

            thisInst.metList.AreAllMetsMCPd();
            if (thisInst.metList.allMCPd)
            {
                txtisMCPWakeModel.Text      = "MCP'd Met data used";
                txtisMCPWakeModel.BackColor = Color.MediumOrchid;
            }
            else
            {
                txtisMCPWakeModel.Text      = "Meas. Met data used";
                txtisMCPWakeModel.BackColor = Color.LightCoral;
            }

            cboPowerCrvs.Items.Clear();

            if (thisInst.turbineList.PowerCurveCount > 0)
            {
                for (int i = 0; i < thisInst.turbineList.PowerCurveCount; i++)
                {
                    cboPowerCrvs.Items.Add(thisInst.turbineList.powerCurves[i].name);
                }
            }

            if (cboPowerCrvs.Items.Count > 0)
            {
                cboPowerCrvs.SelectedIndex = 0;
            }
        }
 public void Put(Continuum.Core.Models.User user)
 {
     try
     {
         _teamLogic.UpdateUser(user);
     }
     catch (SecurityException ex)
     {
         throw ExceptionBuilder.CreateException(ex.Message, "Security", HttpStatusCode.Forbidden);
     }
 }
示例#10
0
        public void CalcSRDH_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\TopoInfo testing.cfm";

            thisInst.Open(Filename);
            thisInst.topo.GetElevsAndSRDH_ForCalcs(thisInst, null, false);

            // Test 1
            int    thisX    = 694370;
            int    thisY    = 4537997;
            double thisElev = 232.3494;
            int    radius   = 4000;

            Exposure thisExpo = thisInst.topo.CalcExposures(thisX, thisY, thisElev, radius, 1.0f, 1, thisInst.topo, 16);

            thisInst.topo.CalcSRDH(ref thisExpo, thisX, thisY, radius, 1.0f, 16);

            StreamReader sr = new StreamReader(testingFolder + "\\CalcSRDH Test 1.csv");

            for (int i = 0; i < 16; i++)
            {
                string   thisData   = sr.ReadLine();
                string[] parsedData = thisData.Split(',');
                Assert.AreEqual(Convert.ToDouble(parsedData[0]), thisExpo.SR[i], 0.05, "Wrong Surface Roughness Test 1 WD =" + i);
                Assert.AreEqual(Convert.ToDouble(parsedData[1]), thisExpo.dispH[i], 0.05, "Wrong Displacement Height Test 1 WD =" + i);
            }

            sr.Close();

            // Test 2
            thisX    = 712026;
            thisY    = 4539040;
            thisElev = 221.6944;
            radius   = 8000;

            thisExpo = thisInst.topo.CalcExposures(thisX, thisY, thisElev, radius, 1.0f, 1, thisInst.topo, 16);
            thisInst.topo.CalcSRDH(ref thisExpo, thisX, thisY, radius, 1.0f, 16);

            sr = new StreamReader(testingFolder + "\\CalcSRDH Test 2.csv");

            for (int i = 0; i < 16; i++)
            {
                string   thisData   = sr.ReadLine();
                string[] parsedData = thisData.Split(',');
                Assert.AreEqual(Convert.ToDouble(parsedData[0]), thisExpo.SR[i], 0.05, "Wrong Surface Roughness Test 2 WD =" + i);
                Assert.AreEqual(Convert.ToDouble(parsedData[1]), thisExpo.dispH[i], 0.05, "Wrong Displacement Height Test 2 WD =" + i);
            }

            sr.Close();

            thisInst.Close();
        }
        public void ExportIceThrows()
        {
            Continuum thisInst = new Continuum("");

            string fileName = testingFolder + "\\Ice throw\\Ice throw testing.cfm";

            thisInst.Open(fileName);

            // Test 1: W1 WD Ind = 0
            string       test1Hits   = testingFolder + "\\Ice throw\\Test 1 W1 Hits.csv";
            double       turbUTMX    = 277929.9674;
            double       turbUTMY    = 4553360.947;
            int          test1WD_Ind = 0;
            StreamWriter sw1         = new StreamWriter(test1Hits);

            // Test 2: W1 WD Ind = 10
            string       test2Hits   = testingFolder + "\\Ice throw\\Test 2 W1 Hits.csv";
            int          test2WD_Ind = 10;
            StreamWriter sw2         = new StreamWriter(test2Hits);

            // Test 3: W1 WD Ind = 15
            string       test3Hits   = testingFolder + "\\Ice throw\\Test 3 W1 Hits.csv";
            int          test3WD_Ind = 15;
            StreamWriter sw3         = new StreamWriter(test3Hits);

            SiteSuitability.FinalPosition[] iceHits = thisInst.siteSuitability.yearlyIceHits[0].iceHits; // ice hits in first year of simulation

            for (int i = 0; i < iceHits.Length; i++)
            {
                if (iceHits[i].turbineName == "W1")
                {
                    double thisDirection = thisInst.topo.GetDirection((iceHits[i].thisX - turbUTMX), (iceHits[i].thisZ - turbUTMY));
                    int    thisWD_Ind    = thisInst.metList.GetWD_Ind(thisDirection);

                    if (thisWD_Ind == test1WD_Ind)
                    {
                        sw1.WriteLine(iceHits[i].thisX + "," + iceHits[i].thisZ + ",");
                    }
                    else if (thisWD_Ind == test2WD_Ind)
                    {
                        sw2.WriteLine(iceHits[i].thisX + "," + iceHits[i].thisZ + ",");
                    }
                    else if (thisWD_Ind == test3WD_Ind)
                    {
                        sw3.WriteLine(iceHits[i].thisX + "," + iceHits[i].thisZ + ",");
                    }
                }
            }

            sw1.Close();
            sw2.Close();
            sw3.Close();
        }
示例#12
0
        public void Find_MERRA_Coords_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MERRA_Testing.cfm";

            thisInst.Open(Filename);

            Met thisMet = thisInst.metList.metItem[0];

            UTM_conversion.Lat_Long theseLL = thisInst.UTM_conversions.UTMtoLL(thisInst.metList.metItem[0].UTMX, thisInst.metList.metItem[0].UTMY);
            MERRA merra = thisInst.merraList.GetMERRA(theseLL.latitude, theseLL.longitude);

            // Test 1
            bool Get_MERRA_Coords = merra.Find_MERRA_Coords(merraFolder);

            Assert.AreEqual(4, merra.MERRA_Nodes[0].XY_ind.X_ind, "Wrong x ind");
            Assert.AreEqual(2, merra.MERRA_Nodes[0].XY_ind.Y_ind, "Wrong y ind");

            // Test 2
            merra.numMERRA_Nodes = 4;
            Array.Resize(ref merra.MERRA_Nodes, merra.numMERRA_Nodes);
            merra.ClearAll();
            merra.Set_Interp_LatLon_Dates_Offset(41.2, -83.8, thisInst.UTM_conversions.GetUTC_Offset(41.2, -83.8), thisInst);

            Get_MERRA_Coords = merra.Find_MERRA_Coords(merraFolder);
            Assert.AreEqual(4, merra.MERRA_Nodes[0].XY_ind.X_ind, "Wrong x ind 0");
            Assert.AreEqual(1, merra.MERRA_Nodes[0].XY_ind.Y_ind, "Wrong y ind 0");
            Assert.AreEqual(5, merra.MERRA_Nodes[1].XY_ind.X_ind, "Wrong x ind 1");
            Assert.AreEqual(1, merra.MERRA_Nodes[1].XY_ind.Y_ind, "Wrong y ind 1");
            Assert.AreEqual(4, merra.MERRA_Nodes[2].XY_ind.X_ind, "Wrong x ind 2");
            Assert.AreEqual(2, merra.MERRA_Nodes[2].XY_ind.Y_ind, "Wrong y ind 2");
            Assert.AreEqual(5, merra.MERRA_Nodes[3].XY_ind.X_ind, "Wrong x ind 3");
            Assert.AreEqual(2, merra.MERRA_Nodes[3].XY_ind.Y_ind, "Wrong y ind 3");

            // Test 3
            merra.numMERRA_Nodes = 16;
            Array.Resize(ref merra.MERRA_Nodes, merra.numMERRA_Nodes);
            merra.ClearAll();
            merra.Set_Interp_LatLon_Dates_Offset(40.4, -82.9, thisInst.UTM_conversions.GetUTC_Offset(40.4, -82.9), thisInst);
            Get_MERRA_Coords = merra.Find_MERRA_Coords(merraFolder);
            Assert.AreEqual(1, merra.MERRA_Nodes[0].XY_ind.X_ind, "Wrong x ind 0");
            Assert.AreEqual(2, merra.MERRA_Nodes[0].XY_ind.Y_ind, "Wrong y ind 0");
            Assert.AreEqual(2, merra.MERRA_Nodes[1].XY_ind.X_ind, "Wrong x ind 1");
            Assert.AreEqual(2, merra.MERRA_Nodes[1].XY_ind.Y_ind, "Wrong y ind 1");
            Assert.AreEqual(3, merra.MERRA_Nodes[2].XY_ind.X_ind, "Wrong x ind 2");
            Assert.AreEqual(2, merra.MERRA_Nodes[2].XY_ind.Y_ind, "Wrong y ind 2");
            Assert.AreEqual(4, merra.MERRA_Nodes[3].XY_ind.X_ind, "Wrong x ind 2");
            Assert.AreEqual(2, merra.MERRA_Nodes[3].XY_ind.Y_ind, "Wrong y ind 2");

            thisInst.Close();
        }
示例#13
0
        /// <summary>  Finds and returns array of grid points surrounding met/node for P10 exposure calculation. </summary>
        public TopoInfo.TopoGrid[] GetGridArray(double UTMX, double UTMY, Continuum thisInst) //
        {
            double minX = UTMX - gridRadius;
            double minY = UTMY - gridRadius;

            double maxX = UTMX + gridRadius;
            double maxY = UTMY + gridRadius;

            // Find closest nodes to minX and minY and maxX and maxY with a minimum distance of 10 km from edge of topography
            TopoInfo.TopoGrid closestNodeToMin = thisInst.topo.GetClosestNodeFixedGrid(minX, minY, reso, 10000);
            TopoInfo.TopoGrid closestNodeToMax = thisInst.topo.GetClosestNodeFixedGrid(maxX, maxY, reso, 10000);

            minX = closestNodeToMin.UTMX;
            minY = closestNodeToMin.UTMY;
            maxX = closestNodeToMax.UTMX;
            maxY = closestNodeToMax.UTMY;

            Check_class check = new Check_class();

            int gridCount = 0;

            TopoInfo.TopoGrid[] gridArray = new TopoInfo.TopoGrid[1];

            double dirBinSize = (double)360 / thisInst.metList.numWD;

            double[] windRose     = thisInst.metList.GetAvgWindRose(thisInst.modeledHeight, Met.TOD.All, Met.Season.All);
            bool[]   sectorsToUse = FindSectorsForGrid(windRose);

            for (double i = minX; i <= maxX; i = i + reso)
            {
                for (double j = minY; j <= maxY; j = j + reso)
                {
                    double dist     = thisInst.topo.CalcDistanceBetweenPoints(i, j, UTMX, UTMY);
                    double deltaX   = i - UTMX;
                    double deltaY   = j - UTMY;
                    int    dirInd   = thisInst.topo.CalcDirInd(deltaX, deltaY, dirBinSize);
                    int    goodToGo = check.NewNodeCheck(thisInst.topo, i, j, 10000, "Calcs");
                    //  bool gridOk = thisInst.topo.newNode(i, j, thisInst.radiiList, gridRadius);

                    if (goodToGo == 100 && ((dist < gridRadius && sectorsToUse[dirInd] == true) || dist < gridRadius / 2))
                    {
                        gridCount = gridCount + 1;
                        Array.Resize(ref gridArray, gridCount);

                        gridArray[gridCount - 1].UTMX = i;
                        gridArray[gridCount - 1].UTMY = j;
                    }
                }
            }

            return(gridArray);
        }
示例#14
0
        /// <summary> Gets nodes for upwind flow separation model. </summary>
        public void GetFlowSepNodes(NodeCollection nodeList, Continuum thisInst, double[] windRose)
        {
            int numWD = 0;

            try {
                numWD = windRose.Length;
            }
            catch {
                return;
            }

            flowSepNodes = nodeList.FindAllFlowSeps(this, thisInst, numWD);
        }
示例#15
0
        public void GetClosestWS_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter Archbold testing.cfm";

            thisInst.Open(Filename);
            Met thisMet = thisInst.metList.metItem[0];

            double thisWS = thisMet.metData.GetClosestWS(1, 13256);

            Assert.AreEqual(thisWS, 2.771643406, 0.0001, "Wrong closest wind speed Test 1");
        }
示例#16
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary> GUI form initializer. </summary>
        public GenWakeMap(Continuum continuum)
        {
            InitializeComponent();
            thisInst = continuum;

            if (thisInst.topo.useSepMod)
            {
                txt_FlowSep_Used.Text      = "Flow Sep. model used";
                txt_FlowSep_Used.BackColor = Color.LightBlue;
            }
            else
            {
                txt_FlowSep_Used.Text      = "Flow Sep. model NOT used";
                txt_FlowSep_Used.BackColor = Color.LightCoral;
            }

            if (thisInst.topo.useSR)
            {
                txtLC_Used.Text      = "Roughness model used";
                txtLC_Used.BackColor = Color.MediumSeaGreen;
            }
            else
            {
                txtLC_Used.Text      = "Roughness model NOT used";
                txtLC_Used.BackColor = Color.LightCoral;
            }

            thisInst.metList.AreAllMetsMCPd();
            if (thisInst.metList.allMCPd)
            {
                txtisMCPGenWakeMap.Text      = "MCP'd Met data used";
                txtisMCPGenWakeMap.BackColor = Color.MediumOrchid;
            }
            else
            {
                txtisMCPGenWakeMap.Text      = "Meas. Met data used";
                txtisMCPGenWakeMap.BackColor = Color.LightCoral;
            }

            chkMetsToUse.Items.Clear(); // Met list on Wake model dialog
            int metCount = thisInst.metList.ThisCount;

            if (metCount > 0)
            {
                for (int j = 0; j < metCount; j++) // Now repopulate it with met towers
                {
                    Met thisMet = thisInst.metList.metItem[j];
                    chkMetsToUse.Items.Add(thisMet.name, true);
                }
            }
        }
示例#17
0
        /// <summary> Using calculated wake profile polynomials (i.e. wakeLossCoeffs), calculates the wake losses and net energy at the referenced map node. </summary>
        public void CalcWakeLossesMap(ref MapNode thisMapNode, Continuum thisInst, Wake_Model thisWakeModel, WakeCollection.WakeLossCoeffs[] wakeLossCoeffs)
        {
            WakeCollection.WakeCalcResults wakeResults = thisInst.wakeModelList.CalcWakeLosses(wakeLossCoeffs, thisMapNode.UTMX, thisMapNode.UTMY,
                                                                                               thisMapNode.sectDist, thisMapNode.grossAEP, thisMapNode.sectorGross, thisInst, thisWakeModel, thisMapNode.windRose);

            thisMapNode.avgWS_Est = wakeResults.wakedWS;
            thisMapNode.sectDist  = wakeResults.sectorDist;
            thisMapNode.sectorWS  = wakeResults.sectorWakedWS;

            thisMapNode.netEnergyEsts.est            = wakeResults.netEnergy;
            thisMapNode.netEnergyEsts.sectorEnergy   = wakeResults.sectorNetEnergy;
            thisMapNode.netEnergyEsts.wakeLoss       = wakeResults.wakeLoss;
            thisMapNode.netEnergyEsts.sectorWakeLoss = wakeResults.sectorWakeLoss;
        }
示例#18
0
        public void GetAnemsClosestToHH_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter Archbold testing.cfm";

            thisInst.Open(Filename);
            Met thisMet = thisInst.metList.metItem[0];

            int    actInd = 0;
            double HH     = 30;

            for (int i = 0; i < thisMet.metData.GetNumAnems(); i++)
            {
                if (thisMet.metData.anems[i].height == 30 && thisMet.metData.anems[i].ID == 'B')
                {
                    actInd = i;
                }
            }

            int[] thisInd = thisMet.metData.GetAnemsClosestToHH(HH);
            Assert.AreEqual(thisInd[1], actInd, 0, "Wrong anem index");

            HH = 55;
            for (int i = 0; i < thisMet.metData.GetNumAnems(); i++)
            {
                if (thisMet.metData.anems[i].height == 50 && thisMet.metData.anems[i].ID == 'B')
                {
                    actInd = i;
                }
            }

            thisInd = thisMet.metData.GetAnemsClosestToHH(HH);
            Assert.AreEqual(thisInd[1], actInd, 0, "Wrong anem index");

            HH = 42;
            for (int i = 0; i < thisMet.metData.GetNumAnems(); i++)
            {
                if (thisMet.metData.anems[i].height == 40 && thisMet.metData.anems[i].ID == 'B')
                {
                    actInd = i;
                }
            }

            thisInd = thisMet.metData.GetAnemsClosestToHH(HH);
            Assert.AreEqual(thisInd[1], actInd, 0, "Wrong anem index");

            thisInst.Close();
        }
示例#19
0
        public void ConvertToMPS_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter New Bremen testing.cfm";

            thisInst.Open(Filename);

            Met_Data_Filter thisQC = thisInst.metList.metItem[0].metData;

            Assert.AreEqual(thisQC.anems[0].windData[20].avg, 1.56459544, 0.001, "Wind speed not converted to m/s correctly");
            Assert.AreEqual(thisQC.anems[0].windData[20].SD, 0.447027269, 0.001, "Wind speed not converted to m/s correctly");
            Assert.AreEqual(thisQC.anems[0].windData[20].max, 2.637460885, 0.001, "Wind speed not converted to m/s correctly");
            Assert.AreEqual(thisQC.anems[0].windData[20].min, 0.357621815, 0.001, "Wind speed not converted to m/s correctly");
        }
        public void CalcProbabilityOfHits()
        {
            Continuum thisInst = new Continuum("");

            string fileName = testingFolder + "\\Ice Throw\\Ice Throw testing.cfm";

            thisInst.Open(fileName);

            UTM_conversion.UTM_coords theseUTM = new UTM_conversion.UTM_coords();
            theseUTM.UTMZoneNumber = thisInst.UTM_conversions.UTMZoneNumber;
            theseUTM.hemisphere    = "Northern";
            theseUTM.UTMEasting    = 277870;
            theseUTM.UTMNorthing   = 4553300;
            UTM_conversion.Lat_Long theseLL = thisInst.UTM_conversions.UTMtoLL(theseUTM.UTMEasting, theseUTM.UTMNorthing);

            SiteSuitability.Zone zone = new SiteSuitability.Zone();
            zone.latitude  = theseLL.latitude;
            zone.longitude = theseLL.longitude;
            zone.xSize     = 20;
            zone.ySize     = 20;

            // Test 1: Probability of at least one ice hit in a year
            double probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 0, thisInst);

            Assert.AreEqual(probHits, 1.0, 0.001, "Wrong Ice hit probability Test 1");

            // Test 2: Prob of 1 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 1, thisInst);
            Assert.AreEqual(probHits, 0.3, 0.001, "Wrong Ice hit probability Test 2");

            // Test 3: Prob of 2 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 2, thisInst);
            Assert.AreEqual(probHits, 0.05, 0.001, "Wrong Ice hit probability Test 3");

            // Test 4: Prob of 3 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 3, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 4");

            // Test 5: Prob of 4 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 4, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 5");

            // Test 6: Prob of more than 4 hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 5, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 6");

            thisInst.Close();
        }
示例#21
0
        public void Method_Of_Bins_Test()
        {
            // Test Method of Bins method
            // Loop through WD, TOD, Season, and WS width (0.5 and 1.0 m/s)
            Continuum thisInst = new Continuum("");
            string    fileName = "C:\\Users\\liz_w\\Desktop\\Continuum 3 GUI Testing\\SaveFolder\\OneMetTSNotFiltWithMERRAAndMCP_1";

            thisInst.Open(fileName + ".cfm");
            thisInst.isTest = true;
            thisInst.cboMCP_Type.SelectedIndex = 1;

            Met thisMet = thisInst.GetSelectedMet("MCP");

            Met.WSWD_Dist thisEst = new Met.WSWD_Dist();
            Met.WSWD_Dist lastEst = new Met.WSWD_Dist();

            for (int WD_ind = 0; WD_ind <= 4; WD_ind++)
            {
                for (int TOD_ind = 0; TOD_ind <= 1; TOD_ind++)
                {
                    for (int seasonInd = 0; seasonInd <= 1; seasonInd++)
                    {
                        for (int WS_width_ind = 0; WS_width_ind <= 1; WS_width_ind++)
                        {
                            if (WS_width_ind == 0)
                            {
                                thisInst.txtWS_bin_width.Text = "0.5";
                            }
                            else
                            {
                                thisInst.txtWS_bin_width.Text = "1.0";
                            }

                            thisInst.cboMCPNumHours.SelectedIndex   = TOD_ind;
                            thisInst.cboMCPNumSeasons.SelectedIndex = seasonInd;
                            thisInst.cboMCPNumWD.SelectedIndex      = WD_ind;
                            thisInst.DoMCP();
                            thisEst = thisMet.GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All);

                            Assert.AreNotEqual(thisEst.WS, lastEst.WS, "LT Estimate did not change with setting change");
                            lastEst = thisEst;
                        }
                    }
                }
            }

            thisInst.Close();
        }
        /// <summary> Prompts user for new MERRA2 data file folder. </summary>
        public void ChangeMERRA2Folder(Continuum thisInst)
        {
            MessageBox.Show("Please select folder containing MERRA2 .ascii data files.");
            if (thisInst.fbd_MERRAData.ShowDialog() == DialogResult.OK)
            {
                MERRAfolder = thisInst.fbd_MERRAData.SelectedPath;
            }
            else
            {
                return;
            }

            thisInst.txt_MERRA2_folder.Text = MERRAfolder.ToString();

            SetMERRA2LatLong(thisInst);
        }
示例#23
0
        /// <summary> Gets the flow separation nodes for map node (if flow separation model is used). </summary>
        public void GetFlowSepNodes(ref MapNode thisMapNode, Continuum thisInst)
        {
            int numWD = 0;

            try {
                numWD = thisMapNode.windRose.Length;
            }
            catch {
                return;
            }

            NodeCollection nodeList = new NodeCollection();
            Nodes          thisNode = nodeList.GetMapAsNode(thisMapNode);

            thisMapNode.flowSepNodes = nodeList.FindAllFlowSeps(thisNode, thisInst, numWD);
        }
示例#24
0
        public void CalcNetEnergyTimeSeries_Test()
        {
            Continuum thisInst = new Continuum("");
            string    fileName = testingFolder + "\\WakeCollection TS testing.cfm";

            thisInst.Open(fileName);

            Turbine        thisTurb   = thisInst.turbineList.turbineEsts[0];
            NodeCollection nodeList   = new NodeCollection();
            Nodes          targetNode = nodeList.GetTurbNode(thisTurb);
            string         MCP_Method = thisInst.Get_MCP_Method();

            TurbineCollection.PowerCurve powerCurve = thisInst.turbineList.powerCurves[0];;
            Wake_Model wakeModel = thisInst.wakeModelList.wakeModels[0];

            // Find wake loss coeffs
            WakeCollection.WakeLossCoeffs[] wakeCoeffs = null;
            int minDistance = 10000000;
            int maxDistance = 0;

            for (int i = 0; i < thisInst.turbineList.TurbineCount; i++)
            {
                int[] Min_Max_Dist = thisInst.turbineList.CalcMinMaxDistanceToTurbines(thisInst.turbineList.turbineEsts[i].UTMX, thisInst.turbineList.turbineEsts[i].UTMY);
                if (Min_Max_Dist[0] < minDistance)
                {
                    minDistance = Min_Max_Dist[0];                                // this is min distance to turbine but when WD is at a different angle (not in line with turbines) the X dist is less than this value so making this always equal to 2*RD
                }
                if (Min_Max_Dist[1] > maxDistance)
                {
                    maxDistance = Min_Max_Dist[1];
                }
            }

            minDistance = (int)(2 * wakeModel.powerCurve.RD);
            if (maxDistance == 0)
            {
                maxDistance = 15000;                   // maxDistance will be zero when there is only one turbine. Might be good to make this value constant
            }
            wakeCoeffs = thisInst.wakeModelList.GetWakeLossesCoeffs(minDistance, maxDistance, wakeModel, thisInst.metList);

            Turbine wakedTurb = thisInst.turbineList.turbineEsts[2];

            double[] netEsts = thisInst.wakeModelList.CalcNetEnergyTimeSeries(wakeCoeffs, wakedTurb.UTMX, wakedTurb.UTMY, 6, thisInst, wakeModel, 270, 3000, 1);
            Assert.AreEqual(netEsts[0], 4.75284, 0.001, "Wrong waked WS Test 1");

            thisInst.Close();
        }
示例#25
0
        public void ReadGeoTiffTopo_Test()
        {
            Continuum thisInst = new Continuum("");

            thisInst.savedParams.savedFileName = testingFolder + "\\Testing GeoTiff load.cfm";
            thisInst.SaveFile(true);
            thisInst.UTM_conversions.savedDatumIndex = 0;
            thisInst.UTM_conversions.UTMZoneNumber   = 17;
            thisInst.UTM_conversions.hemisphere      = "Northern";

            string Filename = testingFolder + "\\NED_15051924\\NED_15051924.tif";

            thisInst.topo.ReadGeoTiffTopo(Filename, thisInst);
            thisInst.topo.topoNumXY.X.calcs = thisInst.topo.topoNumXY.X.all;
            thisInst.topo.topoNumXY.Y.calcs = thisInst.topo.topoNumXY.Y.all;
            thisInst.topo.elevsForCalcs     = thisInst.topo.topoElevs;

            // Test 1
            double UTMX = 268339.8f;
            double UTMY = 4564816.2f;
            double elev = thisInst.topo.CalcElevs(UTMX, UTMY);

            Assert.AreEqual(214.557, elev, 0.25, "Wrong elevation Test 1");

            // Test 2
            UTMX = 291638.58f;
            UTMY = 4555225.2f;
            elev = thisInst.topo.CalcElevs(UTMX, UTMY);

            Assert.AreEqual(242.645, elev, 0.25, "Wrong elevation Test 2");

            // Test 3
            UTMX = 268193.992f;
            UTMY = 4550969.3f;
            elev = thisInst.topo.CalcElevs(UTMX, UTMY);

            Assert.AreEqual(245.988, elev, 0.25, "Wrong elevation Test 3");

            // Test 4
            UTMX = 285429.3f;
            UTMY = 4562086f;
            elev = thisInst.topo.CalcElevs(UTMX, UTMY);

            Assert.AreEqual(225.246, elev, 0.25, "Wrong elevation Test 4");

            thisInst.Close();
        }
示例#26
0
        public void ExportTopoData()
        {
            // Exports topography data to .csv for testing
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\TopoInfo testing.cfm";

            thisInst.Open(Filename);

            // Creates Topo_export.csv. Excel macro queries it for elevations specified below. Only needs to be run once.

            Export export = new Export();

            export.ExportTopo(thisInst, testingFolder);

            thisInst.Close();
        }
示例#27
0
        public void CalcSectorWS_Ratios_Test()
        {
            Continuum thisInst = new Continuum("");

            thisInst.UTM_conversions.savedDatumIndex = 0;
            thisInst.UTM_conversions.hemisphere      = "Northern";
            thisInst.ofdMets.FileName = testingFolder + "\\Archbold.TAB";
            thisInst.ImportMetsTAB();
            Met thisMet = thisInst.metList.metItem[0];

            thisMet.CalcSectorWS_Ratios(thisInst);

            Assert.AreEqual(thisMet.WSWD_Dists[0].sectorWS_Ratio[0], 0.868457, 0.001, "Wrong Sector WS index 0");
            Assert.AreEqual(thisMet.WSWD_Dists[0].sectorWS_Ratio[4], 0.880843, 0.001, "Wrong Sector WS index 4");
            Assert.AreEqual(thisMet.WSWD_Dists[0].sectorWS_Ratio[9], 1.027484, 0.001, "Wrong Sector WS index 9");
            Assert.AreEqual(thisMet.WSWD_Dists[0].sectorWS_Ratio[15], 0.962568, 0.001, "Wrong Sector WS index 15");
        }
示例#28
0
        public void ExportLandCoverData()
        {
            // Exports land cover data to .csv for testing
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\TopoInfo testing.cfm";

            thisInst.Open(Filename);

            // Creates LC_export.csv. Excel macro queries it for land covers specified below. Only needs to be run once.

            Export export = new Export();

            export.ExportLC(thisInst, testingFolder);

            thisInst.Close();
        }
示例#29
0
        public void Calc_Percent_Vane_Filtered_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MetDataFilter Archbold testing.cfm";

            thisInst.Open(Filename);

            Met thisMet = thisInst.metList.metItem[0];

            Met_Data_Filter.Vane_Data This_Vane = new Met_Data_Filter.Vane_Data();

            for (int i = 0; i < thisMet.metData.GetNumVanes(); i++)
            {
                if (thisMet.metData.vanes[i].height == 41)
                {
                    This_Vane = thisMet.metData.vanes[i];
                }
            }

            double thisPercFilt = thisMet.metData.CalcPercentVaneFiltered(This_Vane, Met_Data_Filter.Filter_Flags.Icing);

            Assert.AreEqual(thisPercFilt, 0.027302, 0.00001, "Wrong Icing Filt at 41m Test 1");

            for (int i = 0; i < thisMet.metData.GetNumVanes(); i++)
            {
                if (thisMet.metData.vanes[i].height == 49)
                {
                    This_Vane = thisMet.metData.vanes[i];
                }
            }

            thisPercFilt = thisMet.metData.CalcPercentVaneFiltered(This_Vane, Met_Data_Filter.Filter_Flags.Icing);
            Assert.AreEqual(thisPercFilt, 0.024543, 0.00001, "Wrong Icing Filt at 49m Test 2");

            thisMet.metData.startDate = Convert.ToDateTime("1/27/2009");
            thisMet.metData.endDate   = Convert.ToDateTime("4/3/2009");

            thisPercFilt = thisMet.metData.CalcPercentVaneFiltered(thisMet.metData.vanes[0], Met_Data_Filter.Filter_Flags.Icing);
            Assert.AreEqual(thisPercFilt, 0.016729798, 0.00001, "Wrong Icing Filt at 41m");

            thisPercFilt = thisMet.metData.CalcPercentVaneFiltered(thisMet.metData.vanes[1], Met_Data_Filter.Filter_Flags.Icing);
            Assert.AreEqual(thisPercFilt, 0.018097643, 0.00001, "Wrong Icing Filt at 49m");

            thisInst.Close();
        }
示例#30
0
        public void Calc_Avg_or_LT_Test()
        {
            Continuum thisInst = new Continuum("");

            string Filename = testingFolder + "\\MERRA_Testing.cfm";

            thisInst.Open(Filename);

            Met thisMet = thisInst.metList.metItem[0];

            UTM_conversion.Lat_Long theseLL = thisInst.UTM_conversions.UTMtoLL(thisInst.metList.metItem[0].UTMX, thisInst.metList.metItem[0].UTMY);
            MERRA merra = thisInst.merraList.GetMERRA(theseLL.latitude, theseLL.longitude);

            if (merra.interpData.TS_Data.Length == 0)
            {
                merra.GetMERRADataFromDB(thisInst);
                merra.GetInterpData(thisInst.UTM_conversions);
            }

            // Test 1
            double thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 100, 100, "50 m WS");

            Assert.AreEqual(6.670311915, thisAvg, 0.001, "Wrong 50m WS all data");

            // Test 2
            thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 100, 100, "Surface Pressure");
            Assert.AreEqual(98.72393837, thisAvg, 0.001, "Wrong Pressure");

            // Test 3
            thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 100, 100, "10 m Temp"); // all data
            Assert.AreEqual(10.33596373, thisAvg, 0.001, "Wrong 10m Temp");

            // Test 4
            thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 1, 2008, "50 m WS"); // jan 2008
            Assert.AreEqual(8.938906452, thisAvg, 0.001, "Wrong 50m WS");

            // Test 5
            thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 100, 2010, "50 m WS"); // avg 2010
            Assert.AreEqual(6.421752226, thisAvg, 0.001, "Wrong 50 m WS");

            // Test 6
            thisAvg = merra.Calc_Avg_or_LT(merra.interpData.TS_Data, 1, 100, "50 m WS"); // avg all january's
            Assert.AreEqual(7.639244713, thisAvg, 0.001, "Wrong 50m WS");

            thisInst.Close();
        }
        public void CalcWS_DistForTurbOrMap_Test()
        {
            Continuum thisInst = new Continuum("");


            string Filename = testingFolder + "\\RDM test.cfm";

            thisInst.Open(Filename);

            double[] thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 7.5f, 24, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[0], 0.024216, 0.001, "Wrong WS distribution in Test 1");
            Assert.AreEqual(thisDist[9], 0.093039, 0.001, "Wrong WS distribution in Test 1");

            thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 7.0f, 24, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[0], 0.029410, 0.001, "Wrong WS distribution in Test 2");
            Assert.AreEqual(thisDist[6], 0.125111, 0.001, "Wrong WS distribution in Test 2");
            Assert.AreEqual(thisDist[10], 0.069316, 0.001, "Wrong WS distribution in Test 2");

            thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 9.4f, 24, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[3], 0.036817, 0.001, "Wrong WS distribution in Test 3");
            Assert.AreEqual(thisDist[8], 0.068238, 0.001, "Wrong WS distribution in Test 3");
            Assert.AreEqual(thisDist[12], 0.071463, 0.001, "Wrong WS distribution in Test 3");

            thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 5f, 3, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[2], 0.09668, 0.001, "Wrong WS distribution in Test 4");
            Assert.AreEqual(thisDist[4], 0.158107, 0.001, "Wrong WS distribution in Test 4");
            Assert.AreEqual(thisDist[14], 0.0065201, 0.001, "Wrong WS distribution in Test 4");

            thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 4.2f, 3, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[1], 0.0682394, 0.001, "Wrong WS distribution in Test 5");
            Assert.AreEqual(thisDist[6], 0.1050160, 0.001, "Wrong WS distribution in Test 5");
            Assert.AreEqual(thisDist[12], 0.0036309, 0.001, "Wrong WS distribution in Test 5");

            thisDist = thisInst.metList.CalcWS_DistForTurbOrMap(thisInst.metList.GetMetsUsed(), 5.3f, 3, Met.TOD.All, Met.Season.All, thisInst.modeledHeight);

            Assert.AreEqual(thisDist[0], 0.0430541, 0.001, "Wrong WS distribution in Test 6");
            Assert.AreEqual(thisDist[4], 0.135551, 0.001, "Wrong WS distribution in Test 6");
            Assert.AreEqual(thisDist[10], 0.0240220, 0.001, "Wrong WS distribution in Test 6");

            thisInst.Close();
        }