Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Thermistor library version 1.0");
            Console.WriteLine("Copyright (C) 2007, 2013 - SoftQuadrat GmbH, Germany");
            Console.WriteLine();
            var      line  = 0;
            NtcTable table = new NtcTable("Simu", "Simulated NTC");

            try
            {
                using (var csv = new CsvReader(new StreamReader("simu.txt"), false))
                {
                    while (csv.ReadNextRecord())
                    {
                        line += 1;
                        //if (csv.Count() != 2)
                        //{
                        //    throw new Exception("Wrong number of tokens encountered in line:\n" + line);
                        //}
                        var temperature = csv[0];
                        var resistance  = csv[1];
                        table.add(temperature, resistance);
                    }
                }
            }
            catch (IOException e)
            {
                throw new Exception(e.Message, e);
            }

            NtcThermistorModel ntc = new NtcThermistorSimplifiedModel(table);

            Console.WriteLine("Simplified Model");
            doCalculation(table, ntc);
            ntc = new NtcThermistorModel(table);
            Console.WriteLine("Standard Model");
            doCalculation(table, ntc);
            ntc = new NtcThermistorExtendedModel(table);
            Console.WriteLine("Extended Model");
            doCalculation(table, ntc);

            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Thermistor library version 1.0");
            Console.WriteLine("Copyright (C) 2007, 2013 - SoftQuadrat GmbH, Germany");
            Console.WriteLine();
            var line = 0;
            NtcTable table = new NtcTable("Simu", "Simulated NTC");
            try
            {
                using (var csv = new CsvReader(new StreamReader("simu.txt"), false))
                {
                    while (csv.ReadNextRecord())
                    {
                        line += 1;
                        //if (csv.Count() != 2)
                        //{
                        //    throw new Exception("Wrong number of tokens encountered in line:\n" + line);
                        //}
                        var temperature = csv[0];
                        var resistance = csv[1];
                        table.add(temperature, resistance);
                    }
                }
            }
            catch (IOException e)
            {
                throw new Exception(e.Message, e);
            }

            NtcThermistorModel ntc = new NtcThermistorSimplifiedModel(table);
            Console.WriteLine("Simplified Model");
            doCalculation(table, ntc);
            ntc = new NtcThermistorModel(table);
            Console.WriteLine("Standard Model");
            doCalculation(table, ntc);
            ntc = new NtcThermistorExtendedModel(table);
            Console.WriteLine("Extended Model");
            doCalculation(table, ntc);

            Console.Read();
        }