functions.thermo.paths: Thermodynamic paths and cycles

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Functions to calculate thermodynamic paths and cycles

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
cpcv.cal(datafile, plots = FALSE)
RefCoefAir
cp.cv(TC,ref=RefCoefAir)
fcp(TC)
fcpcv(TC)
fcv(TC)
fpv(V,p)
simpson(fun, a, b, pts = 100)
simpson.pv(nRT, a, b, pts = 100)
path.calc(x)
path.summary(y)
isochor(x)
isobar(x)
adiabat(x)
isotherm(x)
phase()
path.lines(x, plane = "Pv", shade.between = FALSE, lab.cycle = FALSE, shade.cycle = FALSE)
path.cycles(x, plane = "Pv", shade.cycle = FALSE)
path.cycles.summary(y)

Arguments

datafile

name of file for calibration

plots

Logical TRUE for plot

TC

Temp in deg C

ref

Ref and Coef argument to cp.cv; default is RefCoefAir

V

Volume

p

Pressure

fun

function to integrate

a

lower bound of interval

b

upper bound of interval

pts

number of points within the interval

nRT

gas law to calculate pV

x

argument specifying the states for any of isochor, isobar, adiabat, and isotherm ptah functions. These fucntions are used internally by path.calc. Argument x of path.calc specifies states for each one of isotherm, adiabat, isochor, isobar: V, P, n, T, M, S or to path.lines shade.under is a logical and part of the x argument specification; it is used by path.lines to shade area under the curve for a given path; default=FALSE or no shade. Argument x is also an argument to path.cycles as list of states in the cycle and cycle type; "carnot", "brayton","otto","diesel","stirling","box"

y

argument to path.summary or to path.cycles.summary: return from any path function as list(v,V,P,T,s,S,W,Q,cv,cp,gamma,WQtot,call,nM)

shade.between

logical used by path.lines to shade area between to paths; default=FALSE or no shade

lab.cycle

logical used by path.lines to label paths as a thermodynamic cycle; default=FALSE or no cycle

shade.cycle

logical used by path.lines and path.cycles to shade area within a thermodynamic cycle; default=FALSE or no shade

plane

Thermodynamic plane "Ts" or "Pv" to draw cycle. Default is Pv

Details

Function cpcv.cal calibrates heat capacities as a function of temperature from a datafile. Results for data file AirCvCpTK.csv (same as dataset AirCvCpTK) are stored in RefCoefAir for easy reference. The result of cpcv.cal for other files can be used for the argument ref of cp.cv. Function cp.cv calculates heat capacity at a given temperature. Simpson integrates a function and simpson.pv integrates pv work using gas law. Function path.calc arguments, V is an array with values of V1 and V2, P is array of corresponding pressure values, T can be left unspecified and calculated from P and V. Argument path declares the type of process. argument lab are labels for the initial and final states of the path. Default values are one mole of dry air with M =28.97 Other calculation modes such as providing T instead of P, to calculate temperature from pressure and volume. The call y<-path.calc(x) produces y that contains values of specific volume (m3/kg), volume (liters), pressure (bar), temperature (degC), specific heat W and work Q in kJ/kg, heat capacities in kJ/kgK, and gamma. By default there are 1001 points calculated. Function path.summary(y) provides a view of the path.calc results. Function path.lines(x)uses path.calc and helps visualize a paths x; or a list of paths, e.g., list(x1,x2) where x1 and x2 are paths. These paths could be more than 2 and form a thermodynamic cycle. Function path.cycles calculates and plots a thermodynamic cycle Function path.cycles.summary(y) provides a view of the path.cycles results

Value

TK.ref

T ref in K

cv.ref

cv ref

cpcv.ref

cp to cv ratio ref

cv.coef

cv coefficents

cpcv.coef

cp to cv ratio coefficents

cv

cv per mole

cp

cp per mole

cp.cv

cp to cv ratio

cv.kg

cv per kg

cp.kg

cp per kg

s

integration result by Simpson method

y

return list from path.calc or path.cycles. Used by path.summary and by path.lines as well as by path.cycles.summary

start.end

start and end of path

WQtot

Total work and heat

pts

mumber of points calculated

call=y$call

function called

nM

Number of moles

Note

Functions used in Chapter 4 of Acevedo (2018)

Author(s)

Miguel F. Acevedo acevedo@unt.edu

References

Acevedo, M.F. 2018. Introduction to Renewable Electric Power Systems and the Environment with R. Boca Raton, FL: CRC Press. (ISBN 9781138197343)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# heat capacities at a given temperature, say 100C
cp.cv(TC=100)

# cv at the middle of a range of temperature 
cp.cv(TC=(323+25)/2)$cv

# arguments: V(l), P(bar), T(C), n(mol), M(g/mol)
# default n=1,M=28.9
# example specify V and P
x <- list(V=c(24.78,NA),P=c(1,2),path='isochor',lab=c("1","2"))
y <- path.calc(x)
path.summary(y)

# specify volume and calculate pressure
x <- list(V=c(24.78,34.78),P=c(1,NA),path='isobar',lab=c("3","4"))
y <- path.calc(x)
path.summary(y)

# example specify V and T visualize the path
x <- list(V=c(10,30),T=c(30,NA),path='isotherm',lab=c("1","2"))
path.lines(x)

# visualize two paths
x1 <- list(V=c(24.78,NA),P=c(1,2),path='isochor',lab=c("1","2"))
x2 <- list(V=c(24.78,34.78),P=c(1,NA),path='isobar',lab=c("3","4"))
path.lines(list(x1,x2))

# visualize two paths and shade in between curves
x1 <- list(V=c(10,30),T=c(200,200),path='isotherm',lab=c("3","4"))
x2 <- list(V=c(10,30),T=c(30,30),path='isotherm',lab=c("1","2"))
x <- list(x1,x2)
path.lines(x,shade.between=TRUE)

# carnot cycle
x <- list(TH=200,TL=30,V1=20,V4=40,cty='carnot')
y <- path.cycles(x,shade.cycle=TRUE)

renpow documentation built on May 1, 2019, 6:49 p.m.