SLiCAP circuit matrix equation

../_images/colorCode.svg

One of the first steps in the execution of each instruction is the construction of the MNA matrix equation (MNA: Modified Nodal Analysis). The matrix equation depends on the transfer type and the conversion type.

Every instruction returns the MNA matrix equation. The instruction doMatrix() returns the matrix equation without evaluating anything. It is the fastest way to obtain this equation.

The default settings of the transfer type and the conversion type in the doMatrix() are both None.

Settings for transfer types will be discussed in Work with feedback circuits.

Settings for conversion types will be discussed in Work with balanced circuits.

../_images/colorCode.svg

SLiCAP output dispalyed on this manual page, is generated with the script: matrix.py, imported by Manual.py.

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

Obtain the matrix equation of the circuit

 9# Create a circuit object
10cir    = sl.makeCircuit("kicad/Transimpedance/Transimpedance.kicad_sch", imgWidth=350)
11result = sl.doMatrix(cir)
12
13Iv     = result.Iv # Vector with independent variables 
14                   # (independent sources)
15M      = result.M  # MNA matrix
16Dv     = result.Dv # Vector with dependent variables 
17                   # (unknown nodal voltages and branch currents)
18print(Iv)
19print(M)
20print(Dv)

The result is shown below:

../_images/Transimpedance.svg
Matrix([[0], [I_s], [0]])
Matrix([[0, 1, 0], [0, C_s*s + 1/R_t, -1/R_t], [1, -1/R_t, 1/R_t]])
Matrix([[I_N1], [V_in], [V_out]])

Naming of the dependent variables

Nodal voltages are named as V_<node_name>, where node_name is the name of the node.

Branch currents are named as I_<ref_des>, where ref_des is the reference designator of the branch element.

Display the matrix equation on HTML pages and in LaTeX documents

With the aid of the report module Creating reports, the matrix equation can be displayed on HTML pages or in LaTeX documents.

Below the script for generating the rst snippet for this help file.

22# Generate RST snippets for the Help file
23rst = sl.RSTformatter()
24
25rst.matrixEqn(Iv, M, Dv).save("eqn-matrix-trimp")

The result is shown below.

\[\begin{split}\left[\begin{matrix}0\\I_{s}\\0\end{matrix}\right]=\left[\begin{matrix}0 & 1 & 0\\0 & C_{s} s + \frac{1}{R_{t}} & - \frac{1}{R_{t}}\\1 & - \frac{1}{R_{t}} & \frac{1}{R_{t}}\end{matrix}\right]\cdot \left[\begin{matrix}I_{N1}\\V_{in}\\V_{out}\end{matrix}\right]\end{split}\]
../_images/colorCode.svg