feat(python): add TankOptions support to from_displacement

This commit is contained in:
Antoine Anceau committed 2026-02-09 19:07:33 +01:00
1 parent 5ecd1fb91a
commit 21a95fb4ee
3 files changed
+195 -23

No files matched your search

+44 -4
View File
@@ -1,7 +1,43 @@
Hydrostatics
============
Classes for hydrostatic calculations.
TankOptions
-----------
.. py:class:: TankOptions(include_mass=False, include_fsm=True)
Options for tank handling in hydrostatic calculations.
:param include_mass: Include tank fluid mass in displacement (default: False)
:param include_fsm: Apply Free Surface Moment correction to GM (default: True)
.. py:staticmethod:: none()
Create options with no tank effects (mass=False, fsm=False).
.. py:staticmethod:: all()
Create options with all tank effects (mass=True, fsm=True).
.. py:staticmethod:: mass_only()
Create options with only mass included (mass=True, fsm=False).
.. py:staticmethod:: fsm_only()
Create options with only FSM correction (mass=False, fsm=True).
.. py:attribute:: include_mass
:type: bool
Whether tank mass is included.
.. py:attribute:: include_fsm
:type: bool
Whether FSM correction is applied.
HydrostaticsCalculator
----------------------
@@ -13,7 +49,7 @@ HydrostaticsCalculator
:param vessel: The vessel to calculate hydrostatics for
:param water_density: Water density in kg/m³ (default: 1025.0 for seawater)
.. py:method:: from_draft(draft, trim=0.0, heel=0.0, vcg=None)
.. py:method:: from_draft(draft, trim=0.0, heel=0.0, vcg=None, num_stations=None, tank_options=None)
Calculates hydrostatics at a given draft, trim, and heel.
@@ -22,9 +58,11 @@ HydrostaticsCalculator
:param heel: Heel angle (degrees)
:param vcg: Vertical center of gravity for GM calculation (optional)
:type vcg: float or None
:param num_stations: Number of stations (optional)
:param tank_options: TankOptions object (optional)
:returns: HydrostaticState with all properties
.. py:method:: from_drafts(draft_ap, draft_fp, heel=0.0, vcg=None)
.. py:method:: from_drafts(draft_ap, draft_fp, heel=0.0, vcg=None, tank_options=None)
Calculates hydrostatics from drafts at Aft and Forward Perpendiculars.
@@ -33,9 +71,10 @@ HydrostaticsCalculator
:param heel: Heel angle (degrees)
:param vcg: Vertical center of gravity for GM calculation (optional)
:type vcg: float or None
:param tank_options: TankOptions object (optional)
:returns: HydrostaticState with all properties
.. py:method:: from_displacement(displacement_mass, vcg=None, cog=None, trim=None, heel=None)
.. py:method:: from_displacement(displacement_mass, vcg=None, cog=None, trim=None, heel=None, tank_options=None)
Calculates hydrostatics for a given displacement, finding the required draft.
@@ -44,6 +83,7 @@ HydrostaticsCalculator
:param cog: Full center of gravity (LCG, TCG, VCG) tuple (optional, overrides vcg)
:param trim: Fixed trim angle in degrees (optional, default 0.0)
:param heel: Fixed heel angle in degrees (optional, default 0.0)
:param tank_options: TankOptions object (optional)
:returns: HydrostaticState with all properties