pathsim.blocks.rf.sources module

pathsim.blocks.rf.sources.gaussian(t, f_max)[source]

gaussian pulse with its maximum at t=0

Parameters:
  • t (float) – evaluation time

  • f_max (float) – maximum frequency component of gaussian

Returns:

out – gaussian value

Return type:

float

pathsim.blocks.rf.sources.triangle_wave(t, f)[source]

triangle wave with amplitude ‘1’ and frequency ‘f’

Parameters:
  • t (float) – evaluation time

  • f (float) – trig wave frequency

Returns:

out – trig wave value

Return type:

float

pathsim.blocks.rf.sources.square_wave(t, f)[source]

square wave with amplitude ‘1’ and frequency ‘f’

Parameters:
  • t (float) – evaluation time

  • f (float) – square wave frequency

Returns:

out – square wave value

Return type:

float

class pathsim.blocks.rf.sources.SquareWaveSource(frequency=1, amplitude=1, phase=0)[source]

Bases: Block

Source block that generates an analog square wave

Notes

This block is purely analog with no internal events. Not to be confused with a clock that has internal scheduled events

Parameters:
  • frequency (float) – frequency of the square wave

  • amplitude (float) – amplitude of the square wave

  • phase (float) – phase of the square wave

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.rf.sources.TriangleWaveSource(frequency=1, amplitude=1, phase=0)[source]

Bases: Block

Source block that generates an analog triangle wave

Parameters:
  • frequency (float) – frequency of the triangle wave

  • amplitude (float) – amplitude of the triangle wave

  • phase (float) – phase of the triangle wave

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.rf.sources.SinusoidalSource(frequency=1, amplitude=1, phase=0)[source]

Bases: Block

Source block that generates a sinusoid wave

Parameters:
  • frequency (float) – frequency of the sinusoid

  • amplitude (float) – amplitude of the sinusoid

  • phase (float) – phase of the sinusoid

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.rf.sources.GaussianPulseSource(amplitude=1, f_max=1000.0, tau=0.0)[source]

Bases: Block

Source block that generates a gaussian pulse

Parameters:
  • amplitude (float) – amplitude of the gaussian pulse

  • f_max (float) – maximum frequency component of the gaussian pulse (steepness)

  • tau (float) – time delay of the gaussian pulse

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.rf.sources.StepSource(amplitude=1, tau=0.0)[source]

Bases: Block

Source block that generates a unit step

Parameters:
  • amplitude (float) – amplitude of the step / step height

  • tau (float) – time delay of the step

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

class pathsim.blocks.rf.sources.ChirpSource(amplitude=1, f0=1, BW=1, T=1)[source]

Bases: Block

Chirp source, sinusoid with frequency ramp up and ramp down.

This works by using a time dependent triangle wave for the frequency and integrating it with a numerical integration engine to get a continuous phase. This phase is then used to evaluate a sinusoid.

Parameters:
  • amplitude (float) – amplitude of the chirp signal

  • f0 (float) – start frequency of the chirp signal

  • BW (float) – bandwidth of the frequency ramp of the chirp signal

  • T (float) – period of the frequency ramp of the chirp signal

set_solver(Solver, **solver_args)[source]

Initialize the numerical integration engine with local truncation error tolerance if required.

If the block already has an integration engine, it is changed, if it does not require an integration engine, this method just passes.

Parameters:
  • Solver (Solver) – numerical integrator

  • solver_args (dict) – additional args for the solver

update(t)[source]

The ‘update’ method is called iteratively for all blocks BEFORE the timestep to resolve algebraic loops (fixed-point iteraion).

It is meant for instant time blocks (blocks that dont have a delay due to the timestep, such as Amplifier, etc.) and updates the ‘outputs’ of the block directly based on the ‘inputs’ and possibly internal states.

It computes and returns the relative difference between the new output and the previous output (before the step) to track convergence of the fixed-point iteration.

Parameters:

t (float) – evaluation time

Returns:

error – relative error to previous iteration for convergence control

Return type:

float

solve(t, dt)[source]

The ‘solve’ method performes one iterative solution step that is required to solve the implicit update equation of the solver if an implicit solver (numerical integrator) is used.

It returns the relative difference between the new updated solution and the previous iteration of the solution to track convergence within an outer loop.

This only has to be implemented by blocks that have an internal integration engine with an implicit solver.

Parameters:
  • t (float) – evaluation time

  • dt (float) – integration timestep

Returns:

error – solver residual norm

Return type:

float

step(t, dt)[source]

The ‘step’ method is used in transient simulations and performs an action (numeric integration timestep, recording data, etc.) based on the current inputs and the current internal state.

It performes one timestep for the internal states. For instant time blocks, the ‘step’ method does not has to be implemented specifically.

The method handles timestepping for dynamic blocks with internal states such as ‘Integrator’, ‘StateSpace’, etc.

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