STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_balance Namespace Reference

Functions

EngineDesign _design (*, float ox_area=99.245e-6, float fuel_area=75.125e-6, float mr=1.65)
float _orifice (float area, float cd, float rho, float dp)
MixtureBalance _balance (*, float dp_ox, float dp_fuel, float cd=0.6, float pc=2.0e6, float rho_ox=1140.0, float rho_fuel=789.0, EngineDesign|None design=None)
None test_identity_is_exact (float dp_ox, float dp_fuel)
None test_face_ratio_does_not_move_with_the_plumbing ()
None test_equal_drop_is_the_face_ratio ()
None test_face_ratio_matches_its_closed_form ()
None test_symmetric_injector_on_one_propellant_is_unity ()
None test_stiffness_is_the_share_of_chamber_pressure ()
None test_feed_loss_never_goes_negative ()
None test_soft_leg_is_reported_and_stiff_one_is_not ()
None test_notes_blame_the_face_when_the_face_is_wrong ()
None test_notes_blame_the_stand_when_the_face_is_right ()
None test_trim_pressure_lands_on_the_design_ratio ()
None test_trim_is_zero_when_already_on_design ()
None test_a_dead_leg_does_not_raise ()
None test_a_leg_flowing_backwards_does_not_raise ()
EngineDesign _banded (tuple[float, float] ox, tuple[float, float] fuel)
None test_the_configs_band_is_used_over_the_rule_of_thumb ()
None test_the_rule_of_thumb_is_named_as_such_when_there_is_no_band ()
None test_a_leg_inside_its_band_draws_no_comment ()
None test_too_stiff_is_reported_too ()
None test_a_band_is_read_off_the_real_config ()

Detailed Description

The mixture-ratio split: is it exact, and does it blame the right half?

The claim :mod:`feedtwin.engine.balance` makes is unusually strong for a
diagnostic -- not "this correlates with" but "this is identically equal to". So
the tests are correspondingly strict: the identity is checked to machine
precision rather than to a tolerance, and the two terms are checked to be
*independent* in the way the claim requires. A face ratio that moved when the
plumbing changed would make the whole decomposition a lie, and it would be a
comfortable lie -- the numbers would still add up.

Function Documentation

◆ _balance()

◆ _banded()

EngineDesign test_balance._banded ( tuple[float, float] ox,
tuple[float, float] fuel )
protected

◆ _design()

◆ _orifice()

float test_balance._orifice ( float area,
float cd,
float rho,
float dp )
protected

Definition at line 41 of file test_balance.py.

Referenced by _balance().

◆ test_a_band_is_read_off_the_real_config()

None test_balance.test_a_band_is_read_off_the_real_config ( )
The end-to-end claim: this number comes out of EngineDesign's own file.

Definition at line 297 of file test_balance.py.

◆ test_a_dead_leg_does_not_raise()

None test_balance.test_a_dead_leg_does_not_raise ( )
Zero fuel flow is a real state during an ox lead. It must report zero
rather than divide, because the start transient is sampled through it.

Definition at line 210 of file test_balance.py.

References _design().

◆ test_a_leg_flowing_backwards_does_not_raise()

None test_balance.test_a_leg_flowing_backwards_does_not_raise ( )
An Engine Abort with the mains open trickles: the chamber can sit above
the ox injector inlet while fuel still drops forwards. sqrt(dp_ox/dp_fuel)
of that raised a math domain error, and the cockpit's /history failed on
every frame until the stand was reset (D-53).

Definition at line 229 of file test_balance.py.

References _design().

◆ test_a_leg_inside_its_band_draws_no_comment()

None test_balance.test_a_leg_inside_its_band_draws_no_comment ( )

Definition at line 282 of file test_balance.py.

References _balance(), and _banded().

◆ test_equal_drop_is_the_face_ratio()

None test_balance.test_equal_drop_is_the_face_ratio ( )
With both legs at the same drop, the stand contributes exactly nothing.

Definition at line 103 of file test_balance.py.

References _balance().

◆ test_face_ratio_does_not_move_with_the_plumbing()

None test_balance.test_face_ratio_does_not_move_with_the_plumbing ( )
Change only the pressure split; the face term must not budge.

