### Run Style Guide Checking Source: https://lcapy.readthedocs.io/en/latest/install Installs and runs a style guide checker to ensure code quality and consistency within the Lcapy project. ```bash $ pip3 install flake8 ``` -------------------------------- ### Install Development Dependencies Source: https://lcapy.readthedocs.io/en/latest/install Installs additional packages required for building documentation, running the interactive shell, and rendering graphics for Lcapy development. ```bash $ sudo apt install texlive-latex-extra texlive-fonts-extra $ pip3 install sphinx ipython pycairo[doc] ``` -------------------------------- ### Install Lcapy for Development Source: https://lcapy.readthedocs.io/en/latest/install Installs Lcapy from its source code, typically after cloning the repository. This method is recommended for developers who plan to modify the Lcapy codebase. ```bash $ cd $ pip3 install git+https://github.com/mph-/lcapy.git#egg=lcapy ``` -------------------------------- ### Run Unit Tests Source: https://lcapy.readthedocs.io/en/latest/install Installs pytest and runs the unit tests for Lcapy to verify its functionality and identify potential bugs. ```bash $ pip3 install pytest ``` -------------------------------- ### Install Style Guide Checkers Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs linters like flake8 and its plugins for checking code style and identifying potential issues in the Lcapy codebase. ```console pip3 install flake8 flake8-bugbear flake8-requirements flake8-comprehensions ``` -------------------------------- ### Run Coverage Analysis Source: https://lcapy.readthedocs.io/en/latest/install Installs coverage tools and runs them to analyze the code coverage of Lcapy's test suite. ```bash $ pip3 install coverage ``` -------------------------------- ### Install Lcapy from Git Repository Source: https://lcapy.readthedocs.io/en/latest/install Installs the latest version of Lcapy directly from its GitHub repository. This is useful for users who want the most recent features or are contributing to the project. ```bash $ pip install git+https://github.com/mph-/lcapy.git#egg=lcapy ``` -------------------------------- ### Start Jupyter Notebook Server Source: https://lcapy.readthedocs.io/en/latest/_sources/overview Command to start a Jupyter notebook server from the terminal. This allows interactive exploration of Lcapy examples in a web browser. ```console $ cd lcapy/doc/examples/notebooks $ jupyter notebook ``` -------------------------------- ### Install Lcapy for Development Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs Lcapy in an editable mode from a local clone of the repository, along with dependencies for testing and release. This is recommended for developers contributing to Lcapy. ```console cd lcapy pip3 install --editable .[test,release] ``` -------------------------------- ### Install Pytest for Unit Tests Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs the pytest framework, used for running unit tests to ensure the correctness of Lcapy's functionality. ```console pip3 install pytest ``` -------------------------------- ### Install Lcapy from GitHub Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs the latest version of Lcapy directly from its GitHub repository. This is useful for users who want the most recent features or bug fixes. ```console pip install git+https://github.com/mph-/lcapy.git#egg=lcapy ``` -------------------------------- ### Install Lcapy Documentation Dependencies Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs additional Python packages required for building Lcapy's documentation, such as Sphinx and IPython. ```console pip3 install --editable .[doc] ``` -------------------------------- ### Install Coverage for Analysis Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs the coverage tool, which is used to measure code coverage during the execution of unit tests. ```console pip3 install coverage ``` -------------------------------- ### Resistor Schematics Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Demonstrates various resistor configurations in LCapy schematics. Includes examples for different resistor setups and their visual representations. ```schematic .. literalinclude:: examples/schematics/resistors1.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors2.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors3.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors4.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors5.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors6.sch ``` ```schematic .. literalinclude:: examples/schematics/resistors7.sch ``` -------------------------------- ### Install Lcapy using pip Source: https://lcapy.readthedocs.io/en/latest/install Installs Lcapy and its Python dependencies using pip. This is the primary method for installing Lcapy on most systems. ```bash $ pip3 install lcapy ``` -------------------------------- ### Install Documentation Dependencies on Linux (apt) Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs system-level dependencies required for building documentation on Linux systems using apt, including GTK+ and Python bindings. ```console sudo apt-get install gir1.2-gtk-3.0 python3-gi python3-gi-cairo ``` -------------------------------- ### Install Graphviz for Schematic Debugging Source: https://lcapy.readthedocs.io/en/latest/install Installs Graphviz, a tool used for debugging schematic graphs generated by Lcapy. This is essential for visualizing and troubleshooting circuit diagrams. ```bash $ sudo apt install graphviz ``` -------------------------------- ### LadderAlt Two-Port Example Source: https://lcapy.readthedocs.io/en/latest/_sources/networks Shows the creation of a LadderAlt two-port network, which starts the alternating sequence with a Shunt element. ```python from lcapy import LadderAlt, L, R, C n = LadderAlt(L('L1'), R('R1'), C('C1')) ``` -------------------------------- ### Install Basic LaTeX on macOS and Add Packages Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs a minimal LaTeX distribution on macOS using Homebrew and then adds extra packages using the tlmgr utility. ```console brew install basictex eval "$(/usr/libexec/path_helper)" sudo tlmgr install collection-latexextra ``` -------------------------------- ### State-Space Analysis with Lcapy Source: https://lcapy.readthedocs.io/en/latest/_sources/overview Shows how to perform state-space analysis using the `ss` method in Lcapy. The example defines a circuit and then calls `ss.state_equations()` to get the state equations. ```python >>> from lcapy import Circuit >>> a = Circuit(""" V 1 0 {v(t)}; down R1 1 2; right L 2 3; right=1.5, i={i_L} R2 3 0_3; down=1.5, i={i_{R2}}, v={v_{R2}} W 0 0_3; right W 3 3_a; right C 3_a 0_4; down, i={i_C}, v={v_C} W 0_3 0_4; right""") >>> ss = a.ss >>> ss.state_equations() ⎡d ⎤ ⎡-R₁ -1 ⎤ ⎢──(i_L(t))⎥ ⎢─── ─── ⎥ ⎡1⎤ ``` -------------------------------- ### PiSection Two-Port Example Source: https://lcapy.readthedocs.io/en/latest/_sources/networks Demonstrates the creation and usage of a PiSection two-port network with example components. ```python from lcapy import PiSection, L, R, C n = PiSection(L('L1'), R('R1'), C('C1')) ``` -------------------------------- ### Install LaTeX on macOS using Homebrew Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs a full LaTeX distribution on macOS using Homebrew, providing all necessary components for rendering schematics. ```console brew install mactex ``` -------------------------------- ### Install LaTeX Packages on Linux (apt) Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs essential LaTeX packages on Debian-based Linux systems using apt, including Ghostscript and extra LaTeX components required for schematic rendering. ```console sudo apt install ghostscript texlive-latex-extra cm-super ``` -------------------------------- ### Power Supply Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Shows various examples of power supply connections (vcc, vdd, vee, vss) in schematics. ```schematic W 1 2; right ``` -------------------------------- ### LCpy Schematic Example: Mixer Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Shows a basic mixer circuit example using lcapy schematics. ```schematic .. literalinclude:: examples/schematics/MX1.sch ``` -------------------------------- ### Install Lcapy using pip Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs the Lcapy Python package and its core dependencies using pip. This is the primary method for installing Lcapy on most systems. ```console pip3 install lcapy ``` -------------------------------- ### Connections Example 1 Schematic Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Shows the first example of circuit connections. The `.sch` file defines how components are interconnected. ```schematic .. literalinclude:: examples/schematics/connections1.sch ``` -------------------------------- ### Connections Example 2 Schematic Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Presents the second example of circuit connections. The `.sch` file illustrates different interconnection methods. ```schematic .. literalinclude:: examples/schematics/connections2.sch ``` -------------------------------- ### Install Graphviz for Schematic Debugging Source: https://lcapy.readthedocs.io/en/latest/_sources/install Installs the Graphviz package, which is required for debugging schematic graphs generated by Lcapy. ```console sudo apt install graphviz ``` -------------------------------- ### Ground Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Provides multiple examples of different ground connection types used in schematics. ```schematic W 1 2; right ``` -------------------------------- ### VRmesh1.sch Schematic Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Displays the VRmesh1.sch circuit schematic and its corresponding PNG image. This example showcases a basic circuit configuration. ```schematic .. literalinclude:: examples/schematics/VRmesh1.sch .. image:: examples/schematics/VRmesh1.png :width: 9.4cm ``` -------------------------------- ### fit3.sch Schematic Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Displays the fit3.sch circuit schematic and its corresponding PNG image. This example showcases a basic circuit configuration. ```schematic .. literalinclude:: examples/schematics/fit3.sch .. image:: examples/schematics/fit3.png :width: 11.1cm ``` -------------------------------- ### Opamp and Amplifier Tutorials Source: https://lcapy.readthedocs.io/en/latest/_sources/releases Adds new tutorials focusing on opamp configurations, specifically transimpedance amplifiers and multi-feedback filters. ```python # Adds new opamp tutorials on transimpedance amplifiers and multi-feedback filters ``` -------------------------------- ### K2.sch Schematic Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Displays the K2.sch circuit schematic and its corresponding PNG image. This example showcases a basic circuit configuration. ```schematic .. literalinclude:: examples/schematics/K2.sch .. image:: examples/schematics/K2.png :width: 6.5cm ``` -------------------------------- ### cmos-led1.sch Schematic Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Displays the cmos-led1.sch circuit schematic and its corresponding PNG image. This example showcases a basic circuit configuration. ```schematic .. literalinclude:: examples/schematics/cmos-led1.sch .. image:: examples/schematics/cmos-led1.png :width: 8.3cm ``` -------------------------------- ### LCopy Inverting Opamp Amplifier Example Source: https://lcapy.readthedocs.io/en/latest/schematics A complete netlist example for an inverting op-amp amplifier circuit, including component definitions, connections, and schematic attributes. ```text P1 1 0_1; down R1 1 2; right R2 2_1 3_1; right E1 3_2 0_3 opamp 2_0 2 A; mirror W 0_1 0; right W 2_0 0; down W 3_2 3; right W 0 0_3; right P2 3 0_3; down W 2_1 2; down W 3_1 3_2; down ; draw_nodes=connections ``` -------------------------------- ### Start IPython with Pylab Source: https://lcapy.readthedocs.io/en/latest/overview This command starts the IPython interactive shell with pylab support, which is often used for scientific computing and plotting in Python, including with Lcapy. ```bash ipython --pylab ``` -------------------------------- ### LCopy Circuit: Shield-Ground (Extended) Example Source: https://lcapy.readthedocs.io/en/latest/gallery An extended version of the 'shield-ground' example, including additional components and connections for a more complex circuit. ```lc Vs 14 12 ac; down Rs 14 1; right Cable1; right=4, dashed, kind=coax, l= W 1 Cable1.in; right=0.5 W Cable1.out 2; right=0.5 W Cable1.ognd 10; down=0.5 Cc Cable1.mid Cable1.b; down=0.2, dashed, scale=0.6 W 2 3; right=1.5 W 3 11; right=0.75 W 3 4; down=0.5 W 5 6; down=0.5 W 6 7; left W 7 10; up=0.5 R 10 8; right E1 8 0 opamp 4 5 A_2; left=0.5, mirror, scale=0.5 E2 15 0 opamp 11 17 A_1; right, scale=0.5 W 17 18; down W 12 18; right W 18 0; down=0.2, sground Rin 11 17; down ; label_nodes=none, draw_nodes=connections ``` -------------------------------- ### Circuit Analysis for Novices Source: https://lcapy.readthedocs.io/en/latest/index Basic circuit analysis examples for beginners, including DC and AC voltage dividers. ```python from lcapy import Circuit # Example for DC voltage divider Novice = Circuit() Novice.add('V1', 'n1', '0', '10') Novice.add('R1', 'n1', 'n2', '1k') Novice.add('R2', 'n2', '0', '2k') print(Novice.Vout.node[1]) # Example for AC voltage divider steady state response AC_Novice = Circuit() AC_Novice.add('V1', 'n1', '0', '10 * exp(j*2*pi*1000*t)') AC_Novice.add('R1', 'n1', 'n2', '1k') AC_Novice.add('C1', 'n2', '0', '1e-6') print(AC_Novice.Vout.node[1]) ``` -------------------------------- ### Shield Guard Schematic Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Schematic demonstrating a shield guard setup. This example explores methods for protecting sensitive signals. ```python .. literalinclude:: examples/tutorials/shield-guard/shield-guard.sch ``` -------------------------------- ### LadderAlt Two-Port Network Source: https://lcapy.readthedocs.io/en/latest/networks Illustrates the creation of a LadderAlt two-port network, similar to Ladder but starting with a Shunt element. The example shows instantiation with components. ```python >>> n = LadderAlt(R('R1'), L('L1'), C('C1')) ``` -------------------------------- ### Lcapy Two-Port Initialization Example Source: https://lcapy.readthedocs.io/en/latest/_sources/networks Demonstrates the initialization of a two-port network using a chain of Shunt and Series components and accessing its Z-parameters and sources. ```python tp = Shunt(R('R1')).chain(Series(R('R2') + V('V1'))) z = tp.Zmodel print(z.params) print(z.sources) print(z.equation()) ``` -------------------------------- ### LCopy Schematic: CMOS Open-Drain Output Source: https://lcapy.readthedocs.io/en/latest/gallery An LCopy schematic representing a CMOS open-drain output configuration. This example shows the typical setup for such an output. ```LCopy ``` -------------------------------- ### LCpy Version 0.34 Release Notes Source: https://lcapy.readthedocs.io/en/latest/releases Version 0.34 transitioned to using setuptools and was published to PyPI. ```python # V0.34 switched to using setuptools and pushed to [https::pypi.org](https://lcapy.readthedocs.io/en/latest/:pypi.org) ``` -------------------------------- ### LCopy Simple Switched RC Circuit Netlist and IVP Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Demonstrates the creation of a basic switched RC circuit netlist, its schematic representation, and the conversion to an initial value problem (IVP) for time-domain analysis. ```python from lcapy import * a = Circuit(""" V 1 0; down SW 1 2 no; right R 2 3; right C 3 0_3; down W 0 0_3; right ; draw_nodes=connections") a.draw() cct_ivp = a.convert_IVP(0) print(cct_ivp.C.V(t)) ``` -------------------------------- ### LCopy Schematic: PIO-input3.sch Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Second example schematic file 'PIO-input3.sch' for LCapy, further illustrating PIO input configurations in digital circuits. This schematic offers an alternative input setup. ```schematic .. literalinclude:: examples/schematics/digital/PIO-input3.sch ``` -------------------------------- ### LCapy Circuit Simulation Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Demonstrates basic LCapy circuit simulation, including calculating output voltage and impedance, and handling circuit modifications like removing components or adding resistors. ```python >>> Vo.limit('Ad', oo) Vₛ⋅(R₁ + Râ‚‚) ──────────── R₁ ``` ```python >>> a.impedance(3, 0) 0 ``` ```python >>> c = a.copy() >>> c.remove('Vs') >>> c.impedance(3, 0) ValueError: The MNA A matrix is not invertible for time analysis because: 1. there may be capacitors in series; 2. a voltage source might be short-circuited; 3. a current source might be open-circuited; 4. a dc current source is connected to a capacitor (use step current source). 5. part of the circuit is not referenced to ground ``` ```python >>> c.add('Rin 3 0') >>> c.impedance(3, 0) ``` ```python >>> c.impedance(3, 0) Rᵢₙ ``` -------------------------------- ### LCopy Circuit Netlist and IVP Conversion Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Demonstrates creating a circuit netlist using Lcapy, drawing its schematic, and converting it to an initial value problem (IVP) for time-domain analysis. The example focuses on a switched RC circuit. ```python from lcapy import * a = Circuit(""" V 1 0; down W 1 5; right SW 2 5 4 spdt 0; right, mirror, invert, nosim, l W 2 4; right, mirror, invert, ignore R 2 3; right W 4 0_2; down C 3 0_3 C 0; down W 0 0_2; right=0.5 W 0_2 0_3; right ; draw_nodes=connections") a.draw() cct_ivp = a.convert_IVP(0) print(cct_ivp.C.V(t)) ``` -------------------------------- ### LCopy RL Circuit Netlist and IVP Conversion Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Illustrates the process of defining an RL circuit netlist, visualizing it, and converting it to an initial value problem (IVP) for subsequent time-domain analysis. ```python from lcapy import * a = Circuit(""" V 1 0; down SW 1 2 no; right R 2 3; right L 3 0_3; down W 0 0_3; right ; draw_nodes=connections") a.draw() cct_ivp = a.convert_IVP(0) print(cct_ivp.L.V(t)) ``` -------------------------------- ### Set Initial Circuit Values Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Illustrates setting initial values for circuit components using the `initialize()` method. This method allows setting initial conditions based on a related circuit's state at a specific time. ```python from lcapy import * a1 = Circuit(""" V 1 0 dc; down R 1 2; right C 2 0_2; down W 0 0_2; right """ ) a2 = Circuit(""" V 1 0 step; down R 1 2; right C 2 0_2 C; down W 0 0_2; right W 2 3; right L 3 0_3; down W 0_2 0_3; right """ ) t1 = expr('t1', positive=True) a2i = a2.initialize(a1, t1) a2i ``` ```python from lcapy import * a1 = Circuit(""" V 1 0 dc; down R 1 2; right C 2 0_2; down W 0 0_2; right """ ) a1.initialize(a1, 3) ``` -------------------------------- ### LCopy Initial Value Calculations Source: https://lcapy.readthedocs.io/en/latest/genindex Methods for calculating post and pre-initial values for various circuit analysis domains. ```python from lcapy.sexpr import LaplaceDomainExpression from lcapy.smatrix import LaplaceDomainMatrix from lcapy.super import Superposition from lcapy.texpr import TimeDomainExpression from lcapy.tmatrix import TimeDomainMatrix # Post-initial value calculations LaplaceDomainExpression.post_initial_value() LaplaceDomainMatrix.LaplaceDomainExpression.post_initial_value() Superposition.post_initial_value() TimeDomainExpression.post_initial_value() TimeDomainMatrix.TimeDomainExpression.post_initial_value() # Pre-initial value calculations Superposition.pre_initial_value() TimeDomainExpression.pre_initial_value() TimeDomainMatrix.TimeDomainExpression.pre_initial_value() ``` -------------------------------- ### RC and RL Circuit Analysis Source: https://lcapy.readthedocs.io/en/latest/index Tutorials covering the analysis of RC and RL circuits, including initial value settings and switch replacements. ```python from lcapy import Circuit # Example for RC circuit analysis C = Circuit() C.add('V1', 'n1', '0', '10 * sin(2*pi*1000*t)') C.add('R1', 'n1', 'n2', '1e3') C.add('C1', 'n2', '0', '1e-6') print(C.V1.node[1]) # Example for RL circuit analysis R = Circuit() R.add('V1', 'n1', '0', '10 * sin(2*pi*1000*t)') R.add('R1', 'n1', 'n2', '1e3') R.add('L1', 'n2', '0', '1e-3') print(R.V1.node[1]) ``` -------------------------------- ### Setting Initial Values with Lcapy Initialize Source: https://lcapy.readthedocs.io/en/latest/tutorials Demonstrates using the `initialize` method in Lcapy to set initial values for circuit components. It shows how to initialize a circuit based on another circuit's state at a specific time, and a trivial case where a capacitor's voltage is set to a DC source value. ```python from lcapy import * a1 = Circuit(""" V 1 0 dc; down R 1 2; right C 2 0_2; down W 0 0_2; right ") a2 = Circuit(""" V 1 0 step; down R 1 2; right C 2 0_2 C; down W 0 0_2; right W 2 3; right L 3 0_3; down W 0_2 0_3; right ") t1 = expr('t1', positive=True) a2i = a2.initialize(a1, t1) ``` ```python from lcapy import * a1 = Circuit(""" V 1 0 dc; down R 1 2; right C 2 0_2; down W 0 0_2; right ") a1.initialize(a1, 3) ``` -------------------------------- ### Install zfitpy Source: https://lcapy.readthedocs.io/en/latest/applications This snippet shows the command to install the zfitpy Python package using pip. ```bash $ pip3 ``` -------------------------------- ### Install zfitpy Source: https://lcapy.readthedocs.io/en/latest/_sources/applications Installs the zfitpy Python package using pip. This command is typically run in a console or terminal. ```console pip3 install zfitpy ``` -------------------------------- ### Buffer Schematic Examples Source: https://lcapy.readthedocs.io/en/latest/gallery Demonstrates the use of buffer and inverter components in schematics. It shows how to connect these components using wires. ```lc U1 buffer; right U2 inverter; right W U1.out U2.in; right=0.5 ``` -------------------------------- ### LCpy Schematic Example: Guard Ring Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Shows an example of a guard ring implementation in lcapy schematics. ```schematic .. literalinclude:: examples/schematics/guard1.sch ``` -------------------------------- ### LCpy Schematic Example: Causal System Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Provides an example of a causal system diagram created with lcapy schematics. ```schematic .. literalinclude:: examples/schematics/LTFT.sch ``` -------------------------------- ### Component Mirroring and Flipping Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics Shows how to mirror and flip components using attributes like 'mirror', 'flipud', 'invert', and 'fliplr'. Also demonstrates 'mirrorinputs' for opamps. ```python cct.add('E1 1 2 opamp 3 0; right, mirror') ``` -------------------------------- ### Transformer XT1 Schematics Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery A specific example of a transformer (XT1) in LCapy schematics, detailing its connection and representation. ```schematic .. literalinclude:: examples/schematics/XT1.sch ``` -------------------------------- ### Voltage Gain Transimpedance Amplifier with LCapy Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Demonstrates the simulation of a transimpedance amplifier with voltage gain using LCapy, showing the circuit definition and calculation of output voltage. ```python from lcapy import Circuit, t, oo a = Circuit(""" E 1 0 opamp 3 2 Ad; right W 2_1 2; right W 2 2_2; down R1 2_2 4; right R2 1 4; down R3 4 0; down, implicit W 1 1_1; right W 3 0; down=0.25, implicit ; draw_nodes=connections, label_ids=none, label_nodes=primary """) ``` -------------------------------- ### Transformer Schematics Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Provides an example of a transformer circuit in LCapy schematics, showing its implementation and visual representation. ```schematic .. literalinclude:: examples/schematics/transformers.sch ``` -------------------------------- ### Netlist Component Specification Example Source: https://lcapy.readthedocs.io/en/latest/schematics Provides an example of a netlist entry specifying a resistor with drawing attributes like color and length. ```APIDOC R1 1 2; right=2, color=blue Description: Defines a resistor between nodes 1 and 2. Attributes: - right=2: Specifies the drawing direction and length. - color=blue: Sets the color of the component to blue. ``` -------------------------------- ### Replace Switches in Circuit Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Demonstrates replacing switches with open or short circuits using the `replace_switches()` and `replace_switches_before()` methods. It shows how to create new circuit states before and after a switch event. ```python from lcapy import * a = Circuit(""" V 1 0; down W 1 5; right SW 2 5 4 spdt; right, mirror, invert R 2 3; right W 4 0_2; down C 3 0_3; down W 0 0_2; right=0.5 W 0_2 0_3; right ; draw_nodes=connections") a.draw() before = a.replace_switches_before(0) after = a.replace_switches(0).initialize(before, 0) ``` -------------------------------- ### Lcapy Schematic Example: Antennas Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics This schematic example displays the representation of antennas within the Lcapy environment, showcasing their graphical depiction. ```schematic include "examples/schematics/antennas.sch" ``` -------------------------------- ### Transistor Schematics Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Demonstrates the use of transistors in LCapy schematics. Includes examples of different transistor configurations and their diagrams. ```schematic .. literalinclude:: examples/schematics/transistors.sch ``` ```schematic .. literalinclude:: examples/schematics/transistors2.sch ``` -------------------------------- ### LCopy Matrix API Documentation Source: https://lcapy.readthedocs.io/en/latest/modules API documentation for the LCopy matrix module, covering matrix creation, simplification, substitution, and solving linear systems. ```APIDOC lcapy.matrix.matrix(mat) Create Lcapy Matrix from a SymPy Matrix. If a t symbol is found in an element a tMatrix object is created. If a s symbol is found in an element an sMatrix object is created. lcapy.matrix.matrix_inverse(M, method='default') Calculates the inverse of a matrix. lcapy.matrix.matrix_solve(M, b, method='default') Solves a linear system of equations M*x = b. lcapy.matrix.msympify(expr) Sympifies an expression, potentially handling matrix elements. Matrix.rewrite(*args, **hints) Rewrites matrix elements using specified functions or patterns. Matrix.simplify() Simplifies the elements of the matrix. Matrix.subs(*args, **kwargs) Substitutes variables in matrix expressions, similar to sympy.subs. Matrix.symbols (property) Returns the symbols present in the matrix. Matrix.sympy (property) Returns the SymPy representation of the matrix. ``` -------------------------------- ### Lcapy Netlist Schematics Source: https://lcapy.readthedocs.io/en/latest/_sources/overview Demonstrates how to generate schematics from netlists using Lcapy and Circuitikz. Includes examples of basic circuits and the use of orientation hints and ports. ```python >>> from lcapy import Circuit >>> cct = Circuit(""" V1 1 0 {V(s)}; down R1 1 2; right C1 2 0_2; down W1 0 0_2; right""") >>> cct.draw('schematic.pdf') ``` ```python >>> from lcapy import Circuit >>> cct = Circuit('voltage-divider.sch') >>> cct.draw('voltage-divider.pdf') ``` -------------------------------- ### Lcapy Schematic Example: Capacitors Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics This schematic example displays the representation of capacitors in Lcapy, demonstrating their graphical symbols and typical connections in circuits. ```schematic include "examples/schematics/capacitors.sch" ``` -------------------------------- ### Initialize LoopAnalysis with a Circuit Source: https://lcapy.readthedocs.io/en/latest/modules Demonstrates how to create an instance of the LoopAnalysis class by passing a Circuit object. This is the primary way to begin loop analysis. ```python from lcapy import Circuit, LoopAnalysis cct = Circuit(''' V1 1 0 {u(t)}; down R1 1 2; right=2 L1 2 3; down=2 W1 0 3; right W 1 5; up W 2 6; up C1 5 6; right=2 ''') la = LoopAnalysis(cct) ``` -------------------------------- ### Lcapy Schematic Example: Blocks2 Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics This is a second example demonstrating the use of 'blocks' in Lcapy, potentially showcasing different block configurations or functionalities. ```schematic include "examples/schematics/blocks2.sch" ``` -------------------------------- ### Lcapy Mesh Analysis Example Source: https://lcapy.readthedocs.io/en/latest/_sources/circuits Illustrates how to perform mesh analysis on a circuit defined by a netlist. It shows the process of creating a Circuit object, drawing the circuit, and obtaining the mesh equations. ```python cct = Circuit(""" V1 1 0; down R1 1 2; right L1 2 3; right R2 3 4; right L2 2 0_2; down C2 3 0_3; down R3 4 0_4; down W 0 0_2; right W 0_2 0_3; right W 0_3 0_4; right""") cct.draw() l = cct.mesh_analysis() l.mesh_equations() ``` -------------------------------- ### Lcapy Schematic Example: Batteries Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics This schematic example illustrates the representation of batteries in Lcapy, demonstrating their graphical symbols and potential usage in circuits. ```schematic include "examples/schematics/batteries.sch" ``` -------------------------------- ### Lcapy Schematic Example: Resistors4 Source: https://lcapy.readthedocs.io/en/latest/_sources/schematics This schematic example presents a different configuration of resistors, likely demonstrating specific layout or connection patterns. ```schematic include "examples/schematics/resistors4.sch" ``` -------------------------------- ### Switching Circuits Initialization Source: https://lcapy.readthedocs.io/en/latest/_sources/tutorials Illustrates how to handle switching circuits in Lcapy using the `convert_IVP()` method. This method converts a circuit with switches into an initial value problem, allowing for the analysis of circuits with changing states. It also mentions related methods like `replace_switches()`, `switching_times()`, and `initialize()`. ```python from lcapy import * a = Circuit('V 1 0; down W 1 5; right SW 2 5 4 spdt; right, mirror, invert R 2 3; right W 4 0_2; down C 3 0_3; down') # The convert_IVP method is used to handle switching circuits # a.convert_IVP(time=...) # Internally uses replace_switches(), switching_times(), initialize() ``` -------------------------------- ### Circuit Analysis Example Source: https://lcapy.readthedocs.io/en/latest/_sources/netlists Example demonstrating current calculation for a simple circuit with a current source and resistor, illustrating the effect of current sign conventions. ```python a = Circuit(""" I1 1 0 R1 1 0""") # Current of the source I1 a.I1.i # Current of the resistor R1 a.R1.i ``` -------------------------------- ### Inverting Amplifier Circuit Setup Source: https://lcapy.readthedocs.io/en/latest/tutorials Sets up an inverting amplifier circuit using Lcapy's Circuit class, including resistors, a voltage source, and an opamp with specific orientation. ```python from lcapy import Circuit, t, oo a = Circuit(""" E 1 0 opamp 3 2 Ad; right, flipud R1 4 2; right R2 2_2 1_1; right W 2 2_2; up W 1 1_1; up W 4 4_2; down=0.5 Vs 4_2 0_3; down W 0_3 0_1; down=0.5 W 3 0_2; down W 1 1_2; right P 1_2 0; down W 0_1 0_2; right W 0_2 0; right ; draw_nodes=connections, label_ids=none, label_nodes=primary ") ``` -------------------------------- ### Chip Schematics Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Showcases integrated circuits (chips) in LCapy schematics. Includes examples of different chip configurations and their diagrams. ```schematic .. literalinclude:: examples/schematics/chips.sch ``` ```schematic .. literalinclude:: examples/schematics/chips2.sch ``` -------------------------------- ### Circuit Description and Subcircuits Source: https://lcapy.readthedocs.io/en/latest/netlists Demonstrates how to use the describe() method to understand the circuit analysis approach and access subcircuits for superposition analysis. ```python >>> cct = Circuit(""" ... V1 1 0 {1 + u(t)} ... R1 1 2 ... L1 2 0""") >>> cct.describe() This is solved using superposition. DC analysis is used for source V1. Laplace analysis is used for source V1. >>> cct.subcircuits {'dc': V1 1 0 dc {1} R1 1 2 L1 2 0 L_1, 's': V1 1 0 {Heaviside(t)} R1 1 2 L1 2 0 L_1 } ``` -------------------------------- ### Lcapy Circuit Class Initialization and Usage Source: https://lcapy.readthedocs.io/en/latest/modules Details the initialization of the Circuit class with a netlist and demonstrates accessing component voltages, currents, and nodal voltages. It also shows how to calculate impedance and Thevenin equivalents. ```python from lcapy import Circuit # Initialize Circuit with a netlist string cct = Circuit(''' V1 1 0 V; down R1 1 2 R; right C1 2 0_2 C; down W 0 0_2; right''') # Draw the schematic cct.draw('schematic.pdf') # Get transform domain voltage across V1 cct.V1.V # Get transform domain current through R1 cct.R1.I # Get nodal voltage at node 2 cct[2].V # Get time domain voltage across C1 cct.C1.v # Calculate impedance between nodes 2 and 0 Z = cct.impedance(2, 0) # Calculate open-circuit voltage between nodes 2 and 0 Voc = cct.Voc(2, 0) # Get Thevenin equivalent circuit between nodes 2 and 0 thevenin = cct.thevenin(2, 0) # Draw the s-domain model cct.s_model().draw() ``` -------------------------------- ### Variable Component Schematics Example Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Illustrates the use of variable components in LCapy schematics, providing an example of a circuit with adjustable elements. ```schematic .. literalinclude:: examples/schematics/variable1.sch ``` -------------------------------- ### Switch Schematics Examples Source: https://lcapy.readthedocs.io/en/latest/_sources/gallery Illustrates the usage of switches in LCapy schematics. Features examples of different switch types and their circuit diagrams. ```schematic .. literalinclude:: examples/schematics/switches.sch ``` ```schematic .. literalinclude:: examples/schematics/switches2.sch ``` -------------------------------- ### Voltage Follower Circuit Setup Source: https://lcapy.readthedocs.io/en/latest/tutorials Defines a voltage follower circuit with a load capacitor using Lcapy's Circuit class. This is the basic setup without considering opamp output resistance. ```python from lcapy import * a = Circuit(""" E1 1 0 opamp 2 3 A; right, mirror W 1 4; right C 4 0_1; down W 3 3_1; up=0.75 W 3_1 3_2; right W 3_2 1; down W 2_1 2; right W 0 0_1; right P1 2_1 0; down") a.draw() ``` -------------------------------- ### Transimpedance Amplifier with Voltage Gain Circuit and Analysis Source: https://lcapy.readthedocs.io/en/latest/tutorials Defines a transimpedance amplifier circuit with voltage gain and calculates its transimpedance. Demonstrates the simplification and analysis of the transimpedance with an infinite open-loop gain. ```python from lcapy import Circuit, t, oo a = Circuit(""" E 1 0 opamp 3 2 Ad; right W 2_1 2; right W 2 2_2; down R1 2_2 4; right R2 1 4; down R3 4 0; down, implicit W 1 1_1; right W 3 0; down=0.25, implicit ; draw_nodes=connections, label_ids=none, label_nodes=primary ; draw_nodes=connections, label_ids=none, label_nodes=primary ") a.draw() print(a.transimpedance(2, 0, 1, 0).limit('Ad', oo).simplify()) ```