From 5aabfe9704d4a89fac449cba85b114de420421f3 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Fri, 23 Oct 2015 14:58:04 -0400 Subject: [PATCH 1/3] [Matlab] Fix setState_sat*.m functions Fix the setState_satLiquid and setState_satVapor functions so that they call the main set method instead of the underlying C++ layer. Resolves #299. --- interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m | 2 +- interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m index 5afb29c91..5c617f137 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m @@ -6,4 +6,4 @@ function setState_satLiquid(tp) % class derived from ThermoPhase) % -thermo_set(tp.tp_id, 2, 0); +set(tp, 'T', temperature(tp), 'Liquid', 1.0) diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m index 3e0bf9ad2..6805e1e17 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m @@ -6,4 +6,4 @@ function setState_satVapor(tp) % class derived from ThermoPhase) % -thermo_set(tp.tp_id, 3, 0); +set(tp, 'T', temperature(tp), 'Vapor', 1.0) From 0b5c97ad4f41a12b2abeb4efa07c6fe9458651a8 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Fri, 23 Oct 2015 17:06:33 -0400 Subject: [PATCH 2/3] [Doc] Correct docs for setState_*sat in Matlab Correct the documentation to clarify that a vector must be passed in to these functions, not a single value. --- interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m | 9 +++++++-- interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m index 1d4a5e256..c3afb15e8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m @@ -1,10 +1,15 @@ function setState_Psat(tp, px) -% SETSTATE_PSAT Set the fluid to a saturated state at a given pressure. +% SETSTATE_PSAT Set the fluid state using the given pressure and quality. % setState_Psat(tp,px) +% The fluid state will be set to a saturated liquid-vapor state using the +% input pressure and vapor fraction (quality) as the independent, +% intensive variables. % :param tp: % Instance of class :mat:func:`ThermoPhase` (or another % class derived from ThermoPhase) % :param px: -% Pressure. Units: Pa +% Vector of length 2 containing the desired values for the pressure (Pa) +% and the vapor fraction % + thermo_set(tp.tp_id, 24, px); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m index 765f4959d..fe1accaca 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m @@ -1,11 +1,15 @@ function setState_Tsat(tp, tx) -% SETSTATE_TSAT Set the fluid to a saturated state at a given temperature. +% SETSTATE_TSAT Set the fluid state using the given temperature and quality. % setState_Tsat(tp,tx) +% The fluid state will be set to a saturated liquid-vapor state using the +% input temperature and vapor fraction (quality) as the independent, +% intensive variables. % :param tp: % Instance of class :mat:func:`ThermoPhase` (or another % class derived from ThermoPhase) % :param tx: -% Temperature. Units: K +% Vector of length 2 containing the desired values for the temperature (K) +% and the vapor fraction (quality) % thermo_set(tp.tp_id, 25, tx); From 0be9e7eef7ce98494727e8f3ddc4f3c4057be579 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Fri, 23 Oct 2015 17:08:54 -0400 Subject: [PATCH 3/3] [Matlab] Fix spacing in private functions --- .../toolbox/@ThermoPhase/private/phase_get.m | 4 ++-- .../toolbox/@ThermoPhase/private/phase_set.m | 4 ++-- .../toolbox/@ThermoPhase/private/thermo_set.m | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m index 0d963e4b6..0a2d17e6d 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m @@ -1,8 +1,8 @@ function i = phase_get(n, job, a, b) if nargin == 2 - i = ctmethods(30,n,job); + i = ctmethods(30, n, job); elseif nargin == 3 - i = ctmethods(30,n,job,a); + i = ctmethods(30, n, job, a); else i = ctmethods(30, n, job, a, b); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m index 0ce4e9010..7c5b9bb60 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m @@ -1,8 +1,8 @@ function phase_set(n, job, a, b) if nargin == 2 - ctmethods(30,n,-job); + ctmethods(30, n, -job); elseif nargin == 3 - ctmethods(30,n,-job,a); + ctmethods(30, n, -job, a); else ctmethods(30, n,-job, a, b); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m index 516f1c4a6..6377c4bc0 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m @@ -1,16 +1,16 @@ function i = thermo_set(n, job, a, b, c, d, e, f) if nargin == 2 - i = ctmethods(20,n,-job); + i = ctmethods(20, n, -job); elseif nargin == 3 - i = ctmethods(20,n,-job,a); + i = ctmethods(20, n, -job,a); elseif nargin == 4 - i = ctmethods(20, n,-job, a, b); + i = ctmethods(20, n, -job, a, b); elseif nargin == 5 - i = ctmethods(20, n,-job, a, b, c); + i = ctmethods(20, n, -job, a, b, c); elseif nargin == 6 - i = ctmethods(20, n,-job, a, b, c, d); + i = ctmethods(20, n, -job, a, b, c, d); elseif nargin == 7 - i = ctmethods(20, n,-job, a, b, c, d, e); + i = ctmethods(20, n, -job, a, b, c, d, e); elseif nargin == 8 - i = ctmethods(20, n,-job, a, b, c, d, e, f); + i = ctmethods(20, n, -job, a, b, c, d, e, f); end \ No newline at end of file