Create Circuit Simulation

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
5
down vote

favorite
7












I wonder if someone can help me. How will one go about to create a simple circuit simulator? Similar to Multisim, just a lot simpler!



Basically, I only need resistors, capacitors, inductors and voltage sources.



Is there a tutorial I can follow, to create this using C# and Visual Studio?







share|improve this question
















  • 1




    Must you have AC and DC and oppoint and thermal noise?
    – analogsystemsrf
    Sep 3 at 5:09






  • 1




    AC and DC yes, thermal noise not so important to me now.
    – fitzchivalry
    Sep 3 at 5:22
















up vote
5
down vote

favorite
7












I wonder if someone can help me. How will one go about to create a simple circuit simulator? Similar to Multisim, just a lot simpler!



Basically, I only need resistors, capacitors, inductors and voltage sources.



Is there a tutorial I can follow, to create this using C# and Visual Studio?







share|improve this question
















  • 1




    Must you have AC and DC and oppoint and thermal noise?
    – analogsystemsrf
    Sep 3 at 5:09






  • 1




    AC and DC yes, thermal noise not so important to me now.
    – fitzchivalry
    Sep 3 at 5:22












up vote
5
down vote

favorite
7









up vote
5
down vote

favorite
7






7





I wonder if someone can help me. How will one go about to create a simple circuit simulator? Similar to Multisim, just a lot simpler!



Basically, I only need resistors, capacitors, inductors and voltage sources.



Is there a tutorial I can follow, to create this using C# and Visual Studio?







share|improve this question












I wonder if someone can help me. How will one go about to create a simple circuit simulator? Similar to Multisim, just a lot simpler!



Basically, I only need resistors, capacitors, inductors and voltage sources.



Is there a tutorial I can follow, to create this using C# and Visual Studio?









share|improve this question











share|improve this question




share|improve this question










asked Sep 3 at 4:29









fitzchivalry

466




466







  • 1




    Must you have AC and DC and oppoint and thermal noise?
    – analogsystemsrf
    Sep 3 at 5:09






  • 1




    AC and DC yes, thermal noise not so important to me now.
    – fitzchivalry
    Sep 3 at 5:22












  • 1




    Must you have AC and DC and oppoint and thermal noise?
    – analogsystemsrf
    Sep 3 at 5:09






  • 1




    AC and DC yes, thermal noise not so important to me now.
    – fitzchivalry
    Sep 3 at 5:22







1




1




Must you have AC and DC and oppoint and thermal noise?
– analogsystemsrf
Sep 3 at 5:09




Must you have AC and DC and oppoint and thermal noise?
– analogsystemsrf
Sep 3 at 5:09




1




1




AC and DC yes, thermal noise not so important to me now.
– fitzchivalry
Sep 3 at 5:22




AC and DC yes, thermal noise not so important to me now.
– fitzchivalry
Sep 3 at 5:22










2 Answers
2






active

oldest

votes

















up vote
26
down vote



accepted










I wrote the simulation engine that powers CircuitLab from scratch: from the sparse matrix library up through component models and simulation modes. My co-founder wrote the front-end. It ended up being an unbelievably huge programming project, but one I'm quite proud of. If you're up for the challenge, writing a circuit simulator may be one of the most rewarding programming projects you'll ever tackle.



At a high level, you just need to:



  1. Turn a network of components into a system of equations (non-linear differential equations).

  2. Numerically solve the system of equations (using sparse matrix techniques).

I don't know of an online tutorial, but I've tried to document a lot of this as I write the "Ultimate Electronics" textbook, especially in Chapter 2. There are also a number of 1990s-era books on the topic of circuit simulation, though I don't have them handy at the moment.



My suggestion would be to start from only voltage sources and resistors, and continue building from there. Good luck.






share|improve this answer




















  • Amazing, thank you!
    – fitzchivalry
    Sep 3 at 5:20










  • Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
    – user1584421
    Sep 3 at 18:14

















up vote
2
down vote













I doubt there are online tutorials because it's something pretty specific.



However, one source of information you can definitely use is open source code. One I know of is SpicePy - it's written in Python, but it's very well documented, although the Python language is very descriptive just by itself. You can use such library in your Python code or though the Telegram Bot.



What you'll need is some sort of way to describe the topology of your circuit. One common approach is the use of netlists, which are essentially text that describe each component in the circuit and how it's connect to the other ones (e.g. through node numbers). You can use this strategy or whatever one seems easier for you to take; parsing it and making it an actual graph (i.e. is it meaningful?) out of it might take you some time.



