# Dynamic current leads to runaway values

**URL:** <https://brian.discourse.group/t/dynamic-current-leads-to-runaway-values/267>\
**Category:** Support\
**Created:** [27 January 2021 15:19 UTC](https://brian.discourse.group/t/dynamic-current-leads-to-runaway-values/267 "2021-01-27T15:19:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [28 January 2021 09:41 UTC](https://brian.discourse.group/t/dynamic-current-leads-to-runaway-values/267/2 "2021-01-28T09:41:28Z")

</div>

Hi. The problem is not due to the current, if you remove the current you see the same behaviour. The current as such is correct if you want to model an excitatory conductance. That it depends on the voltage isn’t a problem, that’s the case of all currents (in your model, the Na, K, and leak currents depend on the voltage as well). The confusing thing is maybe that you multiply the conductance directly by `v`, but this should be read as multiplying it by `(v - E_exc)` where `E_exc = 0*mV`. Having said all that, the real problem is that your currents have the wrong sign. You’ll have to add a minus in front of `g_Na`, `g_K`, `g_leak`, and `I`, or use e.g. `(E_Na - v)` instead of `(v - E_Na)`.

Also note that the `euler` method is not adapted to these kind of equations, at least unless you use very short time steps. We generally recommend using `exponential_euler` and probably also a smaller time step, e.g. with `defaultclock.dt = 0.01*ms`. Also, have a look at [this discussion](https://brian.discourse.group/t/zerodivisionerror-when-changing-synaptic-weights-of-large-network-with-hh-neurons/232) why it would be better to reformulate some of your `alpha_...`/`beta_...` equations with the `exprel` function.

Finally, I think your model uses the parameters of Hodgkin & Huxley’s 🦑 axon, make sure this is appropriate for what you are trying to model 😀 .

---

_[View the full topic](https://brian.discourse.group/t/dynamic-current-leads-to-runaway-values/267)._
