SLiCAPmatrices.py¶
SLiCAP module for building the MNA matrix and the associated vectors.
Imported by the module SLiCAPpythonMaxima.py
- getValue(elmt, param, numeric, parDefs)¶
Returns the symbolic or numeric value of a parameter of an element.
This function is called by makeMatrices().
- Parm elmt
element object
- Parameters
param (str) – parameter of interest (‘value’, ‘noise’, ‘dc’ or ‘dcvar’)
numeric (bool) – If True is uses full substitution and sympy.N for converting parameters to sympy floats
parDefs (dict) –
Dict with key value pairs:
key : parameter name (sympy.Symbol)
value: numeric value of sympy expression
- Returns
value: sympy expresssion or numeric value of the element parameter
- Return type
sympy.Expr, int, float, sympy.Float
- getValues(elmt, param, numeric, parDefs)¶
Returns the symbolic or numeric value of numerator and the denominator of a parameter of an element. This function is called by makeMatrices().
- Parm elmt
element object
- Parameters
param (str) – parameter of interest (‘value’, ‘noise’, ‘dc’ or ‘dcvar’)
numeric (bool) – If True is uses full substitution and sp.N for converting parameters to sympy floats
parDefs (dict) –
Dict with key value pairs:
key : parameter name (sympy.Symbol)
value: numeric value of sympy expression
- Returns
Tuple with sympy expresssions or numeric values of the numerator and the denominator of the element parameter.
- Return type
tuple
- makeMatrices(instr)¶
Returns the MNA matrix and the vector with dependent variables of a circuit. The entries in the matrix depend on the instruction type.
- Parameters
cir (SLiCAPprotos.circuit) – Circuit of which the matrices need to be returned.
instr (SLiCAPinstruction.instruction()) –
SLiCAP instruction object
key : parameter name (sympy.Symbol)
value: numeric value of sympy expression
- Returns
tuple with two sympy matrices:
MNA matrix M
Vector with dependent variables Dv
- Return type
tuple
- makeSrcVector(cir, parDefs, elid, value='id', numeric=True)¶
Creates the vector with independent variables. The vector can be created for a single independent variable or for all.
This can be used for determination of a transfer using Cramer’s rule.
If a single variable is used, this vector and Cramer’s rule can be used as an alternative for calculation cofactors:
The refDes of the independent variable (source) is substituted in the vecor with independent variables (value = ‘id’). This vector is then substituted in the detector col, of the MNA matrix. After calculation of the determinant of this modified matrix, the result is divided by refDes.
This method is used for determination of gain factors for noise sources and for DC variance sources.
- Parameters
cir (SLiCAPprotos.circuit) – Circuit of which the matrices need to be returned.
parDefs (dict) –
Dict with key value pairs:
key : parameter name (sympy.Symbol)
value: numeric value of sympy expression
elid (str) – Refdes (ID) of a source to be included in this vector; ‘all’ for all sources.
numeric (bool) – If True is uses full substitution and sympy.N for converting parameters to sympy floats
- Returns
Iv: vector with in dependent variables
- Return type
sympy.Matrix