After that, one common way to analyze circuits in simulators is nodal analysis; then resort to some linear algebra library to solve the system of equations (which will surely be linear), such as Math.Net.






share|improve this answer




















  • Awesome, thanks a lot.
    – fitzchivalry
    Sep 5 at 1:16










Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
return StackExchange.using("schematics", function ()
StackExchange.schematics.init();
);
, "cicuitlab");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "135"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f394068%2fcreate-circuit-simulation%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
26
down vote



accepted










I wrote the simulation engine that powers CircuitLab from scratch: from the sparse matrix library up through component models and simulation modes. My co-founder wrote the front-end. It ended up being an unbelievably huge programming project, but one I'm quite proud of. If you're up for the challenge, writing a circuit simulator may be one of the most rewarding programming projects you'll ever tackle.



At a high level, you just need to:



  1. Turn a network of components into a system of equations (non-linear differential equations).

  2. Numerically solve the system of equations (using sparse matrix techniques).

I don't know of an online tutorial, but I've tried to document a lot of this as I write the "Ultimate Electronics" textbook, especially in Chapter 2. There are also a number of 1990s-era books on the topic of circuit simulation, though I don't have them handy at the moment.



My suggestion would be to start from only voltage sources and resistors, and continue building from there. Good luck.






share|improve this answer




















  • Amazing, thank you!
    – fitzchivalry
    Sep 3 at 5:20










  • Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
    – user1584421
    Sep 3 at 18:14














up vote
26
down vote



accepted










I wrote the simulation engine that powers CircuitLab from scratch: from the sparse matrix library up through component models and simulation modes. My co-founder wrote the front-end. It ended up being an unbelievably huge programming project, but one I'm quite proud of. If you're up for the challenge, writing a circuit simulator may be one of the most rewarding programming projects you'll ever tackle.



At a high level, you just need to:



  1. Turn a network of components into a system of equations (non-linear differential equations).

  2. Numerically solve the system of equations (using sparse matrix techniques).

I don't know of an online tutorial, but I've tried to document a lot of this as I write the "Ultimate Electronics" textbook, especially in Chapter 2. There are also a number of 1990s-era books on the topic of circuit simulation, though I don't have them handy at the moment.



My suggestion would be to start from only voltage sources and resistors, and continue building from there. Good luck.






share|improve this answer




















  • Amazing, thank you!
    – fitzchivalry
    Sep 3 at 5:20










  • Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
    – user1584421
    Sep 3 at 18:14












up vote
26
down vote



accepted







up vote
26
down vote



accepted






I wrote the simulation engine that powers CircuitLab from scratch: from the sparse matrix library up through component models and simulation modes. My co-founder wrote the front-end. It ended up being an unbelievably huge programming project, but one I'm quite proud of. If you're up for the challenge, writing a circuit simulator may be one of the most rewarding programming projects you'll ever tackle.



At a high level, you just need to:



  1. Turn a network of components into a system of equations (non-linear differential equations).

  2. Numerically solve the system of equations (using sparse matrix techniques).

I don't know of an online tutorial, but I've tried to document a lot of this as I write the "Ultimate Electronics" textbook, especially in Chapter 2. There are also a number of 1990s-era books on the topic of circuit simulation, though I don't have them handy at the moment.



My suggestion would be to start from only voltage sources and resistors, and continue building from there. Good luck.






share|improve this answer












I wrote the simulation engine that powers CircuitLab from scratch: from the sparse matrix library up through component models and simulation modes. My co-founder wrote the front-end. It ended up being an unbelievably huge programming project, but one I'm quite proud of. If you're up for the challenge, writing a circuit simulator may be one of the most rewarding programming projects you'll ever tackle.



At a high level, you just need to:



  1. Turn a network of components into a system of equations (non-linear differential equations).

  2. Numerically solve the system of equations (using sparse matrix techniques).

I don't know of an online tutorial, but I've tried to document a lot of this as I write the "Ultimate Electronics" textbook, especially in Chapter 2. There are also a number of 1990s-era books on the topic of circuit simulation, though I don't have them handy at the moment.



My suggestion would be to start from only voltage sources and resistors, and continue building from there. Good luck.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 3 at 4:54









compumike

1,5941015




