Skip to content
Snippets Groups Projects
Commit c61206c3 authored by Thomas Bock's avatar Thomas Bock :speech_balloon:
Browse files

sz

parent 089073ce
No related branches found
No related tags found
No related merge requests found
......@@ -5,63 +5,69 @@
#'
fm3.szparam <- function(L){
res <- list()
h <- NA
N <- 100
E <- 0.0005
if(is.numeric( L$p.target ) &
is.numeric( L$p.fill ) &
is.numeric( L$p.start ) &
is.numeric( L$t.start ) &
is.numeric( L$p.end ) &
is.numeric( L$t.end ) &
is.numeric( L$p.drv.start ) &
is.numeric( L$d.drv.start ) &
is.numeric( L$p.drv.end ) &
is.numeric( L$d.drv.end )){
res[["Pressure_decr"]] <- list()
res[["Pressure_incr"]] <- list()
## Druckabfall durch Leitwert
p.decr <- (L$p.start - L$p.end) / (L$t.start - L$t.end )
## Druckanstieg durch Verdränger
p.incr <- (L$p.drv.start - L$p.drv.end) / (L$d.drv.start - L$d.drv.end)
res[["Pressure_decr"]]$Value <- p.decr
res[["Pressure_decr"]]$Unit <- "mbar/ms"
res[["Pressure_incr"]]$Value <- p.incr
res[["Pressure_incr"]]$Unit <- "mbar/turn"
res[["Sz_repeat"]]$Value <- N
res[["Sz_repeat"]]$Unit <- "1"
res <- list()
h <- NA
v.displacer <- 1000 # ms/turn
if(is.numeric( L$p.target ) & ## mbar
is.numeric( L$p.fill ) & ## mbar
is.numeric( L$dp.decr ) & ## mbar/ms
is.numeric( L$t.readout ) & ## ms
is.numeric( L$t.wait ) ## ms
){
### rel. Modulation
E <- 6e-4
## if( L$p.target > 3e-5 ){
## dh <- 0.00020 ## mbar/(mbar turn) = 1/turn
## } else if (L$p.target > 3e-6 ) {
## dh <- 0.00025
## } else
if (L$p.target > 8e-7 ) {
dh <- 0.00027
} else {
dh <- 0.00144
}
### pressure increment per turn
p.incr <- dh * L$p.fill ## mbar/turn
### demanded pressure diff
dp <- L$p.fill * E
h <- abs(round(dp / p.incr, digit=2))
### displacer turns \wo displacer time correction
h <- abs(dp / p.incr)
### the displacer drive consumes time:
t.displacer <- v.displacer * h ## ms
### the pressure drops:
dp.displacer <- L$dp.decr * t.displacer
### add dp to h
h.displacer <- abs(dp.displacer / p.incr)
### idea to test:
### dead time (switch between tasks
t.dead <- 1000
dp.dead <- L$dp.decr * t.dead
h.dead <- abs(dp.dead / p.incr)
h <- round(h + h.displacer + h.dead, digit=2)
### guard
if(h < 0.25){
h <- 0.25
}
if(h > 4.5){
h <- 4.5
}
res[["Displacer_single"]]$Value <- h
}
### one sz lasts:
t.all <- abs(dp / L$dp.decr)
### number of points:
n.all <- round(t.all / L$t.readout, digit=0)
res[["Pressure_incr"]]$Value <- p.incr
res[["Pressure_incr"]]$Unit <- "mbar/turn"
res[["Displacer_single"]]$Value <- h
res[["Displacer_single"]]$Unit <- "turn"
t.all <- dp / p.decr
t.single <- t.all / N
if( t.single < 10){
t.single <- 10
}
if( t.single > 2000){
t.single <- 2000
}
res[["Time_single"]]$Value <- t.single
res[["Time_single"]]$Unit <- "ms"
res[["Time_single"]]$Value <- L$t.wait
res[["Time_single"]]$Unit <- "ms"
res[["Sz_repeat"]]$Value <- n.all
res[["Sz_repeat"]]$Unit <- "1"
}else{
stop("non numeric input")
}
......
......@@ -19,14 +19,9 @@ source("load.r")
L <- list()
L$p.target <- as.numeric(ini.opts[6])
L$p.fill <- as.numeric(ini.opts[7])
L$p.start <- as.numeric(ini.opts[8])
L$t.start <- as.numeric(ini.opts[9])
L$p.end <- as.numeric(ini.opts[10])
L$t.end <- as.numeric(ini.opts[11])
L$p.drv.start <- as.numeric(ini.opts[12])
L$d.drv.start <- as.numeric(ini.opts[13])
L$p.drv.end <- as.numeric(ini.opts[14])
L$d.drv.end <- as.numeric(ini.opts[15])
L$dp.decr <- as.numeric(ini.opts[8])
L$t.readout <- as.numeric(ini.opts[9])
L$t.wait <- as.numeric(ini.opts[10])
res <- fm3.szparam(L)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment