pytanksim.classes.storagetankclasses

Contains classes which store the properties of the storage tanks.

The StorageTank and SorbentTank classes are part of this module.

Classes

StorageTank

Stores the properties of the storage tank.

SorbentTank

Stores properties of a fluid storage tank filled with sorbents.

Module Contents

class pytanksim.classes.storagetankclasses.StorageTank(stored_fluid: pytanksim.classes.fluidsorbentclasses.StoredFluid, aluminum_mass: float = 0, carbon_fiber_mass: float = 0, steel_mass: float = 0, vent_pressure: float = None, min_supply_pressure: float = 100000.0, thermal_resistance: float = 0, surface_area: float = 0, heat_transfer_coefficient: float = 0, volume: float = None, set_capacity: float = None, full_pressure: float = None, empty_pressure: float = None, full_temperature: float = None, empty_temperature: float = None, full_quality: float = 1, empty_quality: float = 1)

Stores the properties of the storage tank.

It also has methods to calculate useful quantities such as tank dormancy given a constant heat leakage rate, the internal energy of the fluid being stored at various conditions, etc.

volume

Internal volume of the storage tank (m^3).

Type:

float

stored_fluid

Object to calculate the thermophysical properties of the fluid being stored.

Type:

StoredFluid

aluminum_mass

The mass of aluminum making up the tank walls (kg). The default is 0.

Type:

float, optional

carbon_fiber_mass

The mass of carbon fiber making up the tank walls (kg). The default is 0.

Type:

float, optional

steel_mass

The mass of steel making up the tank walls (kg). The default is 0.

Type:

float, optional

vent_pressure

The pressure (Pa) at which the fluid being stored must be vented. The default is None. If None, the value will be taken as the maximum value where the CoolProp backend can calculate the properties of the fluid being stored.

Type:

float, optional

min_supply_pressure

The minimum supply pressure (Pa) for discharging simulations.The default is 1E5.

Type:

float, optional

thermal_resistance

The thermal resistance of the tank walls (K/W). The default is 0. If 0, the value will not be considered in simulations. If the arguments ‘surface_area’ and ‘heat_transfer’ are passed, ‘thermal_resistance’ will be calculated based on those two arguments as long as the user does not pass a value to ‘thermal_resistance’.

Type:

float, optional

surface_area

The surface area of the tank that is in contact with the environment (m^2). The default is 0.

Type:

float, optional

heat_transfer_coefficient

The heat transfer coefficient of the tank surface (W/(m^2 K)). The default is 0.

Type:

float, optional

Initialize a StorageTank object.
capacity(p: float, T: float, q: float = 0, unit: str = 'mol') float

Return the amount of fluid stored in the tank at given conditions.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. Can vary between 0 and 1. The default is 0.

  • unit (str, optional) – Unit of the capacity to be returned. Valid units are “mol” and “kg”. The default is “mol”.

Returns:

Amount of fluid stored.

Return type:

float

capacity_bulk(p: float, T: float, q: float = 0, unit: str = 'mol') float

Calculate the amount of bulk fluid in the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. Can vary between 0 and 1. The default is 0.

  • unit (str, optional) – Unit of the capacity to be returned. Valid units are “mol” and “kg”. The default is “mol”.

Returns:

Amount of bulk fluid stored.

Return type:

float

find_quality_at_saturation_capacity(T: float, capacity: float) float

Find vapor quality at the given temperature and capacity.

Parameters:
  • T (float) – Temperature (K)

  • capacity (float) – Amount of fluid in the tank (moles).

Returns:

Vapor quality of the fluid being stored. This is assuming that the fluid is on the saturation line.

Return type:

float

internal_energy(p: float, T: float, q: float = 1) float

Calculate the internal energy of the fluid inside of the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. The default is 1.

Returns:

Internal energy of the fluid being stored (J).

Return type:

float

conditions_at_capacity_temperature(cap: float, T: float, p_guess: float, q_guess: float) scipy.optimize.OptimizeResult

Find conditions corresponding to a given capacity and temperature.

Parameters:
  • cap (float) – Amount of fluid inside the tank (moles).

  • T (float) – Temperature (K).

  • p_guess (float) – Initial guess for pressure value (Pa) to be optimized.

  • q_guess (float) – Initial guess for vaport quality value to be optimized.

Returns:

The optimization result represented as a OptimizeResult object. The relevant attribute for this method is x, the solution array. x[0] contains the pressure value and x[1] contains the vapor quality value.

Return type:

OptimizeResult

conditions_at_capacity_pressure(cap: float, p: float, T_guess: float, q_guess: float) scipy.optimize.OptimizeResult

Find conditions corresponding to a given capacity and temperature.

Parameters:
  • cap (float) – Amount of fluid inside the tank (moles).

  • P (float) – Pressure (Pa).

  • T_guess (float) – Initial guess for temperature value (K) to be optimized.

  • q_guess (float) – Initial guess for vaport quality value to be optimized.

