SLiCAP Laplace analysis
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:
Impulse: \(a \delta (t) \Leftrightarrow a\)
Step: \(a \mu (t) \Leftrightarrow \frac{a}{s}\)
Linear ramp: \(at \Leftrightarrow \frac{a}{s^2}\)
Sine: \(a\sin{(\omega t)} \Leftrightarrow \frac{a \omega}{s^2+\omega^2}\)
Cosine: \(a\cos{(\omega t)} \Leftrightarrow \frac{a s}{s^2+\omega^2}\)
Real exponential: \(a \exp{(-At)} \Leftrightarrow \frac{a}{s+A}\)
Use Laplace output of other circuits as input
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")
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
isgain
, 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
isNone
. Hence, parameter definitions will not be substituted in element expressions.The default value of the keyword argument
numeric
isNone
. Hence, no numeric evaluation takes place.The default value of the keyword argument
convtype
isNone
. 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",
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:
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
Return attributes
Important
The evaluation of the Laplace Transform, requires:
Creation of the matrix equation
Evaluation of the denominator
doDenom()
Evaluation of the numerator
doNumer()
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:
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