|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| None | test_conversion_to_si (float value, str unit, float expected) |
| None | test_conversion_round_trips (float value, str unit, float _expected) |
| None | test_temperature_carries_an_offset () |
| None | test_temperature_difference_is_a_separate_dimension () |
| None | test_cv_and_kv_convert_through_the_standard_factor () |
| None | test_a_wrong_dimension_is_rejected_by_name () |
| None | test_an_unknown_unit_points_at_the_registry () |
| None | test_gauge_and_absolute_are_spelled_out_and_bare_is_a_difference () |
| None | test_every_dimension_has_a_canonical_unit () |
| None | test_a_unit_can_be_added_from_outside () |
Variables | |
| list | CONVERSIONS |
Unit conversion, and the dimension check that catches the expensive mistake. Unit confusion is the most costly recurring error in this field and the easiest to prevent, provided the prevention sits at a boundary rather than in everyone's memory. These tests hold that boundary. Conversion factors are checked against exact definitions where one exists -- an inch is 0.0254 m by definition, not by measurement -- so a typo in a factor fails rather than shifting every result by a fraction of a percent.
| None test_model_units.test_a_unit_can_be_added_from_outside | ( | ) |
Definition at line 128 of file test_model_units.py.
| None test_model_units.test_a_wrong_dimension_is_rejected_by_name | ( | ) |
The whole point: the message says what was expected and what was given.
Definition at line 89 of file test_model_units.py.
| None test_model_units.test_an_unknown_unit_points_at_the_registry | ( | ) |
No close match for this one, so it should still say where to look.
Definition at line 99 of file test_model_units.py.
| None test_model_units.test_conversion_round_trips | ( | float | value, |
| str | unit, | ||
| float | _expected ) |
Definition at line 51 of file test_model_units.py.
| None test_model_units.test_conversion_to_si | ( | float | value, |
| str | unit, | ||
| float | expected ) |
Definition at line 46 of file test_model_units.py.
| None test_model_units.test_cv_and_kv_convert_through_the_standard_factor | ( | ) |
Cv/Kv comes from IEC 60534 via ``fluids``, not from a literal here. The same constant the Phase 03 valve correlations will use, so a valve authored in Kv and one authored in Cv cannot disagree.
Definition at line 76 of file test_model_units.py.
| None test_model_units.test_every_dimension_has_a_canonical_unit | ( | ) |
Guards the reverse lookup used to label output. ``si_unit_of`` scans for the unit with factor 1.0; a dimension whose units all have factors would make it raise, and only at report time.
Definition at line 118 of file test_model_units.py.
| None test_model_units.test_gauge_and_absolute_are_spelled_out_and_bare_is_a_difference | ( | ) |
``psig`` is one standard atmosphere above ``psia``; bare ``psi`` carries no offset, so it converts a *difference* exactly. Which a drawing's bare pressure means is decided per parameter (feedtwin.model.pressure), never by the unit table.
Definition at line 105 of file test_model_units.py.
| None test_model_units.test_temperature_carries_an_offset | ( | ) |
The one dimension where a scale factor alone is wrong.
Definition at line 55 of file test_model_units.py.
| None test_model_units.test_temperature_difference_is_a_separate_dimension | ( | ) |
A 20 K rise and a 20 K absolute temperature are not the same quantity. Sharing a dimension would let a temperature *difference* be written where an absolute temperature belongs and convert with a 273.15 offset applied -- a silent 273 K error in a heat balance.
Definition at line 63 of file test_model_units.py.
| list test_model_units.CONVERSIONS |
Definition at line 29 of file test_model_units.py.