Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi I could use some guidance on a C + + project of a elementary circuit analysis solver, that takes the input of the netlist
Hi I could use some guidance on a C project of a elementary circuit analysis solver, that takes the input of the netlist document, and outputs the unknown values in an output text file. Asside from providing code my main issue is the debugging of the code, as I Deal with the ERROR CODE DEBUG ASSERTION FAILED! EXPRESSION: VECTOR SUBCRIPT OUT OF RANGE. The most problematic problem I had with my prior code was the runtime error code of exceeding allocated memory. Please help me prevent this error from happening as from all the various code styles i've had before all have this same issue. Please check and make sure.
Here's the project Guidelines and supporting images
One or several source code files of your circuit analysis tool. Your code should deal with the
following files:
Input: a file named netlist.txt located in the same directory as your source code. It sticks
to the format branch label source node label destination node label value as
shown in class.
Output: a file named output.txt created by your code in the same folder as your code.
The output format should be a single row as shown in the slides:
o e e en v v vn i i in
o That is the potentials, voltages, and currents are written in a row separated by
one space between each two.
o Each result is a floatingpoint number in a decimal notation with decimal places
after the point eg
Description
The goal is to implement an elementary circuit analysis tool that reads a circuit netlist and computes the current, voltage potential, and voltage drop at each component.
Input: a circuit netlist.
Output: a file of calculation results.
In this project, you may assume:
The circuit consists of voltage sources and resistors only.
The program will not be tested on malformed or inconsistent netlists.
More Guidelines:
You may create several functions for reading a new netlist,
counting the numbers of branches and nodes, creating several matrices, calculating parameters, etc.
Here are some general steps for your reference:
Read a new netlist. One of the easiest ways is to leverage filestream.
Count the numbers of branches and nodes.
Create an incidence matrix. You may use the method introduced in class to derive a D incidence
matrix from a netlist.
Create a voltage coefficients matrix.
Create a current coefficients matrix.
Create a combined matrix.
Append the input to the combined matrix.
Calculate the parameters eg using Gaussian elimination, LU factorization, or matrix inversion
IO Example
Input netlisttxt:
V
R
R
Output outputtxt:
Note
Your code should be in C only.
You can only use C standard libraries including STL Any libraries that implement matrices for you are not allowed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started