{"id":20595114,"url":"https://github.com/victor-aunon/circuitsolver","last_synced_at":"2025-04-14T23:43:32.675Z","repository":{"id":130283966,"uuid":"195382869","full_name":"victor-aunon/CircuitSolver","owner":"victor-aunon","description":"Electric circuit solver in DC","archived":false,"fork":false,"pushed_at":"2019-07-07T11:19:07.000Z","size":572,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-14T23:43:26.203Z","etag":null,"topics":["cpp","electrical-engineering","electricity","learn-to-code","learning","learning-by-doing"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victor-aunon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-05T09:37:57.000Z","updated_at":"2025-03-28T12:05:33.000Z","dependencies_parsed_at":"2023-04-12T18:15:46.875Z","dependency_job_id":null,"html_url":"https://github.com/victor-aunon/CircuitSolver","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.33333333333333337","last_synced_commit":"af95caa9574a9bc341013eb712057b8aac7ada99"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victor-aunon%2FCircuitSolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victor-aunon%2FCircuitSolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victor-aunon%2FCircuitSolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victor-aunon%2FCircuitSolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victor-aunon","download_url":"https://codeload.github.com/victor-aunon/CircuitSolver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981259,"owners_count":21193143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","electrical-engineering","electricity","learn-to-code","learning","learning-by-doing"],"created_at":"2024-11-16T08:11:56.776Z","updated_at":"2025-04-14T23:43:32.659Z","avatar_url":"https://github.com/victor-aunon.png","language":"C++","readme":"# CircuitSolver\n\n## Table of contents\n1. [Description](#description)\n2. [Building the circuit](#building)\n3. [Solving the circuit](#solving)\n4. [Acknowledgments](#acknowledgments)\n\n---\n\n## 1. Description \u003ca name=\"description\"\u003e\u003c/a\u003e\n_CircuitSolver_ is a C++ program that calculates the electric currents in a DC circuit. The project was created with the aim of encourage C++ learners to build their own projects and provide engineering students with a tool to solve this type of circuits.\n\nAs a learning resource, this project includes a fully commented code that uses:\n* Classes\n* Structs\n* Pointers\n* Code separated in headers and implementation files.\n* Third party libraries.\n* Examples\n\n## 2. Building the circuit \u003ca name=\"building\"\u003e\u003c/a\u003e\nElectric circuits must be built in XML format. The main node is the `\u003ccircuit\u003e` node, which holds the circuit meshes and branches. A `\u003cmesh\u003e` node should be declared with the attribute `ID` as its identifier, the same happens with a `\u003cbranch\u003e` node. \n\nThe circuit elements should be declared inside a `\u003cbranch\u003e` node. If the element is a battery, a `\u003cbattery\u003e` node should be created with the attributes `ID` (the identifier) and `value`, which is the voltage of the battery in volts. Alternatively, if the element is an impedance, a `\u003cresistance\u003e` node should be created with the attributes `ID` (the identifier) and `value`, which is the resistance in ohms.\n\nWhen creating a mesh, the user must define an initial direction of the current flow. The program solves the mesh currents by considering that the current flows clockwise through each mesh. So, taking this direction into account, the user must define the battery voltage according to this. If the current goes through the battery from anode to cathode, then the `value` attribute of the `\u003cbattery\u003e` must be positive; on the contrary, it must be negative. For resistance elements, the user must define the `value` attribute of the `\u003cresistance\u003e` always positive.\n\nAs an example, the following circuit, composed of two meshes, should be declared as follows:\n\n![alt text](https://raw.githubusercontent.com/victor-aunon/CircuitSolver/master/examples/circuit_2_meshes_scheme.png \"Two meshes circuit\")\n\n```XML\n\u003ccircuit\u003e\n    \u003cmesh ID=\"mesh-1\"\u003e\n        \u003cbranch ID=\"branch-1\"\u003e\n            \u003cbattery ID=\"battery-1\" value=\"28\"/\u003e\n            \u003cresistance ID=\"resistance-1\" value=\"4\"/\u003e\n        \u003c/branch\u003e\n        \u003cbranch ID=\"branch-2\"\u003e\n            \u003cresistance ID=\"resistance-2\" value=\"2\"/\u003e\n        \u003c/branch\u003e\n    \u003c/mesh\u003e\n    \u003cmesh ID=\"mesh-2\"\u003e\n        \u003cbranch ID=\"branch-2\"\u003e\n            \u003cresistance ID=\"resistance-2\" value=\"2\"/\u003e\n        \u003c/branch\u003e\n        \u003cbranch ID=\"branch-3\"\u003e\n            \u003cbattery ID=\"battery-2\" value=\"-7\"/\u003e\n            \u003cresistance ID=\"resistance-3\" value=\"1\"/\u003e\n        \u003c/branch\u003e\n    \u003c/mesh\u003e\n\u003c/circuit\u003e\n```\n\n## 3. Solving the circuit \u003ca name=\"solving\"\u003e\u003c/a\u003e\nOnce the circuit has been created, it must be solved by passing it as an argument to the program. In windows, for instance, the user must call the program in this way:\n\n`CircuitSolver.exe \u003cname-of-the-circuit-file\u003e.xml`\n\nIf the file does not exist, or it is not an XML file, or it can't be read, the program will raise an error.\n\nOnce the circuit XML file has been read correctly, the program solves the circuit and creates a text file called `\u003cname-of-the-circuit-file\u003e_solved.txt`. This results file contains the electric currents at each branch and mesh, as well as the power dissipated by each resistance.\n\nRegarding the sign of the current, if the value is positive, it means that the resulting direction of the current matches the initial one, which is clockwise. In case it is negative, the current direction would be anticlockwise. The same happens for branches which are shared between two meshes: its resulting current sign is referred to the one of the first mesh in which the branch was declared.\n\n## 4. Acknowledgments \u003ca name=\"acknowledgments\"\u003e\u003c/a\u003e\nThis software is based on pugixml library (http://pugixml.org). pugixml is Copyright (C) 2006-2018 Arseny Kapoulkine.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictor-aunon%2Fcircuitsolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictor-aunon%2Fcircuitsolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictor-aunon%2Fcircuitsolver/lists"}