---
title: "Details"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Details}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
This vignette collects together other details for odin that we might want to link from elsewhere.
# Order of events
This is only an issue for discrete-time models, as for a continuous time model it is always "now".
Consider discrete time model that compares to data. There will be some series of "updates" then a comparison to data, then we repeat until we reach the end of the data. The order of events as we move from `time = t0` to to `time = t0 + dt` is:
**Update**
1. Reset any variables that use `zero_every`
1. Read from variables
1. Look up interpolation (using `t0`)
1. Evaluate all assignments (therefore with `time = t0` and all variables having the value at the beginning of the step)
1. Write out new values of state
1. Update `time` to `t0 + dt`
**Compare**
1. Read from variables
1. Look up interpolation (using `t0 + dt`)
1. Compare to data