8 #include "IonChannel.h"
124 #pragma region Accessor-Mutators
150 Node::Enabled(bValue);
291 m_dRestingPot = dVal;
672 void Neuron::TonicNoise(
double dblVal)
677 double Neuron::TonicNoise() {
return m_dNoise;}
684 Node::SetSystemPointers(lpSim, lpStructure, lpModule, lpNode,
false);
693 Node::VerifySystemPointers();
696 THROW_PARAM_ERROR(Al_Err_lStructureNotDefined, Al_Err_strStructureNotDefined,
"IGFModule: ",
m_strID);
699 void Neuron::Load(CStdXml &oXml)
711 Enabled(oXml.GetChildBool(
"Enabled",
true));
713 m_dNoise=oXml.GetChildDouble(
"Noise");
715 m_dSize=oXml.GetChildDouble(
"Size");
725 if(oXml.FindChildElement(
"CaActivation",
false))
734 if(oXml.FindChildElement(
"CaDeactivation",
false))
746 if(oXml.FindChildElement(
"NeuronTonicInputs",
false) )
749 int iTotalNeuronTonicInputs = oXml.NumberOfChildren();
750 for(i=0; i<iTotalNeuronTonicInputs; i++)
752 oXml.FindChildByIndex(i);
754 d=oXml.GetChildDouble(
"TonicInputPeriod");
755 j=oXml.GetChildInt(
"TonicInputPeriodType");
765 for(i=0; i<iSpikingChemSynCount; i++)
774 if(oXml.FindChildElement(
"IonChannels",
false) )
781 oXml.FindChildByIndex(iIndex);
809 lpIonChannel->Load(oXml);
814 catch(CStdErrorInfo oError)
816 if(lpIonChannel)
delete lpIonChannel;
822 if(lpIonChannel)
delete lpIonChannel;
823 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
937 m_aryDG.SetSize(iSpikingChemSynCount);
946 for (i=0; i<iSpikingChemSynCount; i++)
1025 else if (lpNS->
TTX() || lpNS->
HH())
1112 for (i=0; i<iSpikingChemSynCount; i++)
1133 if (m_pNetworkData->m_bBlockedList[i])
1136 double noise =double (
Std_LRand(0, RAND_MAX))/ RAND_MAX;
1137 float top=m_pNetworkData->GetPartialBlockTop();
1138 float bottom=m_pNetworkData->GetPartialBlockBottom();
1139 block=bottom/100+noise*(top-bottom)/100;
1163 CStdArray<double> arySynG;
1164 arySynG.SetSize(iSpikingChemSynCount);
1165 for (i=0; i<iSpikingChemSynCount; i++)
1178 for (i=0; i<iSpikingChemSynCount; i++)
1195 double z,tau,Minf,Hinf,dM,dH;
1273 double noise =(double)
Std_LRand(0, RAND_MAX)/ RAND_MAX;
1310 THROW_PARAM_ERROR(Rn_Err_lIonChannelNotFound, Rn_Err_strIonChannelNotFound,
"ID", strID);
1331 for(
int iIndex=0; iIndex<iCount; iIndex++)
1336 THROW_TEXT_ERROR(Rn_Err_lIonChannelNotFound, Rn_Err_strIonChannelNotFound,
"ID");
1361 m_fltGm = (float) (1/(m_dSize*1e6));
1408 for(
int iIndex = 0; iIndex<iSize; iIndex++)
1419 #pragma region DataAccesMethods
1425 if(strType ==
"MEMBRANEVOLTAGE")
1428 if(strType ==
"ADAPTERCURRENT")
1431 if(strType ==
"EXTERNALCURRENT")
1434 if(strType ==
"FIRINGFREQUENCY")
1437 if(strType ==
"THRESHOLD")
1440 if(strType ==
"ELECTRICALSYNAPTICCURRENT")
1443 if(strType ==
"NONSPIKINGSYNAPTICCURRENT")
1446 if(strType ==
"SPIKINGSYNAPTICCURRENT")
1449 if(strType ==
"IONCHANNELCURRENT")
1452 if(strType ==
"CACURRENT")
1455 if(strType ==
"TOTALCURRENT")
1458 if(strType ==
"SPIKE")
1464 if(strType ==
"VREST")
1467 if(strType ==
"GTOTAL")
1474 THROW_PARAM_ERROR(Rn_Err_lInvalidNeuronDataType, Rn_Err_strInvalidNeuronDataType,
"Neuron Data Type", strDataType);
1479 bool Neuron::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
1483 if(Node::SetData(strDataType, strValue,
false))
1486 if(strType ==
"RESTINGPOTENTIAL")
1492 if(strType ==
"RELATIVESIZE")
1494 Size(atof(strValue.c_str()));
1498 if(strType ==
"TIMECONSTANT")
1504 if(strType ==
"INITIALTHRESHOLD")
1510 if(strType ==
"RELATIVEACCOMODATION")
1516 if(strType ==
"ACCOMODATIONTIMECONSTANT")
1522 if(strType ==
"AHP_CONDUCTANCE")
1528 if(strType ==
"AHP_TIMECONSTANT")
1534 if(strType ==
"MAXCACONDUCTANCE")
1540 if(strType ==
"BURSTINITATBOTTOM")
1546 if(strType ==
"TONICSTIMULUS")
1552 if(strType ==
"TONICNOISE")
1554 TonicNoise(atof(strValue.c_str()));
1558 if(strType ==
"ADDEXTERNALCURRENT")
1566 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
1571 void Neuron::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
1573 Node::QueryProperties(aryProperties);
1575 aryProperties.Add(
new TypeProperty(
"MembraneVoltage", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1576 aryProperties.Add(
new TypeProperty(
"AdapterCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1577 aryProperties.Add(
new TypeProperty(
"ExternalCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1578 aryProperties.Add(
new TypeProperty(
"FiringFrequency", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1579 aryProperties.Add(
new TypeProperty(
"Threshold", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1580 aryProperties.Add(
new TypeProperty(
"ElectricalSynapticCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1581 aryProperties.Add(
new TypeProperty(
"NonSpikingSynapticCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1582 aryProperties.Add(
new TypeProperty(
"SpikingSynapticCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1583 aryProperties.Add(
new TypeProperty(
"IonChannelCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1584 aryProperties.Add(
new TypeProperty(
"CaCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1585 aryProperties.Add(
new TypeProperty(
"TotalCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1586 aryProperties.Add(
new TypeProperty(
"Spike", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
1587 aryProperties.Add(
new TypeProperty(
"Gm", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1588 aryProperties.Add(
new TypeProperty(
"Vrest", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1589 aryProperties.Add(
new TypeProperty(
"Gtotal", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1590 aryProperties.Add(
new TypeProperty(
"E", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1592 aryProperties.Add(
new TypeProperty(
"RestingPotential", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1593 aryProperties.Add(
new TypeProperty(
"RelativeSize", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1594 aryProperties.Add(
new TypeProperty(
"TimeConstant", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1595 aryProperties.Add(
new TypeProperty(
"InitialThreshold", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1596 aryProperties.Add(
new TypeProperty(
"RelativeAccomodation", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1597 aryProperties.Add(
new TypeProperty(
"AccomodationTimeConstant", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1598 aryProperties.Add(
new TypeProperty(
"AHP_Conductance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1599 aryProperties.Add(
new TypeProperty(
"AHP_TimeConstant", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1600 aryProperties.Add(
new TypeProperty(
"MaxCAConductance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1601 aryProperties.Add(
new TypeProperty(
"BurstInitAtBottom", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
1602 aryProperties.Add(
new TypeProperty(
"TonicStimulus", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1603 aryProperties.Add(
new TypeProperty(
"TonicNoise", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1604 aryProperties.Add(
new TypeProperty(
"AddExternalCurrent", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1618 oXml.Deserialize(strXml);
1619 oXml.FindElement(
"Root");
1620 oXml.FindChildElement(
"IonChannel");
1643 bool Neuron::AddItem(
const std::string &strItemType,
const std::string &strXml,
bool bThrowError,
bool bDoNotInit)
1647 if(strType ==
"IONCHANNEL")
1655 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
1664 if(strType ==
"IONCHANNEL")
1672 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
static double m_dAbsoluteRefr
The static absolute refractory period after an action potential.
double m_dDCTH
exponential decline working factor for threshold accommodation
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
void PreCalc(IntegrateFireNeuralModule *lpNS)
Initialization routine.
float m_fltExternalI
The external current.
bool GetZapped()
Gets if the neuron is disabled.
double m_dStim
The stimulus current.
Spiking chemical synapse type.
Declares the integrate fire module class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
CaActivation * m_lpCaActive
The pointer to the calcium activation object.
Integrate and fire neural module.
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 BurstVh()
Gets the burst inactivation mid point.
void Cd(bool bVal)
Sets whether Cadmium is applied to the nervous system.
double m_dToniCurrentStimulusulus
A tonic current stimulus that can be applied to the neuron.
double m_dNonSpikingSynCur
The non-spiking synaptic current.
static double m_dCaEquilPot
The static calcium equil pot.
AnimatSim::Behavior::NeuralModule * m_lpModule
The pointer to this items parentNeuralModule. If this is not relevant for this object then this is NU...
float m_fltGTotal
Reported g total.
bool m_bVoltDep
true if voltage dependent
void TTX(bool bVal)
Sets whether ttx is applied to the nervous system.
double m_dGMaxCa
The maximum conductance of the calcium current.
void IncrementStim(double stim)
Increments the current stimulus.
double m_dCm
The membrane capacitance.
CStdPtrArray< IonChannel > * IonChannels()
Gets the ion channels.
CaActivation * m_lpCaInactive
The pointer to the calcium inactivation object.
int NeuronID()
Gets the neuron ID.
double m_dDecay
The synaptic decay.
virtual void ResetSimulation()
Resets the simulation back to time 0.
void InElectricalSynapseCond(double cond)
Increments electrical synapse conductance.
float m_fltChannelI
The ioin channel current.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
double GetTimeStep()
Gets the time step.
double m_dNewMemPot
The next membrane potential.
float m_fltAdapterMemoryI
The adapter current memory. This is used to allow datacharts to track current input from adapters...
Declares the connexion class.
double GetCurrentTime()
Gets the current time.
double m_dRestingPot
The resting potential of the neuron.
Simulator * m_lpSim
The pointer to a Simulation.
double m_dAHPTimeConst
The after-hyperpolarizing time constant.
virtual std::string ID()
Gets the unique GUID ID of this object.
double m_dElecSynCond
The electrical synaptic condutance.
bool m_bZapped
Sets whether the neuron is disabled or not.
float m_fltSpikingSynCurMemory
The spiking synaptic current memory. Used for reporting purposes.
float m_fltMemPot
The memory potential. This is for reporting purposes.
IntegrateFireNeuralModule * m_lpIGFModule
The pointer to the parent IntegrateFireNeuralModule.
IonChannel * FindIonChannel(std::string strID, bool bThrowError)
Searches for an ion channel with the matching ID.
double m_dDGK
exponential decline factor for AHP
double m_dSize
Size of the neuron. This is essentially equivalent to the membrane conductance.
void CalcUpdateFinal(IntegrateFireNeuralModule *lpNS)
Calculates the final update during a step.
long m_lRefrCountDown
The refractory count down.
void InElectricalSynapseCurr(double cur)
Increments electrical synapse current.
double m_dMaxRelCond
The maximum relative conductance.
virtual void AddExternalI(float fltVal)
Adds to the external current.
double m_dEquil
The equilibruim potential.
static double m_dSpikePeak
The static spike peak.
virtual void Initialize()
Initializes this object.
float m_fltFiringFreq
The firing frequency.
double InitialThreshold()
Gets the initial threshold.
virtual bool Enabled()
Tells whether this node is enabled.
float m_fltChannelMemoryI
The ion channel current memory. This is used to allow datacharts to track current input from ion chan...
virtual IonChannel * LoadIonChannel(CStdXml &oXml)
Loads an ion channel.
double Size()
Gets the size of the neuron.
void IncNonSpikingSynCurr(double cur)
Increment non-spiking syn current.
static double m_dAHPEquilPot
The static after-hyperpolarizing equil pot. Typically equil pot for K.
double TimeConstant()
Gets the time constant.
Declares the spiking chemical synapse class.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
CStdArray< double > m_arySynG
Current conductance of each synaptic type.
std::string m_strID
The unique Id for this object.
std::string Std_Trim(std::string strVal)
Trims a string.
double GetThresh()
Gets the votlge threshold.
double m_dSatPSPot
The saturation post-synaptic potential.
virtual void RemoveIonChannel(std::string strID, bool bThrowError=true)
Removes the ion channel.
float m_fltSpike
The spike memory. Used for reporting purposes.
double BurstHTimeConstant()
Gets the burst inactivation time constant.
double RestingPotential()
Gets the resting potential.
double GetRestingPot()
Gets the resting potential.
double BurstSm()
Gets the burst Activation slope.
double m_dGTot
cummulative total contuctance
double m_dSH
Inactivation slope of the calcium current.
double m_dVM
Activation mid point of the calcium current.
Declares the ca activation class.
SpikingChemicalSynapse * GetSpikingChemSynAt(int i)
Gets a spiking chemical synapse at the specified array index.
bool BurstInitAtBottom()
Gets the burst inactivation time constant.
double AccomodationTimeConstant()
Gets the accomodation time constant.
CStdArray< double > m_aryFacilD
exponential decline factor in facilitation.
double m_dMemPot
The membrane potential.
double m_dRelativeAccom
The amount of relative accommodation. This ranges from 0 to 1.
double m_dTimeConst
The time constant for the neuron.
double BurstGMaxCa()
Gets the burst maximum calcium conductance.
double m_dM
The activation variable.
double m_dThreshPSPot
The threshold post-synaptic potential.
double m_dSM
Activation slope of the calcium current.
void ScaleCondForVoltDep(double &G, double postV, double maxV, double minV, double scl)
Scale conductance for volt dependance.
float m_fltNonSpikingSynCurMemory
The non-spiking synaptic current memory. Used for reporting purposes.
static long m_lAbsoluteRefr
The static absolute refractory period in timeslices after an action potential.
virtual int FindIonChannelListPos(std::string strID, bool bThrowError=true)
Searches for an ion channel with the specified ID and returns its position in the array...
double BurstMTimeConstant()
Gets the burst activation time constant.
double AHPTimeConstant()
Gets the after-hyperpolarizing time constant.
bool Std_ToBool(int iVal)
Converts a value toa bool.
double TonicStimulus()
Gets the tonic stimulus current of the neuron.
double m_dNoise
The noise being applied to the membrane.
Declares the synapse type class.
bool GetSpike()
Gets whether a spike occured.
float m_fltGm
The membrane conductance. Used for reporting purposes.
double AHPAmplitude()
Gets the after-hyperpolarizing conductance amplitude.
virtual void AddIonChannel(std::string strXml, bool bDoNotInit)
Adds an ion channel from an xml packet definition.
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
void CalculateFiringFreq(IntegrateFireNeuralModule *lpNS)
Calculates the firing freq.
bool m_bSpike
true if spike occured.
CStdArray< double > m_aryNextSponSynTime
Time to next spontaneous occurrence of this syn type.
virtual ~Neuron()
Destructor.
static double m_dSpikeStrength
The static spike strength used when calculating the action potential.
double m_dSynAmp
base syn amp, before vd or hebb
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Declares the electrical synapse class.
CStdArray< double > m_aryTonicInputPeriod
An array of tonic inputs that can be applied to the neuron.
double GetMemPot()
Gets the membrane potential.
bool m_bBurstInitAtBottom
float m_fltTotalI
The total current.
double RelativeAccomodation()
Gets the relative accomodation.
double m_dH
The inactivation variable.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
double m_fltLastSpikeTime
Time of the last spike.
CStdArray< int > m_aryTonicInputPeriodType
An array of tonic input types that can be applied to the neuron.
double m_dNonSpikingSynCond
The non-spiking synaptic condutance.
double m_dVH
Inactivation mid point of the calcium current.
double m_dHTimeConst
Inactivation time constant the calcium current.
double m_dElecSynCur
The electrical synaptic current.
void PostCalc(IntegrateFireNeuralModule *lpNS)
Called when simulation is ended.
int GetSpikingChemSynCount()
Gets the spiking chemical synapse count.
CStdPtrArray< IonChannel > m_aryIonChannels
The array of ion channels.
int m_iIonChannels
Number of ion channels.
float m_fltElecSynCurMemory
The electrical synaptic current memory. Used for reporting purposes.
Neuron()
Default constructor.
double m_dRelFacil
The relative facilitation amount.
virtual void VerifySystemPointers()
Verify that system pointers have been set correctly.
int m_iNeuronID
Integer ID for the neuron. This is its index in the array of neruons in the neural module...
CStdArray< double > m_aryDG
exponential decline factor in syn G.
double m_dFacilDecay
The facilitation decay.
CStdArray< double > m_aryFacilSponSynG
facilitated initial g increase caused by spontaneous input
float m_fltAdapterI
The adapter current.
double m_dAHPAmp
The after-hyperpolarizing conductance amplitude.
float m_fltICaMemory
The ca current memory.
void IncNonSpikingSynCond(double cond)
Increment non-spiking syn conductance.
void EquilibriumPotential(double dVal)
Sets the equilibrium potential.
double m_dInitialThresh
The initial voltage threshold for the neuron.
double BurstSh()
Gets the burst inactivation slope.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
double m_dMTimeConst
activation time constant the calcium current.
static double m_dDT
The statoc time step.
long Std_LRand(long low, long high)
Generates a random number between two values.
void HH(bool bVal)
Sets whether hodgkin-huxely model is used.
double BurstVm()
Gets the burst activation mid point.
void CalcUpdate(IntegrateFireNeuralModule *lpNS)
Calculates the update during a time step.
Contains all of the classes to implement a basic integrate and fire neural model. ...
float m_fltTotalMemoryI
The total current memory. This is used to allow datacharts to track current input from ion channels...
double m_dGK
cummulative amplitude of AHP conductance
double m_dAccomTimeConst
The accommodation time constant.
double m_dThresh
The voltage threshold.
Declares the non spiking chemical synapse class.
float m_fltVrest
The rest potential. Used for reporting purposes.
float m_fltEMemory
The Reporting variable for E.
Declares the neuron class.
float m_fltThresholdMemory
The threshold potential memory. Used to allow us to chart the threshold if needed.