Esempio n. 1
0
        public void GetFlowType_Test()
        {
            Model thisModel = new Model();

            thisModel.SizeArrays(16);
            thisModel.SetDefaultModelCoeffs(16);

            string flowType = thisModel.GetFlowType(-10, -10, 0, "UW", null, 0, false, 0); // Test 1

            Assert.AreSame("Downhill", flowType, "Wrong flow type: Test 1");

            flowType = thisModel.GetFlowType(-10, -10, 0, "DW", null, 0, false, 0); // Test 2
            Assert.AreSame("Uphill", flowType, "Wrong flow type: Test 2");

            flowType = thisModel.GetFlowType(-10, 10, 0, "UW", null, 0, false, 0); // Test 3
            Assert.AreSame("Downhill", flowType, "Wrong flow type: Test 3");

            flowType = thisModel.GetFlowType(-10, 10, 0, "DW", null, 0, false, 0); // Test 4
            Assert.AreSame("Downhill", flowType, "Wrong flow type: Test 4");

            flowType = thisModel.GetFlowType(10, -10, 0, "UW", null, 0, false, 0); // Test 5
            Assert.AreSame("SpdUp", flowType, "Wrong flow type: Test 5");

            flowType = thisModel.GetFlowType(10, -10, 0, "DW", null, 0, false, 0); // Test 6
            Assert.AreSame("Uphill", flowType, "Wrong flow type: Test 6");

            flowType = thisModel.GetFlowType(10, 10, 0, "UW", null, 0, false, 0); // Test 7
            Assert.AreSame("SpdUp", flowType, "Wrong flow type: Test 7");

            flowType = thisModel.GetFlowType(10, 10, 0, "DW", null, 0, false, 0); // Test 8
            Assert.AreSame("Downhill", flowType, "Wrong flow type: Test 8");

            flowType = thisModel.GetFlowType(30, 10, 0, "UW", null, 0, false, 0); // Test 9
            Assert.AreSame("Uphill", flowType, "Wrong flow type: Test 9");

            flowType = thisModel.GetFlowType(10, 10, 0, "DW", null, 0, false, 0); // Test 10
            Assert.AreSame("Downhill", flowType, "Wrong flow type: Test 10");

            flowType = thisModel.GetFlowType(30, -10, 0, "UW", null, 0, false, 0); // Test 11
            Assert.AreSame("Uphill", flowType, "Wrong flow type: Test 11");

            flowType = thisModel.GetFlowType(30, -10, 0, "DW", null, 0, false, 0); // Test 12
            Assert.AreSame("Uphill", flowType, "Wrong flow type: Test 12");

            // Turbulent tests
            NodeCollection.Sep_Nodes[] This_Sep_Node = new NodeCollection.Sep_Nodes[1];
            This_Sep_Node[0].highNode = new Nodes();
            This_Sep_Node[0].highNode.AddExposure(4000, 1, 1, 16);
            This_Sep_Node[0].highNode.expo[0].expo[0] = 200;                               // UW expo
            This_Sep_Node[0].highNode.expo[0].expo[8] = 200;                               // DW expo

            flowType = thisModel.GetFlowType(-10, 10, 0, "UW", This_Sep_Node, 8, true, 0); // Test 13
            Assert.AreSame("Turbulent", flowType, "Wrong flow type: Test 13");

            flowType = thisModel.GetFlowType(200, 200, 0, "DW", null, 8, true, 0); // Test 14
            Assert.AreSame("Turbulent", flowType, "Wrong flow type: Test 14");
        }
Esempio n. 2
0
        /// <summary> Determines and returns flow type upwind or downwind of site: Downhill, Uphill, Induced Speed-up, Valley or Turbulent </summary>
        public string GetFlowType(double thisUW, double thisDW, int WD_sec, string UW_or_DW, NodeCollection.Sep_Nodes[] flowSepNodes, double thisWS, bool useFlowSep, int radiusInd)
        {
            string flowType    = "";
            bool   isTurbulent = false;

            NodeCollection.Sep_Nodes thisFS_Node = new NodeCollection.Sep_Nodes();
            int numFS = 0;

            if (flowSepNodes != null)
            {
                numFS = flowSepNodes.Length;
            }

            for (int FS_ind = 0; FS_ind < numFS; FS_ind++)
            {
                if (flowSepNodes[FS_ind].flowSepWD == WD_sec)
                {
                    thisFS_Node = flowSepNodes[FS_ind];
                    break;
                }
            }

            if (UW_or_DW == "UW" && thisUW < 10) // can only be turbulent in UW direction if UW exposure < 10 (initially, UW exposure had to be negative
                                                 // but found that some cases with turbulent UW conditions had a slightly positive UW exposure)
            {
                if (thisFS_Node.highNode == null && thisFS_Node.turbEndNode == null)
                {
                    isTurbulent = false;
                }
                else if (thisFS_Node.highNode.expo[radiusInd].expo[WD_sec] + thisFS_Node.highNode.expo[radiusInd].GetDW_Param(WD_sec, "Expo") > sepCrit[WD_sec] &&
                         thisWS > Sep_crit_WS[WD_sec] && useFlowSep == true)
                {
                    isTurbulent = true;
                }
                else
                {
                    isTurbulent = false;
                }
            }
            else if (UW_or_DW == "DW" && thisDW > 0 && thisUW > 0)
            {
                if (thisUW + thisDW > sepCrit[WD_sec] && thisWS > Sep_crit_WS[WD_sec] && useFlowSep == true)
                {
                    isTurbulent = true;
                }
                else
                {
                    isTurbulent = false;
                }
            }

            if (isTurbulent == false)
            {
                if ((thisDW >= 0 && UW_or_DW == "DW") || (thisUW < 0 && thisDW > 0 && UW_or_DW == "UW"))
                {
                    flowType = "Downhill";
                }
                else if (thisUW > UW_crit[WD_sec] || (thisDW < 0 && UW_or_DW == "DW"))
                {
                    flowType = "Uphill";
                }
                else if (thisUW >= 0 && thisUW <= UW_crit[WD_sec] && UW_or_DW == "UW")
                {
                    flowType = "SpdUp";
                }
                else if (thisUW < 0 && thisDW < 0)
                {
                    // flowType = "Valley"
                    flowType = "Downhill";
                }
            }
            else
            {
                flowType = "Turbulent";
            }

            return(flowType);
        }