Answered step by step
Verified Expert Solution
Link Copied!

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 e1 e2... en v1 v2... vn i1 i2... 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 floating-point number in a decimal notation with 3 decimal places
after the point (e.g.,14.654).
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:
1. The circuit consists of voltage sources and resistors only.
2.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:
1. Read a new netlist. One of the easiest ways is to leverage filestream.
2. Count the numbers of branches and nodes.
3. Create an incidence matrix. You may use the method introduced in class to derive a 2D incidence
matrix from a netlist.
4. Create a voltage coefficients matrix.
5. Create a current coefficients matrix.
6. Create a combined matrix.
7. Append the input to the combined matrix.
8. Calculate the parameters (e.g., using Gaussian elimination, LU factorization, or matrix inversion).
I/O Example
Input (netlist.txt):
V1105
R11210
R22020
Output (output.txt):
5,3.333,5,1.667,3.333,-0.167,0.167,0.167
Note
1. Your code should be in C++ only.
2. You can only use C++ standard libraries (including STL). Any libraries that implement matrices for you are not allowed
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago