izhikevich_model.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * izhikevich_model.h
  3. *
  4. * This file is part of the Izhikevich console application.
  5. *
  6. * Copyright (C) 2016, Author: Guido Trensch
  7. *
  8. * The Izhikevich console application is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * It is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this application. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  23. // = IZHIKEVICH MODEL DEFINITION
  24. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  25. // IZHIKEVICH MODEL CONSTANTS SET UP AS GLOBAL VARIABLES
  26. float IZHIKEVICH_A = 0;
  27. float IZHIKEVICH_B = 0;
  28. float IZHIKEVICH_C = 0;
  29. float IZHIKEVICH_D = 0;
  30. float IZHIKEVICH_THR = 0;
  31. #define TRUE 1
  32. #define FALSE 0
  33. // ODE 1
  34. float dvdt( float v // IN
  35. , float u // IN
  36. , void* pI ) // IN external current (optional for the ODE solver)
  37. {
  38. if( pI == NULL ) {
  39. printf( "ERROR: external current expected\n" );
  40. exit( -1 );
  41. }
  42. // SpiNNaker FP error simulation
  43. // return( 0.03997802 * v * v + 5.0 * v + 140.0 - u + *(float*)pI );
  44. return( 0.04 * v * v + 5.0 * v + 140.0 - u + *(float*)pI );
  45. }
  46. // ODE 2
  47. float dudt( float v // IN
  48. , float u ) // IN
  49. {
  50. return( IZHIKEVICH_A * ( IZHIKEVICH_B * v - u ));
  51. }
  52. // Threshold
  53. int threshold( float* v // IN / OUT
  54. , float* u ) // IN / OUT
  55. {
  56. if( *v >= IZHIKEVICH_THR ) {
  57. *v = IZHIKEVICH_C;
  58. *u += IZHIKEVICH_D;
  59. return( TRUE );
  60. }
  61. else {
  62. return( FALSE );
  63. }
  64. }
  65. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  66. // = IZHIKEVICH MODEL PARAMETERS
  67. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  68. // parameter set for regular spiking
  69. #define RS_A (float)(0.02)
  70. #define RS_B (float)(0.2)
  71. #define RS_C (float)(-65.0)
  72. #define RS_D (float)(8.0)
  73. #define RS_THR (float)(30.0)
  74. #define RS_I_EXT (float)(5.0)
  75. #define RS_V_INIT (float)(-75.0)
  76. #define RS_U_INIT (float)(0.0)
  77. #define RS_TYPENAME "IZHIKEVICH RS NEURON TYPE"
  78. // parameter set for intrinsically bursting
  79. #define IB_A (float)(0.02)
  80. #define IB_B (float)(0.2)
  81. #define IB_C (float)(-55.0)
  82. #define IB_D (float)(4.0)
  83. #define IB_THR (float)(30.0)
  84. #define IB_I_EXT (float)(5.0)
  85. #define IB_V_INIT (float)(-75.0)
  86. #define IB_U_INIT (float)(0.0)
  87. #define IB_TYPENAME "IZHIKEVICH IB NEURON TYPE"
  88. // parameter set for chattering
  89. #define CH_A (float)(0.02)
  90. #define CH_B (float)(0.2)
  91. #define CH_C (float)(-50.0)
  92. #define CH_D (float)(2.0)
  93. #define CH_THR (float)(30.0)
  94. #define CH_I_EXT (float)(5.0)
  95. #define CH_V_INIT (float)(-75.0)
  96. #define CH_U_INIT (float)(0.0)
  97. #define CH_TYPENAME "IZHIKEVICH CH NEURON TYPE"
  98. // parameter set for fast spiking
  99. #define FS_A (float)(0.1)
  100. #define FS_B (float)(0.2)
  101. #define FS_C (float)(-65.0)
  102. #define FS_D (float)(2.0)
  103. #define FS_THR (float)(30.0)
  104. #define FS_I_EXT (float)(5.0)
  105. #define FS_V_INIT (float)(-75.0)
  106. #define FS_U_INIT (float)(0.0)
  107. #define FS_TYPENAME "IZHIKEVICH FS NEURON TYPE"
  108. // parameter set for thalamo cortical
  109. #define TC_A (float)(0.02)
  110. #define TC_B (float)(0.25)
  111. #define TC_C (float)(-65.0)
  112. #define TC_D (float)(0.05)
  113. #define TC_THR (float)(30.0)
  114. #define TC_I_EXT (float)(5.0)
  115. #define TC_V_INIT (float)(-75.0)
  116. #define TC_U_INIT (float)(0.0)
  117. #define TC_TYPENAME "IZHIKEVICH TC NEURON TYPE"
  118. // parameter set for resonator
  119. // requires extra current step at e.g. 150 ms
  120. #define RZ_A (float)(0.1)
  121. #define RZ_B (float)(0.25)
  122. #define RZ_C (float)(-65.0)
  123. #define RZ_D (float)(2.0)
  124. #define RZ_THR (float)(30.0)
  125. #define RZ_I_EXT (float)(0.7)
  126. #define RZ_V_INIT (float)(-75.0)
  127. #define RZ_U_INIT (float)(0.0)
  128. #define RZ_TYPENAME "IZHIKEVICH RZ NEURON TYPE"
  129. // parameter set for low-threshold spiking
  130. #define LTS_A (float)(0.02)
  131. #define LTS_B (float)(0.25)
  132. #define LTS_C (float)(-65.0)
  133. #define LTS_D (float)(2.0)
  134. #define LTS_THR (float)(30.0)
  135. #define LTS_I_EXT (float)(5.0)
  136. #define LTS_V_INIT (float)(-75.0)
  137. #define LTS_U_INIT (float)(0.0)
  138. #define LTS_TYPENAME "IZHIKEVICH LTS NEURON TYPE"