0% found this document useful (0 votes)
51 views

Manual

ME105C MATLAB SOFTWARE: \ Excelente tutorial sobre: \ Function thplot, Class state,Class process. \ Idioma: Ingles Paginas:3 Valoración: Excelente Formato: pdf (Adobe Acrobat)

Uploaded by

api-3693527
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Manual

ME105C MATLAB SOFTWARE: \ Excelente tutorial sobre: \ Function thplot, Class state,Class process. \ Idioma: Ingles Paginas:3 Valoración: Excelente Formato: pdf (Adobe Acrobat)

Uploaded by

api-3693527
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

University of California, Berkeley Department of Mechanical Engineering

ME105C MATLAB SOFTWARE


The software package contains classes state and process and function thplot. The
following is the description of their use. You can also get on-line information by typing help
state, help state/get, help process/get, and help thplot in the
MATLAB command line.

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).

ME105, Section 2 Fall 2002


M. Frenklach
UCB, Fall 2002
M. Frenklach Page 2 of 3

Object of class state can be a single state or a list of states, i.e.,


st = [ st1 st2 ]
or, equivalently,
st(1) = st1;
st(2) = st2;
creates an object with two states, st1 and st2, each defined through a call to state.

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

ME105, Thermodynamics Last updated 8/16/02


UCB, Fall 2002
M. Frenklach Page 3 of 3

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.

You can get process properties by the following calls to get(pr,..):


get(pr,'states') returns all states
get(pr,'state',i) returns state(i)

get(pr,'iso',[i,j]) returns {isoProp, isoValue} for process i -> j


get(pr,'iso') = get(pr,'iso',[1,2])

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.

ME105, Thermodynamics Last updated 8/16/02

You might also like