iode.Simulation.nb_iterations

Simulation.nb_iterations(period: str | Period) int[source]

Number of iterations to converge in the last simulation for the period period.

Parameters:
period: str or Period

The period for which to get the number of iterations.

Returns:
int

The number of iterations to converge for the specified period.

Examples

>>> from iode import SAMPLE_DATA_DIR, equations, scalars, variables
>>> from iode import Simulation
>>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs")
Loading .../fun.eqs
274 objects loaded
>>> scalars.load(f"{SAMPLE_DATA_DIR}/fun.scl")
Loading .../fun.scl
161 objects loaded
>>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var")
Loading .../fun.var
394 objects loaded
>>> simu = Simulation()
>>> success = simu.model_simulate("2000Y1", "2015Y1")
Linking equations ....
Calculating SCC...
Calculating SCC... -> #PRE 31 - #INTER 204 - #POST 39
Reordering interdependent block...
Reordering interdependent block...
2000Y1: 1 iters - error =   0.6558 - cpu=...ms
2000Y1: 2 iters - error =   0.1684 - cpu=...ms
2000Y1: 3 iters - error =   0.5237 - cpu=...ms
...
2015Y1: 19 iters - error = 0.002907 - cpu=...ms
2015Y1: 20 iters - error = 0.001537 - cpu=...ms
2015Y1: 21 iters - error = 0.0005893 - cpu=...ms
>>> success
True
>>> # get the number of iterations for the period 2000Y1
>>> simu.nb_iterations("2000Y1")
31