pathsim.blocks.differentiator module

class pathsim.blocks.differentiator.Differentiator(f_max=100.0)[source]

Bases: Block

Differentiates the input signal (SISO) using a first order transfer function with a pole at the origin which implements a high pass filter.

\[H_\mathrm{diff}(s) = \frac{s}{1 + s / f_\mathrm{max}}\]

The approximation holds for signals up to a frequency of approximately f_max.

Notes

Depending on ‘f_max’, the resulting system might become stiff or ill conditioned! As a practical choice set f_max to 3x the highest expected signal frequency.

Parameters:

f_max (float) – highest expected signal frequency

set_solver(Solver, **solver_args)[source]

set the internal numerical integrator

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

  • solver_args (dict) – parameters for solver initialization

update(t)[source]

update system equation fixed point loop

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

solve(t, dt)[source]

advance solution of implicit update equation

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

error – solver residual norm

Return type:

float

step(t, dt)[source]

compute update step 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