pub fn weakest_margin(
aero: &AeroModel,
mach: f64,
cg_station_m: f64,
) -> Result<Margin, SimError>Expand description
The least margin of aero at Mach mach, the air along the axis, over the direction it
crosses the rocket, with the center of mass at cg_station_m: margin in the weakest plane,
whose direction it gives (Margin::roll_rad); or a plane where no margin can be given, if
there is one (#329).
A fin set of one or two fins carries Σ sin²(φ − θ_k) of its force in the plane at φ
(Niskanen 2009 eq. 3.51, hpr_aero::roll_sum), so a rocket with one (AeroModel::rolls)
has a margin in each plane. Each of its terms is then a + b cos 2φ + c sin 2φ, and so are the
net slope S(φ), its moment M(φ) = Σ C_Nα,i x_i, and the sum of the slopes’ magnitudes
Σ(φ) while each fin’s slope is positive: three planes, φ = 0, π/3, 2π/3, give each sum’s
a, b and c. A quotient N/D of two such sums is stationary where
P sin 2φ + Q cos 2φ + R = 0, with P = n₀d₁ − n₁d₀, Q = n₂d₀ − n₀d₂ and
R = n₂d₁ − n₁d₂ (its derivative’s numerator, N′D − ND′, expanded). The center of pressure
M/S is foremost at one of its two roots, and the margin’s conditioning S/Σ
(MARGIN_CONDITION_LIMIT) worst at one of its. Each root, and the axial plane, is evaluated
through the model: a plane with no margin wins, else the least margin. A rocket whose fin sets
are each of three or more fins, or that flies a normal-force table, has one margin, the axial
plane’s, returned bit for bit.
§Errors
As margin.