pathsim.blocks.mixed.sources module

class pathsim.blocks.mixed.sources.Pulse(amplitude=1.0, T=1.0, t_rise=0.0, t_fall=0.0, tau=0.0, duty=0.5)[source]

Bases: Block

Generates a periodic pulse waveform with defined rise and fall times using a hybrid approach with scheduled events and continuous updates.

Scheduled events trigger phase changes (low, rising, high, falling), and the update method calculates the output value based on the current phase, performing linear interpolation during rise and fall.

Parameters:
  • amplitude (float, optional) – Peak amplitude of the pulse. Default is 1.0.

  • T (float, optional) – Period of the pulse train. Must be positive. Default is 1.0.

  • t_rise (float, optional) – Duration of the rising edge. Default is 0.0.

  • t_fall (float, optional) – Duration of the falling edge. Default is 0.0.

  • tau (float, optional) – Initial delay before the first pulse cycle begins. Default is 0.0.

  • duty (float, optional) – Duty cycle, ratio of the pulse ON duration (plateau time only) to the total period T (must be between 0 and 1). Default is 0.5. The high plateau duration is T * duty.

events

Internal scheduled events triggering phase transitions.

Type:

list[Schedule]

_phase

Current phase of the pulse (‘low’, ‘rising’, ‘high’, ‘falling’).

Type:

str

_phase_start_time

Simulation time when the current phase began.

Type:

float

reset()[source]

Resets the block state.

update(t)[source]

Calculate the pulse output value based on the current phase. Performs linear interpolation during ‘rising’ and ‘falling’ phases.

Parameters:

t (float) – evaluation time

Returns:

error – deviation to previous iteration for convergence control (always ‘0.0’, because no passthrough)

Return type:

float

class pathsim.blocks.mixed.sources.Clock(T=1, tau=0)[source]

Bases: Block

Discrete time clock source block.

Utilizes scheduled events to periodically set the block output to 0 or 1 at discrete times.

Parameters:
  • T (float) – period of the clock

  • tau (float) – clock delay

events

internal scheduled event list

Type:

list[Schedule]

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

Bases: Block

Discrete time square wave source.

Utilizes scheduled events to periodically set the block output at discrete times.

Parameters:
  • amplitude (float) – amplitude of the square wave signal

  • frequency (float) – frequency of the square wave signal

  • phase (float) – phase of the square wave signal

events

internal scheduled events

Type:

list[Schedule]

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

Bases: Block

Discrete time unit step block.

Utilizes a scheduled event to set the block output at the defined delay.

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

  • tau (float) – delay of the step

events

internal scheduled event

Type:

list[Schedule]