Manual
Manual
Function thplot
Function thplot displays saturated lines in a graphical form. The following options are
available:
thplot default to 'water'
thplot(substance) substance: 'water','r134a'
The properties displayed on the axes can be chosen from the corresponding selection boxes, and
the units can be chosen by clicking on the units with the right-hand button of the mouse.
Class state
A call
st = STATE(substance,{property1,value1,units1;property2,value2,units2})
creates an object of class state. Each such object contains the following fields:
st.substance = 'water', 'air', 'nitrogen', ...
st.molW = molecular weight (kg/kmol)
st.phys = 'liquid','sat liquid','twophase','sat vapor','vapor','ideal gas'
st.p = pressure (in units of kPa)
st.t = temperature (in units of K)
st.v = specific volume (in units of m3/kg)
st.u = specific energy (in units of kJ/kg)
st.h = specific enthalpy (in units of kJ/kg)
st.s = specific entropy (in units of kJ/kg K)
st.x = quality (fraction)
Examples are:
s1 = state('water',{'p',1.23,'MPa';'x',0.55,''})
s2 = state('water',{'v',0.0011,'' ;'sat','','liquid'})
s3 = state('air', {'p',1.23,'bar';'h',2345,'')
The empty units field, '', implies internal units (in addition to help state, typing
>>convert
displays the internal units; type help convert to see other uses of the convert function).
To get the values of state properties use a call to function get, (for on-line help type help
state/get on the command line). The syntax is
y = GET(st, field, units)
which returns the value of field (e.g., a property value) of state st in units units. For
example,
get(st) returns a list of states
get(st,’p’) returns st.p in base units (i.e., kPa)
get(st,’t’,’C’) returns st.t in degrees Celsius
get(st,'data') returns state data in the matrix form, i.e., an array
[st.p st.t st.v st.u st.h st.s st.x]
Once you created state object st, you can display its states on a thermodynamic diagram via
plot(st)
This will display the same diagram as calling thplot, but with states marked with red “dots”.
Clicking with right-hand button of the mouse on a state dot displays the state number; selecting
this box displays all the property values of the state. Selecting one of them draws a constant-
property line; selecting it again removes this line. Clicking with the right-hand button on a line
connecting states, displays the constant property of the corresponding process if exists.
Class process
Having a set of states, st, whose length(st) > 1, a call
pr = process(st)
creates an object of class process., i.e., a set of connected states,
st(1) -> st(2) -> ... st(end)
A call
pr = process(st,'cycle')
makes a cycle,
1 -> 2 -> 3 -> 4 -> 1
A call
set(pr,'iso')
compares properties of two states, st(i) and st(j), and determines if there is a property such
that st(i).prop is within 1% of st(j).prop. If found, it determines a constant-property
line, isoline (like isobar or isotherm), connecting the states i and j, otherwise generates a
straight dashed line between the two states.
Once you created state object pr, you can display its states on a thermodynamic diagram via
plot(pr)
This is similar to plot(stateObject), but with states connected by constant-value lines,
isolines. If an isoline does not exist for a given process, the corresponding state dots are
connected with a straight dashed line. Clicking with the right-hand button on the line
connecting states, displays the constant property of the corresponding process if exists.