Solve the below problem:
Q: A 200 liter tank initially contains water at 100 kPa and a quality of 1%. Heat is transferred to the water thereby raising its pressure and temperature. At a pressure of 2 MPa a safety valve opens and saturated vapor at 2 MPa flows out. The process continues, maintaining 2 MPa inside until the quality in the tank is 90%, then stops. Determine the total mass of water that flowed out and the total heat transfer.