public void GetSunPosition_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            DateTime thisDate = Convert.ToDateTime("3/15/2019 9:30");
            double   thisLat  = 50;
            double   thisLong = 15;
            int      offset   = 2;

            // Test 1
            SiteSuitability.SunPosition sunPosition = siteSuitability.GetSunPosition(thisDate, offset, thisLat, thisLong);

            Assert.AreEqual(119.7573, sunPosition.azimuth, 1, "Wrong Azimuth Test 1");
            Assert.AreEqual(19.93, sunPosition.altitude, 1, "Wrong Altitude Test 1");

            // Test 2
            thisLat     = 50;
            thisLong    = -115;
            offset      = -6;
            thisDate    = Convert.ToDateTime("9/27/2019 10:15");
            sunPosition = siteSuitability.GetSunPosition(thisDate, offset, thisLat, thisLong);

            Assert.AreEqual(123.9478, sunPosition.azimuth, 1, "Wrong Azimuth Test 2");
            Assert.AreEqual(23.1026, sunPosition.altitude, 1, "Wrong Altitude Test 2");

            // Test 3
            thisDate    = Convert.ToDateTime("1/27/2019 16:45");
            sunPosition = siteSuitability.GetSunPosition(thisDate, offset, thisLat, thisLong);
            Assert.AreEqual(-137.897, sunPosition.azimuth, 1, "Wrong Azimuth Test 3");
            Assert.AreEqual(12.13, sunPosition.altitude, 1, "Wrong Altitude Test 3");
        }
        public void GetRandomRadius_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            TurbineCollection.PowerCurve powerCurve = new TurbineCollection.PowerCurve();
            powerCurve.RD = 87;

            double thisRad = siteSuitability.GetRandomRadius(0, powerCurve);

            Assert.AreEqual(thisRad, 1, 0.1, "Wrong rotor radius Test 1");

            thisRad = siteSuitability.GetRandomRadius(0.2, powerCurve);
            Assert.AreEqual(thisRad, 9.7, 0.1, "Wrong rotor radius Test 2");

            thisRad = siteSuitability.GetRandomRadius(0.4, powerCurve);
            Assert.AreEqual(thisRad, 18.4, 0.1, "Wrong rotor radius Test 3");

            thisRad = siteSuitability.GetRandomRadius(0.6, powerCurve);
            Assert.AreEqual(thisRad, 27.1, 0.1, "Wrong rotor radius Test 4");

            thisRad = siteSuitability.GetRandomRadius(0.8, powerCurve);
            Assert.AreEqual(thisRad, 35.8, 0.1, "Wrong rotor radius Test 5");

            thisRad = siteSuitability.GetRandomRadius(1, powerCurve);
            Assert.AreEqual(thisRad, 44.5, 0.1, "Wrong rotor radius Test 6");
        }
        public void GetIceCrossSecArea_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            double thisCrossSec = siteSuitability.GetIceCrossSecArea(1.3965253, 3.5032493);

            Assert.AreEqual(thisCrossSec, 0.0305128, 0.001, "Wrong iceShape Test 1");

            thisCrossSec = siteSuitability.GetIceCrossSecArea(0.74762332, 2.0350265);
            Assert.AreEqual(thisCrossSec, 0.01400570, 0.001, "Wrong iceShape Test 2");

            thisCrossSec = siteSuitability.GetIceCrossSecArea(1.68766761, 4.16199542);
            Assert.AreEqual(thisCrossSec, 0.0388325, 0.001, "Wrong iceShape Test 3");

            thisCrossSec = siteSuitability.GetIceCrossSecArea(2.42035736, 5.8197984);
            Assert.AreEqual(thisCrossSec, 0.0617534, 0.001, "Wrong iceShape Test 4");
        }
        public void GetIceShape_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            double thisShape = siteSuitability.GetIceShape(0.554152);

            Assert.AreEqual(thisShape, 3.5032493, 0.001, "Wrong iceShape Test 1");

            thisShape = siteSuitability.GetIceShape(0.2919690);
            Assert.AreEqual(thisShape, 2.0350265, 0.001, "Wrong iceShape Test 2");

            thisShape = siteSuitability.GetIceShape(0.6717848);
            Assert.AreEqual(thisShape, 4.161995, 0.001, "Wrong iceShape Test 3");

            thisShape = siteSuitability.GetIceShape(0.9678211);
            Assert.AreEqual(thisShape, 5.81979848, 0.001, "Wrong iceShape Test 4");
        }
        public void GetIceMass_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            double thisMass = siteSuitability.GetIceMass(0.554152);

            Assert.AreEqual(thisMass, 1.39652538, 0.001, "Wrong iceMass Test 1");

            thisMass = siteSuitability.GetIceMass(0.2919690);
            Assert.AreEqual(thisMass, 0.74762333, 0.001, "Wrong iceMass Test 2");

            thisMass = siteSuitability.GetIceMass(0.6717848);
            Assert.AreEqual(thisMass, 1.6876676, 0.001, "Wrong iceMass Test 3");

            thisMass = siteSuitability.GetIceMass(0.9678211);
            Assert.AreEqual(thisMass, 2.42035737, 0.001, "Wrong iceMass Test 4");
        }
        public void GetSunriseAndSunsetTimes_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            // Test 1
            DateTime thisDate = Convert.ToDateTime("1/6/2019");

            DateTime[] sunTimes = siteSuitability.GetSunriseAndSunsetTimes(41, -85, -5, thisDate);

            Assert.AreEqual(sunTimes[0].Hour, 8, 0, "Wrong sunrise hour Test 1");
            Assert.AreEqual(sunTimes[0].Minute, 5, 1, "Wrong sunrise minute Test 1");

            Assert.AreEqual(sunTimes[1].Hour, 17, 0, "Wrong sunset hour Test 1");
            Assert.AreEqual(sunTimes[1].Minute, 26, 1, "Wrong sunset minute Test 1");

            // Test 2
            thisDate = Convert.ToDateTime("8/5/2019");
            sunTimes = siteSuitability.GetSunriseAndSunsetTimes(41, -85, -5, thisDate);

            Assert.AreEqual(sunTimes[0].Hour, 5, 0, "Wrong sunrise hour Test 2");
            Assert.AreEqual(sunTimes[0].Minute, 39, 1, "Wrong sunrise minute Test 2");

            Assert.AreEqual(sunTimes[1].Hour, 19, 0, "Wrong sunset hour Test 2");
            Assert.AreEqual(sunTimes[1].Minute, 53, 1, "Wrong sunset minute Test 2");

            // Test 3
            thisDate = Convert.ToDateTime("1/6/2019");
            sunTimes = siteSuitability.GetSunriseAndSunsetTimes(-0.26, -77.9, -5, thisDate);

            Assert.AreEqual(sunTimes[0].Hour, 6, 0, "Wrong sunrise hour Test 3");
            Assert.AreEqual(sunTimes[0].Minute, 13, 1, "Wrong sunrise minute Test 3");

            Assert.AreEqual(sunTimes[1].Hour, 18, 0, "Wrong sunset hour Test 3");
            Assert.AreEqual(sunTimes[1].Minute, 21, 1, "Wrong sunset minute Test 3");

            // Test 4
            thisDate = Convert.ToDateTime("8/5/2019");
            sunTimes = siteSuitability.GetSunriseAndSunsetTimes(-0.26, -77.9, -5, thisDate);

            Assert.AreEqual(sunTimes[0].Hour, 6, 0, "Wrong sunrise hour Test 4");
            Assert.AreEqual(sunTimes[0].Minute, 15, 1, "Wrong sunrise minute Test 4");

            Assert.AreEqual(sunTimes[1].Hour, 18, 0, "Wrong sunset hour Test 4");
            Assert.AreEqual(sunTimes[1].Minute, 21, 1, "Wrong sunset minute Test 4");
        }
        public void GetIceSpeed_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            TurbineCollection.PowerCurve powerCurve = new TurbineCollection.PowerCurve();
            powerCurve.RD = 87;

            double iceSpeed = siteSuitability.GetIceSpeed(45, 18, powerCurve);

            Assert.AreEqual(iceSpeed, 18.62069, 0.001, "Wrong ice speed Test 1");

            iceSpeed = siteSuitability.GetIceSpeed(90, 18, powerCurve);
            Assert.AreEqual(iceSpeed, 37.24138, 0.001, "Wrong ice speed Test 2");

            iceSpeed = siteSuitability.GetIceSpeed(90, 45, powerCurve);
            Assert.AreEqual(iceSpeed, 93.10345, 0.001, "Wrong ice speed Test 3");

            iceSpeed = siteSuitability.GetIceSpeed(70, 30, powerCurve);
            Assert.AreEqual(iceSpeed, 48.27586, 0.001, "Wrong ice speed Test 4");
        }
        public void GetCd_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();
            double          iceShape        = siteSuitability.GetIceShape(0.554152);
            double          iceCd           = siteSuitability.GetCd(iceShape);

            Assert.AreEqual(iceCd, 1.152679, 0.001, "Wrong drag coeff. Test 1");

            iceShape = siteSuitability.GetIceShape(0.291969);
            iceCd    = siteSuitability.GetCd(iceShape);
            Assert.AreEqual(iceCd, 1.071926, 0.001, "Wrong drag coeff. Test 2");

            iceShape = siteSuitability.GetIceShape(0.671785);
            iceCd    = siteSuitability.GetCd(iceShape);
            Assert.AreEqual(iceCd, 1.18891, 0.001, "Wrong drag coeff. Test 3");

            iceShape = siteSuitability.GetIceShape(0.967821);
            iceCd    = siteSuitability.GetCd(iceShape);
            Assert.AreEqual(iceCd, 1.280089, 0.001, "Wrong drag coeff. Test 4");
        }
        public void GetDegrees_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();
            double          thisDegs        = siteSuitability.GetDegrees(0);

            Assert.AreEqual(180, thisDegs, 1, "Wrong blade throw angle Test 1");

            thisDegs = siteSuitability.GetDegrees(0.2);
            Assert.AreEqual(233, thisDegs, 1, "Wrong blade throw angle Test 2");

            thisDegs = siteSuitability.GetDegrees(0.4);
            Assert.AreEqual(258, thisDegs, 1, "Wrong blade throw angle Test 3");

            thisDegs = siteSuitability.GetDegrees(0.6);
            Assert.AreEqual(282, thisDegs, 1, "Wrong blade throw angle Test 4");

            thisDegs = siteSuitability.GetDegrees(0.8);
            Assert.AreEqual(307, thisDegs, 1, "Wrong blade throw angle Test 5");

            thisDegs = siteSuitability.GetDegrees(1);
            Assert.AreEqual(360, thisDegs, 1, "Wrong blade throw angle Test 6");
        }
        public void IsSunUp_Test()
        {
            SiteSuitability siteSuitability = new SiteSuitability();

            // Test 1
            double   thisLat   = 41.0;
            double   thisLong  = -82.0;
            int      utcOFfset = -5;
            DateTime thisDate  = Convert.ToDateTime("1/6/2019 7:30");
            bool     isSunUp   = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);

            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 1");

            // Test 2
            thisDate = Convert.ToDateTime("1/6/2019 8:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 2");

            // Test 3
            thisDate = Convert.ToDateTime("1/6/2019 16:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 3");

            // Test 4
            thisDate = Convert.ToDateTime("1/6/2019 18:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 4");

            // Test 5
            thisDate = Convert.ToDateTime("8/5/2019 5:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 5");

            // Test 6
            thisDate = Convert.ToDateTime("8/5/2019 6:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 6");

            // Test 7
            thisDate = Convert.ToDateTime("8/5/2019 18:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 7");

            // Test 8
            thisDate = Convert.ToDateTime("8/5/2019 20:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 8");

            // Test 9
            thisLat   = -33;
            thisLong  = 151.0;
            utcOFfset = 10;
            thisDate  = Convert.ToDateTime("1/6/2019 4:30");
            isSunUp   = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 9");

            // Test 10
            thisDate = Convert.ToDateTime("1/6/2019 5:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 10");

            // Test 11
            thisDate = Convert.ToDateTime("1/6/2019 18:30");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 11");

            // Test 12
            thisDate = Convert.ToDateTime("1/6/2019 20:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 12");

            // Test 13
            thisDate = Convert.ToDateTime("8/5/2019 6:15");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 13");

            // Test 14
            thisDate = Convert.ToDateTime("8/5/2019 7:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 14");

            // Test 15
            thisDate = Convert.ToDateTime("8/5/2019 17:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(true, isSunUp, "Wrong SunUp Test 15");

            // Test 16
            thisDate = Convert.ToDateTime("8/5/2019 18:00");
            isSunUp  = siteSuitability.isSunUp(thisDate, utcOFfset, thisLat, thisLong);
            Assert.AreEqual(false, isSunUp, "Wrong SunUp Test 16");
        }