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

Functions

ComponentInstance _pipe (**Param overrides)
None test_laminar_pipe_matches_hagen_poiseuille ()
None test_elevation_is_exactly_rho_g_h ()
None test_a_fitting_drops_exactly_K_dynamic_heads ()
None test_a_valve_reproduces_the_definition_of_cv ()
None test_valve_pressure_drop_does_not_depend_on_bore (float bore_mm)
None test_orifice_cd_inverts_the_bernoulli_relation ()
None test_iso5167_orifice_round_trips_through_the_standard ()
None test_the_friction_correlation_is_a_configuration_choice ()
None test_an_unknown_friction_method_is_rejected_at_load ()
None test_valve_characteristics_follow_iec_shapes (str characteristic, float at_half)
None test_a_shut_valve_keeps_a_seat_leak_rather_than_zero_capacity ()
None test_a_check_valve_is_asymmetric ()
None test_cracking_pressure_must_be_overcome ()
None test_lox_through_a_feed_line_is_physically_sensible ()
None test_choking_is_reported_when_the_fluid_state_supports_it ()
None test_an_impossible_operating_point_says_what_is_wrong ()
None test_a_valve_command_is_component_scoped ()

Variables

 M = Provenance.MANUFACTURER
float PSI = 6894.757293168361
float GPM = 3.785411784e-3 / 60.0
 WATER = FlowConditions(rho=999.0, mu=1.138e-3, p_upstream=5.0 * PSI)

Detailed Description

Do the components reproduce results that exist outside this codebase?

Phase 03's exit criterion. Every check here is against something independent --
a closed-form solution, or the definition of a unit, or a coefficient whose
value is fixed by a standard. None of them checks this package against itself.

The strongest ones are the *definitional* checks. A valve with Cv = 1 passing
one US gallon per minute of water must drop exactly one psi, because that is
what Cv means. A fitting with K = 1 must drop exactly one dynamic head, because
that is what K means. Those cannot drift without something being genuinely
wrong, and they exercise the whole path -- unit conversion, parameter
resolution, correlation adapter -- rather than one function.

Where a correlation has no closed form, the check is that ``fluids`` and this
package agree, which tests the adapter and not the physics. That distinction is
kept explicit in each docstring, because a test that looks like validation and
is really a tautology is worse than no test.

Function Documentation

◆ _pipe()

ComponentInstance test_comps_validation._pipe ( **Param overrides)
protected

◆ test_a_check_valve_is_asymmetric()

None test_comps_validation.test_a_check_valve_is_asymmetric ( )
Forward it is a valve with a cracking pressure; backward it is shut.

The first component whose behaviour is not a smooth function of flow, and
the reason the solver interface has to be residual-based rather than
``dp(mdot)``. Worth re-checking when Phase 04 settles that interface.

Definition at line 319 of file test_comps_validation.py.

◆ test_a_fitting_drops_exactly_K_dynamic_heads()

None test_comps_validation.test_a_fitting_drops_exactly_K_dynamic_heads ( )
K is defined as ``dp / (rho v^2 / 2)``. A sharp exit has K = 1 exactly.

So the drop through it must equal one dynamic head to machine precision --
a definitional check on the fitting adapter, the velocity calculation and
the dynamic head together.

Definition at line 97 of file test_comps_validation.py.

◆ test_a_shut_valve_keeps_a_seat_leak_rather_than_zero_capacity()

None test_comps_validation.test_a_shut_valve_keeps_a_seat_leak_rather_than_zero_capacity ( )
Exactly zero capacity is a singular network, not a closed valve.

Definition at line 306 of file test_comps_validation.py.

◆ test_a_valve_command_is_component_scoped()

None test_comps_validation.test_a_valve_command_is_component_scoped ( )
Two valves must not move together because they share a signal name.

An unqualified ``"command"`` reaching every valve converges perfectly and
models a system nobody built, so the component looks for its own id first.

Definition at line 435 of file test_comps_validation.py.

◆ test_a_valve_reproduces_the_definition_of_cv()

None test_comps_validation.test_a_valve_reproduces_the_definition_of_cv ( )
Cv = 1 passing 1 US gpm of water drops 1 psi. That is what Cv *means*.

The keystone check of the valve model: it goes through the flow-coefficient
unit, the Cv-to-K conversion and the dynamic head, and its expected value
comes from the definition of the unit rather than from any library.

``dp = SG (Q/Cv)^2``, so at SG = 0.999 the answer is 0.999 psi, not 1.000.

Definition at line 120 of file test_comps_validation.py.

◆ test_an_impossible_operating_point_says_what_is_wrong()

None test_comps_validation.test_an_impossible_operating_point_says_what_is_wrong ( )
A flow that cannot pass should say so, not fail inside a root find.

``fluids`` reports this as a bracketing failure several frames down, which
tells a solver author nothing. Phase 04 will want to catch this and back off
a step, and it can only do that if the failure is identifiable.

Definition at line 410 of file test_comps_validation.py.