Returns:

The optimization result represented as a OptimizeResult object. The relevant attribute for this package is x, the solution array. x[0] contains the temperature value and x[1] contains the vapor quality value.

Return type:

scipy.optimize.OptimizeResult

calculate_dormancy(p: float, T: float, heating_power: float, q: float = 0) pandas.DataFrame

Calculate dormancy time given a constant heating rate.

Parameters:
  • p (float) – Initial tank pressure (Pa).

  • T (float) – Initial tank temperature (K).

  • heating_power (float) – The heating power going into the tank during parking (W).

  • q (float, optional) – Initial vapor quality of the tank. The default is 0 (pure liquid).

Returns:

Pandas dataframe containing calculation conditions and results. Each key stores a floating point number. The dictionary keys and their respective values are:

  • ”init pressure”: initial pressure

  • ”init temperature”: initial temperature

  • ”init quality”: initial vapor quality

  • ”dormancy time”: time until tank needs to be vented in seconds

  • ”final temperature”: temperature of the tank as venting begins

  • ”final quality”: vapor quality at the time of venting

  • ”final pressure”: pressure at the time of venting

  • ”capacity error”: error between final and initial capacity

  • ”total energy change”: difference in internal energy between the initial and final conditions

  • ”solid heat capacity contribution”: the amount of heat absorbed by the tank walls

Return type:

pd.DataFrame

class pytanksim.classes.storagetankclasses.SorbentTank(sorbent_material: pytanksim.classes.fluidsorbentclasses.SorbentMaterial, aluminum_mass: float = 0, carbon_fiber_mass: float = 0, steel_mass: float = 0, vent_pressure: float = None, min_supply_pressure: float = 100000.0, thermal_resistance: float = 0, surface_area: float = 0, heat_transfer_coefficient: float = 0, volume: float = None, set_capacity: float = None, full_pressure: float = None, empty_pressure: float = None, full_temperature: float = None, empty_temperature: float = None, full_quality: float = 1, empty_quality: float = 1, set_sorbent_fill: float = 1)

Bases: StorageTank

Stores properties of a fluid storage tank filled with sorbents.

volume

Internal volume of the storage tank (m^3).

Type:

float

sorbent_material

An object storing the properties of the sorbent material used in the tank.

Type:

SorbentMaterial

aluminum_mass

The mass of aluminum making up the tank walls (kg). The default is 0.

Type:

float, optional

carbon_fiber_mass

The mass of carbon fiber making up the tank walls (kg). The default is 0.

Type:

float, optional

steel_mass

The mass of steel making up the tank walls (kg). The default is 0.

Type:

float, optional

vent_pressure

Maximum pressure at which the tank has to be vented (Pa). The default is None.

Type:

float, optional

min_supply_pressure

The minimum supply pressure (Pa) for discharging simulations. The default is 1E5.

Type:

float, optional

thermal_resistance

The thermal resistance of the tank walls (K/W). The default is 0. If 0, the value will not be considered in simulations. If the arguments ‘surface_area’ and ‘heat_transfer’ are passed, ‘thermal_resistance’ will be calculated based on those two arguments as long as the user does not pass a value to ‘thermal_resistance’.

Type:

float, optional

surface_area

Outer surface area of the tank in contact with the environment (m^2). The default is 0.

Type:

float, optional

heat_transfer_coefficient

The heat transfer coefficient of the tank surface (W/(m^2 K)). The default is 0.

Type:

float, optional

Initialize a SorbentTank object.

Parameters:
  • sorbent_material (SorbentMaterial) – An object storing the properties of the sorbent material used in the tank.

  • aluminum_mass (float, optional) – The mass of aluminum making up the tank walls (kg). The default is 0.

  • carbon_fiber_mass (float, optional) – The mass of carbon fiber making up the tank walls (kg). The default is 0.

  • steel_mass (float, optional) – The mass of steel making up the tank walls (kg). The default is 0.

  • vent_pressure (float, optional) – Maximum pressure at which the tank has to be vented (Pa). The default is None.

  • min_supply_pressure (float, optional) – The minimum supply pressure (Pa) for discharging simulations. The default is 1E5.

  • thermal_resistance (float, optional) – The thermal resistance of the tank walls (K/W). The default is 0. If 0, the value will not be considered in simulations. If the arguments ‘surface_area’ and ‘heat_transfer’ are passed, ‘thermal_resistance’ will be calculated based on those two arguments as long as the user does not pass a value to ‘thermal_resistance’.

  • surface_area (float, optional) – Outer surface area of the tank in contact with the environment (m^2). The default is 0.

  • heat_transfer_coefficient (float, optional) – The heat transfer coefficient of the tank surface (W/(m^2 K)). The default is 0.

  • volume (float, optional) – Internal volume of the storage tank (m^3). The default is None. This value is required unless the set capacity and operating conditions are defined, in which case the volume is calculated from the capacity and operating conditions.

  • set_capacity (float, optional) – Set internal capacity of the storage tank (mol). The default is None. If specified, this will override the user-specified tank volume.

  • full_pressure (float, optional) – Pressure (Pa) of the tank when it is considered full. The default is None.

  • empty_pressure (float, optional) – Pressure (Pa) of the tank when it is considered empty. The default is None.

  • full_temperature (float, optional) – Temperature (K) of the tank when it is considered full. The default is None.

  • empty_temperature (float, optional) – Temperature (K) of the tank when it is considered empty. The default is None.

  • full_quality (float, optional) – Vapor quality of the tank when it is considered full. The default is 1 (Gas).

  • empty_quality (float, optional) – Vapor quality of the tank when it is considered empty. The default is 1 (Gas).

  • set_sorbent_fill (float, optional) – Ratio of tank volume filled with sorbent. The default is 1 (completely filled with sorbent).

