Skip to content

Commit 9716d92

Browse files
Added an initial readme
1 parent d8acf53 commit 9716d92

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<p align="center">
2+
<img src="https://github.com/user-attachments/assets/9494c07a-1433-44f5-8ea2-fa535fb48f23" width="500">
3+
</p>
4+
5+
<h1 align="center">
6+
Circuit Simulator
7+
</h1>
8+
9+
<p align="center">
10+
<img src="https://img.shields.io/badge/C%2B%2B-00599C?style=for-the-badge&logo=c%2B%2B&logoColor=white" >
11+
<img src="https://img.shields.io/badge/Visual_Studio-5C2D91?style=for-the-badge&logo=visual%20studio&logoColor=white" >
12+
<img src="https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white" >
13+
14+
</p>
15+
16+
<p align="center">
17+
A circuit simulator that provides an intuitive platform for designing, modifying, and solving simple DC circuits.
18+
</p>
19+
20+
## Features
21+
22+
-**Interactive Circuit Design:** Create circuit elements like resistors, voltage sources, current sources, wires, and ground on a user-friendly grid interface.
23+
24+
-**Efficient Value Input Navigation:** Update circuit element values directly with support for metric prefixes (e.g., k, M, µ) for precision.
25+
26+
-**Seamless Input Navigation:** Quickly switch between circuit elements to modify values.
27+
28+
-**Multiple Circuits:** Design and solve multiple circuits simultaneously within a single canvas.
29+
30+
-**Easy Circuit Solving:** Solve the circuit and hover over nodes and elements to view detailed information like voltage and current values.
31+
32+
-**Error Detection:** Automatically identifies and alerts you to invalid circuit configurations.
33+
34+
-**Camera Control and Zoom:** Adjust the view and zoom level to easily navigate and manage large circuits.
35+
36+
-**Undo/Redo Actions:** Effortlessly correct mistakes with undo functionality.
37+
38+
## User Guide
39+
40+
## 1. Creating a Circuit Element
41+
- **Start Drawing**: Click on any grid intersection to begin creating a circuit element. The element will extend from the clicked intersection to the mouse cursor position.
42+
- **Cancel Creation**: Right-click or press `Ctrl + Z` to cancel the creation.
43+
- **Complete Element**: Click on another grid intersection to finalize the circuit element.
44+
- **Switch Elements**: Press the first character of a circuit element to switch to its drawing mode:
45+
- `R`: Resistor
46+
- `V`: Voltage Source
47+
- `C`: Current Source
48+
- `W`: Wire
49+
- `G`: Ground
50+
51+
---
52+
53+
## 2. Modifying Circuit Element Values
54+
- **Single Element Input**:
55+
- Left-click on the element to enter input mode.
56+
- Type the desired value and press `Enter` (metrix prefixes can be added at the end).
57+
- Supported metric prefixes include:
58+
- `p`: $`10^{-12}`$
59+
- `n`: $`10^{-9}`$
60+
- `µ`: $`10^{-6}`$ (write `u` instead of µ)
61+
- `m`: $`10^{-3}`$
62+
- `k`: $`10^3`$
63+
- `M`: $`10^6`$
64+
- `G`: $`10^9`$
65+
66+
- **Multiple Elements Input**:
67+
- Press `Tab` to navigate to the next element.
68+
- Press `Shift + Tab` to navigate to the previous element.
69+
- Input mode exits when:
70+
- `Enter` is pressed.
71+
- `Shift + Tab` is pressed on the first element.
72+
- `Tab` is pressed on the last element.
73+
74+
---
75+
76+
## 3. Solving the Circuit
77+
- **Solve Command**: Press `Ctrl + Enter` to solve the circuit (multiple circuits can be solved in one canvas).
78+
- **View Results**:
79+
- Hover over nodes to see nodal voltages.
80+
- Hover over elements to view voltage differences and currents.
81+
- **Error Handling**: Invalid circuits will display an error message.
82+
83+
---
84+
85+
## 4. Extra Features
86+
- **Camera Controls**:
87+
- Move the view: Hold `Right Click` and drag the mouse.
88+
- Zoom in/out: Use the mouse wheel or press `Ctrl + =` / `Ctrl + -`.
89+
- **Undo Actions**: Press `Ctrl + Z` to undo the last action.
90+
91+
---
92+
93+
## 5. Shortcuts Summary
94+
95+
| **Action** | **Shortcut** |
96+
|-------------------------------|------------------------|
97+
| Draw Resistor | `R` |
98+
| Draw Voltage Source | `V` |
99+
| Draw Current Source | `C` |
100+
| Draw Wire | `W` |
101+
| Draw Ground | `G` |
102+
| Cancel Element Creation | `Right Click` |
103+
| Enter Input Mode | `Left Click on Element` |
104+
| Enter Input Mode for First Element | `Tab` |
105+
| Navigate to Next Element | `Tab` |
106+
| Navigate to Previous Element | `Shift + Tab` |
107+
| Solve Circuit | `Ctrl + Enter` |
108+
| Move Camera | `Right Click + Drag` |
109+
| Zoom In/Out | `Mouse Wheel` / `Ctrl + =` / `Ctrl + -` |
110+
| Undo Last Action | `Ctrl + Z` |
111+
112+
---
113+
114+
## Project Setup
115+
116+
### Steps
117+
118+
**1. Install Raylib on your system:**
119+
120+
One of the easiest ways to install Raylib is using `vcpkg`
121+
Follow this video for instructions: [here](https://youtu.be/UiZGTIYld1M?si=jz9CSbnuvEvrdDks)
122+
123+
**2. Clone the repository:**
124+
125+
<img src="https://github.com/user-attachments/assets/29d99323-fb76-4faf-a792-754b7ee34da0" alt="Example Image" width="400">
126+
<img src="https://github.com/user-attachments/assets/a52fa04c-52dc-4ca4-8096-5a4ddb12b2d8" alt="Example Image" width="400">
127+
128+
**3. You’re done!:**
129+
130+
Run the project via `Ctrl + F5`.
131+
132+
<img src="https://github.com/user-attachments/assets/5b9cef7b-7ec0-4cc5-b673-1fb0f2caa122" alt="Example Image" width="400">

0 commit comments

Comments
 (0)