| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | public static class Constants { |
| | | 4 | | // Constants (these should be defined with appropriate values) |
| | | 5 | | public const double kAirDensity = 1.204; // Sea level air density in kg/m^3 |
| | | 6 | | public const double kAirDensityScaleHeight = 10.4; // Scale height in km |
| | | 7 | | public const double kGravity = 9.80665; // Standard gravity in m/s^2 |
| | | 8 | | public const double kEarthMeanRadius = 6378137; // Earth's mean radius in meters |
| | | 9 | | |
| | 4348 | 10 | | public static double CalculateAirDensityAtAltitude(double altitude) { |
| | 4348 | 11 | | return kAirDensity * Math.Exp(-altitude / (kAirDensityScaleHeight * 1000)); |
| | 4348 | 12 | | } |
| | | 13 | | |
| | 0 | 14 | | public static double CalculateGravityAtAltitude(double altitude) { |
| | 0 | 15 | | return kGravity * Math.Pow(kEarthMeanRadius / (kEarthMeanRadius + altitude), 2); |
| | 0 | 16 | | } |
| | | 17 | | } |