Esempio n. 1
0
        /// <summary>
        /// Perform a deep Copy of the object.
        /// </summary>
        /// <typeparam name="T">The type of object being copied.</typeparam>
        /// <param name="source">The object instance to copy.</param>
        /// <returns>The copied object.</returns>



        public static string GetDataPackage(CalculationOutput data, string output)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = int.MaxValue - 1;
            return(serializer.Serialize(new { Output = output, Data = data }));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string[] testingType = new string[] {
                "iad1", "iad2", "iad3", "iad4", "iex", "ige", "ili", "ilo",
                "tad1", "tad2", "tad3", "tad4", "tex", "tge", "tli", "tlo"
            };


            Console.WriteLine("Enter below probability names for testing.");
            Console.WriteLine(
                @"
iad1, iad2, iad3, iad4, iex, ige, ili, ilo, 
tad1, tad2, tad3, tad4, tex, tge, tli, tlo
");
            string uInput = Console.ReadLine();


            args = uInput.Split(new string[] { " " }, StringSplitOptions.None);

            double            stopTemarature = Program.UserStopTemparation;
            CalculationOutput cUnitTest      = new CalculationOutput();

            Console.WriteLine("Sample data have been intialized.");

            InitTesting(args, cUnitTest);

            Console.WriteLine("Started -> Iteration testing.");

            //Iteration testing (8 tests);
            IterationTesting(ParseName("iad1"), Program.GetFlightData(), cUnitTest.IterationAdaptive1);
            IterationTesting(ParseName("iad2"), Program.GetFlightData(), cUnitTest.IterationAdaptive2);
            IterationTesting(ParseName("iad3"), Program.GetFlightData(), cUnitTest.IterationAdaptive3);
            IterationTesting(ParseName("iad4"), Program.GetFlightData(), cUnitTest.IterationAdaptive4);
            IterationTesting(ParseName("iex"), Program.GetFlightData(), cUnitTest.IterationExponential);
            IterationTesting(ParseName("ige"), Program.GetFlightData(), cUnitTest.IterationGeometric);
            IterationTesting(ParseName("ili"), Program.GetFlightData(), cUnitTest.IterationLinear);
            IterationTesting(ParseName("ilo"), Program.GetFlightData(), cUnitTest.IterationLogarithmic);
            Console.WriteLine("Finished -> Iteration testing.");

            //Temparature testing (8 tests);
            Console.WriteLine("Started -> Temparature testing.");
            TemparatureTesting(ParseName("tad1"), Program.GetFlightData(), cUnitTest.TemparatureAdaptive1);
            TemparatureTesting(ParseName("tad2"), Program.GetFlightData(), cUnitTest.TemparatureAdaptive2);
            TemparatureTesting(ParseName("tad3"), Program.GetFlightData(), cUnitTest.TemparatureAdaptive3);
            TemparatureTesting(ParseName("tad4"), Program.GetFlightData(), cUnitTest.TemparatureAdaptive4);
            TemparatureTesting(ParseName("tex"), Program.GetFlightData(), cUnitTest.TemparatureExponential);
            TemparatureTesting(ParseName("tge"), Program.GetFlightData(), cUnitTest.TemparatureGeometric);
            TemparatureTesting(ParseName("tli"), Program.GetFlightData(), cUnitTest.TemparatureLinear);
            TemparatureTesting(ParseName("tlo"), Program.GetFlightData(), cUnitTest.TemparatureLogarithmic);
            Console.WriteLine("Finished -> Temparature testing.");



            //Add data to collection



            Console.WriteLine("Press any key to close program.");
            Console.ReadKey();

            //Keep data to DB.
            //AirTableAdapter adp = new AirTableAdapter();
            //adp.Update(_LogAir);
        }
Esempio n. 3
0
        private static void InitTesting(string[] args, CalculationOutput cUnitTest)
        {
            if (args.Length > 0)
            {
                #region Init data via input

                if (args.Contains("iad1"))
                {
                    cUnitTest.IterationAdaptive1 = new List <CalucationData>();
                }
                if (args.Contains("iad2"))
                {
                    cUnitTest.IterationAdaptive2 = new List <CalucationData>();
                }
                if (args.Contains("iad3"))
                {
                    cUnitTest.IterationAdaptive3 = new List <CalucationData>();
                }
                if (args.Contains("iad4"))
                {
                    cUnitTest.IterationAdaptive4 = new List <CalucationData>();
                }
                if (args.Contains("iex"))
                {
                    cUnitTest.IterationExponential = new List <CalucationData>();
                }
                if (args.Contains("ige"))
                {
                    cUnitTest.IterationGeometric = new List <CalucationData>();
                }
                if (args.Contains("ili"))
                {
                    cUnitTest.IterationLinear = new List <CalucationData>();
                }
                if (args.Contains("ilo"))
                {
                    cUnitTest.IterationLogarithmic = new List <CalucationData>();
                }

                if (args.Contains("tad1"))
                {
                    cUnitTest.TemparatureAdaptive1 = new List <CalucationData>();
                }
                if (args.Contains("tad2"))
                {
                    cUnitTest.TemparatureAdaptive2 = new List <CalucationData>();
                }
                if (args.Contains("tad3"))
                {
                    cUnitTest.TemparatureAdaptive3 = new List <CalucationData>();
                }
                if (args.Contains("tad4"))
                {
                    cUnitTest.TemparatureAdaptive4 = new List <CalucationData>();
                }
                if (args.Contains("tex"))
                {
                    cUnitTest.TemparatureExponential = new List <CalucationData>();
                }
                if (args.Contains("tge"))
                {
                    cUnitTest.TemparatureGeometric = new List <CalucationData>();
                }
                if (args.Contains("tli"))
                {
                    cUnitTest.TemparatureLinear = new List <CalucationData>();
                }
                if (args.Contains("tlo"))
                {
                    cUnitTest.TemparatureLogarithmic = new List <CalucationData>();
                }

                #endregion Init data via input
            }
            else
            {
                cUnitTest.IterationAdaptive1   = new List <CalucationData>();
                cUnitTest.IterationAdaptive2   = new List <CalucationData>();
                cUnitTest.IterationAdaptive3   = new List <CalucationData>();
                cUnitTest.IterationAdaptive4   = new List <CalucationData>();
                cUnitTest.IterationExponential = new List <CalucationData>();
                cUnitTest.IterationGeometric   = new List <CalucationData>();
                cUnitTest.IterationLinear      = new List <CalucationData>();
                cUnitTest.IterationLogarithmic = new List <CalucationData>();

                cUnitTest.TemparatureAdaptive1   = new List <CalucationData>();
                cUnitTest.TemparatureAdaptive2   = new List <CalucationData>();
                cUnitTest.TemparatureAdaptive3   = new List <CalucationData>();
                cUnitTest.TemparatureAdaptive4   = new List <CalucationData>();
                cUnitTest.TemparatureExponential = new List <CalucationData>();
                cUnitTest.TemparatureGeometric   = new List <CalucationData>();
                cUnitTest.TemparatureLinear      = new List <CalucationData>();
                cUnitTest.TemparatureLogarithmic = new List <CalucationData>();
            }
        }