Development of electronic simulator

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello, I am involved in programming. So far I have developed several simulators for physical processes, mainly related to thermodynamic processes. I have a lot of interest in electronics, so I decided to go deep and do a simulator of electronic circuits. :) But I got into a lot of difficulty in math. Are there any electronic engineers here who would like to help me? First I need to understand how the signals are presented mathematically, ie. Fourier transform. I found some textbooks, unfortunately there are only short examples and formulas, and I need a more detailed solution to be able to compile the program algorithm. So if anyone is willing to help, please contact me on a private message. The project is not a open source, at least at this stage.

Regards!
 
Last edited:
There must be close to, if not more than, half a century of very wide development of spice.

Two questions...
1. What do you seek to achieve, and
2. Have you looked for open source developments of spice to start from.

If your goals are ambitious, you are heading into an endless world of modelling and serious maths....
 
Thank you for your answers. It is unlikely to be more than a program for personal use. There will be specific functionalities, such as thermal feedback simulation, also through methods FEM or FDM it will be possible to read the temperature of the radiators at certain points and the temperature inside the crystal of the transistors. And other things like interference and random fluctuations simulation. I do not know if any of the available simulators have such functionality. I've tried the more common ones, but I find each of them uncomfortable in some way.
 
And other things like interference and random fluctuations simulation. I do not know if any of the available simulators have such functionality. I've tried the more common ones, but I find each of them uncomfortable in some way.

Well, all of those things are highly dependent on the geometry of your circuit, the shielding, enclosure and environment! Measuring that, let alone controlling it, seems a little difficult. You can simulate by adding noise sources.

I've used MULTISIM in the past and saw that for some components, it simulates the thermal and failure characteristics of components.
 
Member
Joined 2004
Paid Member
You should start here: The Spice Home Page All the other commercial versions do. They add improvements and tweaks but they are all the same basic engine and the files are largely interchangeable. This will allow you to focus on the thermal extensions etc. Some of the existing packages like LTSPICE have some thermal stuff in them. They may help speed your efforts.
 
Interesting project.
I have written PCB design software and thought about doing a simulator then realised there is plenty of free and paid for stuff already out there.

In electronics there are various theories that would be involved in simulation.
1/ Attributes of compoents whether passive or active.
2/ Network theories such as node analysis and Kirchoff's laws etc.
3/ Applying a signals to these such as sine wave, pulses or white noise etc.

I use free LTSPICE and it is good enough for anything I do.
Have a play with LTSPICE and look into how components are made and modelled.
 
After tons of coding, i get some results. Check links below.
Full development will take months, and difficulty level of this is insane! :whacko:

Schematic editor:
image 39 40 7 — Postimage.org
Thermal viewer:
image 2 T22 26 — Postimage.org
Oscilloscope function:
image 5 T42 79 — Postimage.org

Now I'm working on a spectrum analyzer module and trying to solve integrals (fourier transform). Please help with mathematics - could anyone look at whether the equations I solve are correct?
 
I had a look at this.

What would be good is connecting it to spice/Ltspice with a physical design then simply volume model it. You could model down to tracks etc but it would start eating processing power.
I looked at running a 3D cube in a gpu but currently I have personal stuff taking priority (just had hospital op). My focus was if noise etc could be simulated in a 3D tensor.
 
I search a lot on the internet as well as online courses, but I can't find exactly what I have a problem with - solving integrals. I have Matlab, but I need to learn the basics and step-by-step solution (on paper and pencil) to be able to "extract" solving algorithm out from this.

I like to design everything from scratch and standalone, so connection to other software is unacceptable.
 
Last edited:
I like to design everything from scratch and standalone, so connection to other software is unacceptable.

Thats the opposite of how I see software.
I often rip software from the internet or from examples for my code.
I dont just accept it works, i test it thoroughly.
I ripped an FFT and that didnt work right, loads of noise in it.
So kept finding them until one worked right.
 
