我正在制作一个像这样的小游戏程序用于跳空模拟,我有很多方程式下来,但我的终端速度对于任何一个给定的alt来说太高了。我一直在看这个并且过去了我唯一可以想到的是我有一个测量错误或者什么。任何帮助将不胜感激。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GasLaws
{
class Program
{
static void Main(string[] args)
{
double temperature;
double airPressure;
double airDensity;
double tV;
double alt;
//constants
const double gasCont = 287.05;
const double startTemp = 15; //this is C ground level
const double aidRate = 0.0065; //adiobatic rate for temperature by elevation
//Human Constannts
const double drag = 0.7; //in meters
const double area = 7.5; //ft^2
const double wieght = 175;
Console.WriteLine("Enter the alt in feet");
int tempint = Int32.Parse(Console.ReadLine());
alt = (double)tempint * 0.3048; //convert feet to meters
Console.WriteLine("Alt = " + alt + " m");
//calculate air pressur
airPressure = AirPressure(alt);
temperature = CalTemp(startTemp, alt, aidRate);
airDensity = AirDensity(airPressure, gasCont, temperature);
tV = TerminalVelocity(wieght, drag, airDensity, area);
//pasue screen for a second
Console.ReadLine();
}
//p = 101325(1-2.25577 * 10^-5 * alt) ^5
//this calculates correctly
private static double AirPressure(double al)
{
double tempAlt = 1 - 2.25577 * 0.00001 * al;
Console.WriteLine("Inside eq = " + tempAlt);
tempAlt = Math.Pow(tempAlt, 5 );
Console.WriteLine("Power of 5 = " + tempAlt);
tempAlt = 101325 * tempAlt;
Console.WriteLine("Pressure is = " + tempAlt + " Pascal");
return tempAlt;
}
//temperature calculation
// use adiobatic rate to calculate this
//this is right
private static double CalTemp(double t, double al, double rate) //start temperature and altitude
{
double nTemp = t;
for (int i = 0; i < al; i++)
{
nTemp -= rate;
}
Console.WriteLine("Temperature in for loop = " + nTemp);
return nTemp;
}
//claculate like this
//D Pressure / gas constant * temperature
//this works fine
private static double AirDensity(double pres, double gas, double temp)
{
temp = temp + 273.15; //convert temperautre to Kelvans
double dens = pres / (gas * temp);
dens = dens / 1000;
Console.WriteLine("PResure = " + pres);
Console.WriteLine("Gas cont = " + gas);
Console.WriteLine("Temperture = " + temp);
Console.WriteLine("Air Density is: " + dens);
return dens;
}
private static double TerminalVelocity(double w, double cd, double p, double a)
{
double v = (2 * w) / (cd * p * a) ;
v = Math.Sqrt(v);
Console.WriteLine("Terminal Velocity = " + v);
return v;
}
}
}
答案 0 :(得分:2)
您的公式似乎不包括重力加速度,并且您还混合了SI和US /英制单位。你的计算速度有多大?如果你只使用SI单位可能会更容易。另一件看起来有点奇怪的是这一行:
const double drag = 0.7; //in meters
阻力系数是无量纲数。它不应该有一个物理单位(如米)。
正确的公式是:
v = sqrt((2 * m * g) / (d * A * C))
具有相应SI单位的变量是:
m [kg] - 坠落的质量。
g [m / s ^ 2] - 重力加速度。
d [kg / m ^ 3] - 空气密度。
A [m ^ 2] - 预计区域。
C [ - ] - 阻力系数。
如果使用这些单位,公式将以[m / s]为单位产生速度。举个例子。让我们用上面的单位尝试以下值:m = 80,g = 9.8,d = 1,A = 0.7,C = 0.7
这使得终端速度v = 57 m / s,这似乎是合理的。