function water = water_sc(pressure, name2, value2, units) 
% -------------------------------------------------------------------------
% water_sc.m
% -------------------------------------------------------------------------
% Fundamentals of Thermodynamics
% A function that uses two properties of subcooled water (as within the
% subcooled region) and defines as the output a structure with all
% relevant properties at the same state. Since the state is within the
% subcooled region, a combination of pressure and second property will fix 
% the state. 
% -------------------------------------------------------------------------
% Syntax: water = water_sc(pressure, name2, value2, units)
% Inputs: pressure = the pressure of the water
%         name2 = the name of the second property ('T','v','u','h' or 's')
%         value2 = the value of the second property
%         units = 1 (SI units) or 2 (English units)
% Output: water = the structure with all relevant properties in relevant
%         fields (T, p, v, u, h, s, x).  
%         Though undefined (NaN), x is also included to be consistent 
%         with the saturated functions. 
%
% Valid properties and units:
%         T - temperature (C or F)
%         p - pressure (bar or lbf/in^2)
%         v - specific volume (m^3/kg or ft^3/lb)
%         h - specific enthalpy (kJ/kg or Btu/lb)
%         u - specific internal energy (kJ/kg or Btu/lb)
%         s - specific entropy (kJ/kg*K or Btu/lb*R)
%         x - quality (mass of vapor as a unitless fraction between 0-1)
% -------------------------------------------------------------------------
% Notes: Use consistent SI or English units.
% All specific properties defined per unit mass. 
%--------------------------------------------------------------------------
% Example
% water = water_sc(25, 'T', 20, 1)
% This example corresponds to subcooled water at 25 bar, and with a
% temperature of 20 degrees Celcius.
%--------------------------------------------------------------------------
% Simon Ruiz, Undergraduate student, Mechanical Engineering
% Robyn Callaghan, Undergraduate student, Mechanical Engineering
% Dr.Priya Goeser, Professor
% Original: March 31th, 2013
% Modified: July 20, 2016
% Copyright (c) 2013 Simon Ruiz, All Rights Reserved.
% Engineering Studies Program, Armstrong State University.
% -------------------------------------------------------------------------