[Physics] How to calculate the mass of gas needed to fill a cylinder to a certain pressure

gasmassphysical-chemistrypressurevolume

I m tasked with a tricky situation. I need to calculate the exact amount a tank can take in gas. But I dont know the volume of the tank. I just need to make sure that the tank reaches the right pressure and thus the right density.
This is how the system operates:
A hose is connected to a tank. pressure and temperature is recorded. Then the tank is filled with 1 kg of gas (by mass flow meter). Then a second point is recorded.
From there i would need to calculate how much more gas I need to fill, to reach the target pressure.
Is this even possible?
I am also able to calculate the compressibility factor z. The gas composition is known and i also know the pressure and temperature. I also know the molar mass of the gas.

Is there a way to accurately calculate the mass needed to fill the tank?

Thank you!

Edit: I forgot to mention, that the tank may not be empty at the beginning.
Some data to test with:

$P_0$ – Initial pressure – 44,77 bar

$P_1$ – Pressure after $m_1$ was added – 48,87 bar

$P_2$ – Target pressure – 205,09 bar

$m_1$ – mass added – 1315.8 g

$z_1$ @ P1 – 0,8992

$z_2$ @ P2 – 0,7268

$T$ – 276,2 K

I converted the pressure to Pa and ran some calculations but didnt get anywhere.
If someone could find the time to help me out. Thanks!

Edit2: I could also get a density reading from the mass flow meter, if that would help.

Best Answer

From the ideal gas law, with the compressibility factor correction for non-ideality, you have the equation $PV=znRT$. This equation can be used for the initial case, where you pump 1 kg of gas into the tank and measure the pressure and temperature. This same equation can be used for the second case, where you pump more gas into the tank in order to achieve a final pressure that contains the desired mass of gas. Obviously, you don't know the volume of the tank, but there is a way to eliminate this variable from the problem.

Note that the ideal gas law works with moles, and you specified a mass. Thus, the ideal gas law must be modified to account for mass, such that moles are multiplied by molar mass (or molecular weight - MW).

$PV=znRT$

In terms of mass,

$PV(MW)=z[n(MW)]RT$

Since $[n(MW)]$ is the mass of the gas in the tank, substitute "m".

$PV(MW)=zmRT$

This equation applies for both the initial condition, and the final condition. In addition, if you divide the equation for the initial condition by the equation for the final condition, everything that remains constant drops out of the equation. Thus,

\begin{equation} \frac{P_1V_1(MW)=z_1m_1RT_1}{P_2V_2(MW)=z_2m_2RT_2} \end{equation}

Assuming that your tank is "rigid" (not expandable) such that its volume doesn't change, this equation reduces to

\begin{equation} \frac{P_1=z_1m_1T_1}{P_2=z_2m_2T_2} \end{equation}

This equation can be solved for $m_2$, which is the total mass to add to the tank (which includes the original 1 kg of gas). Thus,

\begin{equation} m_2= \frac{z_1P_2T_1}{z_2P_1T_2}m_1 \end{equation}

Obviously, if your ending temperature equals your starting temperature, the equation simplifies even further.

Related Question