pathsim.blocks.sources module

class pathsim.blocks.sources.Constant(value=1)[source]

Bases: Block

Produces a constant output signal (SISO)

Parameters:

value (float) – constant defining block output

update(t)[source]

update system equation fixed point loop

Parameters:

t (float) – evaluation time

Returns:

error – absolute error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.sources.Source(func=<function Source.<lambda>>)[source]

Bases: Block

Source that produces an arbitrary time dependent output, defined by the func (callable).

\[y(t) = \mathrm{func}(t)\]

Example

For example a ramp:

from pathsim.blocks import Source

src = Source(lambda t : t)

or a simple sinusoid with some frequency:

import numpy as np
from pathsim.blocks import Source

#some parameter
omega = 100

#the function that gets evaluated
def f(t):
    return np.sin(omega * t)

src = Source(f)
Parameters:

func (callable) – function defining time dependent block output

update(t)[source]

update system equation fixed point loop by evaluating the internal function ‘func’

Note

No direct passthrough, so the ‘update’ method is optimized

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float