I would be in between - mathematically I want to know the limitations etc.

The beauty of matlab/octave is you can concentrate on the maths and your understanding then move to make it a better algorithm.

I take it you’re using fftw or a library?
 
Last edited:
I search a lot on the internet as well as online courses, but I can't find exactly what I have a problem with - solving integrals. I have Matlab, but I need to learn the basics and step-by-step solution (on paper and pencil) to be able to "extract" solving algorithm out from this.

I like to design everything from scratch and standalone, so connection to other software is unacceptable.

Solving integrals or solving FfT integrals?
 
No, I do not use external libraries. Here's an example of what I'm trying to solve:
Fourier Series Examples

I can't make a detailed solution, i miss something when replacing with a negative boundary.

This might give you a clue:



/*
This computes an in-place complex-to-complex FFT
x and y are the real and imaginary arrays of 2^m points.
dir = 1 gives forward transform
dir = -1 gives reverse transform
*/
int FFT(int dir, long m)
{
long n, i, i1, j, k, i2, l, l1, l2;
double c1, c2, tx, ty, t1, t2, u1, u2, z;

/* Calculate the number of points */
n = 1;
for (i = 0; i < m; i++)
n *= 2;

/* Do the bit reversal */
i2 = n >> 1;
j = 0;
for (i = 0; i < n - 1; i++)
{
if (i < j)
{
tx = x;
ty = y;
x = x[j];
y = y[j];
x[j] = tx;
y[j] = ty;
}
k = i2;
while (k <= j)
{
j -= k;
k >>= 1;
}
j += k;
}

/* Compute the FFT */
c1 = -1.0;
c2 = 0.0;
l2 = 1;
for (l = 0; l < m; l++)
{
l1 = l2;
l2 <<= 1;
u1 = 1.0;
u2 = 0.0;
for (j = 0; j < l1; j++)
{
for (i = j; i < n; i += l2)
{
i1 = i + l1;
t1 = u1 * x[i1] - u2 * y[i1];
t2 = u1 * y[i1] + u2 * x[i1];
x[i1] = x - t1;
y[i1] = y - t2;
x += t1;
y += t2;
}
z = u1 * c1 - u2 * c2;
u2 = u1 * c2 + u2 * c1;
u1 = z;
}
c2 = Math.Sqrt((1.0 - c1) / 2.0);
if (dir == 1)
c2 = -c2;
c1 = Math.Sqrt((1.0 + c1) / 2.0);
}

/* Scaling for forward transform */
if (dir == 1)
{
for (i = 0; i < n; i++)
{
x /= n;
y /= n;
}
}

return (1);
}
 
Sorry I’m still trying to pin what particular problem you’re attempting to solve.

That paper is more about how to represent other functions by using a series - a basic starting point I’d suggest this guy: YouTube the same is applicable - he also covers a far wider picture including complex numbers through Taylor series etc.

The link you gave shows harmonics being used to approximate a sawtooth - then something like this will take you to a matlab program you can then record as you like: http://faculty.olin.edu/bstorey/Notes/Fourier.pdf
 
Last edited:
I search a lot on the internet as well as online courses, but I can't find exactly what I have a problem with - solving integrals. I have Matlab, but I need to learn the basics and step-by-step solution (on paper and pencil) to be able to "extract" solving algorithm out from this.

I like to design everything from scratch and standalone, so connection to other software is unacceptable.


Analytical integration is a hard problem, its not possible to analytically integrate all formulae, and the algorithms that do a good job are complicated. Numerical integration is what's used in simulators because its far more tractable and you have the MIPS to do it.


For simple linear passive RLC components the differential equations yield solutions where the auxiliary equation is a rational function, enabling a pole and zero representation. Anything more complicated such as a non-linear inductor would be numerically simulated.


For small signal ac analysis you assume everything is linear, but devices are allowed to have properties that are an arbitrary function of frequency.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.