Friday, February 27, 2009

What is Linear Transient Analysis?

Transient analysis is used to examine the response of the circuit as a function of time.
Generally, transient analysis can only be applied to circuits that are “lumped” and “time-invariant”.
Lumped means that the circuit is physically small enough to allow us to assume that electric signals affect every point in the circuit simultaneously.
Time-invariant means that delaying the input signal by a certain time simply delays the response by the same time.
The two previous definitions are from the book “Electric Circuits” by James W. Nilson.

Linear transient analysis is a special case of transient analysis where the circuit to be analyzed may only contain linear elements.

In the context of transient analysis, a two-terminal element is linear if the relationship between the instantaneous voltage across the element and the instantaneous current through the element can be described by a linear (differential) equation.
The following figure shows that the resistor, the inductor, and the capacitor are all linear elements.

TwoTerminalElements

For elements having more than two terminals, an element is linear if the relationships between instantaneous currents and/or instantaneous voltages imposed by the element can be described by a set of linear (differential) equations.
The following figure shows that the current controlled voltage source and the transformer are linear elements.

TwoPortNetworks

To conclude, linear transient analysis is used to examine the response of a linear, lumped, time-invariant circuit as a function of time.

Initial Conditions

The solution of the circuit at t = 0 must be known before performing transient analysis because the time domain solution of a circuit depends on the initial state of the energy storage elements in the circuit and also because the user may be interested in the values of some circuit variables at t = 0.

DC analysis is performed prior to transient analysis to get the initial transient solution which is the solution at t = 0.
The user may be given the option to specify initial conditions on energy storage elements (initial currents through coils and initial voltages across capacitors). In this case, the user specified initial conditions are used as constraints on the initial transient solution. Specifically, during the DC analysis, coils and capacitors for which no initial conditions were specified are treated as short circuits and open circuits respectively, and coils and capacitors for which initial conditions were specified are treated as infinite-impedance current sources and zero-impedance voltage sources respectively.

The next version of the simulator will be called Soft Analyst and will support transient analysis.

Sunday, February 22, 2009

The Formal Documentation

Sandcastle is a documentation tool developed by Microsoft. It generates MSDN-style documentation from

  1. the assemblies metadata obtained by reflecting over the assemblies to be documented and
  2. the XML documentation file generated by the compiler. This file contains the XML comments extracted from the source code.

Sandcastle outputs HTML pages that can be deployed to a website. It can also output a set of files that can be fed to the HTML Help Workshop to generate a compiled help file (.chm).
HTML Help Workshop is a freely downloadable HTML help compiler and is not a part of Sandcastle. You can get the HTML Help Workshop from the Microsoft Download Center.
http://www.microsoft.com/downloads/details.aspx?FamilyID=00535334-c8a6-452f-9aa0-d597d16580cc&DisplayLang=en

The following image explains a lot. I got it from a Power Point presentation I downloaded from the official Sandcastle blog.
http://blogs.msdn.com/sandcastle/archive/2006/07/28/681209.aspx



Sandcastle is an open source project hosted on Codeplex. The latest release can be downloaded from
http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx

Sandcastle is a set of command-line programs that are hard to deal with. Luckily, there exists several community tools that provide a GUI front-end for Sandcastle. Examples of these projects are DocProject, Sandcastle Help File Builder, and Sandcastle GUI.

To generate the documentation for my BasicSimulator, I used Sandcastle, Sandcastle Help File Builder, and HTML Help Workshop.

Click here to download the formal documentation.

Thursday, February 5, 2009

The Sequence

Here is the sequence of operations from the time the program is invoked to the time it is ready to process ResQueries.
  1. The Main method loads the XML file containing the netlist. The DomParser validates the DOM and parses it to create CircuitElement objects. The CircuitElements are then packaged in a Circuit object.

  2. The Main method loads the XML file containing the analysis command. The DomParser validates the DOM and parses it to create an AnalysisCommand object.

  3. The Analyst numbers the elements that do not have an admittance description.

  4. The Analyst carries out the requested analysis.

    (A)
    If the User Has Requested
    Operating Point Analysis


    a) The circuit is formulated. Each CircuitElement is responsible for stamping its own contribution.

    b) The linear equations are solved by the LinearEquations class.

    (B)
    If the User Has Requested
    DC Sweep Analysis

    a) The circuit is formulated with the value of the variable DC source (or SweepableSource as I call it in my program) set to the starting value specified in the AnalysisCommand object.

    b) The linear equations are solved by the LinearEquations class.

    c) If the SweepableSource has attained the stopping value, then the analysis step has ended.

    d) The SweepableSource increments its value and changes its entry in the RHS vector to reflect the new value.

    e) Go to the step b.

    Note that LU factorization of linear equations will be performed only once when the equations are solved for the first time. The change in the SweepableSource value does not cause any changes in the coefficients matrix. Only one element in the RHS vector is changed.


    Steps of DC Sweep Analysis

  5. After the analysis step, the Circuit object that now contains the analysis results will be wrapped by a ResQueryProcessor object. The ResQueryProcessor object will be used by the UIManager to get the analysis results requested by the user.

  6. The Main method starts the UIManager and the interaction with the user begins.