示例#1
0
        public void CalculateResistanceTest()
        {
            //Typical thermistor values, figures taken from http://en.wikipedia.org/wiki/Thermistor
            double a = 1.4e-3;
            double b = 2.37e-4;
            double c = 9.90e-8;
            SteinhartHartEquation target = new SteinhartHartEquation(a, b, c);
            double temperature           = 25.507;
            double expected = 3000;
            double actual;

            actual = target.CalculateResistance(temperature);
            Assert.AreEqual(expected.ToString("G4"), actual.ToString("G4"));
        }
示例#2
0
        public void CalculateCoefficientsTest()
        {
            SteinhartHartEquation target = new SteinhartHartEquation(0, 0, 0);
            double r1 = 8196.2083430224284D;
            double t1 = 4D;
            double r2 = 914.68076906345277D;
            double t2 = 55D;
            double r3 = 241.05129129281565D;
            double t3 = 95D;

            target.CalculateCoefficients(r1, t1, r2, t2, r3, t3);
            Assert.AreEqual("1.40E-003", target.A.ToString("E2"));
            Assert.AreEqual("2.37E-004", target.B.ToString("E2"));
            Assert.AreEqual("9.90E-008", target.C.ToString("E2"));
        }