feat: polish & windviz & deploy
This commit is contained in:
parent
81b8e763bd
commit
465ad00f7b
78 changed files with 20622 additions and 2154 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"math"
|
||||
"sort"
|
||||
|
||||
"predictor-refactored/internal/numerics"
|
||||
"predictor-refactored/internal/weather"
|
||||
)
|
||||
|
||||
|
|
@ -45,29 +46,10 @@ func ConstantRate(rate float64) Model {
|
|||
func ParachuteDescent(seaLevelRate float64) Model {
|
||||
k := seaLevelRate * 1.1045
|
||||
return func(_ float64, s State) State {
|
||||
return State{Altitude: -k / math.Sqrt(nasaDensity(s.Altitude))}
|
||||
return State{Altitude: -k / math.Sqrt(numerics.NasaDensity(s.Altitude))}
|
||||
}
|
||||
}
|
||||
|
||||
// nasaDensity returns air density (kg/m^3) for an altitude in metres,
|
||||
// using the NASA simple atmosphere model.
|
||||
// See https://www.grc.nasa.gov/WWW/K-12/airplane/atmosmet.html.
|
||||
func nasaDensity(alt float64) float64 {
|
||||
var temp, pressure float64
|
||||
switch {
|
||||
case alt > 25000:
|
||||
temp = -131.21 + 0.00299*alt
|
||||
pressure = 2.488 * math.Pow((temp+273.1)/216.6, -11.388)
|
||||
case alt > 11000:
|
||||
temp = -56.46
|
||||
pressure = 22.65 * math.Exp(1.73-0.000157*alt)
|
||||
default:
|
||||
temp = 15.04 - 0.00649*alt
|
||||
pressure = 101.29 * math.Pow((temp+273.1)/288.08, 5.256)
|
||||
}
|
||||
return pressure / (0.2869 * (temp + 273.1))
|
||||
}
|
||||
|
||||
// RateSegment is one entry in a Piecewise rate schedule. Until is the UNIX
|
||||
// timestamp at which this segment ends — the model emits the segment's
|
||||
// Rate for all t < Until. The final segment's Rate is held indefinitely.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue