AnimatLab  2
Test
IntegrateFireModule.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 
11 namespace IntegrateFireSim
12 {
22  {
23  protected:
24  // NervousSystem
26  double m_dTimeStep;
27 
29  bool m_bTTX;
30 
32  bool m_bCd;
33 
35  bool m_bHH;
36 
37  // NervousSystem/Synapses/SpikingSynapses
40 
43 
46 
49 
52 
53  // internal Hebb stuff
56 
59 
61  bool m_bFreezeLearning; // used internally as flag, not saved
62 
64  CStdPtrArray<Neuron> m_aryNeurons;
65 
67  CStdPtrArray<SpikingChemicalSynapse> m_arySpikingChemSyn;
68 
70  CStdPtrArray<NonSpikingChemicalSynapse> m_aryNonSpikingChemSyn;
71 
73  CStdPtrArray<ElectricalSynapse> m_aryElecSyn;
74 
76  CStdPtrArray<Connexion> m_aryConnexion;
77 
78  Neuron *LoadNeuron(CStdXml &oXml);
79  SynapseType *LoadSynapseType(CStdXml &oXml);
80  SpikingChemicalSynapse *LoadSpikingChemSyn(CStdXml &oXml, int iIndex);
81  NonSpikingChemicalSynapse *LoadNonSpikingChemSyn(CStdXml &oXml, int iIndex);
82  ElectricalSynapse *LoadElecSyn(CStdXml &oXml, int iIndex);
83  Connexion *LoadConnexion(CStdXml &oXml);
84  void InitSynapse(Connexion *pCx);
85 
87  // ENGINE
90 
91  virtual void LoadInternal(CStdXml &oXml);
92 
93  public:
95  virtual ~IntegrateFireNeuralModule();
96 
97  void ResetIDs();
98 
99 #pragma region Accessor-Mutators
100 
102  void SetCurrentTime(double t);
103  double GetCurrentTime();
104  double GetTimeStep();
105 
106  // neuron stuff
107  int GetNeuronCount();
108  Neuron *GetNeuronAt(int i);
109 
110  // connexion stuff
111  int GetConnexionCount();
112  Connexion *GetConnexionAt(int i);
113 
114  void Cd(bool bVal);
115  bool Cd();
116 
117  void TTX(bool bVal);
118  bool TTX();
119 
120  void HH(bool bVal);
121  bool HH();
122 
123  virtual void TimeStep(float fltVal);
124  virtual float TimeStep();
125 
126  void RetainHebbMemory(bool bVal);
127  bool RetainHebbMemory();
128 
129  void UseCriticalPeriod(bool bVal);
130  bool UseCriticalPeriod();
131 
132  void StartCriticalPeriod(double dVal);
133  double StartCriticalPeriod();
134 
135  void EndCriticalPeriod(double dVal);
136  double EndCriticalPeriod();
137 
138  void FreezeHebb(bool bVal);
139  bool FreezeHebb();
140 
141  void SpikePeak(double dVal);
142  double SpikePeak();
143 
144  void SpikeStrength(double dVal);
145  double SpikeStrength();
146 
147  void CaEquilPot(double dVal);
148  double CaEquilPot();
149 
150  void AbsoluteRefr(double dVal);
151  double AbsoluteRefr();
152 
153  void AHPEquilPot(double dVal);
154  double AHPEquilPot();
155 
156  // Synapse stuff
157  int GetSpikingChemSynCount();
158  SpikingChemicalSynapse *GetSpikingChemSynAt(int i);
159  int GetNonSpikingChemSynCount();
160  NonSpikingChemicalSynapse *GetNonSpikingChemSynAt(int i);
161  int GetElecSynCount();
162  ElectricalSynapse *GetElecSynAt(int i);
163 
164  //NeuralModule Overrides
165  virtual std::string ModuleName();
166 
167 #pragma endregion
168 
169 
170  // the CALCULATION
171  void PreCalc();
172  void CalcUpdate();
173  void PostCalc();
174  double GetScaleElecCond(double minG,double maxG,double jV, double ThreshV,double SaturateV);
175  void ScaleCondForVoltDep(double& G,double postV,double maxV,double minV,double scl);
176  void ScaleCondForNonSpiking(double& G,double PreV,double ThreshV,double SaturateV);
177 
178 
179 #pragma region DataAccesMethods
180  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
181  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
182  virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError = true, bool bDoNotInit = false);
183  virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError = true);
184 #pragma endregion
185 
186  virtual void AddNeuron(std::string strXml, bool bDoNotInit);
187  virtual void RemoveNeuron(std::string strID, bool bThrowError = true);
188  virtual int FindNeuronListPos(std::string strID, bool bThrowError = true);
189 
190  virtual void AddSynapse(std::string strXml, bool bDoNotInit);
191  virtual void RemoveSynapse(std::string strID, bool bThrowError = true);
192  virtual int FindSynapseListPos(std::string strID, bool bThrowError = true);
193 
194  virtual void AddSynapseType(std::string strXml, bool bDoNotInit);
195  virtual void RemoveSynapseType(std::string strID, bool bThrowError = true);
196  virtual int FindSpikingChemListPos(std::string strID, bool bThrowError = true);
197  virtual int FindNonSpikingChemListPos(std::string strID, bool bThrowError = true);
198  virtual int FindElectricalListPos(std::string strID, bool bThrowError = true);
199 
200  virtual void Kill(bool bState = true);
201 
202  virtual long CalculateSnapshotByteSize() {return 0;};
203  virtual void SaveKeyFrameSnapshot(byte *aryBytes, long &lIndex) {};
204  virtual void LoadKeyFrameSnapshot(byte *aryBytes, long &lIndex) {};
205 
206  virtual void ResetSimulation();
207  virtual void Initialize();
208  virtual void StepSimulation();
209  virtual void TimeStepModified();
210  virtual void Load(CStdXml &oXml);
211  //NeuralModule Overrides
212 
213  };
214 
215 } //IntegrateFireSim
216 
virtual void LoadKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Loads a key frame snapshot.
bool m_bTTX
true if ttx drug is applied to the nervous system.
CStdPtrArray< Connexion > m_aryConnexion
The array of connexions in this neural module.
Integrate and fire neural module.
bool m_bHH
true if this nervous system is using a hodgkin-huxely model.
bool m_bFreezeHebb
true to freeze hebbian learning.
bool m_bRandomisedHebb
true to randomise hebbian learning values.
Integrate and fire neuron model.
virtual long CalculateSnapshotByteSize()
Calculates the snapshot byte size.
bool m_bNeedInitialiseHebb
true if hebbian learning needs to be initialized
bool m_bRetainHebbMemory
true to retain hebbian memory
bool m_bCd
true if cadium is applied to the nervous system.
virtual void SaveKeyFrameSnapshot(byte *aryBytes, long &lIndex)
Saves a key frame snapshot.
double m_dStartCriticalPeriod
The start time of the critical period for hebbian learning.
double m_dEndCriticalPeriod
The end time of the critical period for hebbian learning.
CStdPtrArray< NonSpikingChemicalSynapse > m_aryNonSpikingChemSyn
The array of non-spiking chemical synapses in this neural module.
bool m_bFreezeLearning
true to freeze learning.
CStdPtrArray< Neuron > m_aryNeurons
The array of neurons in this neural module.
CStdPtrArray< ElectricalSynapse > m_aryElecSyn
The array of electrical synapses in this neural module.
CStdPtrArray< SpikingChemicalSynapse > m_arySpikingChemSyn
The array of spiking chem synapses in this neural module.
double m_dCurrentTime
Current time of the simulation.
double m_dTimeStep
The time step of the neural module.
Contains all of the classes to implement a basic integrate and fire neural model. ...
bool m_bUseCriticalPeriod
true to use critical period during hebbian learning.