Windchill

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Search

 

Search DelphiForFun.org only

Support DFF

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.

In Association with Amazon.com

 

Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

 

 

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

 

Search DelphiForFun.org only

 

 

 

 

 

Problem Description

Here's a windchill calculator.  WindChill attempts to account for the effect of wind on cooling the human body during cold, windy conditions.   It's value represents a temperature lower than the actual temperature with idea that the cooling effect of the input temperature and wind are equivalent to the windchill temperature with no wind.      

Background & Techniques

The formula presented here is the one currently (2001) used by the US Weather Service to calculate windchill temperatures. 

WC = 91.4 - (0.474677 - 0.020425 * V + 0.303107 * SQRT(V)) * (91.4 -T)
where  T = degrees Fahrenheit  and  V = wind speed MPH.  Values are valid for temperatures between -35 and 35 degrees F and wind speeds from 4 to 40 mph. 

A review of the equation is underway and I have seen reports that the equation will be modified in the future.  

Addendum January 12,2006:  A viewer recently pointed out  that the proposed revision to the wind-chill equation had been implemented, apparently shortly after my original positing in early 2001.   The new equation is based on enhanced models of the effect of wind of exposed skin and experimental results.   The equation is   Wind Chill (F) = 35.74 + 0.6215T - 35.75(V^0.16) + 0.4275T(V^0.16).  The new equation is valid over a wider range of wind speeds: 3 to at least 80 mph.   Windchill values at a given temperature are higher under the new equation than under the old at least partially due to the reduction of wind velocities from an assumed measurement height of 33 ft to 5 ft,  the average height of an exposed face.     A new version of the program  was posted today which reports results based on both the old and new equations.  

Programming Notes

There were two unanticipated problems that had to be resolved to get the program to work properly.  They turned out to be more interesting than  the original problem, so I'll discuss them here.  

I decided to use a TTrackbar component to collect temperature and wind speed data from the user.  By click and dragging sliders,  any temperature or wind speed within the allowable range can be selected.   OnChange exits from the trackbars recalculate and display  the wind chill for each change.  

The problem arose when I decided to orient the trackbars vertically.   TTrackbar is one of many components in Delphi that are simply wrappers for Windows functions.  The frustrating  part is that correcting Microsoft "oversights" is more difficult because the internals are hidden.   For trackbars oriented vertically, the max values appear at the  lower end, thus visually lowering the slider increases the position value.  Not intuitive.   The solution is to display a new "logical position" (temperature or wind speed) whenever the position variable changes.  

A second problem occurs in trackbar usage when max or min property is changed.  This is a perfect example of unintended consequences.  The  component itself may change the value of the  position property to keep it between the modified max and min values.  This triggers an OnChange exit even though the user didn't change the slider, and neither did the program (directly).  Since OnChange recalculates the new windchill whenever position  changes, you can see the problem.  It took a few hours to debug this one.   The problem existed because I decided to get fancy and allow temperatures to be entered in  Fahrenheit or Celsius and the wind speed in miles per hour or kilometers per hour.    When the user clicks a radio button to change units, a routine is triggered to change the max and min values in the associated trackbar for the new units.   This action may trigger the unintended position property change.  The solution was  new Boolean variables, HandleT (for temperature) and HandleV (for wind speed),  set to false before changing max and min and to true afterwards.  The OnChange trackbar exits only recalculate the displayed temperature (or wind speed) and windchill if HandleT (or HandleV)  variable is true.   

 

Running/Exploring the Program 

bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

If I were doing it again, I'd set trackbar min values to 0 and max values to 100 and calculate all temp and wind speed values accordingly.  This would avoid the "unintended consequences" problem described above. 

 

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2013, Gary Darby    All rights reserved.