|
|
@ -3,6 +3,7 @@
|
|
|
|
# Taha Ahmed, Jan 2011
|
|
|
|
# Taha Ahmed, Jan 2011
|
|
|
|
|
|
|
|
|
|
|
|
# CONTENTS
|
|
|
|
# CONTENTS
|
|
|
|
|
|
|
|
# >>>> It2charge
|
|
|
|
# >>>> ProvideSampleId
|
|
|
|
# >>>> ProvideSampleId
|
|
|
|
# >>>> ConvertRefPot
|
|
|
|
# >>>> ConvertRefPot
|
|
|
|
# >>>> Celsius2Kelvin
|
|
|
|
# >>>> Celsius2Kelvin
|
|
|
@ -13,6 +14,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##################################################
|
|
|
|
|
|
|
|
################### It2charge ####################
|
|
|
|
|
|
|
|
##################################################
|
|
|
|
|
|
|
|
It2charge <- function (current, time) {
|
|
|
|
|
|
|
|
## Calculates charge etc. for amperometric data
|
|
|
|
|
|
|
|
## current may be a current or a current density
|
|
|
|
|
|
|
|
## (up to the calling function to keep track of which it is)
|
|
|
|
|
|
|
|
# Calculate the difference of the time vector
|
|
|
|
|
|
|
|
timediff <- c(time[1], diff(time))
|
|
|
|
|
|
|
|
# timediff times the current gives the charge,
|
|
|
|
|
|
|
|
# since the time vector can be considered as
|
|
|
|
|
|
|
|
# the cumulative time, while we need to multiply
|
|
|
|
|
|
|
|
# the current with the time elapsed since the last
|
|
|
|
|
|
|
|
# current measurement (the timediff).
|
|
|
|
|
|
|
|
charge <- current * timediff
|
|
|
|
|
|
|
|
differential <- cumsum(charge) / time
|
|
|
|
|
|
|
|
# Prepare the return dataframe
|
|
|
|
|
|
|
|
ff <- data.frame(time = time, timediff = timediff,
|
|
|
|
|
|
|
|
current = current, charge = charge,
|
|
|
|
|
|
|
|
sumcharge = cumsum(charge), dQdt = differential)
|
|
|
|
|
|
|
|
return(ff)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
##################################################
|
|
|
|
##################################################
|
|
|
|
################ ProvideSampleId #################
|
|
|
|
################ ProvideSampleId #################
|
|
|
|
##################################################
|
|
|
|
##################################################
|
|
|
|