Chemical Engineering Undergraduate

Thermodynamics Equation of state (Peng robinson)

In the following given problem, i need to construct a logical algorithm (Matlab codes/functions) or excel sheet to acquire from an adiabatic reservoir filling process the following:

1)Final mass introduced to a reservoir Temperature of a pure substance and its vapor/liquid compositions (a & b)(Given the reservoir final volume, and the final pressure) (a reference state might need to be added to acquire the final results hence U,G and H are needed to obtain the result)

2) Same thing but for a mixture

I need the process explained in details so i can follow the logical sequence + formulas as well as a brief analysis of the results obtained

Further detailed given in the PDF file