This project simulates the offloading of LNG from a trailer to a storage tank. It calculates the tank's final properties (pressure, temperature, mass, etc.) after offloading, based on thermodynamic data, and visualizes the process.
- Interactive sliders for tank and trailer parameters
- Real-time calculations of final tank state
- Visualization of liquid/gas levels before and after offloading
- Detailed calculation steps displayed
- HTML/CSS/JavaScript
- D3.js for visualization
- MathJax for equations
index.html
: Main app file with sliders, calculations, and visualization- D3.js: Tank and process visualizations
- MathJax: Displaying math formulas
- Clone/download the project.
- Open
index.html
in a browser.
- Tank Volume (
V_tank
): 30 - 80 m³ - Initial Liquid Level (
Level_start
): 1% - 99% - Tank Pressure (
P_start
): 1 - 11 bar - Trailer Pressure (
P_trailer
): 0.5 - 10 bar - Offloaded Mass (
m_offload
): Mass of LNG offloaded
- Interpolates thermodynamic properties using pressure and mass.
- Computes final state: total mass, liquid/gas volumes, pressure, and temperature.
D3.js shows tank liquid and gas levels before and after offloading.
The state of the tank is calculated after offloading using thermodynamic equations, specifically focusing on mass and energy balance.
The total mass in the tank after offloading is the sum of the initial mass in the tank and the offloaded mass:
Where:
- ( m_{\text{total}}^{\text{final}} ) is the total mass in the tank after offloading.
- ( m_{\text{total}}^{\text{start}} ) is the initial mass in the tank.
- ( m_{\text{offload}} ) is the mass of LNG transferred from the trailer.
The internal energy of the system is updated by adding the energy associated with the offloaded LNG:
Where:
- ( U_{\text{total}}^{\text{final}} ) is the total internal energy in the tank after offloading.
- ( h_{\text{liquid}}^{\text{trailer}} ) is the specific enthalpy of the liquid from the trailer.
After offloading, the average specific internal energy and specific volume of the tank are calculated as follows:
Where:
- ( u_{\text{final}} ) is the specific internal energy after offloading.
- ( v_{\text{final}} ) is the specific volume after offloading.
The final tank pressure ( P_{\text{final}} ) is determined by iterating through thermodynamic tables to find the pressure that corresponds to the calculated specific internal energy and volume:
The liquid-gas ratio (quality) ( x ) is determined by the following equation using the specific volumes of the liquid and gas:
Where:
- ( v_{\text{liquid}} ) is the specific volume of the liquid phase.
- ( v_{\text{gas}} ) is the specific volume of the gas phase.
By using these equations, the program calculates the final pressure, temperature, liquid level, and mass distribution within the tank after offloading.