AnimatLab  2
Test
ElectricalSynapse.cpp
Go to the documentation of this file.
1 
7 #include "stdafx.h"
8 #include "SynapseType.h"
9 #include "ElectricalSynapse.h"
10 
11 namespace IntegrateFireSim
12 {
13  namespace Synapses
14  {
15 
23 {
24  m_dLowCoup = 0;
25  m_dHiCoup = 0;
26  m_dTurnOnV = 0;
27  m_dSaturateV = 0;
28 }
29 
37 {
38 
39 }
40 
41 #pragma region Accessor-Mutators
42 
51 void ElectricalSynapse::LowCoupling(double dVal) {m_dLowCoup = dVal;}
52 
62 
71 void ElectricalSynapse::HighCoupling(double dVal) {m_dHiCoup = dVal;}
72 
82 
92 
102 
112 
122 
123 #pragma endregion
124 
125 #pragma region DataAccesMethods
126 
127 bool ElectricalSynapse::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
128 {
129  std::string strType = Std_CheckString(strDataType);
130 
131  if(AnimatBase::SetData(strDataType, strValue, false))
132  return true;
133 
134  if(strType == "LOWCOUPLING")
135  {
136  LowCoupling(atof(strValue.c_str()));
137  return true;
138  }
139 
140  if(strType == "HIGHCOUPLING")
141  {
142  HighCoupling(atof(strValue.c_str()));
143  return true;
144  }
145 
146  if(strType == "TURNONTHRESHOLD")
147  {
148  TurnOnThreshold(atof(strValue.c_str()));
149  return true;
150  }
151 
152  if(strType == "TURNONSATURATE")
153  {
154  TurnOnSaturate(atof(strValue.c_str()));
155  return true;
156  }
157 
158  //If it was not one of those above then we have a problem.
159  if(bThrowError)
160  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
161 
162  return false;
163 }
164 
165 void ElectricalSynapse::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
166 {
167  AnimatBase::QueryProperties(aryProperties);
168 
169  aryProperties.Add(new TypeProperty("LowCoupling", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
170  aryProperties.Add(new TypeProperty("HighCoupling", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
171  aryProperties.Add(new TypeProperty("TurnOnThreshold", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
172  aryProperties.Add(new TypeProperty("TurnOnSaturate", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
173 }
174 
175 #pragma endregion
176 
177 void ElectricalSynapse::Load(CStdXml &oXml)
178 {
179  AnimatBase::Load(oXml);
180 
181  oXml.IntoElem(); //Into SpikingChemSyn Element
182 
183  LowCoupling(oXml.GetChildDouble("LowCoup"));
184  HighCoupling(oXml.GetChildDouble("HiCoup"));
185  TurnOnThreshold(oXml.GetChildDouble("TurnOnV"));
186  TurnOnSaturate(oXml.GetChildDouble("SaturateV"));
187 
188  oXml.OutOfElem(); //OutOf Neuron Element
189 }
190 
191  } //Synapses
192 } //IntegrateFireSim
double TurnOnThreshold()
Gets the turn-on threshold voltage.
double TurnOnSaturate()
Gets the turn-on saturation voltage.
double HighCoupling()
Gets the high coupling voltage.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
double m_dHiCoup
The hi coupling voltage.
Synapse type base class.
Definition: SynapseType.h:22
Declares the synapse type class.
double m_dSaturateV
The saturation voltage level.
double m_dLowCoup
The low coupling voltage.
Declares the electrical synapse class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
double m_dTurnOnV
The turn on voltage level.
double LowCoupling()
Gets the low coupling voltage.
Contains all of the classes to implement a basic integrate and fire neural model. ...