The independence claim. If the face ratio drifted with the feed system, the
split would still sum correctly and would no longer localise the fault --
which is the only reason to compute it.

Definition at line 90 of file test_balance.py.

References _balance().

◆ test_face_ratio_matches_its_closed_form()

None test_balance.test_face_ratio_matches_its_closed_form ( )
``Cd A sqrt(rho)`` on each side, computed independently.

Definition at line 110 of file test_balance.py.

References _balance(), and _design().

◆ test_feed_loss_never_goes_negative()

None test_balance.test_feed_loss_never_goes_negative ( )
A supply below the chamber is a nonsense operating point, not a negative
loss that would read as the plumbing adding pressure.

Definition at line 140 of file test_balance.py.

◆ test_identity_is_exact()

None test_balance.test_identity_is_exact ( float dp_ox,
float dp_fuel )
``O/F == face_ratio * feed_term``, to floating point and no further.

This is the whole basis of the decomposition. A tolerance here would hide
exactly the algebra slip the test exists to catch, so it is checked at
1e-12 relative -- the residual on real solves comes out at 1e-16.

Definition at line 76 of file test_balance.py.

References _balance().

◆ test_notes_blame_the_face_when_the_face_is_wrong()

None test_balance.test_notes_blame_the_face_when_the_face_is_wrong ( )
A face drilled off-design at a perfectly balanced stand must not be
reported as a plumbing problem -- that sends the wrong person to work.

Definition at line 160 of file test_balance.py.

References _balance(), and _design().

◆ test_notes_blame_the_stand_when_the_face_is_right()

None test_balance.test_notes_blame_the_stand_when_the_face_is_right ( )

Definition at line 169 of file test_balance.py.

References _balance(), and _design().

◆ test_soft_leg_is_reported_and_stiff_one_is_not()

None test_balance.test_soft_leg_is_reported_and_stiff_one_is_not ( )

Definition at line 150 of file test_balance.py.

References _balance().

◆ test_stiffness_is_the_share_of_chamber_pressure()

None test_balance.test_stiffness_is_the_share_of_chamber_pressure ( )

Definition at line 134 of file test_balance.py.

◆ test_symmetric_injector_on_one_propellant_is_unity()

None test_balance.test_symmetric_injector_on_one_propellant_is_unity ( )
Same area, same fluid, same drop -- there is nowhere for a ratio to come
from, and a decomposition that produced one would be inventing it.

Definition at line 120 of file test_balance.py.

References _balance(), and _design().

◆ test_the_configs_band_is_used_over_the_rule_of_thumb()

None test_balance.test_the_configs_band_is_used_over_the_rule_of_thumb ( )
EngineDesign states injector_dp_ratio_{O,F}_min in its own config. That
is what the optimiser was constrained by; the 20% rule is only the fallback
for a config that says nothing.

Definition at line 264 of file test_balance.py.

References _balance(), and _banded().

◆ test_the_rule_of_thumb_is_named_as_such_when_there_is_no_band()

None test_balance.test_the_rule_of_thumb_is_named_as_such_when_there_is_no_band ( )

Definition at line 276 of file test_balance.py.

References _balance().

◆ test_too_stiff_is_reported_too()

None test_balance.test_too_stiff_is_reported_too ( )
The band has an upper bound and the rule of thumb does not. Past it the
injector is spending tank pressure the design did not mean to spend.

Definition at line 288 of file test_balance.py.

References _balance(), and _banded().

◆ test_trim_is_zero_when_already_on_design()

None test_balance.test_trim_is_zero_when_already_on_design ( )

Definition at line 196 of file test_balance.py.

References _balance(), and _design().

◆ test_trim_pressure_lands_on_the_design_ratio()

None test_balance.test_trim_pressure_lands_on_the_design_ratio ( )
Apply the recommended fuel-side drop and the O/F must come out right.

Checked by rebuilding the balance at the trimmed drop rather than by
re-deriving the formula, so an algebra error in :meth:`trim_pressure`
cannot be reproduced by the test that is supposed to catch it.

Definition at line 179 of file test_balance.py.

References _balance(), and _design().