# SLiCAP time-domain analysis

The following time-domain analysis functions are implemented in SLiCAP:

- doImpulse() returns an expression for the unit-impulse response of a transfer. It is obtained as the Inverse Laplace Transform of the Laplace transfer function.

- doStep() returns an expression for the unit-step response of a transfer. It is obtained as the Inverse Laplace Transform of the product of \(\frac{1}{s}\) and Laplace transfer function.

- doTime() returns an expression for the time domain response, considering the Laplace values of all independent sources in the circuit.

Important

SliCAP calculates all time-domain responses using the Inverse Laplace Transform. If it fails to do so, it returns a non-evaluated expression.

SLiCAP output displayed on this manual page, is generated with the script: `ttime.py`, imported by `Manual.py`.

     1#!/usr/bin/env python3
     2# -*- coding: utf-8 -*-
     3"""
     4ttime.py: SLiCAP scripts for the HTML help file
     5"""
     6import SLiCAP as sl
     7import sympy as sp
     8# Circuit definition
     9ACcoupling = sl.makeCircuit("kicad/ACcoupling/ACcoupling.kicad_sch")
    10
    11# Define parameter values
    12params = {"R_a": "1k",
    13          "R_b": "1k",
    14          "R_s": "50",
    15          "C_c": "1n",
    16          "f_s": "10M",
    17          "V_p": 2,
    18          "V_B": 5}

The circuit diagram of the circuit `ACcoupling`:

The source signal signal is a sinusoidal voltage with an amplitude of \(V_p\) V and a frequency of \(f_s\) Hz. It is specified with its Laplace Transform:

\[V_\mathrm{V2} = V_p\frac{2 \pi f_s}{s^2 + \left( 2 \pi f_s \right)^2}\]

The power supply voltage steps from zero to \(V_B\):

\[V_\mathrm{V1} = V_B\frac{1}{s}\]

## Unit-impulse response

### Symbolic unit-impulse response

    20# Obtain the symbolic unit-impulse response of the power supply transfer
    21power_impulse_sym = sl.doImpulse(ACcoupling, source="V1").impulse

This yields (rendered output from formatter):

\[h_{p}{\left(t \right)} = \frac{R_{b} \left(\frac{\left(R_{a} R_{s} + R_{b} R_{s}\right) \delta\left(t\right)}{R_{a} R_{b} + R_{a} R_{s} + R_{b} R_{s}} + \frac{\left(R_{a}^{2} R_{b} + R_{a} R_{b}^{2}\right) e^{- \frac{t \left(R_{a}^{2} R_{b} + R_{a}^{2} R_{s} + R_{a} R_{b}^{2} + 2 R_{a} R_{b} R_{s} + R_{b}^{2} R_{s}\right)}{C_{c} R_{a}^{2} R_{b}^{2} + 2 C_{c} R_{a}^{2} R_{b} R_{s} + C_{c} R_{a}^{2} R_{s}^{2} + 2 C_{c} R_{a} R_{b}^{2} R_{s} + 2 C_{c} R_{a} R_{b} R_{s}^{2} + C_{c} R_{b}^{2} R_{s}^{2}}}}{C_{c} R_{a}^{2} R_{b}^{2} + 2 C_{c} R_{a}^{2} R_{b} R_{s} + C_{c} R_{a}^{2} R_{s}^{2} + 2 C_{c} R_{a} R_{b}^{2} R_{s} + 2 C_{c} R_{a} R_{b} R_{s}^{2} + C_{c} R_{b}^{2} R_{s}^{2}}\right)}{R_{a} + R_{b}}\]

### Numeric unit-impulse response

    23# Numeric unit-step response of the signal transfer
    24signal_impulse_num = sl.doImpulse(ACcoupling, pardefs=params, source="V2").impulse
    25print(signal_impulse_num)

This yields:

    -1652892.56198347*exp(-1818181.81818182*t)

## Unit-step response

