Files
willtools-demo/panellift/tests/test_derating.py
T
will 8e6ee31596
ci / test (push) Successful in 6m18s
WillTools 2026-09-09 -- clean snapshot of the development repo for review
History-free snapshot of the private development repository at cbe45c5
(2026-09-09). Code, docs and public catalogue only; no plant or job
knowledge layers, no client or job names (tools/scrub.py clean). The
intro deck is left out of this snapshot because its slide images could
not be checked for job drawings.
2026-09-09 08:32:15 -05:00

73 lines
2.7 KiB
Python

# -*- coding: utf-8 -*-
"""An insert is worth less at release than at 28 days.
A catalogue rating is derived at one concrete strength and the anchor pulls a
cone of concrete out, so below that strength the capacity follows sqrt(f'c).
One handling report checks the same insert at stripping AND at erection, which
is why the rating cannot be derated once on the way in: it has to be done per
stage, at the strength that stage actually has.
"""
import dataclasses
import pytest
from conftest import make_panel
from panellift import checks, pci, statics
from panellift.model import Stage
def rated_panel(basis=3500.0, capacity=8000.0):
panel = make_panel()
return dataclasses.replace(panel, lifters=[
dataclasses.replace(l, capacity_lb=capacity, basis_fc_psi=basis)
for l in panel.lifters])
# ------------------------------------------------------------- the factor
def test_below_the_basis_it_follows_the_square_root():
assert pci.insert_derate(3500.0, 2500.0) == pytest.approx(0.8452, abs=1e-4)
def test_at_or_above_the_basis_nothing_is_gained():
"""Past the basis the anchor's own steel governs; stronger concrete around
it does not make the anchor stronger."""
assert pci.insert_derate(3500.0, 3500.0) == 1.0
assert pci.insert_derate(3500.0, 6000.0) == 1.0
def test_an_unstated_basis_does_not_silently_reduce_a_rating():
assert pci.insert_derate(None, 2500.0) == 1.0
assert pci.insert_derate(3500.0, None) == 1.0
# --------------------------------------------------------- through a check
def test_the_same_insert_is_rated_differently_at_two_stages():
panel = rated_panel()
lifter = panel.lifters[0]
at_release = Stage('stripping', 1.3, 2500.0)
at_28 = Stage('erection', 1.2, 6000.0)
assert checks.rated(lifter, at_release) == pytest.approx(6761, abs=1)
assert checks.rated(lifter, at_28) == pytest.approx(8000, abs=1)
def test_the_capacity_check_uses_the_derated_number(rolling):
panel = rated_panel()
stage = Stage('stripping', 1.3, 2500.0)
a = statics.analyse(panel, stage, rolling, role='strip')
inserts = [f for f in checks.check_insert_capacity(a, rolling)
if f.code == 'INSERT']
assert inserts
assert 'derated from 8,000 lb' in inserts[0].message
def test_no_basis_means_the_rating_is_taken_as_stated(rolling):
"""A plant that types a number into capacity_lb meant that number."""
panel = rated_panel(basis=None)
stage = Stage('stripping', 1.3, 2500.0)
a = statics.analyse(panel, stage, rolling, role='strip')
inserts = [f for f in checks.check_insert_capacity(a, rolling)
if f.code == 'INSERT']
assert inserts and 'derated' not in inserts[0].message