Drop unit suffixes from steel-beam variables and results
Rename calc.py locals and result keys, add inline unit comments, and normalize Lp/Lr/Lb to feet. Update steel-beam.typ references and the tests (current W10X15 input, --stdout summary behavior).
This commit is contained in:
parent
6ed3246555
commit
ddd5ecff58
5 changed files with 129 additions and 133 deletions
|
|
@ -35,42 +35,42 @@ def test_typst_load_demands_match_checked_inputs():
|
|||
assert len(published) == 1
|
||||
derived = published[0]["value"]
|
||||
values = result()["values"]
|
||||
assert derived["Mu_kipft"] == pytest.approx(values["moment_kipft"], abs=0.001)
|
||||
assert derived["Vu_kip"] == pytest.approx(values["shear_kip"], abs=0.001)
|
||||
assert derived["Mu"] == pytest.approx(values["moment"], abs=0.001)
|
||||
assert derived["Vu"] == pytest.approx(values["shear"], abs=0.001)
|
||||
|
||||
|
||||
def test_ground_truth_section_properties():
|
||||
def test_section_properties():
|
||||
values = result()["values"]
|
||||
assert values["section_d"] == pytest.approx(5.875)
|
||||
assert values["section_A"] == pytest.approx(2.52)
|
||||
assert values["section_Sx"] == pytest.approx(5.1)
|
||||
assert values["section_Zx"] == pytest.approx(5.73)
|
||||
assert values["section_rts"] == pytest.approx(1.05)
|
||||
assert values["section_d"] == pytest.approx(10.0)
|
||||
assert values["section_A"] == pytest.approx(4.41)
|
||||
assert values["section_Sx"] == pytest.approx(13.8)
|
||||
assert values["section_Zx"] == pytest.approx(16.0)
|
||||
assert values["section_rts"] == pytest.approx(1.01)
|
||||
|
||||
|
||||
def test_ground_truth_demands_and_flexure():
|
||||
def test_demands_and_flexure():
|
||||
output = result()
|
||||
values = output["values"]
|
||||
assert values["point_load_lbf"] == pytest.approx(7500)
|
||||
assert values["moment_kipft"] == pytest.approx(9.375)
|
||||
assert values["shear_kip"] == pytest.approx(3.75)
|
||||
assert values["Lp_in"] == pytest.approx(37.7, abs=0.1)
|
||||
assert values["Lr_ft"] == pytest.approx(9.48, abs=0.01)
|
||||
assert values["Fcr_ksi"] == pytest.approx(99.57, abs=0.25)
|
||||
assert values["Mp_kipft"] == pytest.approx(23.875)
|
||||
assert values["MnLTB_kipft"] == pytest.approx(21.235, abs=0.01)
|
||||
assert values["phiMn_kipft"] == pytest.approx(19.1, abs=0.1)
|
||||
assert values["moment"] == pytest.approx(8.124)
|
||||
assert values["shear"] == pytest.approx(3.611)
|
||||
assert values["Lp"] == pytest.approx(2.861, abs=0.01)
|
||||
assert values["Lr"] == pytest.approx(8.609, abs=0.01)
|
||||
assert values["Lb"] == pytest.approx(9.0)
|
||||
assert values["Fcr"] == pytest.approx(32.556, abs=0.01)
|
||||
assert values["Mp"] == pytest.approx(66.667, abs=0.01)
|
||||
assert values["MnLTB"] == pytest.approx(37.439, abs=0.01)
|
||||
assert values["phiMn"] == pytest.approx(33.695, abs=0.01)
|
||||
assert output["checks"]["flexure"]["ok"] is True
|
||||
|
||||
|
||||
def test_ground_truth_shear_and_deflection():
|
||||
def test_shear_and_deflection():
|
||||
output = result()
|
||||
values = output["values"]
|
||||
assert values["Aw_in2"] == pytest.approx(1.102, abs=0.001)
|
||||
assert values["Aw"] == pytest.approx(2.5)
|
||||
assert values["Cv1"] == pytest.approx(1)
|
||||
assert values["phiVn_kip"] == pytest.approx(33.047, abs=0.1)
|
||||
assert values["delta_limit_in"] == pytest.approx(0.25)
|
||||
assert values["delta_in"] == pytest.approx(0.078, abs=0.001)
|
||||
assert values["phiVn"] == pytest.approx(75.0)
|
||||
assert values["delta_limit"] == pytest.approx(0.45)
|
||||
assert values["delta"] == pytest.approx(0.040559, abs=1e-5)
|
||||
assert all(output["checks"][name]["ok"] for name in ("shear", "deflection"))
|
||||
|
||||
|
||||
|
|
@ -79,14 +79,14 @@ def test_invalid_section_is_rejected():
|
|||
module.compute({**yaml.safe_load((HERE / "input.yaml").read_text()), "section": "W0X0"})
|
||||
|
||||
|
||||
def test_cli_can_write_json_to_stdout():
|
||||
def test_cli_stdout_prints_summary():
|
||||
completed = subprocess.run(
|
||||
[sys.executable, str(HERE / "calc.py"), "--input", str(HERE / "input.yaml"), "--stdout"],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
output = json.loads(completed.stdout)
|
||||
assert output["section"] == "W6X8.5"
|
||||
assert output["values"]["moment_kipft"] == pytest.approx(9.375)
|
||||
assert completed.stderr == ""
|
||||
assert "Steel Beam Design Summary" in completed.stdout
|
||||
assert "Section: W10X15" in completed.stdout
|
||||
assert "Flexure: OK" in completed.stdout
|
||||
|
|
|
|||
Loading…
Reference in a new issue