### Symbolic unit-step response

    27# Obtain the symbolic unit-step response of the signal transfer
    28signal_step_sym = sl.doStep(ACcoupling, source="V2").stepResp

This yields (rendered output from formatter):

\[a_{s}{\left(t \right)} = \frac{C_{c} R_{a} R_{b} e^{- \frac{t \left(R_{a} + R_{b}\right)}{C_{c} R_{a} R_{b} + C_{c} R_{a} R_{s} + C_{c} R_{b} R_{s}}}}{C_{c} R_{a} R_{b} + C_{c} R_{a} R_{s} + C_{c} R_{b} R_{s}}\]

### Numeric unit-step response

    31power_step_num  = sl.doStep(ACcoupling, pardefs=params, source="V1").stepResp
    32print(power_step_num)
    33

This yields:

    0.5 - 0.454545454545455*exp(-1818181.81818182*t)

## Time-domain response

### Symbolic time-domain response

    34# Obtain the symbolic time-domain response
    35timeResult_sym = timeResult_num = sl.doTime(ACcoupling).time

This yields (rendered output from formatter):

\[V_{out} = \frac{R_{b} V_{B} \left(\frac{\left(2 \pi C_{c} R_{a}^{3} V_{p} f_{s} + 4 \pi C_{c} R_{a}^{2} R_{b} V_{p} f_{s} + 2 \pi C_{c} R_{a} R_{b}^{2} V_{p} f_{s}\right) \cos{\left(2 \pi f_{s} t \right)}}{4 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b} R_{s} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{a}^{2} R_{s}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a} R_{b}^{2} R_{s} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a} R_{b} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} + R_{a}^{2} V_{B} + 2 R_{a} R_{b} V_{B} + R_{b}^{2} V_{B}} + \frac{0.5 \left(8 \pi^{3} C_{c}^{2} R_{a}^{3} R_{b} V_{p} f_{s}^{3} + 8 \pi^{3} C_{c}^{2} R_{a}^{3} R_{s} V_{p} f_{s}^{3} + 8 \pi^{3} C_{c}^{2} R_{a}^{2} R_{b}^{2} V_{p} f_{s}^{3} + 16 \pi^{3} C_{c}^{2} R_{a}^{2} R_{b} R_{s} V_{p} f_{s}^{3} + 8 \pi^{3} C_{c}^{2} R_{a} R_{b}^{2} R_{s} V_{p} f_{s}^{3}\right) \sin{\left(2 \pi t \left(f_{s}^{2}\right)^{0.5} \right)}}{\pi \left(4 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b} R_{s} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{a}^{2} R_{s}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a} R_{b}^{2} R_{s} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a} R_{b} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} + R_{a}^{2} V_{B} + 2 R_{a} R_{b} V_{B} + R_{b}^{2} V_{B}\right) \left(f_{s}^{2}\right)^{0.5}} + \frac{\left(- 4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{3} V_{B} f_{s}^{2} - 8 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{2} R_{s} V_{B} f_{s}^{2} - 4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b} R_{s}^{2} V_{B} f_{s}^{2} - 8 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{3} R_{s} V_{B} f_{s}^{2} - 8 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} - 4 \pi^{2} C_{c}^{3} R_{a} R_{b}^{3} R_{s}^{2} V_{B} f_{s}^{2} - 2 \pi C_{c}^{2} R_{a}^{4} R_{b} V_{p} f_{s} - 2 \pi C_{c}^{2} R_{a}^{4} R_{s} V_{p} f_{s} - 4 \pi C_{c}^{2} R_{a}^{3} R_{b}^{2} V_{p} f_{s} - 6 \pi C_{c}^{2} R_{a}^{3} R_{b} R_{s} V_{p} f_{s} - 2 \pi C_{c}^{2} R_{a}^{2} R_{b}^{3} V_{p} f_{s} - 6 \pi C_{c}^{2} R_{a}^{2} R_{b}^{2} R_{s} V_{p} f_{s} - 2 \pi C_{c}^{2} R_{a} R_{b}^{3} R_{s} V_{p} f_{s} - C_{c} R_{a}^{3} R_{b} V_{B} - 2 C_{c} R_{a}^{2} R_{b}^{2} V_{B} - C_{c} R_{a} R_{b}^{3} V_{B}\right) e^{- \frac{t \left(4 \pi^{2} C_{c}^{2} R_{a}^{3} R_{b}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a}^{3} R_{b} R_{s} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{a}^{3} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b}^{3} V_{B} f_{s}^{2} + 16 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b}^{2} R_{s} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{2} R_{a}^{2} R_{b} R_{s}^{2} V_{B} f_{s}^{2} + 8 \pi^{2} C_{c}^{2} R_{a} R_{b}^{3} R_{s} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{2} R_{a} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{2} R_{b}^{3} R_{s}^{2} V_{B} f_{s}^{2} + R_{a}^{3} V_{B} + 3 R_{a}^{2} R_{b} V_{B} + 3 R_{a} R_{b}^{2} V_{B} + R_{b}^{3} V_{B}\right)}{4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{2} R_{s} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{s}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{3} R_{s} V_{B} f_{s}^{2} + 24 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b} R_{s}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a} R_{b}^{3} R_{s}^{2} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a} R_{b}^{2} R_{s}^{3} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{3} R_{b}^{3} R_{s}^{3} V_{B} f_{s}^{2} + C_{c} R_{a}^{3} R_{b} V_{B} + C_{c} R_{a}^{3} R_{s} V_{B} + 2 C_{c} R_{a}^{2} R_{b}^{2} V_{B} + 3 C_{c} R_{a}^{2} R_{b} R_{s} V_{B} + C_{c} R_{a} R_{b}^{3} V_{B} + 3 C_{c} R_{a} R_{b}^{2} R_{s} V_{B} + C_{c} R_{b}^{3} R_{s} V_{B}}}}{4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b}^{2} R_{s} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{3} R_{b} R_{s}^{2} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{3} R_{a}^{3} R_{s}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{3} R_{s} V_{B} f_{s}^{2} + 24 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b}^{2} R_{s}^{2} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a}^{2} R_{b} R_{s}^{3} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a} R_{b}^{3} R_{s}^{2} V_{B} f_{s}^{2} + 12 \pi^{2} C_{c}^{3} R_{a} R_{b}^{2} R_{s}^{3} V_{B} f_{s}^{2} + 4 \pi^{2} C_{c}^{3} R_{b}^{3} R_{s}^{3} V_{B} f_{s}^{2} + C_{c} R_{a}^{3} R_{b} V_{B} + C_{c} R_{a}^{3} R_{s} V_{B} + 2 C_{c} R_{a}^{2} R_{b}^{2} V_{B} + 3 C_{c} R_{a}^{2} R_{b} R_{s} V_{B} + C_{c} R_{a} R_{b}^{3} V_{B} + 3 C_{c} R_{a} R_{b}^{2} R_{s} V_{B} + C_{c} R_{b}^{3} R_{s} V_{B}} + 1\right)}{R_{a} + R_{b}}\]

