AnimatLab  2
Test
CaActivation.cpp
Go to the documentation of this file.
1 
7 #include "stdafx.h"
8 #include "IonChannel.h"
9 #include "SynapseType.h"
10 #include "IntegrateFireModule.h"
11 #include "Connexion.h"
12 #include "CaActivation.h"
13 #include "Neuron.h"
14 #include "ElectricalSynapse.h"
16 #include "SpikingChemicalSynapse.h"
17 
19 {
20 
21 CaActivation::CaActivation(Neuron *lpParent, std::string strActivationType)
22 {
23  if(!lpParent)
24  THROW_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined);
25 
26  m_lpParent = lpParent;
27  m_strActivationType = Std_ToUpper(Std_Trim(strActivationType));
28 }
29 
37 {
38 }
39 
40 bool CaActivation::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
41 {
42  std::string strType = Std_CheckString(strDataType);
43 
44  if(AnimatBase::SetData(strDataType, strValue, false))
45  return true;
46 
47  if(strType == "MIDPOINT")
48  {
49  if(m_strActivationType == "ACTIVE")
50  m_lpParent->BurstVm(atof(strValue.c_str()));
51  else
52  m_lpParent->BurstVh(atof(strValue.c_str()));
53  return true;
54  }
55 
56  if(strType == "SLOPE")
57  {
58  if(m_strActivationType == "ACTIVE")
59  m_lpParent->BurstSm(atof(strValue.c_str()));
60  else
61  m_lpParent->BurstSh(atof(strValue.c_str()));
62  return true;
63  }
64 
65  if(strType == "TIMECONSTANT")
66  {
67  if(m_strActivationType == "ACTIVE")
68  m_lpParent->BurstMTimeConstant(atof(strValue.c_str()));
69  else
70  m_lpParent->BurstHTimeConstant(atof(strValue.c_str()));
71  return true;
72  }
73 
74  //If it was not one of those above then we have a problem.
75  if(bThrowError)
76  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
77 
78  return false;
79 }
80 
81 void CaActivation::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
82 {
83  AnimatBase::QueryProperties(aryProperties);
84 
85  aryProperties.Add(new TypeProperty("Midpoint", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
86  aryProperties.Add(new TypeProperty("Slope", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
87  aryProperties.Add(new TypeProperty("TimeConstant", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
88 }
89 
90 void CaActivation::Load(CStdXml &oXml)
91 {
92  AnimatBase::Load(oXml);
93 
94  oXml.IntoElem();
95 
96  float fltVal = oXml.GetChildFloat("MidPoint");
97  if(m_strActivationType == "ACTIVE")
98  m_lpParent->BurstVm(fltVal);
99  else
100  m_lpParent->BurstVh(fltVal);
101 
102  fltVal = oXml.GetChildFloat("Slope");
103  if(m_strActivationType == "ACTIVE")
104  m_lpParent->BurstSm(fltVal);
105  else
106  m_lpParent->BurstSh(fltVal);
107 
108 
109  fltVal = oXml.GetChildFloat("TimeConstant");
110  if(m_strActivationType == "ACTIVE")
112  else
114 
115  oXml.OutOfElem();
116 }
117 
118 //Node Overrides
119 
120 } //IntegrateFireSim
Declares the integrate fire module class.
void BurstHTimeConstant(double dVal)
Sets the burst inactivation time constant.
Declares the connexion class.
Integrate and fire neuron model.
Declares the spiking chemical synapse class.
std::string Std_Trim(std::string strVal)
Trims a string.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Declares the ca activation class.
virtual ~CaActivation()
Destructor.
Declares the synapse type class.
void BurstVh(double dVal)
Sets the burst inactivation mid point.
void BurstSh(double dVal)
Sets the burst inactivation slope.
void BurstMTimeConstant(double dVal)
Gets the burst activation time constant.
Declares the electrical synapse class.
void BurstSm(double dVal)
Sets the burst Activation slope.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
CaActivation(Neuron *lpParent, std::string strActivationType)
Constructor.
Neuron * m_lpParent
Pointer to the parent Neuron.
Definition: CaActivation.h:25
std::string m_strActivationType
Type of the activation.
Definition: CaActivation.h:28
void BurstVm(double dVal)
Sets the burst activation mid point.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
Contains all of the classes to implement a basic integrate and fire neural model. ...
Declares the non spiking chemical synapse class.
Declares the neuron class.