Skip to content

Commit

Permalink
[Matlab] Add interface to the new PureFluid property pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber committed Jan 22, 2016
1 parent e30b087 commit 831cfbe
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 0 deletions.
14 changes: 14 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/set.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ function set(tp, varargin)
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
Expand Down
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_PV.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_SH.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_ST.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_TH.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_TV.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_UP.m
Original file line number Diff line number Diff line change
@@ -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);
12 changes: 12 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_VH.m
Original file line number Diff line number Diff line change
@@ -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);
21 changes: 21 additions & 0 deletions src/matlab/thermomethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down

0 comments on commit 831cfbe

Please sign in to comment.