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:
“The press and politicians. A delicate relationship. Too close, and danger ensues. Too far apart and democracy itself cannot function without the essential exchange of information. Creative leaks, a discreet lunch, interchange in the Lobby, the art of the unattributable telephone call, late at night.”
—Howard Brenton (b. 1942)
“This pond never breaks up so soon as the others in this neighborhood, on account both of its greater depth and its having no stream passing through it to melt or wear away the ice.... It indicates better than any water hereabouts the absolute progress of the season, being least affected by transient changes of temperature. A severe cold of a few days duration in March may very much retard the opening of the former ponds, while the temperature of Walden increases almost uninterruptedly.”
—Henry David Thoreau (18171862)
“Whatever may be our just grievances in the southern states, it is fitting that we acknowledge that, considering their poverty and past relationship to the Negro race, they have done remarkably well for the cause of education among us. That the whole South should commit itself to the principle that the colored people have a right to be educated is an immense acquisition to the cause of popular education.”
—Fannie Barrier Williams (18551944)