AnimatLab  2
Test
BistableNeuron.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 
9 #include "Synapse.h"
10 #include "Neuron.h"
11 #include "BistableNeuron.h"
12 #include "FiringRateModule.h"
13 
14 namespace FiringRateSim
15 {
16  namespace Neurons
17  {
18 
26 {
28  m_fltVsth = 0.010f;
30  m_fltIl=0;
31  m_fltIh = 0;
32 }
33 
41 {
42 
43 try
44 {
45 }
46 catch(...)
47 {Std_TraceMsg(0, "Caught Error in desctructor of BistableNeuron\r\n", "", -1, false, true);}
48 }
49 
59 {return m_fltIntrinsic;}
60 
70 {
71  m_fltIntrinsic=fltVal;
72 }
73 
83 {return m_fltIl;}
84 
93 void BistableNeuron::Il(float fltVal)
94 {
95  m_fltIl=fltVal;
96 }
97 
107 {return m_fltIh;}
108 
117 void BistableNeuron::Ih(float fltVal)
118 {
119  m_fltIh=fltVal;
120 }
121 
131 {return m_fltVsthi;}
132 
141 void BistableNeuron::Vsthi(float fltVal)
142 {
143  m_fltVsthi=fltVal;
144 }
145 
155 {return BISTABLE_NEURON;}
156 
157 void BistableNeuron::Copy(CStdSerialize *lpSource)
158 {
159  Neuron::Copy(lpSource);
160 
161  BistableNeuron *lpOrig = dynamic_cast<BistableNeuron *>(lpSource);
162 
163  m_fltIntrinsic = lpOrig->m_fltIntrinsic;
164  m_fltVsthi = lpOrig->m_fltVsthi;
165  m_fltVsth = lpOrig->m_fltVsth;
166  m_fltIl = lpOrig->m_fltIl;
167  m_fltIh = lpOrig->m_fltIh;
168 }
169 
170 float BistableNeuron::CalculateIntrinsicCurrent(FiringRateModule *lpModule, float fltInputCurrent)
171 {
172  if(m_fltVn>=m_fltVsth)
174  else
176 
177  return m_fltIntrinsic;
178 }
179 
181 {
183 
184  m_fltIntrinsic=0;
186 }
187 
189 {
191 
192  //modify the switch threshold to move the same as the regular threshold using accomodation.
194 }
195 
196 #pragma region DataAccesMethods
197 
198 bool BistableNeuron::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
199 {
200  std::string strType = Std_CheckString(strDataType);
201 
202  if(Neuron::SetData(strDataType, strValue, false))
203  return true;
204 
205  if(strType == "VSTH")
206  {
207  Vsthi(atof(strValue.c_str()));
208  return true;
209  }
210 
211  if(strType == "IL")
212  {
213  Il(atof(strValue.c_str()));
214  return true;
215  }
216 
217  if(strType == "IH")
218  {
219  Ih(atof(strValue.c_str()));
220  return true;
221  }
222 
223  //If it was not one of those above then we have a problem.
224  if(bThrowError)
225  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
226 
227  return false;
228 }
229 
230 void BistableNeuron::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
231 {
232  Neuron::QueryProperties(aryProperties);
233 
234  aryProperties.Add(new TypeProperty("Vsth", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
235  aryProperties.Add(new TypeProperty("Il", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
236  aryProperties.Add(new TypeProperty("Ih", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
237 }
238 
239 #pragma endregion
240 
241 void BistableNeuron::Load(CStdXml &oXml)
242 {
243  Neuron::Load(oXml);
244 
245  oXml.IntoElem(); //Into Neuron Element
246 
247  Vsthi(oXml.GetChildFloat("Vsth"));
248  Il(oXml.GetChildFloat("Il"));
249  Ih(oXml.GetChildFloat("Ih"));
250 
251  oXml.OutOfElem(); //OutOf Neuron Element
252 }
253 
254  } //Neurons
255 } //FiringRateSim
256 
float m_fltVsthi
The initial switch threshold voltage.
Firing rate neural module.
float m_fltIntrinsic
The active intrinsic current.
Bistable firing rate neuron.
Declares the bistable neuron class.
virtual float CalculateIntrinsicCurrent(FiringRateModule *lpModule, float fltInputCurrent)
Calculates the intrinsic current.
virtual void StepSimulation()
Step the simulation for this object.
virtual unsigned char NeuronType()
Gets the neuron type.
virtual void ResetSimulation()
Resets the simulation back to time 0.
float m_fltVthadd
The component added to Vthi for accomodation.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
virtual void StepSimulation()
Step the simulation for this object.
float IntrinsicCurrent()
Gets the intrinsic current.
float Ih()
Gets the high current.
float m_fltVn
Current membrane voltage.
float Vsthi()
Gets the threshold voltage.
Declares the synapse class.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares the firing rate module class.
float Il()
Gets the low current.
Contains the classes for a firing rate neural model.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
float m_fltVsth
The siwtch threshold voltage.