Beispiel #1
0
        /// <summary> Reads selected wake model and selected mets to use in creating map. </summary>
        private void GetMapSettings()
        {
            // Get selected wake model
            try
            {
                thisWakeModel = thisInst.wakeModelList.wakeModels[cboWakeModels.SelectedIndex];
            }
            catch
            {
                MessageBox.Show("Select a wake model to use.", "Continuum 3");
            }

            // Get mets to use in map generation
            int numMets = chkMetsToUse.CheckedItems.Count;

            metsUsed = new Met[numMets];

            for (int n = 0; n < numMets; n++)
            {
                for (int j = 0; j <= thisInst.metList.ThisCount - 1; j++)
                {
                    if (chkMetsToUse.CheckedItems[n].ToString() == thisInst.metList.metItem[j].name)
                    {
                        metsUsed[n] = thisInst.metList.metItem[j];
                        break;
                    }
                }
            }

            if (cboUseTimeSeries.SelectedItem.ToString() == "Use Time Series")
            {
                useTimeSeries = true;
            }
            else
            {
                useTimeSeries = false;
            }

            // Get wind flow models
            if (thisInst.metList.isTimeSeries == false || thisInst.metList.isMCPd == false || useTimeSeries == false)
            {
                models = thisInst.modelList.GetModels(thisInst, thisInst.metList.GetMetsUsed(), Met.TOD.All, Met.Season.All, thisInst.modeledHeight, false);
            }
            else
            {
                models = thisInst.modelList.GetAllModels(thisInst, thisInst.metList.GetMetsUsed());
            }

            int Waked_map_ind = 0;

            for (int j = 0; j < thisInst.mapList.ThisCount; j++)
            {
                if (thisInst.mapList.mapItem[j].mapName.Substring(0, 5) == "Waked")
                {
                    Waked_map_ind++;
                }
            }

            mapName = "Waked Map " + (Waked_map_ind + 1);
        }
        /// <summary> Delete all maps that were generated with thisWakeModel </summary>
        public void RemoveMapByWakeModel(Wake_Model thisWakeModel, WakeCollection wakeList)
        {
            int newCount = 0;

            for (int i = 0; i < ThisCount; i++)
            {
                if (mapItem[i].isWaked == false || (mapItem[i].isWaked == true && wakeList.IsSameWakeModel(mapItem[i].wakeModel, thisWakeModel) == false))
                {
                    newCount++;
                }
            }

            if (newCount > 0)
            {
                Map[] tempList  = new Map[newCount];
                int   tempIndex = 0;

                for (int i = 0; i < ThisCount; i++)
                {
                    if (mapItem[i].isWaked == false || (mapItem[i].isWaked == true && wakeList.IsSameWakeModel(mapItem[i].wakeModel, thisWakeModel) == false))
                    {
                        tempList[tempIndex] = mapItem[i];
                        tempIndex++;
                    }
                }

                mapItem = new Map[newCount];
                mapItem = tempList;
            }
            else
            {
                mapItem = null;
            }
        }
Beispiel #3
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;
        }
        /// <summary> Adds a map to the collection and calls Background_worker to start map calculations </summary>
        public void AddMap(string mapname, int minUTMX, int minUTMY, int reso, int numX, int numY, int whatToMap, string powerCurve, Continuum thisInst, bool isWaked,
                           Wake_Model wakeModel, Met[] metsUsed, Model[] models, bool useTimeSeries)
        {
            int thisCount = ThisCount;
            int numMets   = metsUsed.Length;

            string[] metsUsedName = new string[numMets];
            for (int i = 0; i <= numMets - 1; i++)
            {
                metsUsedName[i] = metsUsed[i].name;
            }

            Map thisMap = new Map();

            thisMap.mapName       = mapname;
            thisMap.minUTMX       = minUTMX;
            thisMap.minUTMY       = minUTMY;
            thisMap.reso          = reso;
            thisMap.numX          = numX;
            thisMap.numY          = numY;
            thisMap.modelType     = whatToMap;
            thisMap.powerCurve    = powerCurve;
            thisMap.isWaked       = isWaked;
            thisMap.wakeModel     = wakeModel;
            thisMap.metsUsed      = metsUsedName;
            thisMap.model         = models;
            thisMap.useSR         = thisInst.topo.useSR;
            thisMap.useFlowSep    = thisInst.topo.useSepMod;
            thisMap.useTimeSeries = useTimeSeries;

            // Check to see if map was started but not finished
            int existingInd = GetIncompleteMapInd(thisMap);

            if (existingInd != -999)
            {
                thisMap = mapItem[existingInd];
            }

            if (existingInd == -999)
            {
                // First check that the model doesn//t already exist
                bool mapAlreadyCreated = CheckForDuplicate(metsUsedName, minUTMX, minUTMY, numX, numY, reso, whatToMap, powerCurve, thisInst.topo.useSR,
                                                           thisInst.topo.useSepMod, wakeModel, useTimeSeries);
                if (mapAlreadyCreated == true)
                {
                    return;
                }

                Array.Resize(ref mapItem, thisCount + 1);
                mapItem[thisCount] = thisMap;
            }

            BackgroundWork.Vars_for_Gen_Map args = new BackgroundWork.Vars_for_Gen_Map();
            args.thisInst   = thisInst;
            args.thisMap    = thisMap;
            args.MCP_Method = thisInst.Get_MCP_Method();

            try {
                thisInst.BW_worker = new BackgroundWork();
                thisInst.BW_worker.Call_BW_GenMap(args);
            }
            catch {
                // Background worker is still working
            }
        }
        /// <summary> Checks to see if map has already been created. Returns false if has not been created. </summary>
        public bool CheckForDuplicate(string[] metsUsed, double minUTMX, double minUTMY, int numX, int numY, int reso,
                                      int whatToMap, string powerCurve, bool useSR, bool useSepModel, Wake_Model thisWakeModel, bool useTimeSeries)
        {
            bool           alreadyExists = false;
            WakeCollection wakeList      = new WakeCollection();
            MetCollection  metList       = new MetCollection();

            if (ThisCount > 0)
            {
                for (int i = 0; i < ThisCount; i++)
                {
                    if (mapItem[i].minUTMX == minUTMX && mapItem[i].minUTMY == minUTMY && mapItem[i].numX == numX &&
                        mapItem[i].numY == numY && mapItem[i].reso == reso && mapItem[i].modelType == whatToMap &&
                        metList.sameMets(metsUsed, mapItem[i].metsUsed) && mapItem[i].powerCurve == powerCurve && mapItem[i].useSR == useSR &&
                        mapItem[i].useFlowSep == useSepModel && wakeList.IsSameWakeModel(mapItem[i].wakeModel, thisWakeModel) &&
                        mapItem[i].useTimeSeries == useTimeSeries)
                    {
                        MessageBox.Show("An identical map has already been created.", "Continuum 3");
                        alreadyExists = true;
                        break;
                    }
                }
            }

            return(alreadyExists);
        }