title: Tutorial 104: Running Simulations¶
Tutorial 104: Running Simulations¶
Overview¶
Master the simulation settings in GeckoCIRCUITS. Learn about solver options, time step configuration, convergence issues, and how to optimize simulations for accuracy and speed.
Level: Beginner/Intermediate (⅔)
Duration: 25-30 minutes
Series: Getting Started
Learning Objectives¶
By the end of this tutorial, you will: - [ ] Configure simulation time and time step - [ ] Understand different solver algorithms - [ ] Diagnose and fix convergence problems - [ ] Optimize simulations for speed vs. accuracy - [ ] Use the oscilloscope (SCOPE) effectively - [ ] Export simulation data
Prerequisites¶
- Complete Tutorial 101-103
- Basic understanding of differential equations (helpful but not required)
Simulation Settings Overview¶
Access settings via Simulation > Settings or press F9.
Main Parameters¶
| Parameter | Description | Typical Values |
|---|---|---|
| Simulation Time (Tend) | Total duration to simulate | 1ms - 1s |
| Time Step (dt) | Integration step size | 0.1μs - 10μs |
| Output Interval | Data storage frequency | 1-100 points/period |
| Solver | Numerical integration method | TRZ, BE, GS |
Time Step Configuration¶
Automatic vs. Fixed Time Step¶
Automatic (Recommended for beginners): - GeckoCIRCUITS adjusts dt based on circuit dynamics - Smaller dt during fast transients, larger during steady-state - Good balance of speed and accuracy
Fixed Time Step: - You specify exact dt value - Useful for: deterministic timing, FFT analysis, comparison studies - Risk: too large → inaccuracy, too small → slow simulation
Choosing Time Step¶
Rule of thumb:
Example: fs = 100 kHz → Ts = 10 μs → dt < 100 ns
| Circuit Type | Recommended dt |
|---|---|
| 50/60 Hz AC circuits | 10-100 μs |
| 10 kHz switching | 100 ns - 1 μs |
| 100 kHz switching | 10-100 ns |
| 1 MHz switching | 1-10 ns |
Time Step Too Large¶
Symptoms: - Waveforms look choppy/aliased - Incorrect average values - Missing fast transients - Simulation completes but results are wrong
Time Step Too Small¶
Symptoms: - Simulation runs very slowly - Excessive data storage - No improvement in accuracy (diminishing returns)
Solver Selection¶
GeckoCIRCUITS offers multiple numerical solvers:
Trapezoidal (TRZ) - Default¶
- Accuracy: Second-order, no numerical damping
- Stability: A-stable for linear circuits
- Best for: Most power electronics circuits
- Issue: May show ringing on discontinuities
Backward Euler (BE)¶
- Accuracy: First-order, introduces numerical damping
- Stability: Very stable, L-stable
- Best for: Stiff circuits, initial debugging
- Issue: Over-damps high-frequency oscillations
Gear-Shichman (GS)¶
- Accuracy: Higher-order, multi-step method
- Best for: Circuits with multiple time scales
- Issue: More complex, may have startup transients
Solver Comparison¶
| Characteristic | TRZ | BE | GS |
|---|---|---|---|
| Accuracy | High | Medium | High |
| Damping | None | High | Low |
| Stability | Good | Excellent | Good |
| Speed | Fast | Fast | Medium |
| Memory | Low | Low | Higher |
Simulation Workflow¶
Step 1: Initial Setup¶
- Set simulation time: 5-10 fundamental periods
- Start with automatic time step
- Use TRZ solver
- Run simulation
Step 2: Check Results¶
- View waveforms in SCOPE
- Verify expected behavior
- Look for: oscillations, convergence issues, unrealistic values
Step 3: Refine Settings¶
If results look wrong: - Try smaller time step - Switch to BE solver temporarily - Check circuit for errors
If simulation is too slow: - Increase time step (if accuracy allows) - Reduce simulation time - Simplify circuit model
Oscilloscope (SCOPE) Usage¶
Adding Signals¶
- Connect circuit nodes to SCOPE inputs
- Use current probes for current measurement
- Multiple channels available (different colors)
Measurement Tools¶
| Tool | Function | Access |
|---|---|---|
| Cursors | Measure values at specific times | Click + drag on waveform |
| Auto-scale | Fit all signals in view | Toolbar button |
| Zoom | Magnify time/amplitude | Scroll wheel, toolbar |
| Pan | Move view | Middle-click + drag |
| FFT | Frequency spectrum | View > FFT |
SCOPE Settings¶
- Double-click SCOPE component
- Configure:
- Channels: Enable/disable, colors
- Scale: Manual or auto
- Trigger: Level, edge, mode
- Time base: Samples per division
Data Export¶
Exporting Waveforms¶
- File > Export Data after simulation
- Choose format:
- CSV: For Excel, MATLAB, Python
- Text: Tab-separated values
- Select signals to export
Export Format¶
Time,Channel1,Channel2,Channel3
0.0000,0.00,10.00,0.00
0.0001,5.23,10.00,0.52
0.0002,9.87,10.00,0.99
...
Using Exported Data¶
MATLAB:
Python:
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('simulation_data.csv')
plt.plot(data['Time'], data['Channel1'])
plt.show()
Troubleshooting¶
Simulation Won't Start¶
| Cause | Solution |
|---|---|
| Floating node | Add ground reference |
| Voltage source loop | Add small resistance |
| Current source open | Add parallel resistance |
| Invalid parameters | Check component values |
Simulation Diverges¶
| Cause | Solution |
|---|---|
| Time step too large | Reduce dt |
| Stiff circuit | Use BE solver |
| Unrealistic parameters | Check component values |
| Algebraic loop | Restructure circuit |
Slow Simulation¶
| Cause | Solution |
|---|---|
| Time step too small | Increase dt |
| Long simulation time | Reduce Tend |
| Complex circuit | Simplify model |
| Many SCOPE points | Reduce output interval |
Oscillations in Results¶
| Type | Cause | Solution |
|---|---|---|
| Physical | LC resonance | Expected behavior |
| Numerical | TRZ ringing | Use BE solver or smaller dt |
| Control | Unstable feedback | Check controller gains |
Advanced Settings¶
Initial Conditions¶
For faster convergence: 1. Set initial capacitor voltages 2. Set initial inductor currents 3. Avoids long startup transients
Steady-State Detection¶
GeckoCIRCUITS can detect when circuit reaches steady state: 1. Enable in Simulation > Settings 2. Simulation stops when periodic steady state achieved 3. Useful for efficiency calculations
Parametric Sweeps¶
Run multiple simulations with varying parameters: 1. Use GeckoSCRIPT or MATLAB integration 2. Sweep: duty cycle, load, frequency 3. Automatically collect results
Checkpoint¶
At this point, you should be able to: - [ ] Configure simulation time and time step appropriately - [ ] Choose the right solver for your circuit - [ ] Diagnose and fix common simulation issues - [ ] Use SCOPE measurement tools effectively - [ ] Export data for external analysis
Exercises¶
Exercise 1: Time Step Sensitivity¶
- Open a buck converter circuit
- Run with dt = 1 μs, record output voltage
- Run with dt = 100 ns, record output voltage
- Run with dt = 10 ns, record output voltage
- Compare: At what dt does accuracy stabilize?
Exercise 2: Solver Comparison¶
- Create an LC circuit (L=1mH, C=1μF)
- Run with TRZ solver, observe ringing
- Run with BE solver, observe damping
- Question: Which is more physically accurate?
Exercise 3: Data Export¶
- Run any simulation
- Export data as CSV
- Plot in Excel/MATLAB/Python
- Calculate: average, RMS, ripple
Exercise 4: Convergence Debugging¶
- Create a circuit that diverges (e.g., very large L, very small C)
- Try to fix it using:
- Smaller time step
- BE solver
- Adding damping resistor
- Document: What worked?
Summary¶
In this tutorial, you learned: 1. How simulation time and time step affect results 2. Different solver algorithms and when to use them 3. Troubleshooting common simulation problems 4. Using SCOPE for measurements 5. Exporting data for external analysis
Quick Reference¶
| Setting | Rule of Thumb |
|---|---|
| Simulation time | 5-10 × longest time constant |
| Time step | < Switching period / 100 |
| Solver | TRZ default, BE for stiff circuits |
| Output points | 100-1000 points per period |
Next Steps¶
You've completed the Getting Started series! Continue with: - DC-DC Converters: 2xx Series - Rectifiers: 3xx Series - Examples: Basic Topologies
Tutorial Version: 1.0 Last updated: 2026-02 Compatible with GeckoCIRCUITS v1.0+