feat: named case-result load combinations with full GUI support
Snapshots the current development tree, headlined by proper load combinations (user request): a reusable LoadCombination entity of weighted completed static-case results (e.g. 1.2xDead + 1.6xLive). - core: LoadCombination/LoadCombinationItem entities, Project integration (lookup, unique ids, reference validation) - services: combinations.py (linear superposition + envelope), exported via services __init__ - commands: undoable Add/Delete/Update for combinations - GUI: Load Combinations manager dialog, Run-dialog evaluation, envelope display in Results panel, Combinations tab in Table dock - tests: unit coverage (validation, math, error paths) + integration superposition check vs a single factored run
This commit is contained in:
commit
f361fee969
560 changed files with 178701 additions and 0 deletions
56
tests/integration/test_rc_frame_earthquake.py
Normal file
56
tests/integration/test_rc_frame_earthquake.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
"""Integration test: RC Frame Earthquake example (OpenSees Ex 3.3)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("openseespy")
|
||||
|
||||
from otko.services import load_project, save_project # noqa: E402
|
||||
from otko.services.opensees_runner import OpenSeesRunner # noqa: E402
|
||||
|
||||
pytestmark = pytest.mark.slow
|
||||
|
||||
|
||||
def test_rc_frame_earthquake_runs_and_has_oscillatory_response(tmp_path) -> None: # type: ignore[no-untyped-def]
|
||||
"""Synthetic ground motion produces bounded, oscillatory response."""
|
||||
from examples.rc_frame_earthquake import (
|
||||
build_rc_frame_earthquake,
|
||||
DT,
|
||||
N_PTS,
|
||||
)
|
||||
|
||||
proj = build_rc_frame_earthquake()
|
||||
proj.validate_references()
|
||||
|
||||
osmodel = tmp_path / "eq.osmodel"
|
||||
save_project(proj, osmodel)
|
||||
reloaded = load_project(osmodel)
|
||||
reloaded.validate_references()
|
||||
|
||||
results_dir = Path(tempfile.mkdtemp(prefix="eq_"))
|
||||
result = OpenSeesRunner(reloaded).run(reloaded.analyses[0], results_dir=results_dir)
|
||||
|
||||
# Simulation covers most of the 4-second record (ModifiedNewton
|
||||
# fallback may trim a few steps at stiffness jumps; we allow that).
|
||||
assert result.n_steps >= int(
|
||||
0.9 * N_PTS
|
||||
), f"Only {result.n_steps}/{N_PTS} steps — fallback didn't recover"
|
||||
|
||||
# Node 3 Ux history: bounded, non-trivial, some positive AND some
|
||||
# negative (oscillation confirms the base excitation actually
|
||||
# propagated through the mass + damping chain, not a one-shot push).
|
||||
h3 = result.node_disp_history(3)
|
||||
ux = h3[:, 0]
|
||||
assert max(ux) > 0.05, f"max Ux {max(ux):.4f} too small — did excitation apply?"
|
||||
assert min(ux) < -0.05, f"min Ux {min(ux):.4f} — no negative excursion"
|
||||
# Drift stays reasonable (< 10% of column height).
|
||||
assert max(abs(ux)) < 14.4, f"|Ux|_max = {max(abs(ux)):.2f} exceeds 10% drift"
|
||||
|
||||
# Uy on the top nodes — small compared to Ux (gravity holds, base
|
||||
# excitation is horizontal).
|
||||
uy = h3[:, 1]
|
||||
assert max(abs(uy)) < 1.0, f"max |Uy| = {max(abs(uy)):.4f} in too large"
|
||||
Loading…
Reference in a new issue