[Matlab] Add interface to the new PureFluid property pairs

This commit is contained in:
Bryan W. Weber 2016-01-22 16:49:16 -05:00
parent c1f287d648
commit bff8d10609
9 changed files with 119 additions and 0 deletions

View file

@ -184,6 +184,20 @@ elseif ntot == 2
setState_SP(tp, [sval,pval]);
elseif ns == 1 && nv == 1
setState_SV(tp, [sval,vval]);
elseif ns == 1 && nt == 1
setState_ST(tp, [sval,tval]);
elseif nt == 1 && nv == 1
setState_TV(tp, [tval,vval]);
elseif np == 1 && nv == 1
setState_PV(tp, [pval,vval]);
elseif nu == 1 && np == 1
setState_UP(tp, [uval,pval]);
elseif nv == 1 && nh == 1
setState_VH(tp, [vval,hval]);
elseif nt == 1 && nh == 1
setState_TH(tp, [tval,hval]);
elseif ns == 1 && nh == 1
setState_SH(tp, [sval,hval]);
else
error('Unimplemented property pair.');
end

View file

@ -0,0 +1,12 @@
function setState_PV(tp, pv)
% SETSTATE_PV Set the pressure and specific volume.
% setState_PV(tp,pv)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param pv:
% Vector of length 2 containing the desired values for the
% pressure (Pa) and specific volume (m^3/kg).
%
thermo_set(tp.tp_id, 29, pv);

View file

@ -0,0 +1,12 @@
function setState_SH(tp, sh)
% SETSTATE_SH Set the specific entropy and specific enthalpy.
% setState_SH(tp,sh)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param sh:
% Vector of length 2 containing the desired values for the specific
% entropy (J/kg/K) and specific enthalpy (J/kg).
%
thermo_set(tp.tp_id, 33, sh);

View file

@ -0,0 +1,12 @@
function setState_ST(tp, st)
% SETSTATE_ST Set the specific entropy and temperature.
% setState_ST(tp,st)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param st:
% Vector of length 2 containing the desired values for the specific
% entropy (J/kg-K) and temperature (K).
%
thermo_set(tp.tp_id, 27, st);

View file

@ -0,0 +1,12 @@
function setState_TH(tp, th)
% SETSTATE_TH Set the temperature and specific enthalpy.
% setState_TH(tp,th)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param th:
% Vector of length 2 containing the desired values for the
% temperature (K) and specific enthalpy (J/kg).
%
thermo_set(tp.tp_id, 32, th);

View file

@ -0,0 +1,12 @@
function setState_TV(tp, tv)
% SETSTATE_TV Set the temperature and specific volume.
% setState_TV(tp,tv)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param tv:
% Vector of length 2 containing the desired values for the
% temperature (K) and specific volume (m^3/kg).
%
thermo_set(tp.tp_id, 28, tv);

View file

@ -0,0 +1,12 @@
function setState_UP(tp, up)
% SETSTATE_UP Set the specific internal energy and pressure.
% setState_UP(tp,up)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param up:
% Vector of length 2 containing the desired values for the specific
% internal energy (J/kg) and pressure (Pa).
%
thermo_set(tp.tp_id, 30, up);

View file

@ -0,0 +1,12 @@
function setState_VH(tp, vh)
% SETSTATE_VH Set the specific volume and specific enthalpy.
% setState_VH(tp,vh)
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param vh:
% Vector of length 2 containing the desired values for the specific
% volume (m^3/kg) and specific enthalpy (J/kg).
%
thermo_set(tp.tp_id, 31, vh);

View file

@ -61,6 +61,27 @@ static void thermoset(int nlhs, mxArray* plhs[],
case 26:
ierr = th_set_RP(th,ptr);
break;
case 27:
ierr = th_set_ST(th,ptr);
break;
case 28:
ierr = th_set_TV(th,ptr);
break;
case 29:
ierr = th_set_PV(th,ptr);
break;
case 30:
ierr = th_set_UP(th,ptr);
break;
case 31:
ierr = th_set_VH(th,ptr);
break;
case 32:
ierr = th_set_TH(th,ptr);
break;
case 33:
ierr = th_set_SH(th,ptr);
break;
default:
mexErrMsgTxt("unknown pair attribute.");
}