AnalogCircuit - Lab 7 Simple Resistive Circuits Solver (COE318)
Overview This Java application models and solves simple DC circuits made up of resistors and voltage sources. Users can input circuit components through the terminal using a specific text-based format. The program interprets the input, models the circuit, and provides a SPICE-style output. This lab focuses on implementing a system from scratch based on requirements including testing via JUnit without a predefined design.
Features
- Accepts circuit components via user input:
- Resistor: r
- Voltage Source: v
- Commands:
- spice → outputs circuit in SPICE format
- end → exits the program
- Validates inputs and handles polarity for voltage sources
- Outputs all components in correct SPICE format with unique IDs
File Structure
- UserMain.java: Main class that reads user input and runs the application
- UserInterface.java: Handles command input and processing logic
- Circuit.java: Manages the collection of all components (Singleton design pattern)
- Node.java: Represents circuit nodes with auto-assigned IDs
- Resistor.java: Models resistors between two nodes with unique ID and resistance
- Voltage.java: Models DC voltage sources between two nodes with polarity