View source: R/make_predictions.R
predict_inactivation | R Documentation |
Predicts the inactivation of a microorganism under isothermal or non-isothermal temperature conditions. The thermal resistence of the microorganism are defined with the input arguments.
predict_inactivation( simulation_model, times, parms, temp_profile, ..., tol0 = 1e-05 )
simulation_model |
character identifying the model to be used. |
times |
numeric vector of output times. |
parms |
list of parameters defining the parameters of the model. |
temp_profile |
data frame with discrete values of the temperature for
each time. It must have one column named |
... |
Additional arguments passed to |
tol0 |
numeric. Observations at time 0 make Weibull-based models singular. The time for observatins taken at time 0 are changed for this value. By default ('tol0 = 1e-5') |
The value of the temperature is calculated at each value of time by
linear interpolation of the values provided by the input argument
temp_profile
.
The function ode
of the package deSolve
is
used for the resolution of the differential equation.
A list of class SimulInactivation
with the results. It has
the following entries:
model: character defining the model use for the prediction.
model_parameters: named numeric vector with the values of the model parameters used.
temp_approximations: function used for the interpolation of the temperature. For a numeric value of time given, returns the value of the temperature and its first derivative.
simulation: A data frame with the results calculated. Its
first column contains the times at which the
solution has been calculated. The following
columns the values of the variables of the
model. The three last columns provide the
values of logN
, S
and
logS
.
ode
, get_model_data
## EXAMPLE 1 ----------- ## Retrieve the model keys available for dynamic models. get_model_data() ## Set the input arguments example_model <- "Geeraerd" # Geeraerd's model will be used times <- seq(0, 5, length=100) # values of time for output model_data <- get_model_data(example_model) # Retrive the data of the model used print(model_data$parameters) print(model_data$variables) model_parms <- c(D_R = 1, z = 10, N_min = 100, temp_ref = 100, N0 = 100000, C_c0 = 1000 ) ## Define the temperature profile for the prediction temperature_profile <- data.frame(time = c(0, 1.25, 2.25, 4.6), temperature = c(70, 105, 105, 70)) ## Call the prediction function prediction_results <- predict_inactivation(example_model, times, model_parms, temperature_profile) ## Show the results head(prediction_results$simulation) plot(prediction_results) time_to_logreduction(1.5, prediction_results) ## END EXAMPLE 1 -----------
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.