/// <summary> Calculates wind speed from predictor met to Map node along path of nodes. </summary> public void DoWS_EstAlongNodes(Continuum thisInst, ref MapNode thisMapNode, int WS_Est_Ind) { InvestCollection radiiList = thisInst.radiiList; ModelCollection modelList = thisInst.modelList; NodeCollection nodeList = new NodeCollection(); Met thisMet = thisInst.metList.GetMet(thisMapNode.WS_Estimates[WS_Est_Ind].predictorMetName); int thisRadius = thisMapNode.WS_Estimates[WS_Est_Ind].radius; if (thisMet == null) { return; } int numWD = thisInst.metList.numWD; int radiusIndex = 0; for (int i = 0; i < radiiList.ThisCount; i++) { if (thisRadius == radiiList.investItem[i].radius) { radiusIndex = i; break; } } Model[] models = modelList.GetModels(thisInst, thisInst.metList.GetMetsUsed(), Met.TOD.All, Met.Season.All, thisInst.modeledHeight, false); Model thisModel = models[radiusIndex]; Nodes endNode = nodeList.GetMapAsNode(thisMapNode); ModelCollection.WS_Est_Struct WS_EstStr = modelList.DoWS_Estimate(thisMet, endNode, thisMapNode.WS_Estimates[WS_Est_Ind].pathOfNodes, thisModel, thisInst); thisMapNode.WS_Estimates[WS_Est_Ind].sectorWS = WS_EstStr.sectorWS; // Have sectorwise wind speed at map node now need to calculate avg WS using wind rose for (int WD = 0; WD < numWD; WD++) { thisMapNode.WS_Estimates[WS_Est_Ind].WS = thisMapNode.WS_Estimates[WS_Est_Ind].WS + thisMapNode.WS_Estimates[WS_Est_Ind].sectorWS[WD] * thisMapNode.windRose[WD]; } }
/// <summary> Combines all wind speed estimates formed by each predictor met and each wind flow model to form average wind speed estimate at map node. </summary> public void GenerateAvgWS_AtOneMapNode(ref MapNode thisMapNode, Continuum thisInst) { double avgWS = 0; double avgWeight = 0; MetCollection metList = thisInst.metList; ModelCollection modelList = thisInst.modelList; InvestCollection radiiList = thisInst.radiiList; int numRadii = thisInst.radiiList.ThisCount; int numWD = thisInst.metList.numWD; thisMapNode.sectorWS = new double[numWD]; double[] sectorWS = new double[numWD]; int numMetsUsed = metsUsed.Length; Met[] predMets = new Met[numMetsUsed]; for (int i = 0; i < numMetsUsed; i++) { for (int j = 0; j < metList.ThisCount; j++) { if (metsUsed[i] == metList.metItem[j].name) { predMets[i] = metList.metItem[j]; break; } } } Model[] models = modelList.GetModels(thisInst, metList.GetMetsUsed(), Met.TOD.All, Met.Season.All, thisInst.modeledHeight, false); NodeCollection nodeList = new NodeCollection(); Nodes MapNode = nodeList.GetMapAsNode(thisMapNode); ModelCollection.ModelWeights[] indivMetWeights = modelList.GetWS_EstWeights(predMets, MapNode, models, metList.GetAvgWindRose(thisInst.modeledHeight, Met.TOD.All, Met.Season.All), thisInst.radiiList); for (int r = 0; r < numRadii; r++) { for (int j = 0; j < thisMapNode.WS_Estimates.Length; j++) { bool isMetUsed = false; for (int k = 0; k < metsUsed.Length; k++) { if (metsUsed[k] == thisMapNode.WS_Estimates[j].predictorMetName) { isMetUsed = true; break; } } if (isMetUsed == true && thisMapNode.WS_Estimates[j].radius == radiiList.investItem[r].radius && thisMapNode.WS_Estimates[j].WS != 0) { Met thisMet = thisInst.metList.GetMet(thisMapNode.WS_Estimates[j].predictorMetName); double weight = thisInst.modelList.GetWeightForMetAndModel(indivMetWeights, thisMet, models[r]); avgWS = avgWS + thisMapNode.WS_Estimates[j].WS * weight; thisMapNode.WS_Estimates[j].WS_weight = weight; avgWeight = avgWeight + weight; for (int WD = 0; WD < numWD; WD++) { sectorWS[WD] = sectorWS[WD] + thisMapNode.WS_Estimates[j].sectorWS[WD] * weight; } } } } thisMapNode.avgWS_Est = 0; if (avgWeight != 0) { thisMapNode.avgWS_Est = avgWS / avgWeight; for (int WD = 0; WD < numWD; WD++) { thisMapNode.sectorWS[WD] = thisMapNode.sectorWS[WD] + sectorWS[WD] / avgWeight; } } }