Note

SLiCAP can handle very large equations!

However: In order to provide useful design information:

“Models should be as simple as possible, but not simpler”

### Numeric time-domain response

    37# Numeric time-domain response
    38timeResult_num  = sl.doTime(ACcoupling, pardefs=params)
    39
    40# Plot the numeric response
    41sl.plotSweep("AC_time", "Time-domain response", timeResult_num, 0, 2, 500, sweepScale="u")
    42
    43power_impulse = sl.doImpulse(ACcoupling, source="V1")
    44M             = power_impulse.M
    45Iv            = power_impulse.Iv
    46Dv            = power_impulse.Dv
    47denom         = power_impulse.denom
    48numer         = power_impulse.numer
    49transfer      = power_impulse.laplace

The plot is hown below.

## Return attributes

Important

Calculation of the unit impulse response requires execution of:

- doNumer()

- doDenom()

- doLaplace()

This returns the following result attributes:

    43power_impulse = sl.doImpulse(ACcoupling, source="V1")
    44M             = power_impulse.M
    45Iv            = power_impulse.Iv
    46Dv            = power_impulse.Dv
    47denom         = power_impulse.denom
    48numer         = power_impulse.numer
    49transfer      = power_impulse.laplace

## Related math functions

### Convert a step response into a periodic pulse response

