Functions
Structures and Constructors
GasChromatographySimulator.Column
— TypeColumn(L, d, a_d, df, a_df, sp, gas)
Structure describing the GC Column.
Arguments
L
: Length of the capillary measured in m (meter)d
: A functiond(x, a_d)
ofx
, the position along the capillary, describing the diameter in m (meter). Or a number for a constant value.a_d
: Parameters of the diameter function.d_f
: A functiond_f(x, a_df)
ofx
, describing the film thickness in m (meter). Or a number for a constant value.a_df
: Parameters of the film thickness function.sp
: The name of the stationary phase.gas
: The name of the mobile phase. Allowed values: He, H2 or N2.
GasChromatographySimulator.Column
— MethodColumn(L, d, df, sp, gas)
Construct the structure Column
with given values for the case of constant diameter d
and film thickness df
.
Arguments
L
: Length of the capillary measured in m (meter).d
: Diameter of the capillary measured in m (meter).d_f
: Film thickness of the capillary measured in m (meter).sp
: The name of the stationary phase.gas
: The name of the mobile phase. Allowed values: He, H2 or N2.
Examples
julia julia> Column(10.0, 0.1e-3, 0.1e-6, "DB5", "He")
GasChromatographySimulator.Program
— TypeProgram(time_steps, temp_steps, Fpin_steps, pout_steps, gf, a_gf, T_itp, Fpin_itp, pout_itp)
Structure to describe the temperature and flow/pressure program of a GC Column. The function gf
describes an optional thermal gradient.
Arguments
time_steps
: Time steps in s (seconds).temp_steps
: Temperature steps in °C (degree celsius).Fpin_steps
: Flow steps in m³/s resp. inlet pressure steps in Pa(a) (pascal, absolute).pout_steps
: Outlet pressure steps in Pa(a) (pascal, absolute).gf
: Gradient functiongf(x, a_gf)
, describes the thermal gradient.a_gf
: Parameters of the gradient function.T_itp
: Interpolated (linear) temperatureT(x,t)
, constructed fromtime_steps
,temp_steps
andgf
.Fpin_itp
: Interpolated (linear) flow/inlet pressureFpin(t)
, constructed fromtime_steps
andFpin_steps
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
, constructed fromtime_steps
andpout_steps
.
Note: The length of the arrays time_steps
, temp_steps
, pin_steps
and a_gf
have to be the same.
GasChromatographySimulator.Program
— MethodProgram(time_steps::Array{<:Real, 1}, temp_steps::Array{<:Real, 1}, Fpin_steps::Array{<:Real, 1}, pout_steps::Array{<:Real, 1}, L)
Construct the structure Program
with given values for the case without a thermal gradient.
Arguments
time_steps::Array{<:Real, 1}
: Time steps in s (seconds).temp_steps::Array{<:Real, 1}
: Temperature steps in °C (degree celsius).Fpin_steps::Array{<:Real, 1}
: Flow steps in m³/s resp. inlet pressure steps in Pa(a).pout_steps::Array{<:Real, 1}
: Outlet pressure steps in Pa(a) (pascal, absolute).L
: Length of the capillary measured in m (meter).
The length of the arrays time_steps
, temp_steps
, Fpin_steps
and pout_steps
have to be the same.
The argument L
is used to construct the temperature interpolation T_itp(x,t)
.
Examples
julia> Program([0.0, 60.0, 300.0, 120.0],
[40.0, 40.0, 320.0, 320.0],
300000.0.*ones(4),
zeros(4),
10.0)
GasChromatographySimulator.Program
— MethodProgram(time_steps, temp_steps, Fpin_steps, pout_steps, a_gf, Tcontrol, L)
Construct the structure Program
with given values.
Arguments
time_steps
: Time steps in s (seconds).temp_steps
: Temperature steps in °C (degree celsius).Fpin_steps
: Flow steps in m³/s resp. inlet pressure steps in Pa(a).pout_steps
: Outlet pressure steps in Pa(a) (pascal, absolute).a_gf
: Parameters of the gradient function.Tcontrol
: Option defining at which point of the column the temperature
program is calculated. The options are inlet
(x=0) and outlet
(x=L).
L
: Length of the capillary measured in m (meter).
The length of the arrays time_steps
, temp_steps
, pin_steps
, pout_steps
and a_gf
have to be the same.
The arguments Tcontrol
and L
are used to construct the thermal gradient function gf(x)
and the temperature interpolation T_itp(x,t)
.
Examples
julia> Program([0.0, 60.0, 300.0, 120.0],
[40.0, 40.0, 320.0, 320.0],
300000.0.*ones(4),
zeros(4),
[[20.0, 20.0, 20.0, 20.0] zeros(4) 10.0.*ones(4) [0.0, -2.0, -5.0, -5.0]],
"inlet",
10.0)
GasChromatographySimulator.Substance
— TypeSubstance(name, CAS, Tchar, θchar, ΔCp, φ₀, ann, Cag, t₀, τ₀)
Structure to describe the properties of a solute, which migrates through the GC Column. These datas are in most cases read from a database with the function load_solute_database()
.
Arguments
name
: Name of the solute.CAS
: CAS number of the solute.Tchar
: Characterisic temperature (in K). One of the three distribution-centric thermodynamic parameters describing the retention of this solute on the given stationary phase.θchar
: Characterisic parameters (in °C). One of the three distribution-centric thermodynamic parameters describing the retention of this solute on the given stationary phase.ΔCp
: Change of the isobaric heat capacity moving from the mobile to the stationary phase (in J mol⁻¹ K⁻¹). One of the three distribution-centric thermodynamic parameters describing the retention of this solute on the given stationary phase.φ₀
: Dimensionless film thickness (φ ≈ df/d) of the column for which the thermodynamic parameters (Tchar, θchar, ΔCp) were estimated.ann
: Annotations. In most cases the source of the data is noted here.Cag
: The diffusitivity constant of the solutea
in the mobile phaseg
(in...). It is calculated by the functiondiffusitivity()
.t₀
: Initial time of the solute (in s) at the start of the simulation.τ₀
: Initial peak width of the solute (in s) at the start of the simulation.
See also: load_solute_database
GasChromatographySimulator.Options
— TypeOptions(alg, abstol, reltol, Tcontrol, odesys, ng, vis, control, k_th)
Structure describing some general options for the simulation.
Arguments
alg
: The algorithm used for the ODE solver. The algorithmsOwrenZen3()
,OwrenZen4()
andOwrenZen5()
are recommended.abstol
: The absolute tolerance for the ODE solver. Recommended value 1e-6 to 1e-8.reltol
: The relative tolerance for the ODE solver. Recommended value 1e-3 to 1e-5.Tcontrol
: Option defining at which point of the column the temperature program is calculated. The options areinlet
(x=0) andoutlet
(x=L).odesys
: Combine the ODEs for migration and peak-width into a system of ODEs (odesys = true
) or solve the two ODEs separately (odesys = false
).ng
: Option to calculate the simulation without a gradient (ng = true
) or with a gradient (ng = false
).vis
: Used model of viscosity.HP
is a second-order polynomial taken from the HP flow calculator.Blumberg
is an emperical formula according to the bookTemperature-programmed Gas Chromatography
by Leonid M. Blumberg (2010, Wiley-VCH).control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program.k_th
: Threshold for the maximum of the retention factor. If the calculated retention factor is bigger thank_th
than the retention factor is set to the valuek_th
. This is done to avoid to small step widths in the solver for highly retained soultes at the beginning of a GC program.
TODO: add option for the retention model ('ABC', 'K-centric')
For more informations about the arguments alg
, abstol
and reltol
see the documentation of the DifferentialEquations.jl package.
GasChromatographySimulator.Parameters
— TypeParameters(col, prog, sub, opt)
Structure describing all parameters for the simulation of a GC system.
Arguments
col
: StructureColumn
describing the parameters of the GC column and mobile phase gas.prog
: StructureProgram
describing the temperature and pressure program of a GC Column.sub
: An array of the structureSubstance
describing the parameters of the solutes which are separated in the GC simulation.opt
: StructureOptions
describing additional option parameters.
Physical Model
GasChromatographySimulator.pressure
— Functionpressure(x, t, T_itp, Fpin_itp, pout_itp, L, d, gas; ng=false, vis="Blumberg", control="Pressure")
Calculate the pressure at position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) flowF(t)
resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m. Can be a function of positionx
.gas
: Name of the mobile phase gas.ng
: Option to calculate the simulation without a gradient (ng = true
, eq. 2) or with a gradient (ng = false
, eq. 1).vis
: used model for viscosity "Blumberg" or "HP"control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$p(x,t) = \sqrt(p_{in}(t)^2-\frac{κ(x,t)}{κ_L(t)}\left(p_{in}^2-p_{out}^2\right))$ Eq. 1
$p(x,t) = \sqrt(p_{in}(t)^2-\frac{x}{L}\left(p_{in}^2-p_{out}^2\right))$ Eq. 2
with $κ(x,t)$ the flow restriction up to position x
at time t
and $κ_L(t) = κ(x=L,t)$ the flow restriction of the whole column at time t
.
See also: flow_restriction
GasChromatographySimulator.flow_restriction
— Functionflow_restriction(x, t, T_itp, d, gas; ng=false, vis="Blumberg")
Calculate the flow restriction $κ$ up to position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.d
: Diameter of the GC column, in m. Can be a function of positionx
.gas
: Name of the mobile phase gas.ng
: Option to calculate the simulation without a gradient (ng = true
, eq. 2) or with a gradient (ng = false
, eq. 1).vis
: used model for viscosity "Blumberg" or "HP"
$κ(x,t) = \int_0^x \frac{η(y,t) T(y,t)}{d(y)^4}dy$ Eq. 1
$κ(x,t) = \frac{η(t) T(t) x}{d^4}$ Eq. 2
with $η(x,t)$ the viscosity of the mobile phase gas.
See also: viscosity
GasChromatographySimulator.viscosity
— Functionviscosity(x, t, T_itp, gas; vis="Blumberg")
Calculate the (dynamic) viscosity of the mobile phase gas at position x
at time t
in Pa s.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.gas
: Name of the mobile phase gas.vis
: used model
vis = "HP"
Simple model used in the HP Flow calculator
`η(x,t) = C_1 * \left(T(x,t) + T_{st}\right) + C_2
vis = "Blumberg"
$η(x,t) = η_{st}\left(\frac{T(x,t)}{T_{st}}\right)^{(ξ_0 + ξ_1 \frac{T(x,t)-T_{st}}{T_{st}})}$
with $η_{st}$, $ξ_0$ and $ξ_1$ parameters dependent on the mobile phase gas [1].
[1] Blumberg, Leonid M., Temperature-Programmed Gas Chromatography, Wiley-VCH, 2010.
viscosity(T, gas; vis="Blumberg")
Calculate the (dynamic) viscosity of the mobile phase gas at temperature T
in Pa s.
Arguments
T
: Temperature in K.gas
: Name of the mobile phase gas.vis
: used model for viscosity "Blumberg" or "HP".
vis = "HP"
Simple model used in the HP Flow calculator
`η(x,t) = C_1 * \left(T(x,t) + T_{st}\right) + C_2
vis = "Blumberg"
`
$η(x,t) = η_{st}\left(\frac{T)}{T_{st}} ight)^{(ξ_0 + ξ_1 \frac{T-T_{st}}{T_{st}})}$
with $η_{st}$, $ξ_0$ and $ξ_1$ parameters dependent on the mobile phase gas [1].
[1] Blumberg, Leonid M., Temperature-Programmed Gas Chromatography, Wiley-VCH, 2010.
GasChromatographySimulator.holdup_time
— Functionholdup_time(T, Fpin, pout, L, d, gas; vis="Blumberg", control="Pressure")
Calculate the hold-up time in s without a gradient.
Arguments
T
: Temperature in K.Fpin
: Flow in m³/s resp. inlet pressure in Pa(a).pout
: Outlet pressure in Pa(g).L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$t_M = \frac{128}{3}\frac{L^2}{d^2}η\frac{p_{in}^3-p_{out}^3}{(p_{in}^2-p_{out}^2)^2}$
holdup_time(t, T_itp, pin_itp, pout_itp, L, d, gas; ng=false, vis="Blumberg", control="Pressure")
Calculate the hold-up time in s at time t
with a gradient.
Arguments
t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.pin_itp
: Interpolated (linear) inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.ng
: Option to calculate the simulation without a gradient (ng = true
, eq. 2) or with a gradient (ng = false
, eq. 1).vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$t_M(t) = 64\frac{κ_L(t)}{p_{in}(t)^2-p_{out}(t)^2} \int_0^L d(y)^2\frac{p(y,t)}{T(y,t)}dy$ Eq. 1
$t_M(t) = \frac{128}{3}\frac{L^2}{d^2}η(t)\frac{p_{in}(t)^3-p_{out}(t)^3}{(p_{in}(t)^2-p_{out}(t)^2)^2}$ Eq. 2
GasChromatographySimulator.flow
— Functionflow(T, Fpin, pout, L, d, gas; vis="Blumberg", control="Pressure")
Calculate the normalized flow through the GC column in m³/s without a gradient.
Arguments
T
: Temperature in K.Fpin
: Flow in m³/s resp. inlet pressure in Pa(a).pout
: Outlet pressure in Pa(g).L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$F = \frac{π}{256}\frac{T_n}{p_n}\frac{d^4}{L}\frac{p_{in}^2-p_{out}^2}{η T}$
with $T_n$ the normalized temperature ($T_n=(25 + 273.15)$K), $p_n$ the normalized pressure ($p_n = 101300$ Pa(a)) and $η$ the viscosity the mobile phase gas at temperature $T$.
flow(t, T_itp, Fpin_itp, pout_itp, L, d, gas; ng=false, vis="Blumberg", control="Pressure")
Calculate the normalized flow through the GC column in m³/s at time t
.
Arguments
t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) Flow F(t) resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.ng
: Option to calculate the simulation without a gradient (ng = true
, eq. 2) or with a gradient (ng = false
, eq. 1).vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$F(t) = \frac{π}{256}\frac{T_n}{p_n}\frac{p_{in}(t)^2-p_{out}(t)^2}{κ_L(t)}$ Eq. 1
$F(t) = \frac{π}{256}\frac{T_n}{p_n}\frac{d^4}{L}\frac{p_{in}(t)^2-p_{out}(t)^2}{η(t) T(t)}$ Eq. 2
with $T_n$ the normalized temperature ($T_n=(25 + 273.15)$K), $p_n$ the normalized pressure ($p_n = 101300$ Pa(a)), $κ_L$ the flow restriction of the column and $η$ the viscosity the mobile phase gas at temperature $T$.
GasChromatographySimulator.mobile_phase_residency
— Functionmobile_phase_residency(x, t, T_itp, Fpin_itp, pout_itp, L, d, gas; ng=false, vis="Blumberg", control="Pressure")
Calculate the residency (the inverse velocity) of the mobile phase at position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) Flow F(t) resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.ng
: Option to calculate the simulation without a gradient (ng = true
)
or with a gradient (ng = false
).
vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$r_M(x,t) = 64 \frac{d^2 κ_L}{T(x,t)}\frac{p(x,t)}{p_{in}^2-p_{out}^2}$
with $T_n$ the normalized temperature ($T_n=(25 + 273.15)$K), $p_n$ the normalized pressure ($p_n = 101300$ Pa(a)), $κ_L$ the flow restriction of the column and $p(x,t)$ the local pressure.
See also: pressure
, flow_restriction
GasChromatographySimulator.residency
— Functionresidency(x, t, T_itp, Fpin_itp, pout_itp, L, d, df, gas, Tchar, θchar, ΔCp, φ₀; ng=false, vis="Blumberg", control="Pressure")
Calculate the residency (the inverse velocity) of the solute at position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) Flow F(t) resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.df
: Film thickness of the GC column, in m.gas
: Name of the mobile phase gas.Tchar
: Characteristic temperature of the solute, in K.θchar
: Characteristic parameters of the solute, in °C.ΔCp
: Change of the isobaric heat capacity of the solute moving from the mobile to the
stationary phase, in J mol⁻¹ K⁻¹.
φ₀
: Dimensionless film thickness (φ ≈ df/d) of the column for which the
thermodynamic parameters (Tchar, θchar, ΔCp) were estimated.
ng
: Option to calculate the simulation without a gradient (ng = true
)
or with a gradient (ng = false
).
vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$r(x,t) = r_M(x,t) \left(1+k(x,t)\right)$
with $r_M$ the residency of the mobile phase and $k(x,t)$ the retention factor of the solute on the stationary phase.
See also: mobile_phase_residency
, retention_factor
GasChromatographySimulator.retention_factor
— Functionretention_factor(x, t, T_itp, d, df, Tchar, θchar, ΔCp, φ₀)
Calculate the retention factor of the solute in the stationary phase at position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.d
: Diameter of the GC column, in m.df
: Film thickness of the GC column, in m.Tchar
: Characteristic temperature of the solute, in K.θchar
: Characteristic parameters of the solute, in °C.ΔCp
: Change of the isobaric heat capacity of the solute moving from the mobile to the
stationary phase, in J mol⁻¹ K⁻¹.
φ₀
: Dimensionless film thickness (φ ≈ df/d) of the column for which the
thermodynamic parameters (Tchar, θchar, ΔCp) were estimated.
$k(x,t) = \frac{φ}{φ₀} \exp{\left((\frac{ΔC_p}{R}+\frac{T_{char}}{θ_{char}})(\frac{T_{char}}{T}+-1) \frac{ΔC_p}{R}\ln{(\frac{T}{T_{char}})}\right)}$
with $R$ the molar gas constant and $φ$ the dimensionless film thickness of the simulated GC Column ($φ = d_f/d$).
TODO: add option for the retention model ('ABC', 'K-centric')
GasChromatographySimulator.plate_height
— Functionplate_height(x, t, T_itp, Fpin_itp, pout_itp, L, d, df, gas, Tchar, θchar, ΔCp, φ₀, Cag; ng=false, vis="Blumberg", control="Pressure", k_th=1e12)
Calculate the plate height of the solute at position x
at time t
according to the Golay equation.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) Flow F(t) resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.df
: Film thickness of the GC column, in m.gas
: Name of the mobile phase gas.Tchar
: Characteristic temperature of the solute, in K.θchar
: Characteristic parameters of the solute, in °C.ΔCp
: Change of the isobaric heat capacity of the solute moving from the mobile to the
stationary phase, in J mol⁻¹ K⁻¹.
φ₀
: Dimensionless film thickness (φ ≈ df/d) of the column for which the
thermodynamic parameters (Tchar, θchar, ΔCp) were estimated.
Cag
: diffusivity constant of solutea
in gasg
.ng
: Option to calculate the simulation without a gradient (ng = true
)
or with a gradient (ng = false
).
vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$H(x,t) = 2 \frac{D_M}{u_M} + \frac{d^2}{96}\left(6 μ^2-16 μ +11 \right) \frac{u_M}{D_M} + \frac{2}{3} d_f^2 μ(1-μ) \frac{u_M}{D_S}$
with $D_M$ the diffusion coefficient of the solute in the mobile phase, $D_S$ the diffusion coefficient of the solute in the stationary phase, $u_M$ the velocity of the mobile phase and μ the mobility of the solute.
$D_S$ is correlated to $D_M$ by:
$D_S = \frac{D_M}{10000}$
TODO: alternative correlations?
$u_M$ is realated to the residency of the mobile phase $r_M$:
$u_M = \frac{1}{r_M}$
μ is correlated to the retention factor $k$:
$μ = \frac{1}{1 + k}$
See also: diffusion_mobile
, mobile_phase_residency
, retention_factor
GasChromatographySimulator.diffusion_mobile
— Functiondiffusion_mobile(x, t, T_itp, Fpin_itp, pout_itp, L, d, gas, Cag; ng=false, vis="Blumberg", control="Pressure")
Calculate the diffusion coefficient of the solute in the mobile phase at position x
at time t
.
Arguments
x
: Position along the GC column, in m.t
: Time in s.T_itp
: Interpolated (linear) temperatureT(x,t)
.Fpin_itp
: Interpolated (linear) Flow F(t) resp. inlet pressurepin(t)
.pout_itp
: Interpolated (linear) outlet pressurepout(t)
.L
: Length of the capillary measured in m (meter).d
: Diameter of the GC column, in m.gas
: Name of the mobile phase gas.Cag
: diffusivity constant of solutea
in gasg
.ng
: Option to calculate the simulation without a gradient (ng = true
)
or with a gradient (ng = false
).
vis
: used model for viscosity "Blumberg" or "HP".control
: Control of the "Flow" or of the "Pressure" (at column inlet) during the program
$D_M(x,t) = C_{ag} \frac{T(x,t)^{1.75}}{p(x,t)}$
Solving
GasChromatographySimulator.simulate
— Functionsimulate(par::Parameters; kwargs...)
Simulate the GC system defined by the structure par
.
Alternative call: simulate(L, d, df, gas, T_itp, Fpin_itp, pout_itp, Tchar, θchar, ΔCp, φ₀, Cag, t₀, τ₀, opt; kwargs...)
Note: Based on the option for odesys
the result is different. For odesys = true
the result is a dataframe (the peaklist) and the solution of the ODEs as a system (solution structure from DifferentialEquations.jl). If odesys = false
the result is a dataframe (the peaklist) and the two solutions of the ODEs for time $t(z)$ and peak variance $τ²(z)$. kwargs...
to pass additional options to the ODE solve function as named tuples.
GasChromatographySimulator.solve_system_multithreads
— Functionsolve_system_multithreads(par::Parameters, kwargs...)
Simulate the GC system defined by the structure par
by solving the ODEs for $t(z)$ and $τ²(z)$ together as a system of ODEs using multiple threads (parallel computing) for the simulation of different solutes. kwargs...
to pass additional options to the ODE solve function as named tuples.
Note: The result is an array of the solution structure from DifferentialEquations.jl.
Alternative call: solve_system_multithreads(L, d, df, gas, T_itp, Fpin_itp, pout_itp, Tchar, θchar, ΔCp, φ₀, Cag, t₀, τ₀, opt; kwargs...)
with the substance realted quantitites beeing vectors.
Examples
julia> sol = solve_system_multithreads(par)
Missing docstring for GasChromatographySimulator.solve_multithreads
. Check Documenter's build log for details.
GasChromatographySimulator.solving_migration
— Functionsolving_migration(col::Column, prog::Program, sub::Substance, opt::Options; kwargs...)
Solve for the migration $t(z)$ of solute sub
in the GC Column col
with the program prog
and the options opt
. kwargs...
to pass additional options to the ODE solve function as named tuples.
Alternative call: solving_migration(L, d, df, gas, T_itp, Fpin_itp, pout_itp, Tchar, θchar, ΔCp, φ₀, t₀, opt; kwargs...)
Note: The result is the solution structure from DifferentialEquations.jl.
GasChromatographySimulator.solving_peakvariance
— Functionsolving_peakvariance(solution_tz, col::Column, prog::Program, sub::Substance, opt::Options; kwargs...)
Solve for the development of the peak variance $τ²(z)$ of solute sub
in the GC Column col
with the program prog
and the options opt
during its migration defined by solution_tz
. kwargs...
to pass additional options to the ODE solve function as named tuples.
Alternative call: solving_peakvariance(solution_tz, L, d, df, gas, T_itp, Fpin_itp, pout_itp, Tchar, θchar, ΔCp, φ₀, Cag, τ₀, opt; kwargs...)
Note: The result is the solution structure from DifferentialEquations.jl.
GasChromatographySimulator.solving_odesystem_r
— Functionsolving_odesystem_r(col::Column, prog::Program, sub::Substance, opt::Options; kwargs...)
Solve the migration $t(z)$ and peak variance development $τ²(z)$ of solute sub
in the GC Column col
with the program prog
and the options opt
as a system of ODEs. kwargs...
to pass additional options to the ODE solve function as named tuples.
Note: The result is the solution structure from DifferentialEquations.jl.
See also: odesystem_r!
GasChromatographySimulator.odesystem_r!
— Functionodesystem_r!(dt, t, p, z)
The ODE system for migration $t(z)$ and peak variance development $τ²(z)$.
$\frac{dt}{dz} = r(z, t(z))$
$\frac{dτ^2}{dz} = H(z, t(z)) r(z, t(z)) + 2 τ^2(z, t(z)) \frac{∂r}{∂t}(z,t(z))$
See also: solving_odesystem_r
, peakode
GasChromatographySimulator.peakode
— Functionpeakode(z, t, τ², col, prog, sub, opt)
The second ODE function for the ODE system describing the peak variance development $τ²(z)$, using automatic differentiation.
$\frac{dτ^2}{dz} = H(z, t(z)) r(z, t(z)) + 2 τ^2(z, t(z)) \frac{∂r}{∂t}(z,t(z))$
See also: solving_odesystem_r
, odesystem_r!
Results
GasChromatographySimulator.peaklist
— Methodpeaklist(sol, par)
Construct a DataFrame with the peak list of the solution sol
of the simulation of the GC system defined by par
.
Output
The peaklist DataFrame consists of the entrys:
No
: Number of the solute in the database.Name
: Name of the solute.tR
: Retention time of the solute (in s).τR
: Peak width of the solute (in s).TR
: Temperature of the end of the column at the retention time (in °C).σR
: Band width of the solute at retention time (in m).uR
: Solute velocity at retention time (in m/s).kR
: Retention factor of the solute at retention time.Res
: Resolution (4τ) between neighboring peaks.Δs
: separation metric between neighboring peaks, assuming linear development of peak widthτR
between the peaks.Annotations
: additional anotations, e.g. Source, categories, if available
Examples
julia> pl = peaklist(sol, par)
...
GasChromatographySimulator.peaklist
— Methodpeaklist(sol, peak, par)
Construct a DataFrame with the peak list of the solution sol
and peak
of the simulation of the GC system defined by par
.
Output
The peaklist DataFrame consists of the entrys:
No
: Number of the solute in the database.Name
: Name of the solute.tR
: Retention time of the solute (in s).τR
: Peak width of the solute (in s).TR
: Temperature of the end of the column at the retention time (in °C).σR
: Band width of the solute at retention time (in m).uR
: Solute velocity at retention time (in m/s).kR
: Retention factor of the solute at retention time.Res
: Resolution (4τ) between neighboring peaks.Δs
: separation metric between neighboring peaks, assuming linear development of peak widthτR
between the peaks.Annotations
: additional anotations, e.g. Source, categories, if available
Examples
julia> pl = peaklist(sol, peak, par)
...
GasChromatographySimulator.sol_extraction
— Methodsol_extraction(sol, par)
Extract the points z=t, t=u1, τ²=u2 from the solution sol
of the ODE system of the GC system defined by par
and exports them in a DataFrame.
Examples
df_sol = sol_extraction(sol, par)
...
GasChromatographySimulator.sol_extraction
— Methodsol_extraction(sol, peak, par)
Extract the points zt=sol.t, t=sol.u, zτ²=peak.t and τ²=peak.u from the solution sol
and peak
of the ODEs of the GC system defined by par
and exports them in a DataFrame.
Examples
df_sol = sol_extraction(sol, peak, par)
...
Plot functions
GasChromatographySimulator.plot_chromatogram
— Functionplot_chromatogram(peaklist, tlims; annotation=true, number=true, mirror=false, offset=0.0, uncertainty=false, color=:blue)
Plot the chromatogram of the peaks listed in peaklist
over the time tupel tlims = (t_start, t_end
). If peaklist
contains values with uncertainties, than only the values of retention time and peak widths without uncertainties are used.
Arguments
peaklist
: DataFrame with the names, retention times and peak widths of the simulated substances.tlims
: Tuple defining the start and end time of the plotted chromatogram.annotation
: Boolean, switching the annotation of the peaks on/off; default = true.number
: Boolean, switching the type of the annotation between number of the substance in the peaklist (number = true
) or name of the substance (number = false
); default = true.mirror
: Boolean, ifmirror = true
the chromatogram is multiplied by-1
; default = false.offset
: Float64, this value is added to the chromatogram; default = 0.0.uncertainty
: Boolean, ifuncertainty = true
the uncertainty in retention time will be plotted as rectangle with ± uncertainty of retention time and uncertainty of peak width wil be plotted as two additional chromatograms with peak width aspeak width - uncertainty
andpeak width + uncertainty
. Default is false.color
: Symbol of the color for the chromatogram, default is:blue
.
Output
Tupel (p_chrom, t, chrom)
p_chrom
: the plot of the chromatogramchrom
over timet
t
: Array of time of the chromatogramchrom
: Array of the abundance values of the chromatogram
GasChromatographySimulator.plot_chromatogram!
— Functionplot_chromatogram!(p_chrom, peaklist, tlims; annotation=true, number=true, mirror=true, offset=0.0, uncertainty=false, color=:darkgreen)
Add the chromatogram of the peaks listed in peaklist
over the time tupel tlims = (t_start, t_end
) to the plot p_chrom
. If peaklist
contains values with uncertainties, than only the values of retention time and peak widths without uncertainties are used.
Arguments
p_chrom
: Plot of an existing chromatogram.peaklist
: DataFrame with the names, retention times and peak widths of the simulated substances.tlims
: Tuple defining the start and end time of the plotted chromatogram.annotation
: Boolean, switching the annotation of the peaks on/off; default = true.number
: Boolean, switching the type of the annotation between number of the substance in the peaklist (number = true
) or name of the substance (number = false
); default = true.mirror
: Boolean, ifmirror = true
the chromatogram is multiplied by-1
; default = false.offset
: Float64, this value is added to the chromatogram; default = 0.0.uncertainty
: Boolean, ifuncertainty = true
the uncertainty in retention time will be plotted as rectangle with ± uncertainty of retention time and uncertainty of peak width wil be plotted as two additional chromatograms with peak width aspeak width - uncertainty
andpeak width + uncertainty
. Default is false.color
: Symbol of the color for the chromatogram, default is:darkgreen
.
Output
Tupel (t, chrom)
t
: Array of time of the chromatogramchrom
: Array of the abundance values of the chromatogram
GasChromatographySimulator.plot_flow
— Functionplot_flow(par)
Calculate and plot the flow (in mL/min, normalized) of the carrier gas in a GC Column with a program defined in the parameters par::GasChromatography.Parameters
.
GasChromatographySimulator.plot_pressure
— Functionplot_pressure(prog)
Plot the inlet and outlet pressure over time of the program prog::GasChromatographySimulator.Program
.
GasChromatographySimulator.plot_temperature
— Functionplot_temperature(par; selector="T(t)")
Plot the temperature program of the GC Column.
Arguments
par::GasChromatographySimulator.Parameters
: parameters of the GC systemselector::String
: selection of the plot as:
* `selector = "T(t)"`: 2D-plot of temperature `T` over time `t` at inlet (`x=0`) and outlet (`x=L`)
* `selector = "T(x)"`: 2D-plot of temperature `T` over column position `x` at the `time_steps` of the program
* `selector = "T(x,t)"`: 3D-plot of temperature `T` over column position `x` and `t`
GasChromatographySimulator.local_plots
— Functionlocal_plots(xx, yy, sol, par; uncertainty=true)
Show additional 'local' plots of selected yy
quantities over selected xx
quantities. If the solutions sol
contain values with uncertainties, the uncertainty of yy
will be plotted as a ribbon, while uncertainties in xx
are ignored (if uncertainty=true
, else all uncertainties are ignored).
Arguments
xx
: Selected quantity shown on the x-axis. Possible values: "z", "t", "T", "τ", "σ" and "u".yy
: Selected quantity shown on the y-axis. Possible values: "z", "t", "T", "τ", "σ" and "u".sol
: The solution of the simulation.par
: The parameters of the simulated GC-system.
GasChromatographySimulator.velocity
— Functionvelocity(df_sol, i, par)
Calculate the velocity (in m/s) coressponding to solution of the i-th
sunstance of a GC-system defined by par
.
UI functions for notebooks
GasChromatographySimulator.UI_Column
— FunctionUI_Column(sp)
Construct a combined PlutoUI widget for the settings of the GC Column with the selectable stationary phases sp
.
UI fields
- $L$: column length in m.
- $d$: column diameter in mm.
- $d_f$: film thickness in µm.
- stat. phase: stationary phase of the column
- Gas: mobile phase
GasChromatographySimulator.UI_Program
— FunctionUI_Program(; default=("0 60 300 300 120", "40 40 170 300 300", "0 0 40 60 0", "-3 -3 -3 -3 -3", "18 18 58 98 98", "0 0 0 0 0"))
Construct a combined PlutoUI widget for the settings of the program of a GC column with or without a thermal gradient (depending on the default tuple).
With thermal gradient
For default as a tuple of six strings the folwing fields will be shown in the widget:
- example default tupel: default=("0 60 300 300 120", "40 40 170 300 300", "0 0 40 60 0", "-3 -3 -3 -3 -3", "18 18 58 98 98", "0 0 0 0 0")
*time steps
: the time steps after which duration the values of temperature, inlet pressure, ΔT and α are achieved by linear interpolation (in s). *temperature steps
: the temperature steps (in °C). *ΔT steps
: the steps of the temperature difference (in °C) between column inlet and outlet. *α steps
: the steps of the gradient profile (α = 0 ... linear change of temperature along column, α < 0 ... concave exponential profile, α > 0 ... convexe exponential profile). *$p_{in}$ steps: the steps of the inlet pressure (in kPa(g)) *$p_{out}$ steps: the steps of the outlet pressure (in kPa(a))
Without thermal gradient
For a default as a tuple of four strings the folwing fields will be shown in the widget:
- example default tupel: default=("0 60 600 120", "40 40 300 300", "18 18 98 98", "vacuum")
*time steps
: the time steps after which duration the values of temperature, inlet pressure, ΔT and α are achieved by linear interpolation (in s). *temperature steps
: the temperature steps (in °C). $p_{in}$ steps: the steps of the inlet pressure (in kPa(g)) column outlet
selection of the outlet of the colum, "vacuum" ($p_{out} = 0.0$ kPa(a)) or "atmosphere" ($p_{out} = 101.3$ kPa(a)).
GasChromatographySimulator.UI_Substance
— FunctionUI_Substance(sol; default=(1:4, ))
Construct a combined PlutoUI widget for the settings of the substances separated in the simulated GC system with the selectable substances subs
.
Depending on the tupel of default
the widget is setup.
For default = (1:4, 0.0, 0.0)
the UI fields are:
- Select Substances: Selection of the substances, which will be simulated, default selection = 1st to 4th substance.
- Injection time: Start time (in s) of the simulation. The same for all selected substances. Default is 0.0 s.
- Injection width: Peak width (in s) of all selected substances at the time of injection. Default is 0.0 s.
For default = (1:4,)
the UI fields are:
- Select Substances: Selection of the substances, which will be simulated, default selection = 1st to 4th substance.
GasChromatographySimulator.UI_Options
— FunctionUI_Options()
Construct a combined PlutoUI widget for the settings of the options for the simulation.
GasChromatographySimulator.setting_prog
— Functionsetting_prog(prog_values)
Translates the Program parameters from a tuple defined by a PlutoUI widget into the structure GasChromatographySimulator.Program.
Helper functions
GasChromatographySimulator.temperature_interpolation
— Functiontemperature_interpolation(time_steps, temp_steps, gradient_function, L)
Construct the temperature function depending on position x
and time t
.
Arguments
time_steps::Array{<:Real,1}
: Time steps in s (seconds).temp_steps::Array{<:Real,1}
: Temperature steps in °C (degree celsius).gf::Function
: Gradient functiongf(x, a_gf)
, describes the thermal gradient.L
: Length of the capillary measured in m (meter).
For the spatial dependency of the interpolated temperature T_ipt(x,t)
the gradient function gf
is calculated every 1e-3 m (1 mm). Positions inbetween are linear interpolated. For the temporal dependency the temperatures temp_steps
defined at the time_steps
are linear interpolated over time t
.
Examples
julia> T_itp = temperature_interpolation([0.0, 60.0, 300.0, 120.0], [40.0, 40.0, 320.0, 320.0], gf, 10.0)
GasChromatographySimulator.steps_interpolation
— Functionsteps_interpolation(time_steps, steps)
Construct a linear interpolated function depending on time t
of the steps
-values over time_steps
.
Arguments
time_steps::Array{<:Real,1}
: Time steps in s (seconds).steps::Array{<:Real,1}
: steps, e.g. pressure or flow.
Examples
julia> pin_itp = steps_interpolation([0.0, 60.0, 300.0, 120.0],
[300000.0, 300000.0, 400000.0, 400000.0])
GasChromatographySimulator.load_solute_database
— Functionload_solute_database(db_path, db, sp, gas, solutes, t₀, τ₀)
Load the data of solutes
for the stationary phase sp
and the mobile phase gas
from the database file db
(located in db_path
) into an array of the structure Substance
. The row number of the selected solutes in the loaded database are added to the annotations of the Substance
structure.
Arguments
db_path::String
: Path to the database file.db::String
: Name of the database file.sp::String
: Name of the stationary phase.gas::String
: Name of the mobile phase.solutes::Array{<:AbstractString,1}
: Name of the solutes.t₀::Array{<:Real,1}
: Initial start times of the solutes.τ₀::Array{<:Real,1}
: Initial peak widths of the solutes.
Examples
julia> sub = load_solute_database("path/to/the/file", "db.csv", "DB5", "He", ["C10", "C11"], [0.0, 0.0], [0.5, 0.5])
load_solute_database(db_, sp_, gas_, solutes_, t₀_, τ₀_)
New function to load the data for the substances solutes_
from the database db_
for the stationary phase sp_
and mobile phase gas_
with initial time t₀_
and initial peak width τ₀_
. The parameters solutes_
, t₀_
and τ₀_
must be vectors of the same length. Acceptable values for solutes_
are either the substance names, CAS numbers or the number No from the database.
The loaded data is returned as a vector of the GasChromatographySimulator.Substance structure.
GasChromatographySimulator.all_solutes
— Functionall_solutes(sp, db; id=false, separator=" - ")
Extract the name of all solutes for which data in a database db
and the stationay phase sp
is available.
Arguments
sp
: Name of the stationary phase.db
: DataFrame of the database.id
: iftrue
than the number of the solutes in the database are combined with the solute name. Default = false.separator
: string used to separate the solute number from the solute name. Default = " - ".
Examples
julia> all = all_solutes("DB5", db)
GasChromatographySimulator.diffusivity
— Functiondiffusivity(M, Cn, Hn, On, Nn, Rn, gas)
Calculate the diffusivity constant Cag
of solute a
in gas g
using the emperical Fuller-Schettler-Giddings model [1].
[1] Fuller, Edward N.; Ensley, Keith; Giddings, J. Calvin, Diffusion of Halogenated Hydrocarbons in Helium. The Effect of Structure on Collision Cross Sections, The Journal of Physical Chemistry, Volume 73, Issue 11, 1969, 3679–3685
Arguments
M
: Molar mass of the solute.Cn
: Number of carbon atoms of the solute.Hn
: Number of hydrogen atoms of the solute.On
: Number of oxygen atoms of the solute.Nn
: Number of nitrogen atoms of the solute.Rn
: Number of closed rings of the structure of the solute.gas
: The name of the mobile phase. Allowed values: He, H2 or N2.
diffusivity(id, gas)
Calculate the diffusivity constant Cag
of solute id
in gas gas
using the emperical Fuller-Schettler-Giddings model [1], using the identifier of the solute id
.
[1] Fuller, Edward N.; Ensley, Keith; Giddings, J. Calvin, Diffusion of Halogenated Hydrocarbons in Helium. The Effect of Structure on Collision Cross Sections, The Journal of Physical Chemistry, Volume 73, Issue 11, 1969, 3679–3685
Arguments
id
: Named tupel identifying the solute. (Name, CAS, formula, MW, smiles)gas
: The name of the mobile phase. Allowed values: He, H2 or N2.
GasChromatographySimulator.common
— Functioncommon(s_1, s_1)
Compare two arrays and return the common elements.
GasChromatographySimulator.compare_peaklist
— Functioncompare_peaklist(pl_1, pl_2)
Compare two peaklists (results of GasChromatographySimulator.jl) and calculate absolute and relative differences of retention times and peak widths.
GasChromatographySimulator.compare_measurement_simulation
— Functioncompare_measurement_simulation(meas, peaklist)
Compare the retention times of measured and simulated substances.
Arguments
meas
: DataFrame consisting at least of the columns:Name
and:RT
(measured retention time in s)peaklist
: DataFrame as result from GasChromatographySimulator.jl with the columns:Name
and:tR
(simulated retention time in s).
The comparison is done by searching the same Name
of the substance in both DataFrames and calculating the absolute difference of the retention times (in s) and the relative difference (in %).
GasChromatographySimulator.conventional_program
— Methodconventional_program(CP; time_unit="min")
Translate the conventional program notation into a vector of time steps and value steps (temperature, pressure, flow) used in GasChromatographySimulator.Program
The conventional temperature program is defined as an array of the following form (for a temperature program): CP = [T₁, t₁, r₁, T₂, t₂, r₂, T₃, t₃, ...]
corresponding to the notation: T₁(t₁) - r₁ - T₂(t₂) - r₂ - T₃(t₃) - ...
which can be read as: Starting temperature T₁
is holded for time t₁
. After the holding time the temperature increases linearly with the heating rate r₁
, until temperature T₂
is reached. This temperature is held for the time t₂
after which the temperature increases linearly by the heating rate r₂
until temperature T₃
is reached, which is hold for the time t₃
, and so on.
The option time_unit
determines the unit of time in the program CP
. For time_unit = "min"
(default) the times are measured in minutes and the heating rates in °C/min. For time_unit = "s"
the times are measured in seconds and the heating rate in °C/s.
GasChromatographySimulator.temperature_program
— Methodtemperature_program(time_steps, value_steps; time_unit="min")
Translate the vector of time steps and value steps (temperature, pressure, flow) into a conventional program notation.
The conventional temperature program is defined as an array of the following form (for a temperature program): CP = [T₁, t₁, r₁, T₂, t₂, r₂, T₃, t₃, ...]
corresponding to the notation: T₁(t₁) - r₁ - T₂(t₂) - r₂ - T₃(t₃) - ...
which can be read as: Starting temperature T₁
is holded for time t₁
. After the holding time the temperature increases linearly with the heating rate r₁
, until temperature T₂
is reached. This temperature is held for the time t₂
after which the temperature increases linearly by the heating rate r₂
until temperature T₃
is reached, which is hold for the time t₃
, and so on.
The option time_unit
determines the unit of time in the program CP
. For time_unit = "min"
(default) the times are measured in minutes and the heating rates in °C/min. For time_unit = "s"
the times are measured in seconds and the heating rate in °C/s.
GasChromatographySimulator.common_time_steps
— Functioncommon_time_steps(time_steps_1, time_steps_2)
Estimate a new set of time steps, which represents the combination of time_steps_1
and time_steps_2
.
GasChromatographySimulator.new_value_steps
— Functionnew_value_steps(value_steps, time_steps, new_time_steps)
Estimate the new value steps at the new_time_steps
from the original set of value_steps
over time_steps
. The new values at new time steps are calculated from a linear change of the value between the original time steps.
GasChromatographySimulator.Column
GasChromatographySimulator.Column
GasChromatographySimulator.Options
GasChromatographySimulator.Parameters
GasChromatographySimulator.Program
GasChromatographySimulator.Program
GasChromatographySimulator.Program
GasChromatographySimulator.Substance
GasChromatographySimulator.UI_Column
GasChromatographySimulator.UI_Options
GasChromatographySimulator.UI_Program
GasChromatographySimulator.UI_Substance
GasChromatographySimulator.all_solutes
GasChromatographySimulator.common
GasChromatographySimulator.common_time_steps
GasChromatographySimulator.compare_measurement_simulation
GasChromatographySimulator.compare_peaklist
GasChromatographySimulator.conventional_program
GasChromatographySimulator.diffusion_mobile
GasChromatographySimulator.diffusivity
GasChromatographySimulator.flow
GasChromatographySimulator.flow_restriction
GasChromatographySimulator.holdup_time
GasChromatographySimulator.load_solute_database
GasChromatographySimulator.local_plots
GasChromatographySimulator.mobile_phase_residency
GasChromatographySimulator.new_value_steps
GasChromatographySimulator.odesystem_r!
GasChromatographySimulator.peaklist
GasChromatographySimulator.peaklist
GasChromatographySimulator.peakode
GasChromatographySimulator.plate_height
GasChromatographySimulator.plot_chromatogram
GasChromatographySimulator.plot_chromatogram!
GasChromatographySimulator.plot_flow
GasChromatographySimulator.plot_pressure
GasChromatographySimulator.plot_temperature
GasChromatographySimulator.pressure
GasChromatographySimulator.residency
GasChromatographySimulator.retention_factor
GasChromatographySimulator.setting_prog
GasChromatographySimulator.simulate
GasChromatographySimulator.sol_extraction
GasChromatographySimulator.sol_extraction
GasChromatographySimulator.solve_system_multithreads
GasChromatographySimulator.solving_migration
GasChromatographySimulator.solving_odesystem_r
GasChromatographySimulator.solving_peakvariance
GasChromatographySimulator.steps_interpolation
GasChromatographySimulator.temperature_interpolation
GasChromatographySimulator.temperature_program
GasChromatographySimulator.velocity
GasChromatographySimulator.viscosity