Hello,

I’m trying to inject a current which is dependent on the membrane voltage. I’ve already created a TimedArray of conductance values and multiply this by Vm to get the current. However, during the run both current and voltage quickly become too large or NaN (depending on integration method). I suspect this is due to the current and voltage amplifying each other. Is there a way to update the current based on the voltage one time-step in to the past, or an even better way?

# Minimal code to reproduce the problem

```
from brian2 import *
import matplotlib.pyplot as plt
import numpy as np
start_scope()
#Conductances
g_exc = abs(np.random.normal(size=10000))*mS
g_exc = TimedArray(g_exc, dt=0.2*ms)
#Parameters
area = 20000*umetre**2
E_Na = 55*mV
E_K = -77*mV
E_leak = -65*mV
g_Na = (120*msiemens)
g_K = (35*msiemens)
g_leak = (0.3*msiemens)
C = (1*ufarad)
duration = 2000*ms
#Make the neuron
eqs = '''
alpha_m = (0.182/mV) * (35.*mV + v) / (1 - exp(-(35.*mV + v) / (9.*mV)))/ms : Hz
alpha_h = (0.25) * exp(- (90.*mV + v) / (12.*mV))/ms : Hz
alpha_n = (0.02/mV) * (25.*mV - v) / (1 - exp(-(25.*mV - v) / (9.*mV)))/ms : Hz
beta_m = (-0.124/mV) * (35.*mV + v) / (1 - exp((35.*mV - v) / (9.*mV)))/ms : Hz
beta_h = (0.25) * exp((62.*mV + v) / (6.*mV)) / exp((90.*mV + v) / (12.*mV))/ms : Hz
beta_n = (-0.002/mV) * (25.*mV - v) / (1 - exp((25.*mV - v) / (9.*mV)))/ms : Hz
dm/dt = alpha_m * (1-m) - beta_m * m : 1
dh/dt = alpha_h * (1-h) - beta_h * h : 1
dn/dt = alpha_n * (1-n) - beta_n * n : 1
dv/dt = (g_Na * m**3 * h * (v - E_Na) +
g_K * n**4 * (v - E_K) +
g_leak * (v - E_leak) + I) / C : volt
I = (g_exc(t) * v) : amp
'''
neuron = NeuronGroup(1, model=eqs, method='euler')
neuron.v = -65*mV
neuron.m = 0.05
neuron.h = 0.6
neuron.n = 0.32
M = StateMonitor(neuron, ['v', 'I'], record = True)
run(duration, report='text')
plt.plot(M.t/ms, M.v[0])
#plt.plot(M.t/ms, M.I[0])
plt.show()
```

I’ve also tried changing I (in the equations) to: `dI/dt = (g_exc(t) * v)/ms : amp`

Is there a way to update the current based on the voltage one time-step into the past, or an even better way?

Kind regards,

Mik