aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hodgkin_huxley/model.modelica
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-16 15:45:26 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-16 15:45:26 -0800
commitc08fefa5e30e680e348acf7817201193b1a9634f (patch)
tree62c2a706547c7b01b59cc3aef8b8210cadbd63ad /examples/hodgkin_huxley/model.modelica
parent90d533e03132bab1032adde78fae3c10903d05cc (diff)
downloadmodelthing-c08fefa5e30e680e348acf7817201193b1a9634f.tar.gz
modelthing-c08fefa5e30e680e348acf7817201193b1a9634f.zip
clean up hodgkin-huxley
Diffstat (limited to 'examples/hodgkin_huxley/model.modelica')
-rw-r--r--examples/hodgkin_huxley/model.modelica46
1 files changed, 27 insertions, 19 deletions
diff --git a/examples/hodgkin_huxley/model.modelica b/examples/hodgkin_huxley/model.modelica
index 782cb20..7e44547 100644
--- a/examples/hodgkin_huxley/model.modelica
+++ b/examples/hodgkin_huxley/model.modelica
@@ -1,24 +1,32 @@
model HodgkinHuxley
- "Predator-Prey Model"
- parameter Real G_Na =120 "conductance";
- parameter Real G_K =36 "conductance";
- parameter Real G_lk =0.3 "conductance";
- parameter Real C =1.0 "membrane capacitance";
+ "Model of action potential in squid neurons (1952)"
+ parameter Real C_m =1.0 "membrane capacitance";
+ parameter Real g_Na =120 "conductance";
+ parameter Real g_K =36 "conductance";
+ parameter Real g_L =0.3 "conductance";
parameter Real V_Na =115 "potential";
parameter Real V_K =-12 "potential";
- parameter Real V_lk =-49.387 "leakage";
- Real n;
- Real alpha_n;
- Real beta_n;
- Real m;
- Real alpha_m;
- Real beta_m;
- Real h;
- Real alpha_h;
- Real beta_h;
+ parameter Real V_lk =-49.387 "leak reveral potential";
+ parameter Real E_Na =-190 "equilibrium potential";
+ parameter Real E_K =-63 "equilibrium potential";
+ parameter Real E_lk =-85.613 "equilibrium potential";
+ parameter Real n =0.31768 "dimensionless; 0 to 1";
+ parameter Real m =0.05293 "dimensionless; 0 to 1";
+ parameter Real h =0.59612 "dimensionless; 0 to 1";
+ Real V_m "membrane voltage potential";
+ Real I =1.0 "membrane current";
+ Real alpha_n, alpha_m, alpha_h "rate constants";
+ Real beta_n, beta_m, beta_h "rate constants";
equation
- C * der(V_m) = - G_Na * (Vm - E_Na) - G_K * (V_m - E_K) - G_lk * (V_m - V_lk);
- der(n) = - (alpha_n + beta_n) * n + alpha_n;
- der(m) = - (alpha_m + beta_m) * m + alpha_m;
- der(h) = - (alpha_h + beta_h) * h + alpha_h;
+ C_m * der(V_m) = I - g_Na * m^3 * h * (V_m - E_Na) - g_K * n^4 * (V_m - E_K) - G_lk * (V_m - E_lk);
+ der(n) = alpha_n - n * (alpha_n + beta_n);
+ der(m) = alpha_m - m * (alpha_m + beta_m);
+ der(h) = alpha_h - h * (alpha_h + beta_h);
+
+ alpha_n = 0.01 * (V_m + 10) / (e^((V_m + 10)/10) - 1);
+ alpha_m = 0.1 * (V_m + 25) / (e^((V_m + 25)/10) - 1);
+ alpha_h = 0.07 * e^(V_m / 20);
+ beta_n = 0.125 * e^(V_m / 80);
+ beta_m = 4*e^(V_m/18);
+ beta_h = 1 / (e^((V_m + 30)/10) + 1);
end HodgkinHuxley;