public void CalcAvgWS_Test() { Continuum thisInst = new Continuum(""); string Filename = testingFolder + "\\Met testing RDM.cfm"; thisInst.Open(Filename); thisInst.metList.metItem[0].CalcAvgWS(thisInst); thisInst.metList.metItem[1].CalcAvgWS(thisInst); thisInst.metList.metItem[2].CalcAvgWS(thisInst); thisInst.metList.metItem[3].CalcAvgWS(thisInst); Met.WSWD_Dist thisDist = thisInst.metList.metItem[0].GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All); Assert.AreEqual(thisDist.WS, 7.478587, 0.001, "Wrong WS at Met 10"); thisDist = thisInst.metList.metItem[1].GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All); Assert.AreEqual(thisDist.WS, 8.07606, 0.001, "Wrong WS at Met 15"); thisDist = thisInst.metList.metItem[2].GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All); Assert.AreEqual(thisDist.WS, 8.28380, 0.001, "Wrong WS at Met 16"); thisDist = thisInst.metList.metItem[3].GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All); Assert.AreEqual(thisDist.WS, 7.140587, 0.001, "Wrong WS at Met 17"); thisInst.Close(); }
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(); }
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(); }
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(); }
public void ExportWSDist() { Continuum thisInst = new Continuum(""); string Filename = testingFolder + "\\Bobcat Bluff TurbineCollection testing.cfm"; thisInst.Open(Filename); string distFile = testingFolder + "\\CalcAndReturnGrossAEP\\Met 2001 WS Dist.csv"; StreamWriter sw = new StreamWriter(distFile); Met.WSWD_Dist thisDist = thisInst.metList.metItem[0].GetWS_WD_Dist(thisInst.modeledHeight, Met.TOD.All, Met.Season.All); for (int i = 0; i < thisDist.WS_Dist.Length; i++) { sw.WriteLine(Math.Round(thisDist.WS_Dist[i], 4)); } sw.Close(); thisInst.Close(); }
public void AddMetTAB_Test() { string WR_file = testingFolder + "\\AddMet_TAB\\Wind_Rose.txt"; StreamReader 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 + "\\AddMet_TAB\\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 ThisNewInst = new Continuum(""); ThisNewInst.metList.AddMetTAB("Test_Add", 10000, 100000, 80, windRose, sectorWS, 0.5f, 1, ThisNewInst); Assert.AreEqual(ThisNewInst.metList.ThisCount, 1, 0, "Wrong met count"); Met.WSWD_Dist thisDist = ThisNewInst.metList.metItem[0].GetWS_WD_Dist(ThisNewInst.modeledHeight, Met.TOD.All, Met.Season.All); Assert.AreNotSame(thisDist.sectorWS_Dist, null, "Didn't read in sectorwise WS distribution"); Assert.AreNotSame(thisDist.windRose, null, "Didn't read in wind rose"); Assert.AreNotSame(thisDist.sectorWS_Ratio, null, "Didn't calculate directional WS ratios"); Assert.AreNotEqual(thisDist.height, 0, 0, "Didn't read in height"); ThisNewInst.Close(); }
public void Variance_Ratio_Test() { // Test Variance Ratio method 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 = 2; 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++) { 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(); }
public void CalcLT_WSWD_Dists_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Met testing.cfm"; thisInst.Open(fileName); Met thisMet = thisInst.metList.metItem[0]; thisInst.metList.numWD = 16; thisInst.metList.numTOD = 1; thisInst.metList.numSeason = 1; thisInst.ResetTimeSeries(); string MCP_Method = "Orth. Regression"; UTM_conversion.Lat_Long theseLL = thisInst.UTM_conversions.UTMtoLL(thisMet.UTMX, thisMet.UTMY); int offset = thisInst.UTM_conversions.GetUTC_Offset(theseLL.latitude, theseLL.longitude); MERRA thisMERRA = thisInst.merraList.GetMERRA(theseLL.latitude, theseLL.longitude); thisInst.metList.RunMCP(ref thisMet, thisMERRA, thisInst, MCP_Method); thisInst.metList.isMCPd = true; // Test 1 Met.WSWD_Dist thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.All, Met.Season.All, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 6.566949, 0.01, "Wrong overall WS Test 1"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 4.993328, 0.01, "Wrong WS in WD 0 Test 1"); Assert.AreEqual(thisDist.sectorWS_Ratio[4] * thisDist.WS, 5.192708, 0.01, "Wrong WS in WD 4 Test 1"); Assert.AreEqual(thisDist.sectorWS_Ratio[13] * thisDist.WS, 6.9277, 0.01, "Wrong WS in WD 13 Test 1"); Assert.AreEqual(thisDist.sectorWS_Ratio[15] * thisDist.WS, 5.627835, 0.01, "Wrong WS in WD 15 Test 1"); // Test 2 - 3 thisInst.ResetTimeSeries(); thisInst.metList.numTOD = 2; thisInst.metList.RunMCP(ref thisMet, thisMERRA, thisInst, MCP_Method); thisInst.metList.isMCPd = true; thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.Day, Met.Season.All, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 6.296237, 0.01, "Wrong overall WS Test 2"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 4.80529, 0.01, "Wrong WS in WD 0 Test 2"); Assert.AreEqual(thisDist.sectorWS_Ratio[2] * thisDist.WS, 5.194316, 0.01, "Wrong WS in WD 2 Test 2"); Assert.AreEqual(thisDist.sectorWS_Ratio[8] * thisDist.WS, 6.918986, 0.01, "Wrong WS in WD 8 Test 2"); Assert.AreEqual(thisDist.sectorWS_Ratio[15] * thisDist.WS, 5.327543, 0.01, "Wrong WS in WD 15 Test 2"); thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.Night, Met.Season.All, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 6.83764, 0.01, "Wrong overall WS Test 3"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 5.182166, 0.01, "Wrong WS in WD 0 Test 3"); Assert.AreEqual(thisDist.sectorWS_Ratio[5] * thisDist.WS, 5.764806, 0.01, "Wrong WS in WD 2 Test 3"); Assert.AreEqual(thisDist.sectorWS_Ratio[12] * thisDist.WS, 7.685679, 0.01, "Wrong WS in WD 8 Test 3"); Assert.AreEqual(thisDist.sectorWS_Ratio[15] * thisDist.WS, 5.916732, 0.01, "Wrong WS in WD 15 Test 3"); // Test 4 - 7 thisInst.ResetTimeSeries(); thisInst.metList.numTOD = 1; thisInst.metList.numSeason = 4; thisInst.metList.RunMCP(ref thisMet, thisMERRA, thisInst, MCP_Method); thisInst.metList.isMCPd = true; thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.All, Met.Season.Winter, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 7.413855, 0.01, "Wrong overall WS Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 5.1053, 0.01, "Wrong WS in WD 0 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[4] * thisDist.WS, 5.0283, 0.01, "Wrong WS in WD 4 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[8] * thisDist.WS, 8.429297, 0.01, "Wrong WS in WD 8 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[15] * thisDist.WS, 6.318312, 0.01, "Wrong WS in WD 15 Test 4"); thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.All, Met.Season.Spring, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 7.015339, 0.01, "Wrong overall WS Test 5"); Assert.AreEqual(thisDist.sectorWS_Ratio[2] * thisDist.WS, 6.313987, 0.01, "Wrong WS in WD 2 Test 5"); Assert.AreEqual(thisDist.sectorWS_Ratio[6] * thisDist.WS, 6.10201, 0.01, "Wrong WS in WD 6 Test 5"); Assert.AreEqual(thisDist.sectorWS_Ratio[12] * thisDist.WS, 8.21204, 0.01, "Wrong WS in WD 12 Test 5"); thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.All, Met.Season.Summer, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 5.344627, 0.01, "Wrong overall WS Test 6"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 4.7078, 0.01, "Wrong WS in WD 2 Test 6"); Assert.AreEqual(thisDist.sectorWS_Ratio[4] * thisDist.WS, 4.88008, 0.01, "Wrong WS in WD 6 Test 6"); Assert.AreEqual(thisDist.sectorWS_Ratio[14] * thisDist.WS, 4.95684, 0.01, "Wrong WS in WD 12 Test 6"); thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.All, Met.Season.Fall, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 6.50441, 0.01, "Wrong overall WS Test 7"); Assert.AreEqual(thisDist.sectorWS_Ratio[1] * thisDist.WS, 4.96994, 0.01, "Wrong WS in WD 1 Test 7"); Assert.AreEqual(thisDist.sectorWS_Ratio[3] * thisDist.WS, 5.28866, 0.01, "Wrong WS in WD 3 Test 7"); Assert.AreEqual(thisDist.sectorWS_Ratio[9] * thisDist.WS, 8.097313, 0.01, "Wrong WS in WD 9 Test 7"); // Test 9 thisInst.ResetTimeSeries(); thisInst.metList.numTOD = 2; thisInst.metList.numSeason = 4; thisInst.metList.numWD = 24; thisInst.metList.RunMCP(ref thisMet, thisMERRA, thisInst, MCP_Method); thisInst.metList.isMCPd = true; thisDist = thisMet.CalcLT_WSWD_Dists(80, Met.TOD.Night, Met.Season.Summer, thisInst, thisMet.mcp.LT_WS_Ests); Assert.AreEqual(thisDist.WS, 5.76306, 0.01, "Wrong overall WS Test 9"); Assert.AreEqual(thisDist.sectorWS_Ratio[0] * thisDist.WS, 4.90395, 0.01, "Wrong WS in WD 0 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[11] * thisDist.WS, 5.706386, 0.01, "Wrong WS in WD 4 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[20] * thisDist.WS, 5.528143, 0.01, "Wrong WS in WD 8 Test 4"); Assert.AreEqual(thisDist.sectorWS_Ratio[23] * thisDist.WS, 5.174853, 0.01, "Wrong WS in WD 15 Test 4"); thisInst.Close(); }
/// <summary> Conducts wind speed estimate from Met 1 to Met 2 and vice-versa and calculates WS cross-prediction struct (WS_CrossPreds[,]) </summary> public void DoMetCrossPred(int crossPredInd, int radiusIndex, Continuum thisInst) { int numWD = thisInst.metList.numWD; int numNodes = 0; NodeCollection nodeList = new NodeCollection(); if (WS_Pred[crossPredInd, radiusIndex].nodePath == null) { numNodes = 0; } else { numNodes = WS_Pred[crossPredInd, radiusIndex].nodePath.Length; } if (numNodes > 0) { WS_Pred[crossPredInd, radiusIndex].nodeWS_Ests1to2 = new double[numNodes]; WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests1to2 = new double[numNodes, numWD]; WS_Pred[crossPredInd, radiusIndex].nodeWS_Ests2to1 = new double[numNodes]; WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests2to1 = new double[numNodes, numWD]; } Nodes[] pathOfNodes; Model thisModel = WS_Pred[crossPredInd, radiusIndex].model; // Get WS distributions at each site (used to calculate the cross-prediction percent error) Met.WSWD_Dist met1Dist = met1.GetWS_WD_Dist(thisInst.modeledHeight, thisModel.timeOfDay, thisModel.season); Met.WSWD_Dist met2Dist = met2.GetWS_WD_Dist(thisInst.modeledHeight, thisModel.timeOfDay, thisModel.season); // Conduct cross-prediction from Met 1 to Met 2 Nodes endNode = nodeList.GetMetNode(met2); ModelCollection.WS_Est_Struct WS_EstStr = thisInst.modelList.DoWS_Estimate(met1, endNode, WS_Pred[crossPredInd, radiusIndex].nodePath, thisModel, thisInst); // Get sectorwise wind speed and calculate sectorwise percent error (for Met 1 predicting Met 2) for (int WD_Ind = 0; WD_Ind < numWD; WD_Ind++) { WS_Pred[crossPredInd, radiusIndex].sectorWS_Ests[0, WD_Ind] = WS_EstStr.sectorWS[WD_Ind]; double met2WS = met2Dist.WS * met2Dist.sectorWS_Ratio[WD_Ind]; WS_Pred[crossPredInd, radiusIndex].percErrSector[0, WD_Ind] = (WS_EstStr.sectorWS[WD_Ind] - met2WS) / met2WS; } WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests1to2 = WS_EstStr.sectorWS_AtNodes; double avgWS = 0; double WR_count = 0; // Get overall wind speed at nodes (for Met 1 predicting Met 2) for (int nodeInd = 0; nodeInd < numNodes; nodeInd++) { avgWS = 0; WR_count = 0; Nodes thisNode = WS_Pred[crossPredInd, radiusIndex].nodePath[nodeInd]; double[] nodeWindRose = thisInst.metList.GetInterpolatedWindRose(thisModel.metsUsed, thisNode.UTMX, thisNode.UTMY, thisModel.timeOfDay, thisModel.season, thisInst.modeledHeight); for (int WD_Ind = 0; WD_Ind < numWD; WD_Ind++) { avgWS = avgWS + nodeWindRose[WD_Ind] * WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests1to2[nodeInd, WD_Ind]; WR_count = WR_count + nodeWindRose[WD_Ind]; } WS_Pred[crossPredInd, radiusIndex].nodeWS_Ests1to2[nodeInd] = avgWS / WR_count; } avgWS = 0; WR_count = 0; for (int WD = 0; WD < numWD; WD++) { avgWS = avgWS + WS_Pred[crossPredInd, radiusIndex].sectorWS_Ests[0, WD] * met2Dist.windRose[WD]; WR_count = WR_count + met2Dist.windRose[WD]; } // Calculate avg WS estimate and overall error at Met 2 avgWS = avgWS / WR_count; WS_Pred[crossPredInd, radiusIndex].WS_Ests[0] = avgWS; WS_Pred[crossPredInd, radiusIndex].percErr[0] = (avgWS - met2Dist.WS) / met2Dist.WS; // Now conduct same calculations but going from Met 2 to Met 1. endNode = nodeList.GetMetNode(met1); if (numNodes > 0) { pathOfNodes = new Nodes[numNodes]; } else { pathOfNodes = null; } // Reverse order of nodes when going from Met 2 to Met 1 for (int i = 0; i < numNodes; i++) { pathOfNodes[i] = WS_Pred[crossPredInd, radiusIndex].nodePath[numNodes - 1 - i]; } // Do WS Estimate for Met 2 predicting Met 1 WS_EstStr = thisInst.modelList.DoWS_Estimate(met2, endNode, pathOfNodes, thisModel, thisInst); // Get sectorwise wind speed and sectorwise percent error (for Met 2 predicting Met 1) for (int WD_Ind = 0; WD_Ind < numWD; WD_Ind++) { WS_Pred[crossPredInd, radiusIndex].sectorWS_Ests[1, WD_Ind] = WS_EstStr.sectorWS[WD_Ind]; WS_Pred[crossPredInd, radiusIndex].percErrSector[1, WD_Ind] = (WS_EstStr.sectorWS[WD_Ind] - met1Dist.WS * met1Dist.sectorWS_Ratio[WD_Ind]) / (met1Dist.WS * met1Dist.sectorWS_Ratio[WD_Ind]); } WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests2to1 = WS_EstStr.sectorWS_AtNodes; avgWS = 0; WR_count = 0; // Get overall wind speed at nodes (for Met 2 predicting Met 1) for (int nodeInd = 0; nodeInd < numNodes; nodeInd++) { avgWS = 0; WR_count = 0; Nodes thisNode = pathOfNodes[nodeInd]; double[] nodeWindRose = thisInst.metList.GetInterpolatedWindRose(thisModel.metsUsed, thisNode.UTMX, thisNode.UTMY, thisModel.timeOfDay, thisModel.season, thisInst.modeledHeight); for (int WD_Ind = 0; WD_Ind < numWD; WD_Ind++) { avgWS = avgWS + nodeWindRose[WD_Ind] * WS_Pred[crossPredInd, radiusIndex].nodeSectorWS_Ests2to1[nodeInd, WD_Ind]; WR_count = WR_count + nodeWindRose[WD_Ind]; } WS_Pred[crossPredInd, radiusIndex].nodeWS_Ests2to1[nodeInd] = avgWS / WR_count; } avgWS = 0; WR_count = 0; for (int WD = 0; WD < numWD; WD++) { avgWS = avgWS + WS_Pred[crossPredInd, radiusIndex].sectorWS_Ests[1, WD] * met1Dist.windRose[WD]; WR_count = WR_count + met1Dist.windRose[WD]; } // Calculate avg WS estimate and overall error at Met 1 avgWS = avgWS / WR_count; WS_Pred[crossPredInd, radiusIndex].WS_Ests[1] = avgWS; WS_Pred[crossPredInd, radiusIndex].percErr[1] = (avgWS - met1Dist.WS) / met1Dist.WS; }