1,5941015











  • Amazing, thank you!
    – fitzchivalry
    Sep 3 at 5:20










  • Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
    – user1584421
    Sep 3 at 18:14
















  • Amazing, thank you!
    – fitzchivalry
    Sep 3 at 5:20










  • Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
    – user1584421
    Sep 3 at 18:14















Amazing, thank you!
– fitzchivalry
Sep 3 at 5:20




Amazing, thank you!
– fitzchivalry
Sep 3 at 5:20












Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
– user1584421
Sep 3 at 18:14




Thank you for this answer and book! Out of curiosity, as an estimation, can you tell how many lines of code it ended up being?
– user1584421
Sep 3 at 18:14












up vote
2
down vote













I doubt there are online tutorials because it's something pretty specific.



However, one source of information you can definitely use is open source code. One I know of is SpicePy - it's written in Python, but it's very well documented, although the Python language is very descriptive just by itself. You can use such library in your Python code or though the Telegram Bot.



What you'll need is some sort of way to describe the topology of your circuit. One common approach is the use of netlists, which are essentially text that describe each component in the circuit and how it's connect to the other ones (e.g. through node numbers). You can use this strategy or whatever one seems easier for you to take; parsing it and making it an actual graph (i.e. is it meaningful?) out of it might take you some time.



After that, one common way to analyze circuits in simulators is nodal analysis; then resort to some linear algebra library to solve the system of equations (which will surely be linear), such as Math.Net.






share|improve this answer




















  • Awesome, thanks a lot.
    – fitzchivalry
    Sep 5 at 1:16














up vote
2
down vote













I doubt there are online tutorials because it's something pretty specific.



However, one source of information you can definitely use is open source code. One I know of is SpicePy - it's written in Python, but it's very well documented, although the Python language is very descriptive just by itself. You can use such library in your Python code or though the Telegram Bot.



What you'll need is some sort of way to describe the topology of your circuit. One common approach is the use of netlists, which are essentially text that describe each component in the circuit and how it's connect to the other ones (e.g. through node numbers). You can use this strategy or whatever one seems easier for you to take; parsing it and making it an actual graph (i.e. is it meaningful?) out of it might take you some time.



After that, one common way to analyze circuits in simulators is nodal analysis; then resort to some linear algebra library to solve the system of equations (which will surely be linear), such as Math.Net.






share|improve this answer




















  • Awesome, thanks a lot.
    – fitzchivalry
    Sep 5 at 1:16












up vote
2
down vote










up vote
2
down vote









I doubt there are online tutorials because it's something pretty specific.



However, one source of information you can definitely use is open source code. One I know of is SpicePy - it's written in Python, but it's very well documented, although the Python language is very descriptive just by itself. You can use such library in your Python code or though the Telegram Bot.



What you'll need is some sort of way to describe the topology of your circuit. One common approach is the use of netlists, which are essentially text that describe each component in the circuit and how it's connect to the other ones (e.g. through node numbers). You can use this strategy or whatever one seems easier for you to take; parsing it and making it an actual graph (i.e. is it meaningful?) out of it might take you some time.



After that, one common way to analyze circuits in simulators is nodal analysis; then resort to some linear algebra library to solve the system of equations (which will surely be linear), such as Math.Net.






share|improve this answer












I doubt there are online tutorials because it's something pretty specific.



However, one source of information you can definitely use is open source code. One I know of is SpicePy - it's written in Python, but it's very well documented, although the Python language is very descriptive just by itself. You can use such library in your Python code or though the Telegram Bot.



What you'll need is some sort of way to describe the topology of your circuit. One common approach is the use of netlists, which are essentially text that describe each component in the circuit and how it's connect to the other ones (e.g. through node numbers). You can use this strategy or whatever one seems easier for you to take; parsing it and making it an actual graph (i.e. is it meaningful?) out of it might take you some time.



After that, one common way to analyze circuits in simulators is nodal analysis; then resort to some linear algebra library to solve the system of equations (which will surely be linear), such as Math.Net.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 3 at 15:16









edmz

1212




1212











  • Awesome, thanks a lot.
    – fitzchivalry
    Sep 5 at 1:16
















  • Awesome, thanks a lot.
    – fitzchivalry
    Sep 5 at 1:16















Awesome, thanks a lot.
– fitzchivalry
Sep 5 at 1:16




Awesome, thanks a lot.
– fitzchivalry
Sep 5 at 1:16

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2felectronics.stackexchange.com%2fquestions%2f394068%2fcreate-circuit-simulation%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke