STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_blowdown_tank_resolve.py
Go to the documentation of this file.
1"""Tests for blowdown tank volume / propellant resolution."""
2
3import pytest
4from types import SimpleNamespace
5
6from copv.blowdown_solver import (
7 resolve_blowdown_tank_state,
8 resolve_tank_volume_m3,
9 split_propellant_by_of,
10)
11
12
14 return SimpleNamespace(
15 fluids={
16 "oxidizer": SimpleNamespace(density=1140.0),
17 "fuel": SimpleNamespace(density=422.0),
18 },
19 design_requirements=SimpleNamespace(optimal_of_ratio=3.5),
20 lox_tank=SimpleNamespace(tank_volume_m3=0.017474, mass=6.75),
21 fuel_tank=SimpleNamespace(tank_volume_m3=0.011109, mass=7.0),
22 )
23
24
26 m_o, m_f = split_propellant_by_of(13.75, 3.5)
27 assert m_o + m_f == pytest.approx(13.75)
28 assert m_o / m_f == pytest.approx(3.5)
29
30
32 vol = resolve_tank_volume_m3(
33 tank_volume_m3=None,
34 ullage_volume_m3=0.011,
35 propellant_mass_kg=6.75,
36 density_kg_m3=1140.0,
37 tank_name="LOX",
38 )
39 assert vol == pytest.approx(0.011 + 6.75 / 1140.0)
40
41
43 config = _mock_config()
44 V_lox, m_lox, _, V_fuel, m_fuel, _ = resolve_blowdown_tank_state(
45 config,
46 total_propellant_kg=13.75,
47 of_ratio=3.5,
48 lox_tank_volume_m3=0.017474,
49 fuel_tank_volume_m3=0.011109,
50 )
51 assert m_lox + m_fuel == pytest.approx(13.75)
52 assert m_lox / m_fuel == pytest.approx(3.5)
53 assert V_lox == pytest.approx(0.017474)
54 assert V_fuel == pytest.approx(0.011109)
55
56
58 with pytest.raises(ValueError, match="too small"):
59 resolve_tank_volume_m3(
60 tank_volume_m3=0.001,
61 ullage_volume_m3=None,
62 propellant_mass_kg=6.75,
63 density_kg_m3=1140.0,
64 tank_name="LOX",
65 )