docs: update stability and hydrostatics documentation for from_loading

This commit is contained in:
Antoine Anceau committed 2026-04-22 21:45:36 +02:00
1 parent 56caef7b31
commit 6f33fb309b
5 files changed
+43 -23

No files matched your search

+10
View File
@@ -91,6 +91,16 @@ HydrostaticsCalculator
is interpreted as the mass of the vessel **excluding** the fluid in the tanks.
The total displacement used for calculation will be ``displacement_mass + tank_fluid_mass``.
.. py:method:: from_loading(loading, num_stations=None)
Calculates hydrostatics for a given LoadingCondition.
This method automatically applies the given loading condition (including tank fill overrides), calculates the equilibrium based on total displacement and combined COG, and restores the original tank fill levels.
:param loading: :class:`~navaltoolbox.LoadingCondition` to analyze.
:param num_stations: Number of stations (optional).
:returns: HydrostaticState with all properties.
HydrostaticState
----------------
+3
View File
@@ -187,6 +187,9 @@ LoadingCondition
.. py:method:: resolve_items()
Returns (item_displacement, (lcg, tcg, vcg)) in a single call. Use this for stability calculations to avoid double-counting tank masses.
.. note::
It is highly recommended to use the convenience methods directly on the calculators: :py:meth:`~navaltoolbox.StabilityCalculator.gz_curve_from_loading` and :py:meth:`~navaltoolbox.HydrostaticsCalculator.from_loading`. These methods automatically handle the save/restore process for tank configurations.
:rtype: tuple[float, tuple[float, float, float]]
+18
View File
@@ -24,6 +24,15 @@ StabilityCalculator
:param fixed_trim: Optional fixed trim in degrees. If None, calculates free trim.
:return: A :class:`StabilityCurve` object.
.. method:: gz_curve_from_loading(loading: LoadingCondition, heels: list[float], fixed_trim: float | None = None) -> StabilityCurve
Calculate the GZ curve directly from a LoadingCondition. Automatically applies tank fill overrides, uses solid displacement, and restores original fill levels.
:param loading: The LoadingCondition defining mass and tank fills.
:param heels: List of heel angles in degrees.
:param fixed_trim: Optional fixed trim in degrees.
:return: A :class:`StabilityCurve` object.
.. py:method:: kn_curve(displacements, heels, lcg=0.0, tcg=0.0, fixed_trim=None)
Calculates KN curves (Righting Lever from Keel) for multiple displacements.
@@ -51,6 +60,15 @@ StabilityCalculator
:param fixed_trim: Optional fixed trim in degrees. If None, calculates free trim.
:return: A :class:`CompleteStabilityResult` object containing all analysis data.
.. method:: complete_stability_from_loading(loading: LoadingCondition, heels: list[float], fixed_trim: float | None = None) -> CompleteStabilityResult
Calculate complete stability analysis directly from a LoadingCondition. Automatically applies tank overrides, calculates equilibrium, and restores original states.
:param loading: The LoadingCondition defining mass and tank fills.
:param heels: List of heel angles in degrees.
:param fixed_trim: Optional fixed trim in degrees.
:return: A :class:`CompleteStabilityResult` object containing all analysis data.
CompleteStabilityResult
-----------------------