pathsim.blocks.wrapper module

class pathsim.blocks.wrapper.Wrapper(func=None, T=1, tau=0)[source]

Bases: Block

Wrapper block for discrete implementation and external code integration.

The Wrapper class is designed to trigger the wrapped method at fixed intervals using an internal scheduled event. This makes it particularly useful for wrapping external code or implementing discrete-time systems within the simulation framework.

The block uses the Schedule class to periodically call the _run_wrapper method, which must be implemented by subclasses. The inputs and outputs of the block are handled through the inputs and outputs registers, enabling seamless integration with other blocks in the simulation. …

Parameters:
  • func (callable) – function that defines algebraic block IO behaviour

  • T (float) – sampling period for the wrapped function

  • tau (float) – delay time for the start time of the event

Evt

internal event. Used for periodic sampling the wrapped method

tau

delau time for the start time of the event

Type:

float

T

sampling period for the event

Type:

float

update(t)[source]

Update system equation for fixed point loop.

Note

no direct passthrough, so the ‘update’ method is optimized for this case

Parameters:

t (float) – evaluation time

Returns:

error – deviation to previous iteration for convergence control here returns ‘0.0’, because no direct passthrough

Return type:

float

property tau

Getter for tau

Returns:

tau – delay time for the Schedule event

Return type:

float

property T

Get the sampling period of the block

Returns:

T – sampling period for the Schedule event

Return type:

float

classmethod dec(T=1, tau=0)[source]

decorator class for direct instance access from func