SLiCAP Laplace analysis

../_images/colorCode.svg

Symbolic complex frequency domain analysis provides:

  • A Laplace transfer function

    This is the Laplace Transform of the unit impulse response from a circuit having the signal source as input signal, and the detector voltage or current as output signal.

  • The Laplace Transform of a detector voltage or current with the voltages and currents of the independent sources as input signals.

    Important

    The value parameter of independent sources must be specified in the Laplace domain:

    Some examples of time functions and their Laplace Transform:

    1. Impulse: \(a \delta (t) \Leftrightarrow a\)

    2. Step: \(a \mu (t) \Leftrightarrow \frac{a}{s}\)

    3. Linear ramp: \(at \Leftrightarrow \frac{a}{s^2}\)

    4. Sine: \(a\sin{(\omega t)} \Leftrightarrow \frac{a \omega}{s^2+\omega^2}\)

    5. Cosine: \(a\cos{(\omega t)} \Leftrightarrow \frac{a s}{s^2+\omega^2}\)

    6. Real exponential: \(a \exp{(-At)} \Leftrightarrow \frac{a}{s+A}\)

    7. Use Laplace output of other circuits as input

    8. Use built-in filter Laplace filter responses as input

SLiCAP can perform mixed symbolic/numeric Laplace analysis and has a number of supporting functions for processing the results.

SLiCAP output displayed below, is generated with the script: laplace.py, imported by Manual.py.

1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4"""
5laplace.py: SLiCAP scripts for the HTML help file
6"""
7import SLiCAP as sl

Perform Laplace analysis

Create a circuit object

10passive_network = sl.makeCircuit("kicad/myPassiveNetwork/myPassiveNetwork.kicad_sch")
../_images/myPassiveNetwork.svg

Obtain the Laplace Transform of the gain

The function doLaplace() returns the Laplace Transform of a transfer, or of a detector voltage or current.

Below a script for obtaining the Laplace Transform of the source-detector transfer (gain) of the circuit.

12# Obtain the transfer from source to detector
13result = sl.doLaplace(passive_network)
14gain   = result.laplace
15print(gain)

Note

  • The default value of the keyword argument transfer is gain, which is the transfer from source to load.

  • By default, the source and the detector as defined in the circuit will be used.

  • The default value of the keyword argument pardefs is None. Hence, parameter definitions will not be substituted in element expressions.

  • The default value of the keyword argument numeric is None. Hence, no numeric evaluation takes place.

  • The default value of the keyword argument convtype is None. Hence, no differential-mode or common-mode conversion will be applied.

The result is shown below.

R_ell*(C_b*L*s**2 + 1)/((R_ell + R_s)*(C_a*C_b*L*R_ell*R_s*s**3/(R_ell + R_s) + s**2*(C_a*L*R_ell + C_b*L*R_ell + C_b*L*R_s)/(R_ell + R_s) + s*(C_a*R_ell*R_s + L)/(R_ell + R_s) + 1))

This can be typesetted using the formatter. The script below shows how to create an RST snippet for the source of this help file.

