calcPowderSensCoeff function
Calculates powder sensitivity coefficient (fractional velocity change per 15°C)/// from two raw measurement pairs without requiring an Ammo object. from two raw measurement pairs without requiring an Ammo object.
v0Mps/t0C— reference muzzle velocity and powder temperaturev1Mps/t1C— secondary measured velocity and temperature
Returns null when the pair is degenerate:
- either velocity is non-positive
- velocities are equal (no Δv)
- temperatures are equal (no Δt)
Implementation
double? calcPowderSensCoeff(
double v0Mps,
double t0C,
double v1Mps,
double t1C,
) {
if (v0Mps <= 0 || v1Mps <= 0) return null;
final double vDelta = (v0Mps - v1Mps).abs();
final double tDelta = (t0C - t1C).abs();
if (vDelta == 0 || tDelta == 0) return null;
final double vLower = v1Mps < v0Mps ? v1Mps : v0Mps;
return (vDelta / tDelta) * (15.0 / vLower);
}