◆ test_an_unknown_friction_method_is_rejected_at_load()

None test_comps_validation.test_an_unknown_friction_method_is_rejected_at_load ( )

Definition at line 271 of file test_comps_validation.py.

◆ test_choking_is_reported_when_the_fluid_state_supports_it()

None test_comps_validation.test_choking_is_reported_when_the_fluid_state_supports_it ( )
IEC 60534 choked flow needs a saturation and a critical pressure.

Where they are unknown the limit is reported as absent rather than
fabricated -- a valve on an unspecified fluid should not claim to know
where it chokes.

Definition at line 388 of file test_comps_validation.py.

◆ test_cracking_pressure_must_be_overcome()

None test_comps_validation.test_cracking_pressure_must_be_overcome ( )
At vanishing flow the drop tends to the cracking pressure, not to zero.

Definition at line 341 of file test_comps_validation.py.

◆ test_elevation_is_exactly_rho_g_h()

None test_comps_validation.test_elevation_is_exactly_rho_g_h ( )
Static head, with no flow, is not a correlation -- it is arithmetic.

Reported through ``static_head`` rather than ``pressure_drop`` because it
does not reverse with the flow; see test_audit_regressions for the bug that
distinction fixed. Ten metres of LOX is about 1.6 bar, so omitting it in a
tall vehicle is a real error, not a refinement.

Definition at line 78 of file test_comps_validation.py.

References _pipe().

◆ test_iso5167_orifice_round_trips_through_the_standard()

None test_comps_validation.test_iso5167_orifice_round_trips_through_the_standard ( )
Agreement with ``fluids``, which implements ISO 5167 -- an adapter check.

This asserts that the arguments are passed correctly and the sign of the
result is right, not that Reader-Harris/Gallagher is correct. Stated plainly
because the difference matters: a passing test here is evidence about this
package, not about the standard.

Definition at line 193 of file test_comps_validation.py.

◆ test_laminar_pipe_matches_hagen_poiseuille()

None test_comps_validation.test_laminar_pipe_matches_hagen_poiseuille ( )
The one pipe case with an exact analytic solution.

``dp = 128 mu L Q / (pi D^4)``, equivalently f = 64/Re. Exact, no
correlation involved, so any disagreement is an error in the friction
factor, the Reynolds number, the dynamic head, or the unit conversion --
which between them is most of the pipe model.

Definition at line 54 of file test_comps_validation.py.

References _pipe().

◆ test_lox_through_a_feed_line_is_physically_sensible()

None test_comps_validation.test_lox_through_a_feed_line_is_physically_sensible ( )
An end-to-end sanity check on real propellant, not a pinned number.

Phase 12 is what validates against measured hardware. This asserts only
that the pieces connect and the result sits in a defensible range -- which
is the honest claim available before there is any test data.

Definition at line 360 of file test_comps_validation.py.

◆ test_orifice_cd_inverts_the_bernoulli_relation()

None test_comps_validation.test_orifice_cd_inverts_the_bernoulli_relation ( )
``m = Cd A sqrt(2 rho dp)``, solved for dp and checked forward.

Definition at line 170 of file test_comps_validation.py.

◆ test_the_friction_correlation_is_a_configuration_choice()

None test_comps_validation.test_the_friction_correlation_is_a_configuration_choice ( )
Different correlations, same order of magnitude, different answers.

Which explicit approximation to Colebrook a project uses is a modelling
decision. This asserts both halves of that: the option genuinely changes the
result, and the alternatives agree to within a couple of percent, so the
choice is a refinement rather than a coin flip.

Definition at line 238 of file test_comps_validation.py.

References max, and min.

◆ test_valve_characteristics_follow_iec_shapes()

None test_comps_validation.test_valve_characteristics_follow_iec_shapes ( str characteristic,
float at_half )
Half travel gives very different capacity depending on the trim.

Definition at line 290 of file test_comps_validation.py.

◆ test_valve_pressure_drop_does_not_depend_on_bore()

None test_comps_validation.test_valve_pressure_drop_does_not_depend_on_bore ( float bore_mm)
Cv already accounts for the valve's geometry.

K does depend on bore, and Cv-to-K converts between them -- so if the two
were inconsistent, the drop would move with a diameter that Cv has already
priced in. A silent factor-of-several error, and this is what catches it.

Definition at line 147 of file test_comps_validation.py.

Variable Documentation

◆ GPM

float test_comps_validation.GPM = 3.785411784e-3 / 60.0

Definition at line 36 of file test_comps_validation.py.

◆ M

test_comps_validation.M = Provenance.MANUFACTURER

Definition at line 34 of file test_comps_validation.py.

◆ PSI

float test_comps_validation.PSI = 6894.757293168361

Definition at line 35 of file test_comps_validation.py.

◆ WATER

test_comps_validation.WATER = FlowConditions(rho=999.0, mu=1.138e-3, p_upstream=5.0 * PSI)

Definition at line 39 of file test_comps_validation.py.