AnimatLab  2
Test
CsSpikeGeneratorGroup.cpp
1 
7 #include "StdAfx.h"
8 
9 #include "CsSynapseGroup.h"
10 #include "CsNeuronGroup.h"
11 #include "CsSpikeGeneratorGroup.h"
12 #include "CsNeuralModule.h"
13 
14 namespace AnimatCarlSim
15 {
16 
24 {
25  m_lpSpikeRates = NULL;
26  m_uiRefPeriod = 1;
27 }
28 
36 {
37 
38 try
39 {
40  DeletePoissonRates();
41 }
42 catch(...)
43 {Std_TraceMsg(0, "Caught Error in desctructor of CsSpikeGeneratorGroup\r\n", "", -1, false, true);}
44 }
45 
46 void CsSpikeGeneratorGroup::Copy(CStdSerialize *lpSource)
47 {
48  CsNeuronGroup::Copy(lpSource);
49 
50  CsSpikeGeneratorGroup *lpOrig = dynamic_cast<CsSpikeGeneratorGroup *>(lpSource);
51 
52 }
53 
54 void CsSpikeGeneratorGroup::DeletePoissonRates()
55 {
56  if(m_lpSpikeRates)
57  {
58  delete m_lpSpikeRates;
59  m_lpSpikeRates = NULL;
60  }
61 }
62 
63 void CsSpikeGeneratorGroup::SetSpikeRatesUpdated()
64 {
65  m_lpCsModule->SNN()->setSpikeRateUpdated();
66 }
67 
68 void CsSpikeGeneratorGroup::SetCARLSimulation()
69 {
70  if(m_lpCsModule && m_lpCsModule->SNN() && m_bEnabled)
71  {
73 
74  DeletePoissonRates();
75 
76  // set Poisson rates for all neurons
77  m_lpSpikeRates = new PoissonRate(m_uiNeuronCount);
78  for (int i=0; i<m_uiNeuronCount; i++)
79  m_lpSpikeRates->rates[i] = 0;
80  m_lpCsModule->SNN()->setSpikeRate(m_iGroupID, m_lpSpikeRates, m_uiRefPeriod);
81 
82  //Set this up as a spike monitor.
84  }
85  else
86  m_iGroupID = -1;
87 }
88 
90 {
92 }
93 
95 {
96 
97 }
98 
99 void CsSpikeGeneratorGroup::AddExternalNodeInput(int iTargetDataType, float fltInput)
100 {
101 }
102 
103 #pragma region DataAccesMethods
104 
105 bool CsSpikeGeneratorGroup::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
106 {
107  std::string strType = Std_CheckString(strDataType);
108 
109  if(CsNeuronGroup::SetData(strDataType, strValue, false))
110  return true;
111 
112 
113  //If it was not one of those above then we have a problem.
114  if(bThrowError)
115  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
116 
117  return false;
118 }
119 
120 void CsSpikeGeneratorGroup::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
121 {
122  CsNeuronGroup::QueryProperties(aryProperties);
123 
124 }
125 
126 #pragma endregion
127 
128 void CsSpikeGeneratorGroup::Load(CStdXml &oXml)
129 {
130  CsNeuronGroup::Load(oXml);
131 
132  oXml.IntoElem(); //Into Neuron Element
133 
134 
135  oXml.OutOfElem(); //OutOf Neuron Element
136 }
137 
138 
139 } //AnimatCarlSim
140 
141 
142 
Contains the classes for a firing rate neural model.
Definition: CsAdapter.cpp:14
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
Declares the CsNeuronGroup class.
unsigned int m_uiNeuronCount
The number of neurons in this group.
Definition: CsNeuronGroup.h:35
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
void setSpikeMonitor(int gid, SpikeMonitor *spikeMon=NULL, int configId=ALL)
Definition: snn_cpu.cpp:3981
unsigned int m_uiRefPeriod
The refractory period.
int m_iGroupID
The group ID of this set of neurons.
Definition: CsNeuronGroup.h:41
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
int createSpikeGeneratorGroup(const string &_name, int unsigned size_n, int stype, int configId=ALL)
creates a spike generator group (dummy-neurons, not Izhikevich spiking neurons).
Definition: snn_cpu.cpp:838
virtual void Initialize()
Initializes this object.
virtual void Initialize()
Initializes this object.
CsNeuralModule * m_lpCsModule
Pointer to parent CsNeuralModule.
Definition: CsNeuronGroup.h:32
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.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
Definition: AnimatBase.h:40
virtual void StepSimulation()
Step the simulation for this object.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
std::string m_strName
The name for this object.
Definition: AnimatBase.h:61