close all
clear all

di = 40;  %Inches
df = 25;  %Inches

Pi = 168;  %psia
Pf = 176;  %psia
P2 = 155;  %End pressure of tank, cooresponds to minimum lower spring pressure due to check valve.

db = 5;  %Bore Diameter
dr = 1.5; %Rod Diameter
Au = 0.25*pi*db^2;
Al = 0.25*pi*(db^2-dr^2);

Vtank = 240;  %in^3  %Includes volume of tank and hose
Voil = 30.5;  %in^3  0.5L




Tl = 273+14;
Tu = 273+18;

V0 = 4550;  %in^3  Volume of lower chamber with piston at z=0
%V0 = 4694;  %in^3  Volume of lower chamber with piston at z=0
Vi = V0-di*Al;  %in^3
Vf = V0-df*Al-Voil;  %in^3;
V1 = Vtank-Voil;
V2 = Vtank;


P1 = ((Pf*Vf/Tl)-(Pi*Vi/Tl)+(P2*V2)/Tu)*Tu/V1






