# Execute a Simile model to a given time point

### Description

The model will be executed using the time steps specified by earlier calling set.model.step until either the finish.time is reached or an exception occurs.

### Usage

1 2 | ```
execute.model(instance.handle, finish.time, integration.method,
start.time, error.limit, pause.on.event)
``` |

### Arguments

`instance.handle` |
The handle returned by create.model(), identifying an executable model instance. |

`finish.time` |
Time returned by functions in the model on the last execution step, when incrementing the time takes it to or beyond this value. |

`integration.method` |
One of "Euler" or "Runge-Kutta", the latter being 4th-order. Default is "Euler". |

`start.time` |
Time returned by functions in the model on the first execution step. On each subsequent step this will be incremented by the value specified by earlier calling set.model.step. Default is NA, which starts the model at the time to which it was previously reset or executed. |

`error.limit` |
Maximum integration error allowed by adaptive step size variation, as a fraction of the allowed range of each model compartment value. The integration error is estimated by comparing each compartment's rate of change with that predicted on the previous time step (equal to its previous rate of change if integration method is Euler). If error limit is exceeded, the time step is temporarily shortened and the model re-executed from the end of the last time step. Default is 0, in which case no adaptive step size variation is done. |

`pause.on.event` |
Controls whether execution should be paused in the case of potentially interesting model occurrences. These are limit events (discrete events triggered by the value of an expression reaching a preset maximum or minimum), and compartment over/underruns (the level of a compartment exceeding or underrunning its specified maximum or minimum). Default is FALSE. |

### Value

Result code: value of system error (-ve), user-defined interruption (+ve) or 0 if model runs to finish.time

### Author(s)

Jasper Taylor

### Examples

1 2 3 | ```
for (count in 0:1738) {
execute.model("dummy_ih", count+1, "Euler", count, 0, FALSE)
}
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.