The function step2PeriodicPulse converts a step response into a periodic pulse response.

    51# Convert a step response into a periodic pulse response
    52# Example step response
    53step_resp  = sp.sympify("A*(1-exp(-t/tau_s))")
    54# Define pulse time 'tau_p' and pulse period 'T_p'
    55tau_p, T_p = sp.symbols("tau_p, T_p")
    56# Generate the response to 3 pulses
    57three_pulse_resp = sl.step2PeriodicPulse(step_resp, tau_p, T_p, 3)

Formatted result:

\[\begin{split}\begin{align} H_{3p} = & A \left(1 - e^{- \frac{t}{\tau_{s}}}\right) \theta\left(t, 1\right) + A \theta\left(- 2 T_{p} + t, 1\right) \left(1 - e^{- \frac{- 2 T_{p} + t}{\tau_{s}}}\right) \nonumber \\ & + A \theta\left(- T_{p} + t, 1\right) \left(1 - e^{- \frac{- T_{p} + t}{\tau_{s}}}\right) - A \theta\left(t - \tau_{p}, 1\right) \left(1 - e^{- \frac{t - \tau_{p}}{\tau_{s}}}\right) \nonumber \\ & - A \theta\left(- 2 T_{p} + t - \tau_{p}, 1\right) \left(1 - e^{- \frac{- 2 T_{p} + t - \tau_{p}}{\tau_{s}}}\right) - A \theta\left(- T_{p} + t - \tau_{p}, 1\right) \left(1 - e^{- \frac{- T_{p} + t - \tau_{p}}{\tau_{s}}}\right) \end{align}\end{split}\]

where \(\theta(t)\) is Sympy’s Heaviside Function, occuring at \(t=0\) (see below).

Warning

Numeric evaluation of periodic periodic pulse responses created in this way, may take a while!

### Sympy’s Heaviside function

sympy.Heaviside(t, 1): \(\theta(t,1)=0\) for \(t<0\) and \(\theta(t,1)=1\) for \(t \ge 0\).

    >>> import sympy as sp
    >>> sp.Heaviside(-1,1)
    0
    >>> sp.Heaviside(0,1)
    1
    >>> sp.Heaviside(1,1)
    1

## Display equations on HTML pages and in LaTeX documents

The report module Create reports, discusses how HTML snippets and LaTeX snippets can be created for variables, expressions, equations and tables.

As a matter of fact, all equations, tables and figures on this page are created with this module:

    59# Generate RST snippets for the Help file
    60rst = sl.RSTformatter()
    61
    62rst.eqn("h_p(t)", power_impulse_sym).save("eqn-ACcoupling-power-impulse")
    63rst.eqn("a_s(t)", signal_step_sym).save("eqn-ACcoupling-signal-step")
    64rst.eqn("V_out", timeResult_sym).save("eqn-ACcoupling-time")
    65rst.eqn("H_3p", three_pulse_resp, multiline=2).save("eqn-H_3p-time")
    66
    67# Generate LaTeX snippets for the Help file
    68ltx = sl.LaTeXformatter()
    69
    70ltx.eqn("h_p(t)", power_impulse_sym).save("eqn-ACcoupling-power-impulse")
    71ltx.eqn("a_s(t)", signal_step_sym).save("eqn-ACcoupling-signal-step")
    72ltx.eqn("V_out", timeResult_sym).save("eqn-ACcoupling-time")
    73ltx.eqn("H_3p", three_pulse_resp, multiline=1).save("eqn-H_3p-time")

## Plot frequency characteristics

SLiCAP plot functions are discussed in Create plots