aboutsummaryrefslogtreecommitdiffstats
path: root/examples/hodgkin_huxley/model.modelica
blob: 7e44547f55a061b8bfe3fbd2700a043b24c71dc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
model HodgkinHuxley
    "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    "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_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;