Skip to content
Snippets Groups Projects
Commit 3ae7b624 authored by wactbprot's avatar wactbprot
Browse files

SRG Ute style

parent 573bac4e
No related branches found
No related tags found
No related merge requests found
source("load.r")
cdb <- cdbIni()
cdb$id <- "cal-2017-se1-kk-75093_0002"
cdb$id <- "cal-2018-se1-vg-4812_0001"
cdb$DBName <- "vl_db"
cdb$DBName <- "vl_db_work"
doc <- cdbGetDoc(cdb)$res
a <- abbrevList(doc)
......@@ -21,7 +21,7 @@ doc <- se1.pressure.ind(doc)
if(length(a$ct) > 0){
resType <- a$ct$Type
if(resType == "sigma"){
if(resType == "srg_sigma"){
doc <- calSigma(doc)
}
if(resType == "srg_error"){
......@@ -29,7 +29,7 @@ if(length(a$ct) > 0){
}
}
doc <- se1.uncertPfill(doc)
doc <- se1.uncertf(doc)
doc <- se1.uncertf(doc)
doc <- se1.uncertdT(doc)
doc <- se1.uncertT1(doc)
doc <- se1.uncertRg(doc)
......@@ -55,10 +55,10 @@ if(FALSE){
cdb$dataList <- doc
cdbUpdateDoc(cdb)$res
}
#
#
# #pdf(paste0(cdb$id, ".pdf"))
# plot(p,s
# , xlab = "p.cal in mbar"
# , xlab = "p.cal in mbar"
# , ylab= "sigma.eff"
# , log="x"
# , main=cdb$id)
......@@ -78,11 +78,11 @@ if(FALSE){
# }
# #
# doc <- cuco.uncertPind(doc)
#
#
# doc <- se1.uncertTotal(doc)
#
#
# doc <- dispatchResCal(doc)
# doc <- dispatchResSum(doc)
# #
#
#
# doc <- dispatchResCal(doc)
#'
#'
#'
#' @author wactbprot (wactbprot@gmail.com)
#' @export
#' @keywords
#' @keywords
#'
## ----------------------------------------
ini.opts <- commandArgs(trailingOnly = FALSE)
......@@ -18,19 +18,19 @@ source("load.r")
d <- getDefaults()
ids <- unlist(strsplit(ini.opts[6], ","))
for(i in 1:length(ids)){
cdb <- cdbIni()
cdb$DBName <- "vl_db_work" #d$db$name
cdb$id <- ids[i]
doc <- cdbGetDoc(cdb)$res
if(length(doc$Calibration) > 0){
a <- abbrevList(doc)
doc <- refreshAnalysis(doc)
doc <- refreshResult(doc)
doc <- se1.time(doc)
doc <- se1.temperature(doc)
doc <- se1.pressure.fill(doc)
......@@ -42,25 +42,25 @@ for(i in 1:length(ids)){
if(length(a$ct) > 0){
resType <- a$ct$Type
if(resType == "sigma"){
if(resType == "srg_sigma"){
doc <- calSigma(doc)
}
if(resType == "srg_error"){
doc <- calError(doc)
}
}
cdb$dataList <- doc
print(cdbUpdateDoc(cdb)$res)
}
}
}
##
##
## if(length(doc$Calibration) > 0){
##
##
## doc <- dispatchResCal(doc)
##
##
## doc <- se1.uncertPfill(doc)
## doc <- se1.uncertf(doc)
......@@ -75,7 +75,7 @@ for(i in 1:length(ids)){
## doc <- se1.uncertInh(doc)
## doc <- se1.uncertPres(doc)
## doc <- se1.uncertRep(doc)
##
##
## if(a$cs == "SE1" & a$cpt$Type == "srg_error"){
## doc <- cuco.uncertVisc(doc)
## doc <- cuco.uncertDigit(doc)
......@@ -84,14 +84,14 @@ for(i in 1:length(ids)){
## doc <- cuco.uncertExpSd(doc)
## doc <- cuco.uncertPrise(doc)
## }
##
##
## doc <- se1.uncertPcal(doc)
## doc <- cuco.uncertPind(doc)
##
##
## doc <- se1.uncertTotal(doc)
##
##
## doc <- dispatchResCal(doc)
## doc <- dispatchResSum(doc)
##
##
##
##
## }
......@@ -7,14 +7,28 @@ calSigma <- function( ccc ){
fname <- deparse(match.call()[[1]])
msg <- paste("calculated by", fname)
a <- abbrevList( ccc )
extrLowerValue <- 1.0e-3 # mbar
d <- getConstVal(a$ccu, "d")
rho <- getConstVal(a$ccu, "rho" )
D <- getSubList(a$ccu, "d")
if(length(D) == 0){
D <- getSubList(a$ccu, "Diameter")
}
d_conf <- getConvFactor(ccc, "m", D$Unit)
d <- getConstVal(NA, NA, D)*d_conf
RHO <- getSubList(a$ccu, "rho" )
if(length(RHO) == 0){
RHO <- getSubList(a$ccu, "Density")
}
rho_conf <- getConvFactor(ccc, "kg/m^3", RHO$Unit)
rho <- getConstVal(NA, NA, RHO)*rho_conf
RD <- getSubList(a$cmv, "ind_offset")
IND <- getSubList(a$cmv, "ind" )
CAL <- getSubList(a$cav$Pressure, "cal" )
rd <- getConstVal(NA,NA, RD)
ind <- getConstVal(NA,NA, IND)
cal <- getConstVal(NA,NA,CAL)
......@@ -70,13 +84,13 @@ calSigma <- function( ccc ){
msg)
if( length(iextr) > 3){
sigma0 <- as.vector(coefficients(lm(sigma[iextr] ~ cal[iextr])))[1]
ccc$Calibration$Result$Values$Sigma <-
setCcl(ccc$Calibration$Result$Values$Sigma, "0",
"1",
sigma0,
paste(msg,"points: ",toString(iextr), "used for extrapolation") )
}
return( ccc )
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment