ideas:landing_spot_prediction
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ideas:landing_spot_prediction [2007/04/26 19:07] – rocketboy | ideas:landing_spot_prediction [2008/07/19 23:33] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
I wanted to write an algorithm that could continuously calculate the expected payload landing spot – to end the flight early if it looked like the payload might drift outside of pre-defined bounds. The algorithm would continuously compare the predicted spot this with an internal map of the UK outline and operate a cut-down device if it looked likely that it might drift out to sea. This would allow the balloon payload to run autonomously, | I wanted to write an algorithm that could continuously calculate the expected payload landing spot – to end the flight early if it looked like the payload might drift outside of pre-defined bounds. The algorithm would continuously compare the predicted spot this with an internal map of the UK outline and operate a cut-down device if it looked likely that it might drift out to sea. This would allow the balloon payload to run autonomously, | ||
- | I reasoned that the assent | + | I reasoned that the ascent |
- | I wanted an algorithm that would be easy to implement in a small micro (PIC) and would not use a lot of processor power, program or memory space. | + | I wanted an algorithm that would be easy to implement in a small micro (PIC) and would not use a lot of processor power, program or memory space. |
- | I tested the algorithm using data form the Pegasus III balloon flight. – I used the decent | + | I tested the algorithm using data form the Pegasus III balloon flight. – I used the descent |
{{: | {{: | ||
Line 21: | Line 21: | ||
* Compare the current time, latitude, longitude and height with the previous sample and calculate the differences of each. | * Compare the current time, latitude, longitude and height with the previous sample and calculate the differences of each. | ||
* Calculate the expected air density at the mid-point height between the current and previous sample | * Calculate the expected air density at the mid-point height between the current and previous sample | ||
- | * Calculate the decent | + | * Calculate the descent |
- | * Calculate how long it would take to fall from the current height to the previous height given that decent | + | * Calculate how long it would take to fall from the current height to the previous height given that descent |
* Scale the difference in latitude and longitude by the ratio of the time between the previous and current sample points and the calculated decent time. | * Scale the difference in latitude and longitude by the ratio of the time between the previous and current sample points and the calculated decent time. | ||
* Translate the difference in longitude using the midpoint of the current and previous sample latitude. | * Translate the difference in longitude using the midpoint of the current and previous sample latitude. | ||
Line 28: | Line 28: | ||
* Add the cumulative totals to the current position to get the predicted landing spot - re-translating the longitude given the predicted latitude. | * Add the cumulative totals to the current position to get the predicted landing spot - re-translating the longitude given the predicted latitude. | ||
- | The formula to calculate air density (kg/cu m) is | + | A very simple |
1.205 * EXP(-height / 7990.6) | 1.205 * EXP(-height / 7990.6) | ||
- | where height is in meters. | + | where height is in meters. The (better) NASA algorithem for calcualting air density is given in the pseudocode below. |
- | The formula to calculate | + | The formula to calculate |
| | ||
where cd is the drag co-efficient, | where cd is the drag co-efficient, | ||
- | Longitude adjustment is dome with the formulas: | + | Longitude adjustment is done with the formulas: |
| | ||
and | and | ||
Line 43: | Line 43: | ||
===== Co-Ordinate Maths ===== | ===== Co-Ordinate Maths ===== | ||
This algorithm assumes that the earth is a sphere (rather than the ovaloid that it actually is). | This algorithm assumes that the earth is a sphere (rather than the ovaloid that it actually is). | ||
+ | |||
+ | |||
+ | |||
Line 51: | Line 54: | ||
// NASA air temperature/ | // NASA air temperature/ | ||
- | double air_density(double | + | double air_density(double |
{ | { | ||
- | if (altitude | + | if (alt < 11000.0) |
| | ||
- | temp = 15.04 - (0.00649 * altitude); | + | temp = 15.04 - (0.00649 * alt); |
- | pres = 101.29 * POWER((temp + 273.1) / 288.08, 5.256); | + | pres = 101.29 * power((temp + 273.1) / 288.08, 5.256); |
} | } | ||
else | else | ||
{ | { | ||
- | if (altitude | + | if (alt < 25000.0) |
{ // between 11Km and 25Km - lower Stratosphere | { // between 11Km and 25Km - lower Stratosphere | ||
temp = -56.46; | temp = -56.46; | ||
- | pres = 22.65 * EXP(1.73 - ( 0.000157 * altitude)); | + | pres = 22.65 * exp(1.73 - ( 0.000157 * alt)); |
} | } | ||
else | else | ||
{ // above 25Km - upper Stratosphere | { // above 25Km - upper Stratosphere | ||
- | temp = -131.21 + (0.00299 * altitude); | + | temp = -131.21 + (0.00299 * alt); |
- | pres = 2.488 * POWER((temp + 273.1) / 216.6, -11.388); | + | pres = 2.488 * power((temp + 273.1) / 216.6, -11.388); |
} | } | ||
} | } | ||
Line 74: | Line 77: | ||
| | ||
} | } | ||
+ | |||
void predict() | void predict() | ||
Line 93: | Line 97: | ||
delta_lat = this_lat - last_lat; | delta_lat = this_lat - last_lat; | ||
delta_alt = this_alt - last_alt; | delta_alt = this_alt - last_alt; | ||
- | density = air_density(this_alt + last_alt)/2)); // calculate average air density between altitudes | + | density = air_density((this_alt + last_alt)/ |
descent_rate = sqrt((weight * 9.81)/(0.5 * density * cd * area)); // calcualte descent rate given air density, weight, drag ... | descent_rate = sqrt((weight * 9.81)/(0.5 * density * cd * area)); // calcualte descent rate given air density, weight, drag ... | ||
descent_time = delta_alt / descent_rate; | descent_time = delta_alt / descent_rate; |
ideas/landing_spot_prediction.1177614447.txt.gz · Last modified: 2008/07/19 23:30 (external edit)