Starting from:
$35

$29

Project-­‐1 Part-­‐A CIRCUIT SIMULATOR


Here is a chance for you to implement your own MATLAB-­‐based circuit simulator!

Your simulator should be capable of simulatingany circuit with the following circuit elements:

    • Resistors

    • Independent voltage sources

    • Independent current sources

You will write a MATLAB program that reads a text input file representing the circuit and determines the node voltages using the algorithm provided below on Modified Node Analysis.

The text file will include the information regarding circuits with the following rules:

    • Each element is entered in a single row.

    • The first column is the unique identifier for the element whose first letter indicates the type of the element: R, I or V and the rest is an integer. The second and the third columns denote the node numbers of the element. The last column denotes the value of the element in Ohms, Amperes or Volts.

    • NodeNumber@SecondColumn < NodeNumber@ThirdColumn.

    • Positive value for the current source means that the current is entering the Node@ThirdColumn.

•  Positive value for the voltage source means:
V1
0
1
10
Voltage of Node@SecondColumn < Voltage of Node@ThirdColumn.
R1
0
2
5
•  For example the following circuit will beentered as follows:
I1
0
3
2
1
2
3
R2
0
3
10










R3
1
2
1



R4
2
3
2


0

Your program should prompt the user for the name of the textfile and display the solution (i.e. the node voltages) on screen. Your program should be modular and it should include a function that takes the file name as an input argument and returns the node voltages.

Always remember to have comments in your code and provide some “help” information to guide the users.
EE241 Project-­‐1 Part-­‐A


due: October 30, Sunday 23:55


An algorithm for Modified Node Analysis (MNA):

(adapted from [1])

MNA applied to a circuit with only passive elements (resistors) and independent current and voltage sources results in a matrix equation of the form:
A ∙ x = z

For a circuit with n nodes and m independent voltage sources:

    • The A matrix, stated above:

        ◦ is (n+m)x(n+m) in size, and consists only of known quantities.
        ◦ the nxn part of the matrix in the upper left:
            ▪ has only passive elements
            ▪ elements connected to ground appear only on the diagonal
            ▪ elements not connected to ground are both on the diagonal and off-­‐diagonal terms.

    • The rest of the A matrix (not included in the nxn upper left part) contains only 1,-­‐1 and 0.
    • The x matrix:
        ◦ is an (n+m)x1 vector that holds the unknown quantities (node voltages and the currents through the independent voltage sources).
        ◦ the top n elements are the n node voltages.
        ◦ the bottom m elements represent the currents through the m independent voltage sources in the circuit.
    • The z matrix:
        ◦ is an (n+m)x1 vector that holds only known quantities
        ◦ the top n elements are either zero or the sum and difference of independent current sources in the circuit.
        ◦ the bottom m elements represent the m independent voltage sources in the circuit.
The unknown quantities can be obtained by solving the linear system of equationsA ∙ x = z .

WARNING: One aim of this project is to implement the above algorithm in MATLAB. That excludes obtaining the solution using symbolic manipulations as presented in [2].Making use of the code in [2] will be considered as unauthorized aid.



REFERENCES:

    1. http://www.swarthmore.edu/NatSci/echeeve1/Ref/mna/MNA3.html

    2. http://www.swarthmore.edu/NatSci/echeeve1/Ref/mna/MNA6.html

More products