11from functools import cached_property
2-
32import numpy as np
4-
5- from rocketpy .mathutils .function import Function , funcify_method , reset_funcified_methods
6- from .tank import Tank
7-
3+ from rocketpy .mathutils .function import funcify_method , reset_funcified_methods
84from ..plots .liquid_motor_plots import _LiquidMotorPlots
9- from ..prints .liquid_motor_prints import _LiquidMotorPrints
105from .motor import Motor
11- from ..tools import ( # Utilisez ..tools si liquid_motor.py est dans rocketpy/motors/
12- parallel_axis_theorem_I11 ,
13- parallel_axis_theorem_I22 ,
14- parallel_axis_theorem_I33 ,
15- parallel_axis_theorem_I12 ,
16- parallel_axis_theorem_I13 ,
17- parallel_axis_theorem_I23 ,
18- # Ajoutez d'autres imports de tools si nécessaire (ex: tuple_handler)
19- )
20- # Ajoutez également l'import de Vector s'il n'est pas déjà là
21- from ..mathutils .vector_matrix import Vector
6+
227
238class LiquidMotor (Motor ):
249 """Class to specify characteristics and useful operations for Liquid
2510 motors. This class inherits from the Motor class.
26-
2711 See Also
2812 --------
2913 Motor
30-
3114 Attributes
3215 ----------
3316 LiquidMotor.coordinate_system_orientation : str
@@ -167,8 +150,6 @@ class LiquidMotor(Motor):
167150 It will allow to obtain the net thrust in the Flight class.
168151 """
169152
170- # pylint: disable=too-many-locals, too-many-statements, too-many-arguments
171- # pylint: disable=too-many-locals, too-many-statements, too-many-arguments
172153 # pylint: disable=too-many-locals, too-many-statements, too-many-arguments
173154 def __init__ (
174155 self ,
@@ -183,35 +164,16 @@ def __init__(
183164 interpolation_method = "linear" ,
184165 coordinate_system_orientation = "nozzle_to_combustion_chamber" ,
185166 reference_pressure = None ,
186- # Les arguments spécifiques au LiquidMotor ne sont pas utilisés
187- # dans __init__ car les réservoirs sont ajoutés plus tard via add_tank
188- tanks_mass = 0 , # Note: cet argument est utilisé pour corriger dry_mass
189- oxidizer_tanks_geometries = None , # Non utilisé ici
190- fuel_tanks_geometries = None , # Non utilisé ici
191- oxidizer_tanks_positions = None , # Non utilisé ici
192- fuel_tanks_positions = None , # Non utilisé ici
193- oxidizer_initial_mass = 0 , # Non utilisé ici
194- fuel_initial_mass = 0 , # Non utilisé ici
195- oxidizer_mass_flow_rate_curve = 0 , # Non utilisé ici
196- fuel_mass_flow_rate_curve = 0 , # Non utilisé ici
197- oxidizer_density = None , # Non utilisé ici
198- fuel_density = None , # Non utilisé ici
199- oxidizer_tanks_initial_liquid_level = None , # Non utilisé ici
200- oxidizer_tanks_initial_ullage_mass = None , # Non utilisé ici
201- oxidizer_tanks_initial_ullage_volume = None , # Non utilisé ici
202- fuel_tanks_initial_liquid_level = None , # Non utilisé ici
203- fuel_tanks_initial_ullage_mass = None , # Non utilisé ici
204- fuel_tanks_initial_ullage_volume = None , # Non utilisé ici
167+ tanks_mass = 0 ,
205168 ):
206169
207- # Initialise la liste des réservoirs
170+ # Initialize the list of tanks
208171 self .positioned_tanks = []
209172
210- # Corrige la masse sèche pour inclure la masse des réservoirs
173+ # Correct the dry mass to include the mass of the tanks
211174 dry_mass = dry_mass + tanks_mass
212175 dry_inertia = (* dry_inertia , 0 , 0 , 0 ) if len (dry_inertia ) == 3 else dry_inertia
213-
214- # Appelle l'__init__ de la classe Mère (Motor)
176+
215177 super ().__init__ (
216178 thrust_source = thrust_source ,
217179 dry_mass = dry_mass ,
@@ -226,7 +188,6 @@ def __init__(
226188 reference_pressure = reference_pressure ,
227189 )
228190
229- # Initialise l'objet plots
230191 self .plots = _LiquidMotorPlots (self )
231192
232193 @funcify_method ("Time (s)" , "Exhaust Velocity (m/s)" )
@@ -335,7 +296,6 @@ def center_of_propellant_mass(self):
335296
336297 return mass_balance / total_mass
337298
338- @funcify_method ("Time (s)" , "Inertia I_11 (kg m²)" )
339299 @funcify_method ("Time (s)" , "Inertia I_11 (kg m²)" )
340300 def propellant_I_11 (self ):
341301 """Inertia tensor 11 component of the total propellant, the inertia is
@@ -347,17 +307,9 @@ def propellant_I_11(self):
347307 Function
348308 Total propellant inertia tensor 11 component at time t relative to total propellant CoM.
349309 """
350- # --- DÉBUT CORRECTION ---
351- # Inertias calculées dans __init__ relatives au CoM total du propergol
352310 I_11_prop_relative_to_prop_com = self .propellant_I_11_from_propellant_CM
353-
354- # Dans ce cas, l'inertie est déjà calculée par rapport au centre de masse
355- # du propergol dans __init__. Il n'y a pas besoin de réappliquer le PAT ici.
356- # Les anciennes versions appliquaient le PAT deux fois, ce qui était incorrect.
357-
358- # On retourne directement la valeur calculée dans __init__
359311 return I_11_prop_relative_to_prop_com
360- # --- FIN CORRECTION ---
312+
361313 @funcify_method ("Time (s)" , "Inertia I_22 (kg m²)" )
362314 def propellant_I_22 (self ):
363315 """Inertia tensor 22 component of the propellant, the inertia is
0 commit comments