//'''a wind generation object//''' public Wind(string windstring, double cross_section = 0.1) { self = this; string[] a = windstring.Split(','); if (Utils.len(a) != 3) { return; //raise RuntimeError("Expected wind in speed,direction,turbulance form, not %s" % windstring); } self.speed = float.Parse(a[0]); //# m/s self.direction = float.Parse(a[1]); //# direction the wind is going in self.turbulance = float.Parse(a[2]); //# turbulance factor (standard deviation) //# the cross-section of the aircraft to wind. This is multiplied by the //# difference in the wind and the velocity of the aircraft to give the acceleration self.cross_section = cross_section; //# the time constant for the turbulance - the average period of the //# changes over time self.turbulance_time_constant = 5.0; //# wind time record self.tlast = DateTime.Now; //# initial turbulance multiplier self.turbulance_mul = 1.0; }
//# See http://en.wikipedia.org/wiki/Drag_equation //# //# Drag equation is F(a) = cl * p/2 * v^2 * a, where cl : drag coefficient //# (let's assume it's low, .e.g., 0.2), p : density of air (assume about 1 //# kg/m^3, the density just over 1500m elevation), v : relative speed of wind //# (to the body), a : area acted on (this is captured by the cross_section //# paramter). //# //# So then we have //# F(a) = 0.2 * 1/2 * v^2 * cross_section = 0.1 * v^2 * cross_section public double drag_force(Wind wind, double sp) { return (Math.Pow(sp,2.0)) * 0.1 * wind.cross_section; }
//# See http://en.wikipedia.org/wiki/Drag_equation //# //# Drag equation is F(a) = cl * p/2 * v^2 * a, where cl : drag coefficient //# (let's assume it's low, .e.g., 0.2), p : density of air (assume about 1 //# kg/m^3, the density just over 1500m elevation), v : relative speed of wind //# (to the body), a : area acted on (this is captured by the cross_section //# paramter). //# //# So then we have //# F(a) = 0.2 * 1/2 * v^2 * cross_section = 0.1 * v^2 * cross_section public double drag_force(Wind wind, double sp) { return((Math.Pow(sp, 2.0)) * 0.1 * wind.cross_section); }