70filt.label    = "gain"
71
72# Create the plot
73sl.plotSweep("BP4", "3-rd order Chebyshev type 1 band-pass, 1 dB ripple", 
\[\frac{V_{out}}{V_{V1}} = \frac{R_{\ell} \left(C_{b} L s^{2} + 1\right)}{\left(R_{\ell} + R_{s}\right) \left(\frac{C_{a} C_{b} L R_{\ell} R_{s} s^{3}}{R_{\ell} + R_{s}} + \frac{s^{2} \left(C_{a} L R_{\ell} + C_{b} L R_{\ell} + C_{b} L R_{s}\right)}{R_{\ell} + R_{s}} + \frac{s \left(C_{a} R_{\ell} R_{s} + L\right)}{R_{\ell} + R_{s}} + 1\right)}\]

Numeric evaluation after subsititution of all the parameters:

26# Same, but with parameter substitution and conversion to floats
27gain_numeric = sl.doLaplace(passive_network, pardefs="circuit", numeric=True).laplace
28print(gain_numeric)

Below the result.

(455945326390521*s**2/500000000000000000000000000000 + 9/10)/(455945326390521*s**3/400000000000000000000000000000000000 + 1175660591821169*s**2/50000000000000000000000000000 + 1127*s/1000000000 + 1)

SLiCAP uses rational numbers. Typsetting functions convert them into float. The number of digits is set with ini.disp

>>> import SLiCAP as sl
>>> sl.ini.disp

4

Below the typesetted numeric transfer:

\[\frac{V_{out}}{V_{V1}} = \frac{9.119 \cdot 10^{-16} s^{2} + 0.9}{1.14 \cdot 10^{-21} s^{3} + 2.351 \cdot 10^{-14} s^{2} + 1.127 \cdot 10^{-6} s + 1}\]

Obtain the Laplace Transform of a detector voltage or current

With the keyword argument transfer=None, SLiCAP evaluates the response at the detector. The vector with independent variables now contains the values of all independent sources defined in the circuit. In this case we have \(V_\mathrm{V1}=\frac{1}{s}\).

28vout_laplace = sl.doLaplace(passive_network, transfer=None).laplace
\[V_{out} = \frac{R_{\ell} \left(C_{b} L s^{2} + 1\right)}{a \left(R_{\ell} + R_{s}\right) \left(\frac{C_{a} C_{b} L R_{\ell} R_{s} s^{5}}{R_{\ell} a^{2} + R_{s} a^{2}} + \frac{s^{4} \left(C_{a} L R_{\ell} + C_{b} L R_{\ell} + C_{b} L R_{s}\right)}{R_{\ell} a^{2} + R_{s} a^{2}} + \frac{s^{3} \left(C_{a} C_{b} L R_{\ell} R_{s} a^{2} + C_{a} R_{\ell} R_{s} + L\right)}{R_{\ell} a^{2} + R_{s} a^{2}} + \frac{s^{2} \left(C_{a} L R_{\ell} a^{2} + C_{b} L R_{\ell} a^{2} + C_{b} L R_{s} a^{2} + R_{\ell} + R_{s}\right)}{R_{\ell} a^{2} + R_{s} a^{2}} + \frac{s \left(C_{a} R_{\ell} R_{s} + L\right)}{R_{\ell} + R_{s}} + 1\right)}\]

Return attributes

Important

The evaluation of the Laplace Transform, requires:

  1. Creation of the matrix equation

  2. Evaluation of the denominator doDenom()

  3. Evaluation of the numerator doNumer()

  4. Evaluation of numerator/denominator

This returns the following result attributes:

17M        = result.M
18Iv       = result.Iv
19Dv       = result.Dv
20denom    = result.denom
21numer    = result.numer
22transfer = result.laplace

The matrix equation is for transfer="gain": the value of the signal source has been set to unity:

\[\begin{split}\left[\begin{matrix}0\\1\\0\\0\\0\end{matrix}\right]=\left[\begin{matrix}- L s & 0 & 1 & 0 & -1\\0 & 0 & 0 & 1 & 0\\1 & 0 & C_{b} s + \frac{1}{R_{s}} & - \frac{1}{R_{s}} & - C_{b} s\\0 & 1 & - \frac{1}{R_{s}} & \frac{1}{R_{s}} & 0\\-1 & 0 & - C_{b} s & 0 & C_{a} s + C_{b} s + \frac{1}{R_{\ell}}\end{matrix}\right]\cdot \left[\begin{matrix}I_{L1}\\I_{V1}\\V_{1}\\V_{in}\\V_{out}\end{matrix}\right]\end{split}\]

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:

76# Generate RST snippets for the Help file
77rst = sl.RSTformatter()
78
79rst.eqn("V_out/V_V1", gain).save("eqn-laplace-passive")
80rst.matrixEqn(result.Iv, result.M, result.Dv).save("eqn-matrix-passive")
81rst.eqn("V_out/V_V1", gain_numeric).save("eqn-laplace-passive-numeric")
82rst.eqn("V_out", vout_laplace).save("eqn-laplace-passive-vout")
83rst.coeffsTransfer(sl.coeffsTransfer(gain), 
84                   caption="Normalized coefficients of 'gain'.").save("table-coeffs-gain")
85rst.eqn("P_Bu", BuP,).save("eqn-BuP")
86rst.eqn("P_Be", BeP,).save("eqn-BeP")
87rst.eqn("P_Ch", ChP,).save("eqn-ChP")
88rst.eqn("F_LP", LP,).save("eqn-FLP")
89rst.eqn("F_HP", HP,).save("eqn-FHP")
90rst.eqn("F_BP", BP,).save("eqn-FBP")
91rst.eqn("F_BS", BS,).save("eqn-FBS")
92rst.eqn("F_AP", AP,).save("eqn-FAP")
93rst.eqn("H_s", BP_num).save("eqn-BP_num")

Plot frequency characteristics

SLiCAP plot functions are discussed in Create plots

../_images/colorCode.svg