public void CalcProbabilityOfHits()
        {
            Continuum thisInst = new Continuum("");

            string fileName = testingFolder + "\\Ice Throw\\Ice Throw testing.cfm";

            thisInst.Open(fileName);

            UTM_conversion.UTM_coords theseUTM = new UTM_conversion.UTM_coords();
            theseUTM.UTMZoneNumber = thisInst.UTM_conversions.UTMZoneNumber;
            theseUTM.hemisphere    = "Northern";
            theseUTM.UTMEasting    = 277870;
            theseUTM.UTMNorthing   = 4553300;
            UTM_conversion.Lat_Long theseLL = thisInst.UTM_conversions.UTMtoLL(theseUTM.UTMEasting, theseUTM.UTMNorthing);

            SiteSuitability.Zone zone = new SiteSuitability.Zone();
            zone.latitude  = theseLL.latitude;
            zone.longitude = theseLL.longitude;
            zone.xSize     = 20;
            zone.ySize     = 20;

            // Test 1: Probability of at least one ice hit in a year
            double probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 0, thisInst);

            Assert.AreEqual(probHits, 1.0, 0.001, "Wrong Ice hit probability Test 1");

            // Test 2: Prob of 1 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 1, thisInst);
            Assert.AreEqual(probHits, 0.3, 0.001, "Wrong Ice hit probability Test 2");

            // Test 3: Prob of 2 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 2, thisInst);
            Assert.AreEqual(probHits, 0.05, 0.001, "Wrong Ice hit probability Test 3");

            // Test 4: Prob of 3 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 3, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 4");

            // Test 5: Prob of 4 or more hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 4, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 5");

            // Test 6: Prob of more than 4 hits
            probHits = thisInst.siteSuitability.CalcProbabilityOfHits(zone, 5, thisInst);
            Assert.AreEqual(probHits, 0.00, 0.001, "Wrong Ice hit probability Test 6");

            thisInst.Close();
        }
Beispiel #2
0
        public void LLtoUTM_Test()
        {
            UTM_conversion thisConverter = new UTM_conversion();

            thisConverter.savedDatumIndex = 0;
            thisConverter.UTMZoneNumber   = 16;
            double thisLat  = 39.852;
            double thisLong = -84.549;

            UTM_conversion.UTM_coords theseCoords = thisConverter.LLtoUTM(thisLat, thisLong);

            Assert.AreEqual(709679, theseCoords.UTMEasting, 1, "Wrong easting in Test 1");
            Assert.AreEqual(4414205, theseCoords.UTMNorthing, 1, "Wrong northing in Test 1");

            thisConverter.UTMZoneNumber = 17;
            theseCoords = thisConverter.LLtoUTM(thisLat, thisLong);

            Assert.AreEqual(196370, theseCoords.UTMEasting, 1, "Wrong easting in Test 2");
            Assert.AreEqual(4417361, theseCoords.UTMNorthing, 1, "Wrong northing in Test 2");
        }
        public void CalcNoiseLevel_Test()
        {
            Continuum thisInst = new Continuum("");

            string fileName = testingFolder + "\\Sound\\Sound testing.cfm";

            thisInst.Open(fileName);

            // Test 1
            UTM_conversion.UTM_coords theseUTM = thisInst.UTM_conversions.LLtoUTM(thisInst.siteSuitability.zones[6].latitude, thisInst.siteSuitability.zones[6].longitude);
            double thisNoise = thisInst.siteSuitability.CalcNoiseLevel(Convert.ToInt32(theseUTM.UTMEasting), Convert.ToInt32(theseUTM.UTMNorthing), thisInst);

            Assert.AreEqual(thisNoise, 42.2752, 0.1, "Wrong Noise Test 1");

            // Test 2
            theseUTM  = thisInst.UTM_conversions.LLtoUTM(thisInst.siteSuitability.zones[12].latitude, thisInst.siteSuitability.zones[12].longitude);
            thisNoise = thisInst.siteSuitability.CalcNoiseLevel(Convert.ToInt32(theseUTM.UTMEasting), Convert.ToInt32(theseUTM.UTMNorthing), thisInst);
            Assert.AreEqual(thisNoise, 36.47677, 0.1, "Wrong Noise Test 2");

            thisInst.Close();
        }