AnimatLab  2
Test
SpikingChemicalSynapse.cpp
Go to the documentation of this file.
1 
7 #include "stdafx.h"
8 #include "IonChannel.h"
9 #include "SynapseType.h"
10 #include "Connexion.h"
11 #include "CaActivation.h"
12 #include "Neuron.h"
13 #include "ElectricalSynapse.h"
15 #include "SpikingChemicalSynapse.h"
16 #include "IntegrateFireModule.h"
17 #include "ClassFactory.h"
18 #include <time.h>
19 
20 namespace IntegrateFireSim
21 {
22  namespace Synapses
23  {
24 
32 {
33  m_dEquil = 0;
34  m_dSynAmp = 0;
35  m_dDecay = 0;
36  m_dFacilD = 0;
37  m_dRelFacil = 0;
38  m_dFacilDecay = 0;
39 
40  m_bVoltDep = false;
41  m_dMaxRelCond = 0;
42  m_dSatPSPot = 0;
43  m_dThreshPSPot = 0;
44 
45  m_bHebbian = false;
46  m_dMaxAugCond = 0;
47  m_dLearningInc = 0;
48  m_dLearningTime = 0;
49  m_bAllowForget = false;
50  m_dForgetTime = 0;
51  m_dConsolidation = 0;
52 }
53 
61 {
62 
63 }
64 
65 #pragma region Accessor-Mutators
66 
76 
86 
96 
106 
115 void SpikingChemicalSynapse::DecayRate(double dVal) {m_dDecay = dVal;}
116 
126 
136 
146 
156 
166 
176 {
177  Std_IsAboveMin((double) 0, dVal, true, "FacilitationDecay");
178  m_dFacilDecay = dVal;
180 }
181 
191 
201 
211 
221 
231 
241 
251 
261 
271 
281 
291 
301 
311 
321 
331 
341 
351 
361 
371 
381 
391 
401 
411 
421 
431 
441 
451 
461 
471 
481 
491 
501 
511 
521 
522 #pragma endregion
523 
524 #pragma region DataAccesMethods
525 
526 
527 bool SpikingChemicalSynapse::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
528 {
529  std::string strType = Std_CheckString(strDataType);
530 
531  if(AnimatBase::SetData(strDataType, strValue, false))
532  return true;
533 
534  if(strType == "EQUILIBRIUMPOTENTIAL")
535  {
536  EquilibriumPotential(atof(strValue.c_str()));
537  return true;
538  }
539 
540  if(strType == "SYNAPTICCONDUCTANCE")
541  {
542  SynapticConductance(atof(strValue.c_str()));
543  return true;
544  }
545 
546  if(strType == "DECAYRATE")
547  {
548  DecayRate(atof(strValue.c_str()));
549  return true;
550  }
551 
552  if(strType == "RELATIVEFACILITATION")
553  {
554  RelativeFacilitation(atof(strValue.c_str()));
555  return true;
556  }
557 
558  if(strType == "FACILITATIONDECAY")
559  {
560  FacilitationDecay(atof(strValue.c_str()));
561  return true;
562  }
563 
564  if(strType == "VOLTAGEDEPENDENT")
565  {
566  VoltageDependent(Std_ToBool(strValue));
567  return true;
568  }
569 
570  if(strType == "MAXRELATIVECONDUCTANCE")
571  {
572  MaxRelativeConductance(atof(strValue.c_str()));
573  return true;
574  }
575 
576  if(strType == "SATURATEPOTENTIAL")
577  {
578  SaturatePotential(atof(strValue.c_str()));
579  return true;
580  }
581 
582  if(strType == "THRESHOLDPOTENTIAL")
583  {
584  ThresholdPotential(atof(strValue.c_str()));
585  return true;
586  }
587 
588  if(strType == "HEBBIAN")
589  {
590  Hebbian(Std_ToBool(strValue));
591  return true;
592  }
593 
594  if(strType == "MAXAUGMENTEDCONDUCTANCE")
595  {
596  MaxAugmentedConductance(atof(strValue.c_str()));
597  return true;
598  }
599 
600  if(strType == "LEARNINGINCREMENT")
601  {
602  LearningIncrement(atof(strValue.c_str()));
603  return true;
604  }
605 
606  if(strType == "LEARNINGTIMEWINDOW")
607  {
608  LearningTimeWindow(atof(strValue.c_str()));
609  return true;
610  }
611 
612  if(strType == "ALLOWFORGETTING")
613  {
614  AllowForgetting(Std_ToBool(strValue));
615  return true;
616  }
617 
618  if(strType == "FORGETTINGTIMEWINDOW")
619  {
620  ForgettingTimeWindow(atof(strValue.c_str()));
621  return true;
622  }
623 
624  if(strType == "CONSOLIDATIONFACTOR")
625  {
626  ConsolidationFactor(atof(strValue.c_str()));
627  return true;
628  }
629 
630  //If it was not one of those above then we have a problem.
631  if(bThrowError)
632  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
633 
634  return false;
635 }
636 
637 void SpikingChemicalSynapse::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
638 {
639  AnimatBase::QueryProperties(aryProperties);
640 
641  aryProperties.Add(new TypeProperty("EquilibriumPotential", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
642  aryProperties.Add(new TypeProperty("SynapticConductance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
643  aryProperties.Add(new TypeProperty("DecayRate", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
644  aryProperties.Add(new TypeProperty("RelativeFacilitation", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
645  aryProperties.Add(new TypeProperty("FacilitationDecay", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
646  aryProperties.Add(new TypeProperty("VoltageDependent", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
647  aryProperties.Add(new TypeProperty("MaxRelativeConductance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
648  aryProperties.Add(new TypeProperty("SaturatePotential", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
649  aryProperties.Add(new TypeProperty("ThresholdPotential", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
650  aryProperties.Add(new TypeProperty("Hebbian", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
651  aryProperties.Add(new TypeProperty("MaxAugmentedConductance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
652  aryProperties.Add(new TypeProperty("LearningIncrement", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
653  aryProperties.Add(new TypeProperty("LearningTimeWindow", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
654  aryProperties.Add(new TypeProperty("AllowForgetting", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
655  aryProperties.Add(new TypeProperty("ForgettingTimeWindow", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
656  aryProperties.Add(new TypeProperty("ConsolidationFactor", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
657 }
658 
659 #pragma endregion
660 
661 void SpikingChemicalSynapse::Load(CStdXml &oXml)
662 {
663  AnimatBase::Load(oXml);
664 
665  oXml.IntoElem(); //Into SpikingChemSyn Element
666 
667  EquilibriumPotential(oXml.GetChildDouble("Equil"));
668  SynapticConductance(oXml.GetChildDouble("SynAmp"));
669  DecayRate(oXml.GetChildDouble("Decay"));
670  RelativeFacilitation(oXml.GetChildDouble("RelFacil"));
671  FacilitationDecay(oXml.GetChildDouble("FacilDecay"));
672 
673  VoltageDependent(oXml.GetChildBool("VoltDep"));
674  MaxRelativeConductance(oXml.GetChildDouble("MaxRelCond"));
675  SaturatePotential(oXml.GetChildDouble("SatPSPot"));
676  ThresholdPotential(oXml.GetChildDouble("ThreshPSPot"));
677 
678  Hebbian(oXml.GetChildBool("Hebbian"));
679  MaxAugmentedConductance(oXml.GetChildDouble("MaxAugCond"));
680  LearningIncrement(oXml.GetChildDouble("LearningInc"));
681  LearningTimeWindow(oXml.GetChildDouble("LearningTime"));
682  AllowForgetting(oXml.GetChildBool("AllowForget"));
683  ForgettingTimeWindow(oXml.GetChildDouble("ForgetTime"));
684  ConsolidationFactor(oXml.GetChildDouble("Consolidation"));
685 
686  oXml.OutOfElem(); //OutOf Neuron Element
687 }
688 
689  } //Synapses
690 } //IntegrateFireSim
double LearningIncrement()
Gets the learning increment.
double ForgettingWindow()
Gets the forgetting time window.
bool VoltDep()
Gets whether this synapse is voltage dependent.
Declares the integrate fire module class.
bool AllowForgetting()
Gets whether forgetting is allowed.
AnimatSim::Behavior::NeuralModule * m_lpModule
The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NU...
Definition: AnimatBase.h:49
virtual float TimeStep()
Gets the time step for this moudle in time units.
double m_dMaxAugCond
The maximum augmented conductance.
double MaxAugmentedConductance()
Gets the maximum augmented conductance.
double ThreshPSPot()
Gets the threshold potential.
double ConsolidationFactor()
Gets the consolidation factor.
double MaxGVoltDepRel()
Gets the maximum relative conductance.
Declares the connexion class.
double FacilitationDecay()
Gets the facilitation decay.
double m_dMaxRelCond
The maximum relative conductance.
double RelFacil()
Gets the relative facilitation.
double FacilD()
Gets the facilitation decrement value.
double HebbTimeWindow()
Gets the learning time window.
double RelativeFacilitation()
Gets the relative facilitation.
bool AllowForget()
Gets whether forgetting is allowed.
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 EquilibriumPotential()
Gets the equilibrium potential.
Declares the spiking chemical synapse class.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
double m_dSatPSPot
The saturation post-synaptic potential.
bool Hebbian()
Gets whether this synapse uses Hebbian learning.
Declares the ca activation class.
double MaxRelativeConductance()
Gets the maximum relative conductance.
double m_dThreshPSPot
The threshold post-synaptic potential.
bool VoltageDependent()
Gets whether this synapse is voltage dependent.
Synapse type base class.
Definition: SynapseType.h:22
double ThresholdPotential()
Gets the threshold potential.
bool Std_ToBool(int iVal)
Converts a value toa bool.
Declares the synapse type class.
double m_dSynAmp
base syn amp, before vd or hebb
double SynapticConductance()
Gets the synaptic conductance.
double MaxGHebb()
Gets the maximum augmented conductance.
Declares the electrical synapse class.
double SatPSPot()
Gets the saturation potential.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
bool m_bHebbian
true if hebbian learning is used.
double m_dRelFacil
The relative facilitation amount.
double ForgettingTimeWindow()
Gets the forgetting time window.
double Consolidation()
Gets the consolidation factor.
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.
double SaturatePotential()
Gets the saturation potential.
double LearningTimeWindow()
Gets the learning time window.