BrainSignal Simulator is a modular computational framework for simulating dynamical systems, biological neurons, and neural computation models. It unifies continuous-time differential equation systems and discrete neural network computation under a single simulation engine.
The project supports:
- Chaotic dynamical systems (Lorenz system)
- Biophysical neuron models (LIF, Izhikevich)
- Artificial neural networks (ANN)
- Spiking neural networks (SNN extension ready)
- Multiple numerical integration methods (Euler, RK4, Adaptive RK, Leapfrog, Verlet)
The architecture is designed to be extensible for research in computational neuroscience and numerical simulation.
dx/dt = σ (y - x)
dy/dt = x (ρ - z) - y
dz/dt = x y - β z
State vector:
[x, y, z]
Behavior:
- chaotic attractor
- non-linear sensitivity
- continuous time evolution
dV/dt = (-(V - V_rest) + R * I) / τ
Where:
- V: membrane potential
- V_rest: resting potential
- R: resistance
- I: input current
- τ: time constant
Spike condition:
if V >= threshold → reset
State:
[V]
dV/dt = 0.04V² + 5V + 140 - u + I
du/dt = a(bV - u)
State:
[V, u]
Behavior types:
- tonic spiking
- bursting
- chaotic firing
x_{n+1} = x_n + dt * f(x, t)
Used for:
- fast approximation
- neural models (LIF, Izhikevich in low precision mode)
k1 = f(x, t)
k2 = f(x + dt/2 k1, t + dt/2)
k3 = f(x + dt/2 k2, t + dt/2)
k4 = f(x + dt k3, t + dt)
x_{n+1} = x_n + dt/6 (k1 + 2k2 + 2k3 + 2k4)
Used for:
- Lorenz system
- high precision neuron models
Adaptive step control:
error = |x_high - x_low|
If error > tolerance → reduce dt
If error < tolerance → increase dt
Used for:
- stiff systems
- dynamic stability simulation
- Leapfrog Solver (energy-preserving systems)
- Verlet Solver (physics-based integration)
- Improved Euler Solver (Heun method)
SimulationEngine is responsible for:
- time evolution
- state storage
- model execution
- solver dispatching
Execution flow:
- Model initialized
- Solver attached
- Scheduler generates time steps
- At each step:
- ANN → direct forward computation
- ODE → solver integration
- State stored in history
- SimulationResult returned
ANN bypass logic:
- no differential equations
- no solver usage
- direct step update
Input generation:
x = [base, base * 0.9, base * 0.8]
Output:
x(t+1) = ANN.forward(x)
Discrete update rule:
x_{t+1} = W · x_t
Simplified implementation:
x(t+1) = Σ (w_i * x_i)
State:
[x]
ANN bypasses ODE solvers and uses direct forward computation.
BrainSignal Simulator includes a working Spiking Neural Network (SNN) implementation based on Leaky Integrate-and-Fire (LIF) neurons.
The SNN extends the simulator from continuous numerical models to event-based neural computation. Instead of producing only continuous numerical states, the network also produces discrete spike events when a neuron's membrane potential reaches a predefined threshold.
The current implementation consists of multiple LIF neurons that operate simultaneously during the same simulation.
SNN
│
┌───────────────┼───────────────┐
│ │ │
▼ ▼ ▼
LIF Neuron 0 LIF Neuron 1 LIF Neuron 2
│ │ │
▼ ▼ ▼
membrane V membrane V membrane V
│ │ │
└───────────────┼───────────────┘
│
▼
Spike Events
Stores:
- time_points
- states
- model metadata
- solver metadata
- Variable
- Constant
- Binary expressions
- Evaluator
- Context
Used in:
LIF neuron equation evaluation future symbolic models
- feedforward structure
- random weight initialization
- vector input processing
- spike-based computation
- event-driven updates
- raster visualization support