/// <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; } } }