The Function For Temperature Value Acquisition (C++)
The following code estimates a Pt100 or Pt1000 sensor's temperature from its current resistance (input parameter r).
float GetPt100Temperature(float r) { float const Pt100 = { 80.31, 82.29, 84.27, 86.25, 88.22, 90.19, 92.16, 94.12, 96.09, 98.04, 100.0, 101.95, 103.9, 105.85, 107.79, 109.73, 111.67, 113.61, 115.54, 117.47, 119.4, 121.32, 123.24, 125.16, 127.07, 128.98, 130.89, 132.8, 134.7, 136.6, 138.5, 140.39, 142.29, 157.31, 175.84, 195.84 }; int t = -50, i = 0, dt = 0; if (r > Pt100) while (250 > t) { dt = (t < 110) ? 5 : (t > 110) ? 50 : 40; if (r < Pt100) return t + (r - Pt100) * dt / (Pt100 - Pt100); t += dt; }; return t; } float GetPt1000Temperature(float r) { return GetPt100Temperature(r / 10); }Read more about this topic: Resistance Thermometer
Famous quotes containing the words function, temperature and/or acquisition:
“Every boy was supposed to come into the world equipped with a father whose prime function was to be our father and show us how to be men. He can escape us, but we can never escape him. Present or absent, dead or alive, real or imagined, our father is the main man in our masculinity.”
—Frank Pittman (20th century)
“The bourgeois treasures nothing more highly than the self.... And so at the cost of intensity he achieves his own preservation and security. His harvest is a quiet mind which he prefers to being possessed by God, as he prefers comfort to pleasure, convenience to liberty, and a pleasant temperature to that deathly inner consuming fire.”
—Hermann Hesse (18771962)
“Always and everywhere children take an active role in the construction and acquisition of learning and understanding. To learn is a satisfying experience, but also, as the psychologist Nelson Goodman tells us, to understand is to experience desire, drama, and conquest.”
—Carolyn Edwards (20th century)