A basic virus infection model with 3 compartments
simulate_basicvirus_ode(
U = 1e+05,
I = 0,
V = 1,
n = 0,
dU = 0,
dI = 1,
dV = 2,
b = 2e-05,
p = 5,
g = 1,
tstart = 0,
tfinal = 30,
dt = 0.1
)
: starting value for Uninfected cells : numeric
: starting value for Infected cells : numeric
: starting value for Virus : numeric
: rate of new uninfected cell replenishment : numeric
: rate at which uninfected cells die : numeric
: rate at which infected cells die : numeric
: rate at which virus is cleared : numeric
: rate at which virus infects cells : numeric
: rate at which infected cells produce virus : numeric
: possible conversion factor for virus units : numeric
: Start time of simulation : numeric
: Final time of simulation : numeric
: Time step : numeric
The function returns the output as a list.
The time-series from the simulation is returned as a dataframe saved as list element ts
.
The ts
dataframe has one column per compartment/variable. The first column is time.
The model includes uninfected and infected target cells, as well as free virus. The processes that are modeled are infection, virus production, uninfected cell birth and death, infected cell and virus death.
This code was generated by the modelbuilder R package. The model is implemented as a set of ordinary differential equations using the deSolve package. The following R packages need to be loaded for the function to work: deSolve.
This function does not perform any error checking. So if you try to do something nonsensical (e.g. have negative values for parameters), the code will likely abort with an error message.
2021-07-19
2021-07-19
# To run the simulation with default parameters:
result <- simulate_basicvirus_ode()
# To choose values other than the standard one, specify them like this:
result <- simulate_basicvirus_ode(U = 2e+05,I = 0,V = 2)
# You can display or further process the result, like this:
plot(result$ts[,'time'],result$ts[,'U'],xlab='Time',ylab='Numbers',type='l')
print(paste('Max number of U: ',max(result$ts[,'U'])))
#> [1] "Max number of U: 2e+05"