I'm currently working on a project where I need to estimate how many times a large, high-pressure gas tank can refill a smaller tank. For this purpose, I'm using a pressure regulator to manage the flow between the two tanks and have assumed that the regulator operates perfectly without any inefficiencies.
To model the gas transfer, I started with the ideal gas law and applied the adiabatic expansion formula to derive the following relationship:
$$ P_1 \left(\frac{n_1}{n_2}\right)^\gamma = P_2 $$
and then ran it itervely using a pyhon program to find out how many times it can fill the smaller tI implemented this in a Python program, running iterations to determine how many refills are possible before the pressure in the large tank falls below a specified threshold.
However, I'm questioning one of my underlying assumptions related to the adiabatic process(as there is a regulator in between) :
$$ P_1V_1^γ=P_2V_2^γ $$
Is this correct? if not why is it incorrect and how would I be able to model this correctly?