,

where the subscript

refers to what is initially inside the tank,

refers to what is added or in the line,

is mass (kg),

is the internal energy (kJ/kg), and

is enthalpy (kJ/kg).

**For a Non-Ideal System, Using Water**.

Since two phases are present in the tank at all times, the quality of the steam needs to be calculated:

,

,

,

where the superscripts

and

refer to the specific liquid and vapor properties (per kg),

is the volume of the tank (

),

is the mass of steam added to the tank from the line, and

is the enthalpy at the line temperature

and pressure

. The value

is unknown; it has to be solved for in order to evaluate the conditions of the system.

,

.

Now these expressions can be substituted into the energy balance (remember

) and solved for

.

Since two phases are present in the tank, the final temperature of the system is the saturation temperature at the final pressure

.

The number of moles

initially in the tank can be calculated using the ideal gas law:

.

The internal energy and enthalpy are found by defining a reference point

.

At

,

,

,

,

.

The number of moles in the tank at equilibrium

can also be calculated using the ideal gas law:

.

This equation can be substituted into the energy balance to solve for the final temperature

.

.

The subscript

refers to the gas in the tank before more gas is added, the subscript

refers to the gas in the line, the subscript

denotes a reference state,

is pressure (bar),

is volume (L),

is the ideal gas constant ([L bar]/[mol K]),

is temperature (°C),

is internal energy (J/mol),

is the constant-volume heat capacity for an ideal gas (J/[mol K]), and

is enthalpy (J/mol).

The screencast video at [1] explains how to use this Demonstration.