# Create a lookup variable for a non-linear relationship
sfm <- stockflow() |>
lookup(output,
source = t,
xpts = c(0, 5, 10),
ypts = c(0, 10, 15),
interpolation = "linear"
) |>
stock(x) |>
flow(x_in, eqn = output(t), to = x)
sim <- simulate(sfm)
plot(sim)
Run the code above in your browser using DataLab