34 m_fltDelayInterval = 0;
51 {
Std_TraceMsg(0,
"Caught Error in desctructor of Synapse\r\n",
"", -1,
false,
true);}
121 m_fltDelayInterval = fltVal;
155 int iLength = (int) (m_fltDelayInterval/fltTimeStep);
254 if( iCompoundIndex<0 || iCompoundIndex>=
m_arySynapses.GetSize() )
255 THROW_ERROR(Std_Err_lInvalidIndex, Std_Err_strInvalidIndex);
270 oXml.Deserialize(strXml);
271 oXml.FindElement(
"Root");
272 oXml.FindChildElement(
"CompoundSynapse");
311 for(
int iIndex=0; iIndex<iCount; iIndex++)
316 THROW_TEXT_ERROR(Nl_Err_lSynapseNotFound, Nl_Err_strSynapseNotFound,
"ID");
338 for(iIndex=0; iIndex<iCount; iIndex++)
354 THROW_PARAM_ERROR(Al_Err_lNodeNotFound, Al_Err_strNodeNotFound,
"ID: ",
m_strFromID);
357 for(
int iIndex=0; iIndex<iCount; iIndex++)
365 Link::SetSystemPointers(m_lpSim, lpStructure, lpModule, lpNode,
false);
374 Link::VerifySystemPointers();
377 THROW_PARAM_ERROR(Al_Err_lUnableToCastNeuralModuleToDesiredType, Al_Err_strUnableToCastNeuralModuleToDesiredType,
"ID: ",
m_lpFRModule->
ID());
380 THROW_PARAM_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Link: ",
m_strID);
383 #pragma region DataAccesMethods
389 if(strType ==
"WEIGHT")
391 else if(strType ==
"MODULATION")
397 bool Synapse::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
401 if(Link::SetData(strDataType, strValue,
false))
404 if(strType ==
"WEIGHT")
406 Weight(atof(strValue.c_str()));
410 if(strType ==
"HASDELAY")
416 if(strType ==
"DELAYINTERVAL")
424 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
429 void Synapse::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
431 Link::QueryProperties(aryProperties);
433 aryProperties.Add(
new TypeProperty(
"Modulation", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
435 aryProperties.Add(
new TypeProperty(
"Weight", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
436 aryProperties.Add(
new TypeProperty(
"HasDelay", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
437 aryProperties.Add(
new TypeProperty(
"DelayInterval", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
440 bool Synapse::AddItem(
const std::string &strItemType,
const std::string &strXml,
bool bThrowError,
bool bDoNotInit)
444 if(strType ==
"SYNAPSE")
453 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
462 if(strType ==
"SYNAPSE")
470 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
480 for(
int iIdx=0; iIdx<iSize; iIdx++)
484 for(
int iIndex=0; iIndex<iCount; iIndex++)
488 void Synapse::Load(CStdXml &oXml)
490 AnimatBase::Load(oXml);
494 THROW_PARAM_ERROR(Al_Err_lUnableToCastNodeToDesiredType, Al_Err_strUnableToCastNodeToDesiredType,
"ID: ",
m_lpNode->
ID());
500 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
"Attribute: FromID");
502 m_bEnabled = oXml.GetChildBool(
"Enabled",
true);
505 m_bHasDelay = oXml.GetChildBool(
"HasDelay", m_bHasDelay);
506 m_fltDelayInterval = oXml.GetChildFloat(
"DelayInterval", m_fltDelayInterval);
511 if(oXml.FindChildElement(
"CompoundSynapses",
false))
513 oXml.IntoChildElement(
"CompoundSynapses");
515 int iCount = oXml.NumberOfChildren();
516 for(
int iIndex=0; iIndex<iCount; iIndex++)
518 oXml.FindChildByIndex(iIndex);
547 strType = oXml.GetChildString(
"Type");
552 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Synapse");
555 lpSynapse->Load(oXml);
560 catch(CStdErrorInfo oError)
562 if(lpSynapse)
delete lpSynapse;
568 if(lpSynapse)
delete lpSynapse;
569 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
virtual void AddSynapse(std::string strXml, bool bDoNotInit)
Adds a compound synapse to this one.
Neuron * m_lpToNeuron
The pointer to post-synaptic neuron.
virtual float CalculateModulation(FiringRateModule *lpModule)
Calculates the synaptic modulation.
virtual void Process(float &fltCurrent)
Processes this synapse.
virtual float CalculateCurrent()
Calculates the synaptic current for this synapse.
Firing rate neural module.
Neuron * m_lpFromNeuron
The pointer to pre-synaptic neuron.
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 SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
virtual float TimeStep()
Gets the time step for this moudle in time units.
float m_fltWeight
The weight of the synapse. This is a current value in nanoamps.
virtual void Initialize()
Initializes this object.
float * ModulationPointer()
Gets a pointer to the synaptic modulation.
Simulator * m_lpSim
The pointer to a Simulation.
virtual std::string ID()
Gets the unique GUID ID of this object.
CStdCircularArray< float > m_aryDelayBuffer
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 void ResetSimulation()
Resets the simulation back to time 0.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
std::string m_strID
The unique Id for this object.
std::string Std_Trim(std::string strVal)
Trims a string.
virtual Synapse * GetCompoundSynapse(short iCompoundIndex)
Gets a pointer to a compound synapse.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
Firing Rate Neuron model.
virtual float DelayInterval()
Gets the delay buffer size in time.
Node * m_lpNode
The pointer to this items parent Node. If this is not relevant for this object then this is NULL...
CStdPtrArray< Synapse > m_arySynapses
Array of moduled/gated child synapses.
virtual int FindSynapseListPos(std::string strID, bool bThrowError=true)
Searches for the first synapse list position.
virtual void TimeStepModified()
If the time step is modified then we need to recalculate the length of the delay buffer.
virtual float FiringFreq(FiringRateModule *lpModule)
Calculates the current firing frequency.
virtual bool HasDelay()
Gets whether this synapse has a delay associated with it.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
virtual AnimatBase * FindByID(std::string strID, bool bThrowError=true)
Searches for the object with the specified ID.
Declares the synapse class.
bool Std_ToBool(int iVal)
Converts a value toa bool.
virtual void RemoveSynapse(std::string strID, bool bThrowError=true)
Removes the copmound synapse specified by ID.
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.
Declares the firing rate module class.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
float * WeightPointer()
Gets a pointer to the synaptic weight.
Neuron * FromNeuron()
Gets the pre-synaptic neuron.
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
float Weight()
Gets the synaptic weight.
FiringRateModule * m_lpFRModule
Pointer to parent FiringRateModule.
Contains the classes for a firing rate neural model.
Firing rate synapse model.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
float Modulation()
Gets the synaptic modulation.
float m_fltModulation
The modulation value to use for this synapse.
Synapse()
Default constructor.
Synapse * LoadSynapse(CStdXml &oXml)
Loads a synapse.
virtual ~Synapse()
Destructor.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
Organism * m_lpOrganism
The pointer to this link's organism.
std::string m_strType
The type for this object. Examples are Box, Plane, Neuron, etc..
virtual void SetDelayBufferSize()
Recalculates the size of the delay buffer required.
std::string m_strFromID
GUID ID of the pre-synaptic neruon.