## Pages

### Simulation Speed

SimulIDE aims to be a real-time circuit simulator.

To reach that we need to find the compromise betwen speed and accuracy, so the simulation can run at real time and keep enaught accuracy to simulate the circuit behavior properly.

But this depends on the circuit you are simulating:

- Number of components.
- Number of connections.
- Type of components.

There are 3 types of components that can be very cpu-intensive and slow down simulation:

- Non-Linear: Diodes, Transistors, Op-Amps.
- Reactive: Capacitors, Inductors.

To know how speed-up led simulations have a look to Led Tutorial.

Now lets focus on simulation speed:

Simulation main loop runs at 1 Mhz, 1e6 steps per second, this is the reference speed for everything.

There are 2 main sub-loops for non-linear and reactive components.
These 2 sub-loops run every n main loop steps. By default they run at:

- Reactive: runs once every 50 main loops ( 20 Khz ).
- Non-Linear: runs once every 10 main loops ( 100 Khz).

Note that they always run relative to the main loop.

You can set these 3 parameters:

- Right-Click on any empty part of the circuit.
- Open left panel "Properties" tab.

- Speed:  Speed of main loop in steps per second:

Default Value: 1.000.000
Max Value: 1.000.000
Min Value: 1

If you change this value simulation will run faster or slower.
1.000.000 means real time, 100.000 means "slow motion" 10% of real time.

To understand this exactly:
If you have for exmple an oscillator circuit that produces an 1 Hz square wave:

- At 1.000.000 you will see the output changing every 1 second.
- At 500.000 you will see the output changing every 2 seconds.
- At 100.000 you will see the output changing every 10 seconds.

So changing this value is useful to see simulation running at "slow motion"

- ReactStep: Number of main loop steps to run reactive sub-loop:

Default Value: 50
Max Value: 100
Min Value: 1

The lower this number the more accurate the simulation of reactive components , more cpu it will take so it can slow-down performance.
But all depends in the number of reactive components in the circuit and power of your computer.

You should change this value for low capacitance or inductance values.
For example: for an 50 Khz oscillator using a capacitor you should set this value at least below 10:
run reactive every 10 steps = 100 Khz:

- NoLinStep: Number of main loop steps to run non-linear sub-loop:

Default Value: 10
Max Value: 100
Min Value: 1

Same considerations on ReacStep applies to NoLinStep.

- NoLinAcc: Accuracy of Non-Linear components:

Basicly is the smallest error allowed:
NoLinAcc = 5 means an error of +- 1*10e-5.

The higher this value the more accurate is the simulation, but may slow down simulation.

Default Value: 5
Max Value: 14
Min Value: 3

- Draw Grid: It shows or hides grid.
Hidding grid can improve simulation speed a bit

- Animate: colorize wires showing digital states ( Useful for digital circuits ).

Red for high state.
Blue for low state.

Animating the circuit can slow down simulation speed.