Returns:

Object which stores various properties of a storage tank containing sorbents. It also has some useful methods related to the tank, most notably dormancy calculation.

Return type:

SorbentTank

bulk_fluid_volume(p: float, T: float) float

Calculate the volume of bulk fluid inside of the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature(K).

Returns:

Bulk fluid volume within the tank (m^3).

Return type:

float

capacity(p: float, T: float, q: float = 0) float

Return the amount of fluid stored in the tank at given conditions.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. Can vary between 0 and 1. The default is 0.

Returns:

Amount of fluid stored (moles).

Return type:

float

capacity_bulk(p: float, T: float, q: float = 0) float

Calculate the amount of bulk fluid in the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. Can vary between 0 and 1. The default is 0.

Returns:

Amount of bulk fluid stored (moles).

Return type:

float

internal_energy(p: float, T: float, q: float = 1) float

Calculate the internal energy of the fluid inside of the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. The default is 1.

Returns:

Internal energy of the fluid being stored (J).

Return type:

float

internal_energy_sorbent(p: float, T: float, q: float = 1) float

Calculate the internal energy of the adsorbed fluid in the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. The default is 1.

Returns:

Internal energy of the adsorbed fluid in the tank (J).

Return type:

float

internal_energy_bulk(p: float, T: float, q: float = 1) float

Calculate the internal energy of the bulk fluid in the tank.

Parameters:
  • p (float) – Pressure (Pa).

  • T (float) – Temperature (K).

  • q (float, optional) – Vapor quality of the fluid being stored. The default is 1.

Returns:

Internal energy of the bulk fluid in the tank (J).

Return type:

float

find_quality_at_saturation_capacity(T: float, capacity: float) float

Find vapor quality at the given temperature and capacity.

Parameters:
  • T (float) – Temperature (K)

  • capacity (float) – Amount of fluid in the tank (moles).

Returns:

Vapor quality of the fluid being stored. This is assuming that the fluid is on the saturation line.

Return type:

float

find_temperature_at_saturation_quality(q: float, cap: float) scipy.optimize.OptimizeResult

Find temperature at a given capacity and vapor quality value.

Parameters:
  • q (float) – Vapor quality. Can vary between 0 and 1.

  • cap (float) – Amount of fluid stored in the tank (moles).

Returns:

The optimization result represented as a OptimizeResult object. The relevant attribute for this function is x, the optimized temperature value.

Return type:

scipy.optimize.OptimizeResult

calculate_dormancy(p: float, T: float, heating_power: float, q: float = 0) pandas.DataFrame

Calculate dormancy time given a constant heating rate.

Parameters:
  • p (float) – Initial tank pressure (Pa).

  • T (float) – Initial tank temperature (K).

  • heating_power (float) – The heating power going into the tank during parking (W).

  • q (float, optional) – Initial vapor quality of the tank. The default is 0 (pure liquid).

Returns:

Pandas dataframe containing calculation conditions and results. Each key stores a floating point number. The dictionary keys and their respective values are:

  • ”init pressure”: initial pressure

  • ”init temperature”: initial temperature

  • ”init quality”: initial vapor quality

  • ”dormancy time”: time until tank needs to be vented in seconds

  • ”final temperature”: temperature of the tank as venting begins

  • ”final quality”: vapor quality at the time of venting

  • ”final pressure”: pressure at the time of venting

  • ”capacity error”: error between final and initial capacity

  • ”total energy change”: difference in internal energy between the initial and final conditions

  • ”sorbent energy contribution”: the amount of heat taken by the adsorbed phase via desorption

  • ”bulk energy contribution”: the amount of heat absorbed by the bulk phase

  • ”immersion heat contribution”: how much heat has been absorbed by un-immersing the sorbent material in the fluid

  • ”solid heat capacity contribution”: the amount of heat absorbed by the tank walls

Return type:

pd.DataFrame