Integrator

class pathsim.blocks.integrator.Integrator(initial_value=0.0)[source]

Bases: Block

Integrates the input signal using a numerical integration engine like this:

\[y(t) = \int_0^t u(\tau) \ d \tau\]

or in differential form like this:

\[\begin{split}\begin{eqnarray} \dot{x}(t) &= u(t) \\ y(t) &= x(t) \end{eqnarray}\end{split}\]

The Integrator block is inherently MIMO capable, so u and y can be vectors.

Example

This is how to initialize the integrator:

#initial value 0.0
i1 = Integrator()

#initial value 2.5
i2 = Integrator(2.5)
Parameters:

initial_value (float, array) – initial value of integrator

set_solver(Solver, parent, **solver_args)[source]

set the internal numerical integrator

Parameters:
  • Solver (Solver) – numerical integration solver class

  • parent (None | Solver) – solver instance to use as parent

  • solver_args (dict) – parameters for solver initialization

update(t)[source]

update system equation fixed point loop

Note

integrator does not have passthrough, therefore this method is performance optimized for this case

Parameters:

t (float) – evaluation time

solve(t, dt)[source]

advance solution of implicit update equation of the solver

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

error – solver residual norm

Return type:

float

step(t, dt)[source]

compute timestep update with integration engine

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

  • success (bool) – step was successful

  • error (float) – local truncation error from adaptive integrators

  • scale (float) – timestep rescale from adaptive integrators