Starting from:

$25

EE2703-Assignment 2 Spice - Part 2 Solved

1.    Parse the netlist and create list(s) of different components. You may define class(es) for components and create objects for each component to store them nicely. Component name, connected nodes, value etc... can be the features of this(these) class(es). Remember that list elements can be class objects too.

2.    Create a table of distinct nodes present in the circuit. Assign numbers to the nodes so that they correspond to the rows (columns) of the incidence matrix. You may use a dictionary for doing this. You could then store the node number as the value with the node name as the key.

Note: You can assume that ground node is always named as GND. The ground node will add an extra equation:

                                                                                                            Vk = 0                                            (12)

where k is the node number of GND. You may keep it as V0 always.

3.    Construct matrices M and b using numpy arrays.

4.    Solve the equation Mx = b.

5.    Print all the unknowns. (All node volatges and current through voltage sources)

6.    Solve the following circuits with your program:

(a) A simple resistive circuit (use RL = 1,10 and 100Ω)

 

Figure 1: Resistive circuit

7. Can you use the same techniques to solve for ac circuits? We only have to interpret the impedance as complex numbers and the solution will follow. We will only work with circuits with single frequency at steady state.

Till now, we only had a single command in the netlist (.circuit ... .end). We now allow a new command .ac.

.ac V... frequency

This is a single line command. It will appear after the .circuit ... .end block and specify the frequency of a voltage source.

We will also modify the way voltage source and current values are given. We will use the following representations:

V... n1 n2 ac Vp−p
phase # ac voltage source
V... n1 n2 dc v
# dc voltage source
Similar representations will follow for current sources.

Solve the following circuits:

(a)    A band-pass filter for the current in the resistor

 

Figure 2: Band-pass filter

(b)   A low-pass filter, for the voltage across the load resistor

 

Figure 3: Low-pass filter

More products