AnimatLab  2
Test
TonicNeuron.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 
9 #include "Synapse.h"
10 #include "Neuron.h"
11 #include "TonicNeuron.h"
12 #include "FiringRateModule.h"
13 
14 namespace FiringRateSim
15 {
16  namespace Neurons
17  {
18 
26 {
27  m_fltIh=0;
28 }
29 
37 {
38 
39 }
40 
50 {return m_fltIh;}
51 
60 void TonicNeuron::Ih(float fltVal)
61 {
62  m_fltIh=fltVal;
63 }
64 
73 unsigned char TonicNeuron::NeuronType()
74 {return TONIC_NEURON;}
75 
76 void TonicNeuron::Copy(CStdSerialize *lpSource)
77 {
78  Neuron::Copy(lpSource);
79 
80  TonicNeuron *lpOrig = dynamic_cast<TonicNeuron *>(lpSource);
81 
82  m_fltIh = lpOrig->m_fltIh;
83 }
84 
85 float TonicNeuron::CalculateIntrinsicCurrent(FiringRateModule *lpModule, float fltInputCurrent)
86 {return m_fltIh;}
87 
88 #pragma region DataAccesMethods
89 
90 bool TonicNeuron::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
91 {
92  std::string strType = Std_CheckString(strDataType);
93 
94  if(Neuron::SetData(strDataType, strValue, false))
95  return true;
96 
97  if(strType == "IH")
98  {
99  Ih(atof(strValue.c_str()));
100  return true;
101  }
102 
103  //If it was not one of those above then we have a problem.
104  if(bThrowError)
105  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
106 
107  return false;
108 }
109 
110 void TonicNeuron::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
111 {
112  Neuron::QueryProperties(aryProperties);
113 
114  aryProperties.Add(new TypeProperty("Ih", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
115 }
116 
117 #pragma endregion
118 
119 void TonicNeuron::Load(CStdXml &oXml)
120 {
121  Neuron::Load(oXml);
122 
123  oXml.IntoElem(); //Into Neuron Element
124 
125  Ih(oXml.GetChildFloat("Ih"));
126 
127  oXml.OutOfElem(); //OutOf Neuron Element
128 }
129 
130  } //Neurons
131 } //FiringRateSim
132 
TonicNeuron()
Default constructor.
Definition: TonicNeuron.cpp:25
Firing rate neural module.
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.
Definition: TonicNeuron.cpp:90
Declares the synapse class.
Declares the firing rate module class.
Declares the tonic neuron class.
virtual ~TonicNeuron()
Destructor.
Definition: TonicNeuron.cpp:36
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.
virtual float CalculateIntrinsicCurrent(FiringRateModule *lpModule, float fltInputCurrent)
Calculates the intrinsic current.
Definition: TonicNeuron.cpp:85
Tonic firing rate neuron.
Definition: TonicNeuron.h:21
float m_fltIh
The tonic current.
Definition: TonicNeuron.h:25
virtual unsigned char NeuronType()
Gets the neuron type.
Definition: TonicNeuron.cpp:73
float Ih()
Gets the tonic current.
Definition: TonicNeuron.cpp:49