diff --git a/CHANGELOG.md b/CHANGELOG.md index da0c067..8ccdd3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,16 @@ All notable changes to CableXSec are recorded in this file. The format follows ### Added +- `compute_neutral_axes(..., core_friction=...)`: the biaxial section moment adds the + stick-slip law of the laid power cores, their internal wire rings and the filler profiles + (`core_friction_history` over the same curvature history), so that a global model's + `(kx, ky)` history gives the section moment of the full accounting, not only of the armour. + The core contact loads are those of the bounded model at the reference tension (the first + sample of the tension history), as in `compute_mkappa`; a planar history gives the moment + of `compute_mkappa` with the same options to round-off (tests at 0 and 90 degrees). + `NeutralAxisResult.core_moment_Nm` holds the core share and `ei_max_Nm2` adds the core stick + stiffness. Without `core_friction` the result is unchanged bit for bit. + - Su et al. (2026) 35 kV torsion checked term by term against the source's analytical model (targets registered before the run): armour torque 193.3 / 170.8 kN m² clockwise / anticlockwise against its Fig. 19 shares 193.0 / 172.3 (band 2 %), and at 1000 N m the diff --git a/doc/user_guide.md b/doc/user_guide.md index e0ced6c..22c1ed6 100644 --- a/doc/user_guide.md +++ b/doc/user_guide.md @@ -113,7 +113,8 @@ for screening. `cx.compute_tape_fatigue`): slip regime and wear of the armour contacts, the wire screen along the {term}`core lay`, and the strain-life of tapes. - **{term}`Neutral axis ` under a load history** (`cx.compute_neutral_axes`): where the - armour sticks and slips as the {term}`bending direction` turns. + armour sticks and slips as the {term}`bending direction` turns, and the biaxial section moment + of the history (armour, optionally with the laid-core law: `core_friction`). ### 2.6 Thermal and electrical diff --git a/src/cablexsec/analysis/neutral_axis.py b/src/cablexsec/analysis/neutral_axis.py index 9ed3849..4620f01 100644 --- a/src/cablexsec/analysis/neutral_axis.py +++ b/src/cablexsec/analysis/neutral_axis.py @@ -39,7 +39,8 @@ The number of sign changes is returned so that this can be seen. 4. **Moment direction**: the direction ``psi`` of the section moment ``m = sum_L m_L + EI_min b`` conjugate to ``b`` (the moment-curvature law - of :func:`cablexsec.compute_mkappa`, without core friction). The angle + of :func:`cablexsec.compute_mkappa`; with ``core_friction`` it adds the + laid-core law of :func:`cablexsec.compute_mkappa`). The angle from the curvature to a moment, ``delta = psi - theta`` wrapped to (-180, 180] deg, is positive anticlockwise. Under a curvature that turns anticlockwise at constant magnitude the moment leads: the work per unit @@ -80,6 +81,7 @@ if TYPE_CHECKING: from cablexsec.cables.schema import CableData + from cablexsec.mechanics.core_friction import CoreFrictionSpec from cablexsec.mechanics.mkappa import HelicalLayerSpec __all__ = [ @@ -171,6 +173,9 @@ class NeutralAxisResult: plus ``EI_min``.""" direction_share: float provenance: Provenance + core_moment_Nm: FloatArray | None = None + """Moment of the laid-core law (cores, internal rings, filler profiles) + in ``moment_Nm``, (samples, 2); ``None`` without core friction.""" @property def curvature_1_m(self) -> FloatArray: @@ -333,13 +338,18 @@ def neutral_axes( section_radius_m: float = math.inf, friction_model: FrictionLaw = "direction_tied", direction_share: float = DIRECTION_SHARE, + core_moment_Nm: FloatArray | None = None, + core_stick_EI_Nm2: float = 0.0, ) -> NeutralAxisResult: """Neutral axes of a section of armour ``layers`` (name, spec) over a history. ``kappa_x``, ``kappa_y`` are the axial-strain gradient [1/m]; ``axial_strain`` the strain of the cable axis (zero when ``None``); ``contact_pressure_Pa`` the ``P1+P2`` history of each layer by name (the - layer's own clamping when absent). See the module text for the quantities. + layer's own clamping when absent). ``core_moment_Nm`` (samples, 2) is the + moment of a laid-core law over the same history, added to the section + moment, and ``core_stick_EI_Nm2`` its stick stiffness, added to + ``ei_max_Nm2``. See the module text for the quantities. """ kx = np.asarray(kappa_x, dtype=np.float64) ky = np.asarray(kappa_y, dtype=np.float64) @@ -354,6 +364,19 @@ def neutral_axes( raise CableInputError("EI_min must be finite and non-negative") if not section_radius_m > 0.0: raise CableInputError("the section radius must be positive") + if not (math.isfinite(core_stick_EI_Nm2) and core_stick_EI_Nm2 >= 0.0): + raise CableInputError( + "the core stick stiffness must be finite and non-negative" + ) + core: FloatArray | None = None + if core_moment_Nm is not None: + core = np.asarray(core_moment_Nm, dtype=np.float64) + if core.shape != (kx.size, 2) or not np.isfinite(core).all(): + raise CableInputError( + "the core moment must be finite, one (x, y) pair per sample" + ) + elif core_stick_EI_Nm2 != 0.0: + raise CableInputError("a core stick stiffness needs the core moment") strain = ( np.zeros_like(kx) if axial_strain is None @@ -375,13 +398,19 @@ def neutral_axes( moment = ei_min_Nm2 * curvature for layer in armour: moment = moment + layer.moment_Nm + if core is not None: + moment = moment + core psi, _ = _direction(moment, share) limitations = [ "the wire bending stress is that of the slip law of the fatigue route at " "the declared clamping (and its tension increment); bending-induced " "contact redistribution is not solved", "the moment adds EI_min times the curvature to the armour wire moments; " - "core friction of laid power cores is not included", + + ( + "core friction of laid power cores is not included" + if core is None + else "it adds the laid-core law over the same history" + ), "the stress neutral axis is the diameter of the first circular harmonic; " "after a reversal the stress can change sign more than twice round a " "layer", @@ -406,7 +435,9 @@ def neutral_axes( curvature_threshold_1_m=threshold, section_radius_m=float(section_radius_m), ei_min_Nm2=float(ei_min_Nm2), - ei_max_Nm2=float(ei_min_Nm2 + sum(spec.EI_stick for _, spec in layers)), + ei_max_Nm2=float( + ei_min_Nm2 + sum(spec.EI_stick for _, spec in layers) + core_stick_EI_Nm2 + ), direction_share=share, provenance=Provenance( method=( @@ -418,6 +449,7 @@ def neutral_axes( citations=CITATIONS, limitations=tuple(limitations), ), + core_moment_Nm=core, ) @@ -453,6 +485,7 @@ def compute_neutral_axes( friction_model: FrictionLaw = "direction_tied", direction_share: float = DIRECTION_SHARE, section_radius_m: float | None = None, + core_friction: bool | CoreFrictionSpec | None = None, ) -> NeutralAxisResult: """Neutral axes of ``cable`` over a curvature history (module text). @@ -467,12 +500,31 @@ def compute_neutral_axes( force behind a direct strain, or zeros for the declared clamping alone. ``section_radius_m`` (default: the outer radius of the layers) bounds the strain neutral axis. + + ``core_friction`` (``True`` or a + :class:`~cablexsec.mechanics.core_friction.CoreFrictionSpec`) adds the + stick-slip law of the laid power cores, their internal wire rings and the + filler profiles to the section moment, as ``core_friction`` of + :func:`cablexsec.compute_mkappa` does: the biaxial history of + :func:`~cablexsec.mechanics.core_friction.core_friction_history` with the + contact loads of the bounded contact model at the reference tension (the + first sample of the tension history, zero without one). As in + :func:`cablexsec.compute_mkappa`, the core contact loads stay at that + reference while the armour contact pressure follows the history. A planar + history at a constant tension then gives, along its plane, the moment of + :func:`cablexsec.compute_mkappa` with the same options (direction-tied + armour law). ``None`` (default) keeps the armour-only moment bit for bit. """ from cablexsec.api import armour_contact_histories # noqa: PLC0415 from cablexsec.cable_adapters import ( # noqa: PLC0415 cable_to_mkappa_specs, structural_armour_layers, ) + from cablexsec.mechanics.core_friction import ( # noqa: PLC0415 + build_core_friction, + core_friction_history, + resolve_core_friction, + ) from cablexsec.mechanics.stiffness import ea_fixed, ei_min_slip # noqa: PLC0415 if tension_N is not None and axial_strain is not None: @@ -506,6 +558,17 @@ def compute_neutral_axes( names = [layer.name for layer in structural_armour_layers(cable)] if not specs: raise CableInputError("the cable has no structural armour layer") + core_spec = resolve_core_friction(core_friction) + core_moment: FloatArray | None = None + core_stick = 0.0 + if core_spec is not None: + model = build_core_friction( + cable, core_spec, reference, contact_model="bounded" + ) + core_moment = core_friction_history( + model, kx, np.asarray(kappa_y, dtype=np.float64) + ).moment_Nm + core_stick = model.stick_EI_Nm2 return neutral_axes( list(zip(names, specs, strict=True)), kx, @@ -518,4 +581,6 @@ def compute_neutral_axes( ), friction_model=friction_model, direction_share=direction_share, + core_moment_Nm=core_moment, + core_stick_EI_Nm2=core_stick, ) diff --git a/tests/test_neutral_axis.py b/tests/test_neutral_axis.py index 9071f2c..071ba55 100644 --- a/tests/test_neutral_axis.py +++ b/tests/test_neutral_axis.py @@ -383,3 +383,80 @@ def test_inputs_are_checked(cable: cx.CableData) -> None: cx.compute_neutral_axes( cable, np.zeros(2), np.zeros(2), tension_N=np.array([1.0, -1.0]) ) + + +# -- core friction in the section moment --------------------------------------- + + +_CORES = cx.CoreFrictionSpec( + mu_core_filler=0.46, mu_core_core=0.46, mu_core_sheath=0.46, filler_profiles=True +) + + +@pytest.fixture(scope="module") +def cored() -> cx.CableData: + """The public 66 kV template: laid cores, trefoil wedge and filler profiles.""" + return cx.load_cable(cx.iea_task49_66kv_yaml_path(), geometry_override=None) + + +@pytest.mark.parametrize("phi", [0.0, 0.5 * math.pi]) +def test_core_friction_moment_is_that_of_compute_mkappa_in_planar_bending( + cored: cx.CableData, phi: float +) -> None: + kappa = 0.02 * np.sin(np.linspace(0.0, 4.0 * math.pi, 401)) + tension = np.full(kappa.size, 50e3) + ref = cx.compute_mkappa( + cored, kappa, tension_N=50e3, core_friction=_CORES, phi_bend=phi + ) + result = cx.compute_neutral_axes( + cored, + kappa * math.cos(phi), + kappa * math.sin(phi), + tension_N=tension, + core_friction=_CORES, + ) + along = result.moment_Nm @ np.array([math.cos(phi), math.sin(phi)]) + scale = float(np.ptp(ref.moment_Nm)) + np.testing.assert_allclose(along, ref.moment_Nm, rtol=0.0, atol=1e-12 * scale) + assert result.ei_max_Nm2 == pytest.approx(ref.EI_max_Nm2, rel=1e-12) + assert result.core_moment_Nm is not None + # The cores add a hysteresis of their own (a moment at zero curvature). + assert float(np.max(np.abs(result.core_moment_Nm))) > 0.05 * scale + assert "laid-core law" in " ".join(result.provenance.limitations) + + +def test_core_friction_off_keeps_the_armour_moment_bit_for_bit( + cored: cx.CableData, +) -> None: + turn, kx, ky = _rotating(0.01, revolutions=1, per_revolution=120) + tension = np.full(kx.size, 50e3) # no clamping: contact from tension + base = cx.compute_neutral_axes(cored, kx, ky, tension_N=tension) + off = cx.compute_neutral_axes(cored, kx, ky, tension_N=tension, core_friction=False) + np.testing.assert_array_equal(base.moment_Nm, off.moment_Nm) + assert base.core_moment_Nm is None and off.core_moment_Nm is None + on = cx.compute_neutral_axes(cored, kx, ky, tension_N=tension, core_friction=_CORES) + assert on.core_moment_Nm is not None + np.testing.assert_allclose( + on.moment_Nm - on.core_moment_Nm, base.moment_Nm, rtol=0.0, atol=1e-9 + ) + # Friction dissipates under the turning curvature: the core moment leads + # it (positive work per unit of anticlockwise rotation). + late = slice(60, None) + work = kx[late] * on.core_moment_Nm[late, 1] - ky[late] * on.core_moment_Nm[late, 0] + assert float(np.mean(work)) > 0.0 + + +def test_core_moment_inputs_are_checked(cable: cx.CableData) -> None: + layers = _layers(cable) + with pytest.raises(CableInputError, match=r"one \(x, y\) pair"): + neutral_axes(layers, np.zeros(3), np.zeros(3), core_moment_Nm=np.zeros((2, 2))) # type: ignore[arg-type] + with pytest.raises(CableInputError, match="needs the core moment"): + neutral_axes(layers, np.zeros(3), np.zeros(3), core_stick_EI_Nm2=1.0) # type: ignore[arg-type] + with pytest.raises(CableInputError, match="core stick stiffness"): + neutral_axes( # type: ignore[arg-type] + layers, + np.zeros(3), + np.zeros(3), + core_moment_Nm=np.zeros((3, 2)), + core_stick_EI_Nm2=-1.0, + )