# RCAIDE/Library/Compoments/Energy/Fuel_Tanks/Fuel_Tank.py
# 
# 
# Created:  Mar 2024, M. Clarke 

# ----------------------------------------------------------------------------------------------------------------------
#  IMPORT
# ----------------------------------------------------------------------------------------------------------------------

# RCAIDE imports 
from RCAIDE.Library.Components          import Component
from RCAIDE.Library.Methods.Energy.Sources.Fuel_Tanks.append_fuel_tank_conditions import append_fuel_tank_conditions 

# ----------------------------------------------------------------------------------------------------------------------
#  Fuel Tank
# ---------------------------------------------------------------------------------------------------------------------     
class Fuel_Tank(Component):
    """
    Base class for aircraft fuel tank implementations
    
    Attributes
    ----------
    tag : str
        Identifier for the fuel tank (default: 'fuel_tank')
        
    fuel_selector_ratio : float
        Ratio of fuel flow allocation (default: 1.0)
        
    mass_properties.empty_mass : float
        Mass of empty tank structure [kg] (default: 0.0)
        
    secondary_fuel_flow : float
        Secondary fuel flow rate [kg/s] (default: 0.0)
        
    fuel : Component, optional
        Fuel type stored in tank (default: None)

    Notes
    -----
    The fuel tank base class provides common attributes and methods for
    different types of aircraft fuel tanks. It handles basic fuel storage
    and flow management functionality.

    See Also
    --------
    RCAIDE.Library.Components.Energy.Sources.Fuel_Tanks.Central_Fuel_Tank
        Center section fuel tank
    RCAIDE.Library.Components.Energy.Sources.Fuel_Tanks.Wing_Fuel_Tank
        Wing-mounted fuel tank
    """
    
    def __defaults__(self):
        """
        Sets default values for fuel tank attributes
        """          
        self.tag                         = 'fuel_tank'
        self.fuel_selector_ratio         = 1.0 
        self.mass_properties.empty_mass  = 0.0   
        self.secondary_fuel_flow         = 0.0
        self.fuel                        = None
         

    def append_operating_conditions(self,segment,fuel_line):  
        """
        Append fuel tank operating conditions for a flight segment
        
        Parameters
        ----------
        segment : Segment
            Flight segment containing state conditions
        fuel_line : Component
            Connected fuel line component
        """
        append_fuel_tank_conditions(self,segment, fuel_line)  
        return                                          