library(pipenostics)
## Example: maximum percentage disparity of original B31G
## algorithm and modified B31G showed on CRVL.BAS data
with(b31gdata, {
original <- b31gpf(d, wth, smys, depth, l)
modified <- b31gmodpf(d, wth, smys, depth, l)
round(max(100*abs(1 - original/modified), na.rm = TRUE), 4)
})
## Output:
#[1] 32.6666
## Example: plot disparity of original B31G algorithm and
## modified B31G showed on CRVL data
with(b31gdata[-(6:7),], {
b31g <- b31gpf(depth, wth, smys, depth, l)
b31gmod <- b31gmodpf(depth, wth, smys, depth, l)
axe_range <- range(c(b31g, b31gmod))
plot(b31g, b31g, type = 'b', pch = 16,
xlab = 'Pressure, [PSI]',
ylab = 'Pressure, [PSI]',
main = 'Failure pressure method comparison',
xlim = axe_range, ylim = axe_range)
inc <- order(b31g)
lines(b31g[inc], b31gmod[inc], type = 'b', col = 'red')
legend('topleft',
legend = c('B31G Original',
'B31G Modified'),
col = c('black', 'red'),
lty = 'solid')
})
Run the code above in your browser using DataLab