globals.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef __GLOBALS_H__
  2. #define __GLOBALS_H__
  3. /*
  4. * globals.h
  5. *
  6. * This file is part of the refactored Izhikevich polychronization model application.
  7. *
  8. * Copyright (C) 2018, Author: G. Trensch
  9. *
  10. * The refactored Izhikevich polychronization model application is free software:
  11. * you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * It is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this application. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. #include "params.h"
  26. #if( __RUN_REFACTORED_VERSION__ )
  27. #ifdef __IMPORT_GLOBAL_VARIABLES__
  28. #define EXTERN extern
  29. #else
  30. #define EXTERN
  31. #endif
  32. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  33. // = N E T W O R K P A R A M E T E R S
  34. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  35. #define NUM_EXCITATORY_NEURONS (int)(800)
  36. #define NUM_INHIBITORY_NEURONS (int)(200)
  37. #define NUM_SYNAPSES_PER_NEURON (int)(100)
  38. #define MAX_SYNAPSE_DELAY (int)(20)
  39. #define MAX_SYNAPTIC_STRENGTH (double)(10.0)
  40. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  41. // = M A C R O D E F I N I T I O N S
  42. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  43. #define GET_RANDOM_INT(max) (int(floor(max * ( 0.9999999 * double(rand()) / RAND_MAX))))
  44. #define NUM_TOTAL_NEURONS (int)(NUM_EXCITATORY_NEURONS + NUM_INHIBITORY_NEURONS)
  45. #define MAX_NUM_FIRINGS (int)(100 * NUM_TOTAL_NEURONS)
  46. #define INIT_EXC_SYNAPTIC_WEIGHT (double)(6.0)
  47. #define INIT_INH_SYNAPTIC_WEIGHT (double)(-5.0)
  48. #define RS_A (double)(0.02)
  49. #define RS_D (double)(8.0)
  50. #define RS_V_INIT (double)(-65.0)
  51. #define RS_U_INIT (double)(0.2 * RS_V_INIT)
  52. #define FS_A (double)(0.1)
  53. #define FS_D (double)(2.0)
  54. #define FS_V_INIT (double)(-65.0)
  55. #define FS_U_INIT (double)(0.2 * FS_V_INIT)
  56. #define RS_FS_B (double)(0.2)
  57. #define RS_FS_C (double)(-65.0)
  58. #define RS_FS_THR (double)(30.0)
  59. #define I_EXT (double)(20.0)
  60. #define RC_NOID (int)(-1)
  61. #define RC_ERROR_EXIT (int)(-2)
  62. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  63. // = G L O B A L D A T A S T R U C T U R E S
  64. // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  65. EXTERN int matrixOfPostSynapticNeurons [ NUM_TOTAL_NEURONS ][ NUM_SYNAPSES_PER_NEURON ];
  66. EXTERN double matrixOfSynapticWeights [ NUM_TOTAL_NEURONS ][ NUM_SYNAPSES_PER_NEURON ];
  67. EXTERN double matrixOfSynapticWeights_derivatives[ NUM_TOTAL_NEURONS ][ NUM_SYNAPSES_PER_NEURON ];
  68. EXTERN short numEntriesPerDelay[NUM_TOTAL_NEURONS][MAX_SYNAPSE_DELAY];
  69. EXTERN short listOfSynsByNeuronAndDelay[NUM_TOTAL_NEURONS][MAX_SYNAPSE_DELAY][NUM_SYNAPSES_PER_NEURON];
  70. EXTERN int numPreSynapticNeuronsOfTarget[ NUM_TOTAL_NEURONS ];
  71. // REFACTOR COMMENT: assumption that it fits
  72. EXTERN int listOfPresynapticNeurons[ NUM_TOTAL_NEURONS ][ 3 * NUM_SYNAPSES_PER_NEURON ];
  73. EXTERN int listOfPresynapticDelays [ NUM_TOTAL_NEURONS ][ 3 * NUM_SYNAPSES_PER_NEURON ];
  74. // REFACTOR COMMENT: dead code removed
  75. // double* listOfPointersToSynapticWeights [NUM_TOTAL_NEURONS][3 * NUM_SYNAPSES_PER_NEURON];
  76. EXTERN double* listOfPointersToSynapticWeights_derivatives[NUM_TOTAL_NEURONS][3 * NUM_SYNAPSES_PER_NEURON];
  77. EXTERN double LTP[NUM_TOTAL_NEURONS][1001 + MAX_SYNAPSE_DELAY];
  78. EXTERN double LTD[NUM_TOTAL_NEURONS];
  79. EXTERN int numFirings;
  80. EXTERN int firings[MAX_NUM_FIRINGS][2];
  81. #define TIME (int)(0)
  82. #define NEURON (int)(1)
  83. EXTERN double I_ext[NUM_TOTAL_NEURONS];
  84. EXTERN double a[NUM_TOTAL_NEURONS]; // neuronal dynamics parameters
  85. EXTERN double d[NUM_TOTAL_NEURONS];
  86. EXTERN double v[NUM_TOTAL_NEURONS]; // activity variables
  87. EXTERN double u[NUM_TOTAL_NEURONS];
  88. #if( ODE_SOLVER_REFINEMENT )
  89. EXTERN int spike[NUM_TOTAL_NEURONS]; // spike count in an interval (precise threshold detection)
  90. #endif
  91. #if( LOG_MIN_MAX_V_U )
  92. EXTERN double v_max;
  93. EXTERN double v_min;
  94. EXTERN double u_max;
  95. EXTERN double u_min;
  96. #endif
  97. EXTERN FILE* pFileStimulusOutput;
  98. EXTERN FILE* pFileStimulusInput;
  99. #endif // __RUN_REFACTORED_VERSION__
  100. #endif // __GLOBALS_H__