AnimatLab  2
Test
CsNeuralModule.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 
9 #include "CsNeuralModule.h"
10 #include "CsClassFactory.h"
11 
12 namespace AnimatCarlSim
13 {
21 {
23  m_lpSNN = NULL;
24  m_iSimMode = GPU_MODE;
25  m_fltTimeStep = 0.001f;
28  m_fltNeuralTime = 0;
29 }
30 
38 {
39 
40 try
41 {
42  m_arySynapses.RemoveAll();
43  m_aryNeuronGroups.RemoveAll();
44 }
45 catch(...)
46 {Std_TraceMsg(0, "Caught Error in desctructor of CsNeuralModule\r\n", "", -1, false, true);}
47 }
48 
49 std::string CsNeuralModule::ModuleName() {return "AnimatCarlSimCUDA";};
50 
51 void CsNeuralModule::SimMode(int iMode)
52 {
53  if(!iMode)
54  m_iSimMode = CPU_MODE;
55  else
56  m_iSimMode = GPU_MODE;
57 }
58 
59 int CsNeuralModule::SimMode() {return m_iSimMode;}
60 
70 {
71  unsigned int iInterval = 1;
72  if( m_lpSim->MinTimeStep() > 0)
73  iInterval = (unsigned int) ((((float) (CARLSIM_STEP_SIZE*CARLSIM_STEP_INCREMENT)) / m_lpSim->MinTimeStep())+0.5);
74  return iInterval;
75 }
76 
77 
93 {
94  CsConnectionGenerator *lpItem = NULL;
95  CStdMap<std::string, CsConnectionGenerator *>::iterator oPos;
96  oPos = m_aryGenerators.find(Std_CheckString(strID));
97 
98  if(oPos != m_aryGenerators.end())
99  lpItem = oPos->second;
100  else if(bThrowError)
101  THROW_TEXT_ERROR(Cs_Err_lConnectionGeneratorIDNotFound, Cs_Err_strConnectionGeneratorIDNotFound, " Connection Generator ID: " + strID);
102 
103  return lpItem;
104 }
105 
106 void CsNeuralModule::AddConnectionGenerator(std::string strID, CsConnectionGenerator *lpGen)
107 {
108  if(lpGen)
109  {
110  if(!FindConnectionGenerator(strID, false))
111  m_aryGenerators.Add(strID, lpGen);
112  }
113 }
114 
115 void CsNeuralModule::Kill(bool bState)
116 {
117  int iCount = m_aryNeuronGroups.GetSize();
118  for(int iIndex=0; iIndex<iCount; iIndex++)
119  if(m_aryNeuronGroups[iIndex])
120  m_aryNeuronGroups[iIndex]->Kill(bState);
121 }
122 
134 int CsNeuralModule::FindNeuronGroupListPos(std::string strID, bool bThrowError)
135 {
136  std::string sID = Std_ToUpper(Std_Trim(strID));
137 
138  int iCount = m_aryNeuronGroups.GetSize();
139  for(int iIndex=0; iIndex<iCount; iIndex++)
140  if(m_aryNeuronGroups[iIndex]->ID() == sID)
141  return iIndex;
142 
143  if(bThrowError)
144  THROW_TEXT_ERROR(Cs_Err_lNeuronNotFound, Cs_Err_strNeuronNotFound, "ID");
145 
146  return -1;
147 }
148 
149 void CsNeuralModule::SetCARLSimulation()
150 {
151  if(m_lpSNN)
152  {
153  delete m_lpSNN;
154  m_lpSNN = NULL;
155  }
156 
157  m_aryGenerators.RemoveAll();
158 
159  m_lpSNN = new CpuSNN(m_strID.c_str());
160 
161  m_lpSNN->setStepFeedback(this);
162 
163  //Go through each of the neuron group items and set them up
164  int iCount = m_aryNeuronGroups.GetSize();
165  for(int iIndex=0; iIndex<iCount; iIndex++)
166  if(m_aryNeuronGroups[iIndex])
167  m_aryNeuronGroups[iIndex]->SetCARLSimulation();
168 
169  //Then go through each of the connections and set them up
170  iCount = m_arySynapses.GetSize();
171  for(int iIndex=0; iIndex<iCount; iIndex++)
172  if(m_arySynapses[iIndex])
173  m_arySynapses[iIndex]->SetCARLSimulation();
174 
175  //Now run through each of the connection generators and set them up.
176  CsConnectionGenerator *lpGen = NULL;
177  CStdPtrMap<std::string, CsConnectionGenerator>::iterator oPos;
178  for(oPos=m_aryGenerators.begin(); oPos!=m_aryGenerators.end(); ++oPos)
179  {
180  lpGen = oPos->second;
181  lpGen->SetCARLSimulation();
182  }
183 
184  //m_iSimMode = CPU_MODE;
185 
186  //Initalize the network
187  m_lpSNN->runNetwork(0, 0, m_iSimMode);
188 }
189 
191 {
192 
193  //If we have been told to pause then lets loop till we can continue
194  while(m_bPauseThread || m_lpSim->Paused())
195  {
196  m_bThreadPaused = true;
197 
198  //If we have been told to stop then exit immediately
199  if(m_bStopThread)
200  return true;
201 
202  boost::this_thread::sleep(boost::posix_time::microseconds(1000));
203  }
204 
205  //Otherwise keep going.
206  return false;
207 }
208 
209 void CsNeuralModule::updateMonitors(CpuSNN* s, int step)
210 {
211  //If stop threads has been set then just exit out of here.
212  if(m_bStopThread)
213  return;
214 
215  m_fltNeuralTime = (float) ((step+1)*CARLSIM_STEP_INCREMENT);
217  WaitForPhysicsToCatchUp();
218 }
219 
220 void CsNeuralModule::WaitForPhysicsToCatchUp()
221 {
223 
224  while(m_lpSim->Time() <= m_fltNeuralTime)
225  {
227  return;
228 
229  if(m_bPauseThread)
230  m_bThreadPaused = true;
231  }
232 
234 
235  //std::string strMessage = "P:: Neural: " + STR(m_fltNeuralTime) + ", Physics: " + STR(m_lpSim->Time()) + "\r\n";
236  //OutputDebugString(strMessage.c_str());
237  //std::cout << "Neural: " << m_fltNeuralTime << ", Physics: " << m_lpSim->Time() << "\r\n";
238 }
239 
240 
241 void CsNeuralModule::WaitForNeuralToCatchUp()
242 {
244 
245  while(m_fltNeuralTime <= m_lpSim->Time())
246  {
248  return;
249  }
250 
252 
253  //std::string strMessage = "N:: Neural: " + STR(m_fltNeuralTime) + ", Physics: " + STR(m_lpSim->Time()) + "\r\n";
254  //OutputDebugString(strMessage.c_str());
255  //std::cout << "Neural: " << m_fltNeuralTime << ", Physics: " << m_lpSim->Time() << "\r\n";
256 }
257 
259 {
260  if(m_lpSNN)
261  m_lpSNN->runNetwork(100, 0, m_iSimMode);
262 }
263 
264 void CsNeuralModule::CloseThread()
265 {
268 
269 }
270 
281 {
282  NeuralModule::SimStarting();
283 
284  //Do not do this again if the thread is already running. For example, if we pause the sim and hit play again.
286  {
287  //Only bother running the simulation if there are some synpases in it.
288  if(m_arySynapses.size() > 0)
289  {
290  SetCARLSimulation();
291  StartThread();
292  }
293  }
294 }
295 
297 {
298  NeuralModule::SimStopping();
299 
300  ShutdownThread();
301 }
302 
304 {
305  NeuralModule::ResetSimulation();
306 
307  m_fltNeuralTime = 0;
308 
309  ShutdownThread();
310 
311  int iCount = m_aryNeuronGroups.GetSize();
312  for(int iIndex=0; iIndex<iCount; iIndex++)
313  if(m_aryNeuronGroups[iIndex])
314  m_aryNeuronGroups[iIndex]->ResetSimulation();
315 
316  iCount = m_arySynapses.GetSize();
317  for(int iIndex=0; iIndex<iCount; iIndex++)
318  if(m_arySynapses[iIndex])
319  m_arySynapses[iIndex]->ResetSimulation();
320 }
321 
323 {
324  NeuralModule::Initialize();
325 
326  Organism *lpOrganism = dynamic_cast<Organism *>(m_lpStructure);
327  if(!lpOrganism)
328  THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType, "Organism");
329 
330  int iCount = m_aryNeuronGroups.GetSize();
331  for(int iIndex=0; iIndex<iCount; iIndex++)
332  if(m_aryNeuronGroups[iIndex])
333  m_aryNeuronGroups[iIndex]->Initialize();
334 
335  iCount = m_arySynapses.GetSize();
336  for(int iIndex=0; iIndex<iCount; iIndex++)
337  if(m_arySynapses[iIndex])
338  m_arySynapses[iIndex]->Initialize();
339 }
340 
342 {
343  NeuralModule::StepSimulation();
344 
345  if(m_bThreadProcessing && !m_bWaitingForPhysicsToCatchUp && m_fltNeuralTime < m_lpSim->Time())
346  WaitForNeuralToCatchUp();
347 }
348 
349 #pragma region DataAccesMethods
350 
351 bool CsNeuralModule::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
352 {
353  std::string strType = Std_CheckString(strDataType);
354 
355  if(NeuralModule::SetData(strDataType, strValue, false))
356  return true;
357 
358  if(strType == "TIMESTEP")
359  {
360  TimeStep(atof(strValue.c_str()));
361  return true;
362  }
363 
364  if(strType == "SIMMODE")
365  {
366  SimMode(atoi(strValue.c_str()));
367  return true;
368  }
369 
370  //If it was not one of those above then we have a problem.
371  if(bThrowError)
372  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
373 
374  return false;
375 }
376 
377 void CsNeuralModule::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
378 {
379  NeuralModule::QueryProperties(aryProperties);
380 
381  aryProperties.Add(new TypeProperty("TimeStep", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
382  aryProperties.Add(new TypeProperty("SimMode", AnimatPropertyType::Integer, AnimatPropertyDirection::Set));
383 }
384 
393 void CsNeuralModule::AddNeuronGroup(std::string strXml, bool bDoNotInit)
394 {
395  CStdXml oXml;
396  oXml.Deserialize(strXml);
397  oXml.FindElement("Root");
398  oXml.FindChildElement("NeuronGroup");
399 
400  CsNeuronGroup *lpNeuron = LoadNeuronGroup(oXml);
401  if(!bDoNotInit)
402  lpNeuron->Initialize();
403 }
404 
414 void CsNeuralModule::RemoveNeuronGroup(std::string strID, bool bThrowError)
415 {
416  int iPos = FindNeuronGroupListPos(strID, bThrowError);
417  m_aryNeuronGroups.RemoveAt(iPos);
418 }
419 
428 CStdPtrArray<CsSynapseGroup> *CsNeuralModule::GetSynapses()
429 {return &m_arySynapses;}
430 
431 
433 {
434  if(!lpSynapse)
435  THROW_ERROR(Cs_Err_lSynapseToAddNull, Cs_Err_strSynapseToAddNull);
436  m_arySynapses.Add(lpSynapse);
437 }
438 
447 void CsNeuralModule::AddSynapse(std::string strXml, bool bDoNotInit)
448 {
449  CStdXml oXml;
450  oXml.Deserialize(strXml);
451  oXml.FindElement("Root");
452  oXml.FindChildElement("Synapse");
453 
454  CsSynapseGroup *lpSynapse = LoadSynapse(oXml);
455  if(!bDoNotInit)
456  lpSynapse->Initialize();
457 }
458 
468 {
469  if( iIndex<0 || iIndex>=m_arySynapses.GetSize() )
470  THROW_ERROR(Std_Err_lInvalidIndex, Std_Err_strInvalidIndex);
471  m_arySynapses.RemoveAt(iIndex);
472 }
473 
483 void CsNeuralModule::RemoveSynapse(std::string strID, bool bThrowError)
484 {
485  int iPos = FindSynapseListPos(strID, bThrowError);
486  m_arySynapses.RemoveAt(iPos);
487 }
488 
500 {
501  if( iIndex<0 || iIndex>=m_arySynapses.GetSize() )
502  THROW_ERROR(Std_Err_lInvalidIndex, Std_Err_strInvalidIndex);
503  return m_arySynapses[iIndex];
504 }
505 
517 int CsNeuralModule::FindSynapseListPos(std::string strID, bool bThrowError)
518 {
519  std::string sID = Std_ToUpper(Std_Trim(strID));
520 
521  int iCount = m_arySynapses.GetSize();
522  for(int iIndex=0; iIndex<iCount; iIndex++)
523  if(m_arySynapses[iIndex]->ID() == sID)
524  return iIndex;
525 
526  if(bThrowError)
527  THROW_TEXT_ERROR(Cs_Err_lSynapseNotFound, Cs_Err_strSynapseNotFound, "ID");
528 
529  return -1;
530 }
531 
541 {return m_arySynapses.GetSize();}
542 
550 {m_arySynapses.RemoveAll();}
551 
552 bool CsNeuralModule::AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError, bool bDoNotInit)
553 {
554  std::string strType = Std_CheckString(strItemType);
555 
556  if(strType == "NEURONGROUP")
557  {
558  AddNeuronGroup(strXml, bDoNotInit);
559  return true;
560  }
561  else if(strType == "SYNAPSE")
562  {
563  AddSynapse(strXml, bDoNotInit);
564  return true;
565  }
566 
567 
568  //If it was not one of those above then we have a problem.
569  if(bThrowError)
570  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
571 
572  return false;
573 }
574 
575 bool CsNeuralModule::RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError)
576 {
577  std::string strType = Std_CheckString(strItemType);
578 
579  if(strType == "NEURONGROUP")
580  {
581  RemoveNeuronGroup(strID, bThrowError);
582  return true;
583  }
584  else if(strType == "SYNAPSE")
585  {
586  RemoveSynapse(strID, bThrowError);
587  return true;
588  }
589 
590 
591  //If it was not one of those above then we have a problem.
592  if(bThrowError)
593  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
594 
595  return false;
596 }
597 
598 
599 #pragma endregion
600 
601 void CsNeuralModule::Load(CStdXml &oXml)
602 {
604 
605  CStdXml oNetXml;
606 
607  m_arySourceAdapters.RemoveAll();
608  m_aryTargetAdapters.RemoveAll();
609 
610  oXml.IntoElem(); //Into NeuralModule Element
611 
612  LoadNetworkXml(oXml);
613 
614  oXml.OutOfElem(); //OutOf NeuralModule Element
615 
616  TRACE_DEBUG("Finished loading nervous system config file.");
617 }
618 
628 {
629  short iNeuron, iTotalNeurons;
630 
631  m_aryNeuronGroups.RemoveAll();
632 
633  ID(oXml.GetChildString("ID", m_strID));
634  Type(oXml.GetChildString("Type", m_strType));
635  Name(oXml.GetChildString("Name", m_strName));
636  SimMode(oXml.GetChildInt("SimMode", m_iSimMode));
637 
638  //This will add this object to the object list of the simulation.
639  m_lpSim->AddToObjectList(this);
640 
641  //*** Begin Loading Neurons groups. *****
642  oXml.IntoChildElement("NeuronGroups");
643 
644  iTotalNeurons = oXml.NumberOfChildren();
645  for(iNeuron=0; iNeuron<iTotalNeurons; iNeuron++)
646  {
647  oXml.FindChildByIndex(iNeuron);
648  LoadNeuronGroup(oXml);
649  }
650 
651  oXml.OutOfElem();
652  //*** End Loading Neurons groups. *****
653 
654  //*** Begin Loading Synapses. *****
655  if(oXml.FindChildElement("Synapses", false))
656  {
657  oXml.IntoElem(); //Into Synapses Element
658 
659  int iCount = oXml.NumberOfChildren();
660  for(int iIndex=0; iIndex<iCount; iIndex++)
661  {
662  oXml.FindChildByIndex(iIndex);
663  LoadSynapse(oXml);
664  }
665 
666  oXml.OutOfElem();
667  }
668  //*** End Loading Synapses. *****
669 
670 }
671 
683 {
684  CsNeuronGroup *lpNeuron=NULL;
685  std::string strType;
686 
687 try
688 {
689  //Now lets get the index and type of this neuron
690  oXml.IntoElem(); //Into Neuron Element
691  strType = oXml.GetChildString("Type");
692  oXml.OutOfElem(); //OutOf Neuron Element
693 
694  lpNeuron = dynamic_cast<CsNeuronGroup *>(m_lpSim->CreateObject("AnimatCarlSimCUDA", "Neuron", strType));
695  if(!lpNeuron)
696  THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType, "Neuron");
697 
698  lpNeuron->SetSystemPointers(m_lpSim, m_lpStructure, this, NULL, true);
699  lpNeuron->Load(oXml);
700 
701  m_aryNeuronGroups.Add(lpNeuron);
702  return lpNeuron;
703 }
704 catch(CStdErrorInfo oError)
705 {
706  if(lpNeuron) delete lpNeuron;
707  RELAY_ERROR(oError);
708  return NULL;
709 }
710 catch(...)
711 {
712  if(lpNeuron) delete lpNeuron;
713  THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
714  return NULL;
715 }
716 }
717 
729 {
730  std::string strType;
731  CsSynapseGroup *lpSynapse=NULL;
732 
733 try
734 {
735  oXml.IntoElem(); //Into Synapse Element
736  strType = oXml.GetChildString("Type");
737  oXml.OutOfElem(); //OutOf Synapse Element
738 
739  lpSynapse = dynamic_cast<CsSynapseGroup *>(m_lpSim->CreateObject("AnimatCarlSimCUDA", "Synapse", strType));
740  if(!lpSynapse)
741  THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType, "Synapse");
742 
743  lpSynapse->SetSystemPointers(m_lpSim, m_lpStructure, this, NULL, true);
744  lpSynapse->Load(oXml);
745  AddSynapse(lpSynapse);
746 
747  return lpSynapse;
748 }
749 catch(CStdErrorInfo oError)
750 {
751  if(lpSynapse) delete lpSynapse;
752  RELAY_ERROR(oError);
753  return NULL;
754 }
755 catch(...)
756 {
757  if(lpSynapse) delete lpSynapse;
758  THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
759  return NULL;
760 }
761 }
762 
763 } //AnimatCarlSim
764 
Contains the classes for a firing rate neural model.
Definition: CsAdapter.cpp:14
CStdArray< Adapter * > m_arySourceAdapters
An array of source adapters for this module.
Definition: NeuralModule.h:56
virtual bool stepUpdate(CpuSNN *s, int step)
virtual int FindSynapseListPos(std::string strID, bool bThrowError=true)
Searches for a synapse with the specified ID and returns its position in the list.
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
virtual void Kill(bool bState=true)
Kills.
virtual float TimeStep()
Gets the time step for this moudle in time units.
virtual void Initialize()
Initializes this object.
void LoadNetworkXml(CStdXml &oXml)
Loads the network configuration.
virtual void StepThread()
This method is called from within the IO thread. It calls StepIO for each part.
IStdClassFactory * m_lpClassFactory
The pointer to the class factory for this module.
Definition: NeuralModule.h:53
virtual std::string Type()
returns the string type name of this object.
Definition: AnimatBase.cpp:221
virtual unsigned int SimulationStepInterval()
Tells the number of simulation steps that other components, like stimuli, will need to use for their ...
Simulator * m_lpSim
The pointer to a Simulation.
Definition: AnimatBase.h:43
CsNeuronGroup * LoadNeuronGroup(CStdXml &oXml)
Loads a neuron.
virtual void RemoveNeuronGroup(std::string strID, bool bThrowError=true)
Removes the neuron with the specified ID.
virtual bool Paused()
Gets whether the Simulation is paused.
Definition: Simulator.cpp:347
virtual std::string ID()
Gets the unique GUID ID of this object.
Definition: AnimatBase.cpp:167
virtual void ClearSynapses()
Clears the synapses list.
int runNetwork(int _nsec, int _tstep=0, int simType=CPU_MODE, int ithGPU=0, bool enablePrint=false, int copyState=false)
run the simulation for n sec simType can either be CPU_MODE or GPU_MODE ithGPU: specify on which CUDA...
Definition: snn_cpu.cpp:2644
virtual CStdPtrArray< CsSynapseGroup > * GetSynapses()
Gets a pointer to the synapses array.
bool m_bPauseThread
Set to true to pause the thread processing. Set back to false to resume it.
virtual void AddSynapse(CsSynapseGroup *lpSynapse)
Adds a synapse to this module.
virtual std::string ModuleName()
Gets the module name.
CStdPtrArray< CsSynapseGroup > m_arySynapses
The array of synapses in this module.
virtual void RemoveSynapse(int iIndex)
Removes the synapse described by iIndex.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
Definition: AnimatBase.h:46
std::string m_strID
The unique Id for this object.
Definition: AnimatBase.h:55
bool m_bWaitingForNeuralToCatchUp
True if the physics simulation has finished and is waiting on the neural sim to catch up...
Firing rate synapse model.
std::string Std_Trim(std::string strVal)
Trims a string.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
Definition: Simulator.cpp:3440
virtual void Initialize()
Initializes this object.
CStdArray< Adapter * > m_aryTargetAdapters
An array of target adapters for this module.
Definition: NeuralModule.h:59
virtual std::string Name()
Gets the name of this object.
Definition: AnimatBase.cpp:195
virtual void Initialize()
Initializes this object.
float m_fltNeuralTime
The current time of the neural simulation.
virtual void SimStopping()
Called just before the simulation stops.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
virtual void StepSimulation()
Step the simulation for this object.
Firing Rate Neuron model.
Definition: CsNeuronGroup.h:28
int m_iSimMode
The mode of the simulation. GPU vs CPU.
virtual void ResetSimulation()
Resets the simulation back to time 0.
CpuSNN * m_lpSNN
Pointer to the CARLsim simulator.
virtual int FindNeuronGroupListPos(std::string strID, bool bThrowError=true)
Searches for the neuron with the specified ID and returns its position in the list.
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.
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 int TotalSynapses()
Gets the total number of synapses.
CStdPtrMap< std::string, CsConnectionGenerator > m_aryGenerators
bool m_bThreadProcessing
True while the io thread processing loop is going on.
Firing rate neural module class factory.
bool m_bWaitingForPhysicsToCatchUp
True if the neural simulation has finished and is waiting on the physics sim to catch up...
CsNeuralModule()
Default constructor.
bool m_bStopThread
Flags the thread processing loop to exit.
virtual ~CsNeuralModule()
Destructor.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void AddNeuronGroup(std::string strXml, bool bDoNotInit=false)
Adds a neuron to the module.
virtual CsConnectionGenerator * FindConnectionGenerator(std::string strID, bool bThrowError=true)
Searches for an item with the specified ID and sets its index in the array.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
CStdPtrArray< CsNeuronGroup > m_aryNeuronGroups
The array of neuron groups in this module.
virtual CsSynapseGroup * GetSynapse(int iIndex)
Gets a synapse by its index in the array.
bool m_bThreadPaused
Is set to true once the thread loop is paused.
float m_fltTimeStep
The DT time step for this neural module in seconds.
Definition: NeuralModule.h:40
virtual float Time()
Gets the current simulation time in seconds.
Definition: Simulator.cpp:559
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
std::string m_strType
The type for this object. Examples are Box, Plane, Neuron, etc..
Definition: AnimatBase.h:58
virtual void AddToObjectList(AnimatBase *lpItem)
Adds an object to the list of all simulation objects.
Definition: Simulator.cpp:4068
CsSynapseGroup * LoadSynapse(CStdXml &oXml)
Loads a synapse.
Contains all of CARLsim's core functionality.
Definition: snn.h:619
virtual void SimStarting()
When the simulation is starting we need to configure our NN and start our processing thread...
std::string m_strName
The name for this object.
Definition: AnimatBase.h:61
virtual void ShutdownThread()
This method is called just before the IO thread is closed down. It gives the IO objects a chance to d...