AnimatLab  2
Test
IntegrateFireSim/Neuron.cpp
Go to the documentation of this file.
1 
7 #include "stdafx.h"
8 #include "IonChannel.h"
9 #include "SynapseType.h"
10 #include "IntegrateFireModule.h"
11 #include "Connexion.h"
12 #include "CaActivation.h"
13 #include "Neuron.h"
14 #include "ElectricalSynapse.h"
16 #include "SpikingChemicalSynapse.h"
17 
18 namespace IntegrateFireSim
19 {
20 
21 
22 double Neuron::m_dSpikePeak=0;
24 double Neuron::m_dAHPEquilPot=-70; // equil pot for K
25 double Neuron::m_dCaEquilPot=200;
28 double Neuron::m_dDT=0.5;
29 
37 {
38 
39  m_bZapped = false;
40  m_dRestingPot = -70;
41  m_dSize = 1;
42  m_dTimeConst = 0;
43  m_dInitialThresh = 0;
44  m_dRelativeAccom = 0;
46  m_dAHPAmp = 0;
47  m_dAHPTimeConst = 0;
48  m_dGMaxCa = 0;
49  m_dVM = 0;
50  m_dSM = 0;
51  m_dMTimeConst = 0;
52  m_dVH = 0;
53  m_dSH = 0;
54  m_dHTimeConst = 0;
55  m_fltGTotal = 0;
56 
58  m_dNoise = 0;
59 
60  m_dMemPot = 0;
61  m_dNewMemPot = 0;
62  m_dThresh = 0;
63  m_bSpike = false;
64  m_fltEMemory = 0;
65 
66  m_dElecSynCur = 0;
67  m_dElecSynCond = 0;
70  m_lRefrCountDown = 0;
71  m_dDCTH = 0;
72  m_dDGK = 0;
73  m_dGK = 0;
74  m_dGTot = 0;
75 
76  m_dStim = 0;;
77 
78  m_dM = 0;
79  m_dH = 0;
80  m_fltEMemory = 0;
81  m_bBurstInitAtBottom = true;
82 
83  m_iNeuronID = 0;
84  m_fltAdapterI = 0;
86  m_fltExternalI = 0;
87  m_fltChannelI = 0;
89  m_fltICaMemory = 0;
90  m_fltMemPot = 0;
93  m_fltFiringFreq = 0;
97  m_iIonChannels = 0;
98  m_fltSpike = 0;
99  m_dCm = 0;
100  m_fltGm = 0;
101  m_fltVrest = 0;
102  m_fltTotalI = 0;
103  m_fltTotalMemoryI = 0;
104  m_lpCaActive = NULL;
105  m_lpCaInactive = NULL;
106 }
107 
115 {
116  if(m_lpCaActive)
117  {delete m_lpCaActive; m_lpCaActive = NULL;}
118 
119  if(m_lpCaInactive)
120  {delete m_lpCaInactive; m_lpCaInactive = NULL;}
121 }
122 
123 
124 #pragma region Accessor-Mutators
125 
135 
144 void Neuron::NeuronID(int iID) {m_iNeuronID = iID;}
145 
146 bool Neuron::Enabled() {return m_bZapped;}
147 
148 void Neuron::Enabled(bool bValue)
149 {
150  Node::Enabled(bValue);
151  m_bZapped = !bValue;
152 }
153 
162 void Neuron::AddExternalI(float fltVal)
163 {
164  m_fltExternalI+=fltVal;
165 }
166 
176 
186 
196 
205 bool Neuron::GetSpike() {return m_bZapped?false:m_bSpike;}
206 
215 bool Neuron::GetZapped() {return m_bZapped;}
216 
225 void Neuron::IncrementStim(double stim) {m_dStim+=stim;}
226 
236 
246 
256 
266 
275 CStdPtrArray<IonChannel> *Neuron::IonChannels() {return &m_aryIonChannels;}
276 
285 void Neuron::RestingPotential(double dVal)
286 {
287  //The mempot variables are calculated, so we do not want to just re-set them to the new value.
288  //instead lets adjust them by the difference between the old and new resting potential.
289  double dDiff = dVal - m_dRestingPot;
290 
291  m_dRestingPot = dVal;
292  m_dMemPot += dDiff;
293  m_dNewMemPot += dDiff;
294 }
295 
305 
314 void Neuron::Size(double dVal)
315 {
316  m_dSize = dVal;
317  m_fltGm = (float) (1/(m_dSize*1e6));
319 }
320 
329 double Neuron::Size() {return m_dSize;}
330 
339 void Neuron::TimeConstant(double dVal)
340 {
341  m_dTimeConst = dVal;
343 }
344 
354 
363 void Neuron::InitialThreshold(double dVal)
364 {
365  m_dInitialThresh = dVal;
367  m_fltThresholdMemory = (float) m_dThresh * 0.001;
368 }
369 
379 
389 
399 
409 {
410  m_dAccomTimeConst = dVal;
412 }
413 
423 
432 void Neuron::AHPAmplitude(double dVal) {m_dAHPAmp = dVal;}
433 
442 double Neuron::AHPAmplitude() {return m_dAHPAmp;}
443 
452 void Neuron::AHPTimeConstant(double dVal)
453 {
454  m_dAHPTimeConst = dVal;
456 }
457 
467 
476 void Neuron::BurstGMaxCa(double dVal)
477 {
478  m_dGMaxCa = dVal;
479 
481  {
482  m_dMemPot=m_dRestingPot+7.408;
483  m_dM=0.0945;
484  m_dH=0.0208;
485  }
486  else
487  {
489  m_dM=0.0f;
490  m_dH=0.0f;
491  }
492 
493 }
494 
503 double Neuron::BurstGMaxCa() {return m_dGMaxCa;}
504 
513 void Neuron::BurstVm(double dVal) {m_dVM = dVal;}
514 
523 double Neuron::BurstVm() {return m_dVM;}
524 
533 void Neuron::BurstSm(double dVal) {m_dSM = dVal;}
534 
543 double Neuron::BurstSm() {return m_dSM;}
544 
553 void Neuron::BurstMTimeConstant(double dVal) {m_dMTimeConst = dVal;}
554 
564 
573 void Neuron::BurstVh(double dVal) {m_dVH = dVal;}
574 
583 double Neuron::BurstVh() {return m_dVH;}
584 
593 void Neuron::BurstSh(double dVal) {m_dSH = dVal;}
594 
603 double Neuron::BurstSh() {return m_dSH;}
604 
613 void Neuron::BurstHTimeConstant(double dVal) {m_dHTimeConst = dVal;}
614 
624 
634 {
635  m_bBurstInitAtBottom = bVal;
637 }
638 
648 
657 void Neuron::TonicStimulus(double dblVal)
658 {
660 }
661 
671 
672 void Neuron::TonicNoise(double dblVal)
673 {
674  m_dNoise = dblVal;
675 }
676 
677 double Neuron::TonicNoise() {return m_dNoise;}
678 
679 #pragma endregion
680 
681 
682 void Neuron::SetSystemPointers(Simulator *lpSim, Structure *lpStructure, AnimatSim::Behavior::NeuralModule *lpModule, Node *lpNode, bool bVerify)
683 {
684  Node::SetSystemPointers(lpSim, lpStructure, lpModule, lpNode, false);
685 
686  m_lpIGFModule = dynamic_cast<IntegrateFireNeuralModule *>(lpModule);
687 
688  if(bVerify) VerifySystemPointers();
689 }
690 
692 {
693  Node::VerifySystemPointers();
694 
695  if(!m_lpIGFModule)
696  THROW_PARAM_ERROR(Al_Err_lStructureNotDefined, Al_Err_strStructureNotDefined, "IGFModule: ", m_strID);
697 }
698 
699 void Neuron::Load(CStdXml &oXml)
700 {
701  int i;
702  int j;
703  double d;
704 
705  m_aryTonicInputPeriod.RemoveAll();
706  m_aryTonicInputPeriodType.RemoveAll();
707 
708  Node::Load(oXml);
709 
710  oXml.IntoElem(); //Into Neuron Element
711  Enabled(oXml.GetChildBool("Enabled", true));
712  m_dToniCurrentStimulusulus=oXml.GetChildDouble("TonicStimulus");
713  m_dNoise=oXml.GetChildDouble("Noise");
714  m_dRestingPot=oXml.GetChildDouble("RestingPot");
715  m_dSize=oXml.GetChildDouble("Size");
716  m_dTimeConst=oXml.GetChildDouble("TimeConst");
717  m_dInitialThresh=oXml.GetChildDouble("InitialThresh");
718  m_dRelativeAccom=oXml.GetChildDouble("RelativeAccom");
719  m_dAccomTimeConst=oXml.GetChildDouble("AccomTimeConst");
720  m_dAHPAmp=oXml.GetChildDouble("AHPAmp");
721  m_dAHPTimeConst=oXml.GetChildDouble("AHPTimeConst");
722  m_dGMaxCa=oXml.GetChildDouble("GMaxCa");
723  m_bBurstInitAtBottom=oXml.GetChildBool("BurstInitAtBottom", m_bBurstInitAtBottom);
724 
725  if(oXml.FindChildElement("CaActivation", false))
726  {
727  if(m_lpCaActive)
728  {delete m_lpCaActive; m_lpCaActive = NULL;}
729  m_lpCaActive = new CaActivation(this, "ACTIVE");
731  m_lpCaActive->Load(oXml);
732  }
733 
734  if(oXml.FindChildElement("CaDeactivation", false))
735  {
736  if(m_lpCaInactive)
737  {delete m_lpCaInactive; m_lpCaInactive = NULL;}
738  m_lpCaInactive = new CaActivation(this, "INACTIVE");
740  m_lpCaInactive->Load(oXml);
741  }
742 
743  m_fltGm = (float) (1/(m_dSize*1e6));
744  m_fltVrest = (float) (m_dRestingPot*1e-3);
745 
746  if(oXml.FindChildElement("NeuronTonicInputs", false) )
747  {
748  oXml.IntoElem();
749  int iTotalNeuronTonicInputs = oXml.NumberOfChildren();
750  for(i=0; i<iTotalNeuronTonicInputs; i++)
751  {
752  oXml.FindChildByIndex(i);
753  oXml.IntoElem(); //Into NeuronTonicInput Element
754  d=oXml.GetChildDouble("TonicInputPeriod");
755  j=oXml.GetChildInt("TonicInputPeriodType");
756  m_aryTonicInputPeriod.Add(d);
758  oXml.OutOfElem(); //OutOf NeuronTonicInput Element
759  }
760  oXml.OutOfElem(); //OutOf NeuronTonicInputs Element
761  }
762  else
763  {
764  int iSpikingChemSynCount=m_lpIGFModule->GetSpikingChemSynCount();
765  for(i=0; i<iSpikingChemSynCount; i++)
766  {
767  m_aryTonicInputPeriod.Add(0);
769  }
770  }
771 
772 
773  m_aryIonChannels.RemoveAll();
774  if(oXml.FindChildElement("IonChannels", false) )
775  {
776  oXml.IntoElem();
777 
778  m_iIonChannels = oXml.NumberOfChildren();
779  for(int iIndex=0; iIndex<m_iIonChannels; iIndex++)
780  {
781  oXml.FindChildByIndex(iIndex);
782  LoadIonChannel(oXml);
783  }
784 
785  oXml.OutOfElem();
786  }
787 
788  oXml.OutOfElem(); //OutOf Neuron Element
789 }
790 
802 {
803  IonChannel *lpIonChannel = NULL;
804 
805 try
806 {
807  lpIonChannel = new IonChannel();
808  lpIonChannel->SetSystemPointers(m_lpSim, m_lpStructure, m_lpModule, this, true);
809  lpIonChannel->Load(oXml);
810  m_aryIonChannels.Add(lpIonChannel);
811 
812  return lpIonChannel;
813 }
814 catch(CStdErrorInfo oError)
815 {
816  if(lpIonChannel) delete lpIonChannel;
817  RELAY_ERROR(oError);
818  return NULL;
819 }
820 catch(...)
821 {
822  if(lpIonChannel) delete lpIonChannel;
823  THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
824  return NULL;
825 }
826 }
827 
828 //void Neuron::ClearSpikeTimes()
829 //{
830 // for(int iIndex=0; iIndex<m_iSpikesToKeepForFreqAnal; iIndex++)
831 // m_arySpikeTimes[iIndex] = -1;
832 //}
833 /*
834 void Neuron::StoreSpikeForFreqAnalysis(IntegrateFireNeuralModule *lpNS)
835 {
836  //First push all of the current values down the list.
837  for(int iIndex=(m_iSpikesToKeepForFreqAnal-1); iIndex>0; iIndex--)
838  m_arySpikeTimes[iIndex] = m_arySpikeTimes[iIndex-1];
839 
840  //Now put this one on as the first one.
841  m_arySpikeTimes[0] = lpNS->GetCurrentTime();
842 }
843 */
844 
845 //void Neuron::CalculateFiringFreq(IntegrateFireNeuralModule *lpNS)
846 //{
847 // int iIndex = 0, iSpikeCount = 0;
848 // double fltDiff=0, dblLastSpike=0;
849 //
850 // //First push all of the current values down the list.
851 // for(iIndex=(m_iSpikesToKeepForFreqAnal-1); iIndex>0; iIndex--)
852 // m_arySpikeTimes[iIndex] = m_arySpikeTimes[iIndex-1];
853 //
854 // //Now put this one on as the first one.
855 // m_arySpikeTimes[0] = lpNS->GetCurrentTime();
856 //
857 //
858 // //Lets loop through the stack of past spike times to count how many to use.
859 // iIndex = 0;
860 // while(iIndex<m_iSpikesToKeepForFreqAnal && m_arySpikeTimes[iIndex] >= 0)
861 // {
862 // fltDiff = lpNS->GetCurrentTime() - m_arySpikeTimes[iIndex];
863 //
864 // //Only use spikes that occurred within 1 second of the current time.
865 // if(fltDiff <= 1000)
866 // {
867 // iSpikeCount++;
868 // dblLastSpike = m_arySpikeTimes[iIndex];
869 // }
870 // else
871 // m_arySpikeTimes[iIndex] = -1;
872 //
873 // iIndex++;
874 // }
875 //
876 // if(iSpikeCount>5 && dblLastSpike >0)
877 // {
878 // if(dblLastSpike == lpNS->GetCurrentTime())
879 // m_fltFiringFreq = 1;
880 // else
881 // m_fltFiringFreq = iSpikeCount/((lpNS->GetCurrentTime()-dblLastSpike)/1000);
882 // }
883 // else
884 // m_fltFiringFreq = 0;
885 //
886 //}
887 
897 {
898  if(m_bSpike)
899  {
900  double dblDiff = (lpNS->GetCurrentTime() - m_fltLastSpikeTime)/(double) 1000.0;
901 
902  if(dblDiff > 0)
903  m_fltFiringFreq = 1/dblDiff;
904  else
905  m_fltFiringFreq = NO_FREQ_DATA;
906 
908  }
909  else
910  m_fltFiringFreq = NO_FREQ_DATA;
911 }
912 
914 // ENGINE
915 
925 {
926 //Std_TraceMsg(0,"In Neuron::PreCalc");
927 
928  int i;
929  int iSpikingChemSynCount=lpNS->GetSpikingChemSynCount();
930 
931  //Size is in Mohms, Current is in na, and volt is in mv, Time is in milliseconds.
932  //so T=RC => C = T/R, where R = 1/Size. You make the size smaller it increases Rm.
933  //So C = T*Size; C needs to be nF, (mS/Mohm) = nF
935 
936  m_arySynG.SetSize(iSpikingChemSynCount);
937  m_aryDG.SetSize(iSpikingChemSynCount);
938  m_aryFacilD.SetSize(iSpikingChemSynCount);
939 
940  m_aryFacilSponSynG.SetSize(iSpikingChemSynCount);
941  m_aryNextSponSynTime.SetSize(iSpikingChemSynCount);
942  m_aryTonicInputPeriodType.SetSize(iSpikingChemSynCount);
943  m_aryTonicInputPeriod.SetSize(iSpikingChemSynCount);
944 
945  SpikingChemicalSynapse *lpSCSyn=NULL;
946  for (i=0; i<iSpikingChemSynCount; i++)
947  {
948  lpSCSyn = lpNS->GetSpikingChemSynAt(i);
949  if (lpSCSyn->m_dSynAmp==0)
950  continue;
951  m_arySynG[i]=0.;
952  if (m_aryTonicInputPeriodType[i]==0)
953  m_aryNextSponSynTime[i]=0.;
954  else
955  m_aryNextSponSynTime[i]=(-m_aryTonicInputPeriod[i]*log(double (Std_LRand(0, RAND_MAX))/double(RAND_MAX))+1);
956  m_aryFacilSponSynG[i]=lpSCSyn->m_dSynAmp;
957 
958  m_aryDG[i]=exp(-m_dDT/lpSCSyn->m_dDecay);
959  m_aryFacilD[i]=exp(-m_dDT/lpSCSyn->m_dFacilDecay);
960 
961  //Std_TraceMsg(0, "I: " + STR(i) + " SynG: " + STR(m_arySynG[i]) + " NextSyn: " + STR(m_aryNextSponSynTime[i]) + " FacilG: " + STR(m_aryFacilSponSynG[i]) + " DG: " + STR(m_aryDG[i]) + " FacilD: " + STR(m_aryFacilD[i]));
962  }
963 
964  m_dGK=0;
965  m_bSpike=false;
969 
972  m_fltThresholdMemory = (float) m_dThresh * 0.001;
973 
974 // burster bits
975 // initialise to bottom of burst??
977  {
978  m_dMemPot=m_dRestingPot+7.408;
979  m_dM=0.0945;
980  m_dH=0.0208;
981  }
982  else
983  {
985  m_dM=0.0f;
986  m_dH=0.0f;
987  }
988 
991 
992  //if(m_arySpikeTimes)
993  //{
994  // delete m_arySpikeTimes;
995  // m_arySpikeTimes = NULL;
996  //}
997 
998  //m_arySpikeTimes = new double[m_iSpikesToKeepForFreqAnal];
999  //ClearSpikeTimes();
1000 
1001  m_dStim=0;
1002  m_fltAdapterI = 0;
1003  m_fltAdapterMemoryI = 0;
1004  m_fltMemPot = m_dMemPot * 0.001;
1005 }
1006 
1016 {
1017  int i;
1019 
1020  if (m_lRefrCountDown>0)
1021  {
1022  m_lRefrCountDown--;
1023  m_bSpike=false;
1024  }
1025  else if (lpNS->TTX() || lpNS->HH())
1026  m_bSpike=false;
1027  else
1028  m_bSpike=(m_dMemPot>m_dThresh) ? true : false;
1029 
1030  if (m_bSpike)
1032 
1033  m_fltSpike = (float) m_bSpike;
1034  CalculateFiringFreq(lpNS);
1035 
1036  for (i=0; i<m_arySynG.size(); i++)
1037  {
1038  if (m_arySynG[i]>0)
1039  m_arySynG[i]*=m_aryDG[i]; // decrease previous syn G exponentially with time, unless never increased
1040  }
1041 
1043  m_fltThresholdMemory = (float) m_dThresh * 0.001;
1044 
1045  //ASSERT(m_dStim==0.); // ready for next iteration
1046 }
1047 
1057 {
1058  m_arySynG.RemoveAll(); // current conductance of each synaptic type
1059  m_aryFacilSponSynG.RemoveAll(); // facilitated initial g increase caused by input
1060  m_aryDG.RemoveAll(); // exponential decline factor in syn G
1061  m_aryFacilD.RemoveAll(); // exponential decline factor in facilitation
1062  m_aryNextSponSynTime.RemoveAll(); // time to next occurrence of this syn type
1063 }
1064 
1074 {
1075  double GS,GSI; // total synaptic cond, current
1076  double gCa,iCa; // Ca cond, current
1077  double E,DCE; // mempot-restpot,expon decline factor in mem pot to resting pot
1078  int i;
1079 
1080  double testD;
1081 
1082  if (m_bZapped) // don't bother calculating anything else if zapped
1083  return;
1084 
1085 // do tonic current input
1086  m_dStim+= (m_dToniCurrentStimulusulus + m_fltAdapterI + (m_fltExternalI*1e9));
1087  m_fltAdapterI = 0;
1090 
1091 //Go through the ion channels and calculate their currents.
1092 //Convert time from ms to s, and membrane voltage from mv to v
1093  m_fltChannelMemoryI = 0;
1094  float fltStep = lpNS->GetTimeStep()*1e-3f;
1095  float fltVm = m_dMemPot*1e-3f;
1096  for(int iChannel=0; iChannel<m_iIonChannels; iChannel++)
1097  m_fltChannelMemoryI+=m_aryIonChannels[iChannel]->CalculateCurrent(fltStep, fltVm);
1098  m_fltChannelI=m_fltChannelMemoryI*1e9f; //Currents are always in nA in this model.
1099 
1100 // adjust current injection for size of cell
1101  m_dStim/=m_dSize;
1103 
1104 // Do spontaneous spiking synaptic input
1105 // Each neuron can get tonic input from any synaptic type which
1106 // acts as if a single unknown pre-synaptic neuron of that type inputs either
1107 // regular (type==0) or random (type==1) PSPs.
1108 
1109  if (!lpNS->Cd()) // cadmium blocks all chem synapses & gCa
1110  {
1111  int iSpikingChemSynCount=lpNS->GetSpikingChemSynCount();
1112  for (i=0; i<iSpikingChemSynCount; i++)
1113  {
1115  if (pSyn->m_dSynAmp==0)
1116  continue;
1117 
1118  if (m_aryTonicInputPeriod[i]>0) // if there is spontaneous input
1119  {
1120  if (pSyn->m_dRelFacil!=1) // if facil exists, decrease its amount with time
1122 
1123  testD=m_aryNextSponSynTime[i];
1124 
1125  if (m_aryNextSponSynTime[i]<=0) // due another input
1126  {
1127  // check that synapse has not decremented below zero
1128  //(you can't take away existing G)
1129  if (m_aryFacilSponSynG[i]>0)
1130  {
1131  double block=1.;
1132  #if 0
1133  if (m_pNetworkData->m_bBlockedList[i])
1134  {
1135  //ASSERT(m_pNetworkData->GetPartialBlockInUse());
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;
1140  //ASSERT(block>=0. && block<=1.);
1141  }
1142  #endif
1143  m_arySynG[i]+=block*m_aryFacilSponSynG[i]; // add new synaptic occurrence
1144  }
1145 
1146  // facilitate next response, add residual facil to new syn amp
1147  m_aryFacilSponSynG[i]=(m_aryFacilSponSynG[i]-pSyn->m_dSynAmp) + (pSyn->m_dSynAmp*pSyn->m_dRelFacil); // if <0, ignore
1148 
1149  if (m_aryTonicInputPeriodType[i]==0)
1151  else
1152  m_aryNextSponSynTime[i]=(-m_aryTonicInputPeriod[i]*log(double (Std_LRand(0, RAND_MAX))/double(RAND_MAX))+1);
1153  }
1155  }
1156  }
1157 
1158 
1159  // adjust for voltage dependency by scaling conductance on Neuron
1160  // need local storage, so can do volt dep without altering basic cond
1161  // could do this within m_pInputCx, but since several cx may use same voltage dependent
1162  // synaptic type, more efficient to do outside??
1163  CStdArray<double> arySynG;
1164  arySynG.SetSize(iSpikingChemSynCount);
1165  for (i=0; i<iSpikingChemSynCount; i++)
1166  {
1168  arySynG[i]=m_arySynG[i];
1169  if (pSyn->m_bVoltDep)
1170  lpNS->ScaleCondForVoltDep(arySynG[i],GetMemPot(),
1171  pSyn->m_dSatPSPot,pSyn->m_dThreshPSPot,pSyn->m_dMaxRelCond);
1172 
1173  }
1174 
1175  // sum spiking synaptic stuff
1176  GS=GSI=0;
1178  for (i=0; i<iSpikingChemSynCount; i++)
1179  {
1181  if (pSyn->m_dSynAmp==0)
1182  continue;
1183  GS+=arySynG[i];
1184  // NOTE: the following looks wrong (driving force should be relative to current mempot,
1185  // not resting pot), but is actually right. It's the exponential predictor maths
1186  // (all currents relative to rest ????)
1187  GSI+=(arySynG[i]*(pSyn->m_dEquil-m_dRestingPot));
1188  m_fltSpikingSynCurMemory += (arySynG[i]*(pSyn->EquilibriumPotential()-GetMemPot()));
1189  }
1190  m_fltSpikingSynCurMemory *= (float) 1e-9;
1191 
1192  // do burster
1193  if (m_dGMaxCa>0)
1194  {
1195  double z,tau,Minf,Hinf,dM,dH;
1196  gCa=m_dGMaxCa*m_dM*m_dH;
1197  //ASSERT(m_dM>=0 && m_dM <=1 && m_dH>=0 && m_dH<=1);
1198  // again, looks wrong but is right
1199  iCa=gCa*(m_dCaEquilPot-m_dRestingPot);
1200  m_fltICaMemory = iCa*1e-9;
1201  // update M & H variables
1202  z=exp(-m_dSM*(m_dMemPot-m_dVM));
1203  Minf=1/(1+z);
1204  tau=Minf*sqrt(z)*m_dMTimeConst;
1205  dM=(Minf-m_dM)*(1-exp(-m_dDT/tau));
1206 
1207  z=exp(-m_dSH*(m_dMemPot-m_dVH))*0.5;
1208  Hinf=1/(1+z);
1209  tau=Hinf*sqrt(z)*m_dHTimeConst;
1210  dH=(Hinf-m_dH)*(1-exp(-m_dDT/tau));
1211 
1212  m_dM+=dM;
1213  m_dH+=dH;
1214  //TRACE("M= %lf\t\tH=%lf\tpot = %lf\n",m_M,m_H,m_MemPot);
1215  }
1216  else
1217  m_fltICaMemory=gCa=iCa=0;
1218  }
1219  else // cadmium applied, no chem input or g/iCa
1220  m_fltICaMemory=gCa=iCa=GS=GSI=0;
1221 
1222  // do membrane potential
1223  //If the HH flag is not set then calculate E in standard way outlined by Heitler.
1224  //If HH flag is set then do not do integrate and fire portion, but instead just use basic equation of dividing
1225  //currents by capacitance.
1226  m_dGK=m_dGK*m_dDGK+m_bSpike*m_dAHPAmp; // cummulative AHP cond
1227  m_dGTot=1+GS+m_dGK+gCa+m_dElecSynCond+m_dNonSpikingSynCond; // total membrane cond
1228  DCE=exp(-m_dGTot*m_dDT/m_dTimeConst);
1229  m_fltGTotal = m_dGTot/(1-DCE);
1230 
1231  if(!lpNS->HH())
1232  {
1233  //E=(m_dMemPot-m_dRestingPot)*DCE+
1234  // (m_dStim+m_fltChannelI+GSI+m_dGK*(m_dAHPEquilPot-m_dRestingPot)+iCa+m_dElecSynCur+m_dNonSpikingSynCur)
1235  // *(1-DCE)/m_dGTot;
1237  E=(m_dMemPot-m_dRestingPot)*DCE+(m_fltTotalI*(1-DCE)/m_dGTot);
1238  }
1239  else
1240  {
1242  //E=(m_dStim+m_fltChannelI+GSI+m_dGK*(m_dAHPEquilPot-m_dRestingPot)+iCa+m_dElecSynCur+m_dNonSpikingSynCur)/m_dCm;
1243  E=m_fltTotalI/m_dCm;
1244  }
1245 
1247 
1249  m_dNonSpikingSynCur=m_dNonSpikingSynCond=0;
1250  m_dStim=0.;
1251 // to add electrical synapse
1252 // 1. sum together all elect syn conds (problem with scaling different sized cells here)
1253 // (let neurons have a size factor (relative to 1), then scale defined cond by size
1254 // (increase if < 1, decrease if > 1), so get more current into small cells.
1255 // do same thing for stimulus amp
1256 // this means that chemical conds are per unit area, and so changes in cell size
1257 // have no effect on voltage, but elect syn and injected current have voltage effects
1258 // which scale with size
1259 // 2. add total elect synaptic conductance to m_GTot
1260 // 3. sum all elect syn currents (G_Elec*(other_neuron_mempot-this_neuron_restpot))
1261 // 4. put sum into current part of eqn E= ...
1262 
1263 
1264  // do threshold
1266  // do spike
1269 
1270 // add noise as mempot fluctuation
1271  if (m_dNoise!=0)
1272  {
1273  double noise =(double) Std_LRand(0, RAND_MAX)/ RAND_MAX;
1274  noise-=0.5;
1275  noise*=m_dNoise;
1276  m_dNewMemPot+=noise;
1277  }
1278 
1279 }
1280 
1281 //Node Overrides
1282 
1283 void Neuron::AddExternalNodeInput(int iTargetDataType, float fltInput)
1284 {
1285  if(!m_bZapped)
1286  {
1287  m_fltAdapterI += (fltInput*1e9);
1289  }
1290 }
1291 
1303 IonChannel *Neuron::FindIonChannel(std::string strID, bool bThrowError)
1304 {
1305  for(int iChannel=0; iChannel<m_iIonChannels; iChannel++)
1306  if(m_aryIonChannels[iChannel]->ID() == strID)
1307  return m_aryIonChannels[iChannel];
1308 
1309  if(bThrowError)
1310  THROW_PARAM_ERROR(Rn_Err_lIonChannelNotFound, Rn_Err_strIonChannelNotFound, "ID", strID);
1311 
1312  return NULL;
1313 }
1314 
1326 int Neuron::FindIonChannelListPos(std::string strID, bool bThrowError)
1327 {
1328  std::string sID = Std_ToUpper(Std_Trim(strID));
1329 
1330  int iCount = m_aryIonChannels.GetSize();
1331  for(int iIndex=0; iIndex<iCount; iIndex++)
1332  if(m_aryIonChannels[iIndex]->ID() == sID)
1333  return iIndex;
1334 
1335  if(bThrowError)
1336  THROW_TEXT_ERROR(Rn_Err_lIonChannelNotFound, Rn_Err_strIonChannelNotFound, "ID");
1337 
1338  return -1;
1339 }
1340 
1342 {
1343  m_fltAdapterI = 0;
1344  m_fltAdapterMemoryI = 0;
1345  m_fltExternalI = 0;
1346  m_fltChannelI = 0;
1347  m_fltChannelMemoryI = 0;
1348  m_fltICaMemory = 0;
1349  m_fltMemPot = 0;
1351  m_fltLastSpikeTime = 0;
1352  m_fltFiringFreq = 0;
1356  m_fltSpike = 0;
1357  m_fltTotalI = 0;
1358  m_fltTotalMemoryI = 0;
1359  m_fltSpike = 0;
1361  m_fltGm = (float) (1/(m_dSize*1e6));
1362  m_fltVrest = (float) (m_dRestingPot*1e-3);
1363  m_fltEMemory = 0;
1364 
1365  m_dGK=0;
1366  m_bSpike=false;
1369  m_lRefrCountDown=0;
1370 
1373  m_fltThresholdMemory = (float) m_dThresh * 0.001;
1374  if (m_dGMaxCa>0 && m_bBurstInitAtBottom)
1375  {
1376  m_dMemPot=m_dRestingPot+7.408;
1377  m_dM=0.0945;
1378  m_dH=0.0208;
1379  }
1380  else
1381  {
1383  m_dM=0.0f;
1384  m_dH=0.0f;
1385  }
1386 
1389 
1390  m_dStim=0;
1391  m_fltAdapterI = 0;
1392  m_fltAdapterMemoryI = 0;
1393  m_fltMemPot = m_dMemPot * 0.001;
1394 
1395  m_dGTot = 0;
1396  m_dStim=0;
1397 
1398  m_fltLastSpikeTime = 0;
1399  m_fltFiringFreq = 0;
1400 
1401  m_arySynG.RemoveAll(); // current conductance of each synaptic type
1402  m_aryFacilSponSynG.RemoveAll(); // facilitated initial g increase caused by input
1403  m_aryDG.RemoveAll(); // exponential decline factor in syn G
1404  m_aryFacilD.RemoveAll(); // exponential decline factor in facilitation
1405  m_aryNextSponSynTime.RemoveAll(); // time to next occurrence of this syn type
1406 
1407  int iSize = m_aryTonicInputPeriod.GetSize();
1408  for(int iIndex = 0; iIndex<iSize; iIndex++)
1409  {
1410  m_aryTonicInputPeriod[iIndex] = 0;
1411  m_aryTonicInputPeriodType[iIndex] = 0;
1412  }
1413 
1414  m_iIonChannels = m_aryIonChannels.GetSize();
1415  for(int iIndex = 0; iIndex<m_iIonChannels; iIndex++)
1416  m_aryIonChannels[iIndex]->ResetSimulation();
1417 }
1418 
1419 #pragma region DataAccesMethods
1420 
1421 float *Neuron::GetDataPointer(const std::string &strDataType)
1422 {
1423  std::string strType = Std_CheckString(strDataType);
1424 
1425  if(strType == "MEMBRANEVOLTAGE")
1426  return &m_fltMemPot;
1427 
1428  if(strType == "ADAPTERCURRENT")
1429  return &m_fltAdapterMemoryI;
1430 
1431  if(strType == "EXTERNALCURRENT")
1432  return &m_fltExternalI;
1433 
1434  if(strType == "FIRINGFREQUENCY")
1435  return &m_fltFiringFreq;
1436 
1437  if(strType == "THRESHOLD")
1438  return &m_fltThresholdMemory;
1439 
1440  if(strType == "ELECTRICALSYNAPTICCURRENT")
1441  return &m_fltElecSynCurMemory;
1442 
1443  if(strType == "NONSPIKINGSYNAPTICCURRENT")
1445 
1446  if(strType == "SPIKINGSYNAPTICCURRENT")
1447  return &m_fltSpikingSynCurMemory;
1448 
1449  if(strType == "IONCHANNELCURRENT")
1450  return &m_fltChannelMemoryI;
1451 
1452  if(strType == "CACURRENT")
1453  return &m_fltICaMemory;
1454 
1455  if(strType == "TOTALCURRENT")
1456  return &m_fltTotalMemoryI;
1457 
1458  if(strType == "SPIKE")
1459  return &m_fltSpike;
1460 
1461  if(strType == "GM")
1462  return &m_fltGm;
1463 
1464  if(strType == "VREST")
1465  return &m_fltVrest;
1466 
1467  if(strType == "GTOTAL")
1468  return &m_fltGTotal;
1469 
1470  if(strType == "E")
1471  return &m_fltEMemory;
1472 
1473  //If it was not one of those above then we have a problem.
1474  THROW_PARAM_ERROR(Rn_Err_lInvalidNeuronDataType, Rn_Err_strInvalidNeuronDataType, "Neuron Data Type", strDataType);
1475 
1476  return NULL;
1477 }
1478 
1479 bool Neuron::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
1480 {
1481  std::string strType = Std_CheckString(strDataType);
1482 
1483  if(Node::SetData(strDataType, strValue, false))
1484  return true;
1485 
1486  if(strType == "RESTINGPOTENTIAL")
1487  {
1488  RestingPotential(atof(strValue.c_str()));
1489  return true;
1490  }
1491 
1492  if(strType == "RELATIVESIZE")
1493  {
1494  Size(atof(strValue.c_str()));
1495  return true;
1496  }
1497 
1498  if(strType == "TIMECONSTANT")
1499  {
1500  TimeConstant(atof(strValue.c_str()));
1501  return true;
1502  }
1503 
1504  if(strType == "INITIALTHRESHOLD")
1505  {
1506  InitialThreshold(atof(strValue.c_str()));
1507  return true;
1508  }
1509 
1510  if(strType == "RELATIVEACCOMODATION")
1511  {
1512  RelativeAccomodation(atof(strValue.c_str()));
1513  return true;
1514  }
1515 
1516  if(strType == "ACCOMODATIONTIMECONSTANT")
1517  {
1518  AccomodationTimeConstant(atof(strValue.c_str()));
1519  return true;
1520  }
1521 
1522  if(strType == "AHP_CONDUCTANCE")
1523  {
1524  AHPAmplitude(atof(strValue.c_str()));
1525  return true;
1526  }
1527 
1528  if(strType == "AHP_TIMECONSTANT")
1529  {
1530  AHPTimeConstant(atof(strValue.c_str()));
1531  return true;
1532  }
1533 
1534  if(strType == "MAXCACONDUCTANCE")
1535  {
1536  BurstGMaxCa(atof(strValue.c_str()));
1537  return true;
1538  }
1539 
1540  if(strType == "BURSTINITATBOTTOM")
1541  {
1542  BurstInitAtBottom(Std_ToBool(strValue));
1543  return true;
1544  }
1545 
1546  if(strType == "TONICSTIMULUS")
1547  {
1548  TonicStimulus(atof(strValue.c_str()));
1549  return true;
1550  }
1551 
1552  if(strType == "TONICNOISE")
1553  {
1554  TonicNoise(atof(strValue.c_str()));
1555  return true;
1556  }
1557 
1558  if(strType == "ADDEXTERNALCURRENT")
1559  {
1560  AddExternalI(atof(strValue.c_str()));
1561  return true;
1562  }
1563 
1564  //If it was not one of those above then we have a problem.
1565  if(bThrowError)
1566  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
1567 
1568  return false;
1569 }
1570 
1571 void Neuron::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
1572 {
1573  Node::QueryProperties(aryProperties);
1574 
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));
1591 
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));
1605 }
1606 
1615 void Neuron::AddIonChannel(std::string strXml, bool bDoNotInit)
1616 {
1617  CStdXml oXml;
1618  oXml.Deserialize(strXml);
1619  oXml.FindElement("Root");
1620  oXml.FindChildElement("IonChannel");
1621 
1622  IonChannel *lpChannel = LoadIonChannel(oXml);
1623 
1624  if(!bDoNotInit)
1625  lpChannel->Initialize();
1626 }
1627 
1637 void Neuron::RemoveIonChannel(std::string strID, bool bThrowError)
1638 {
1639  int iPos = FindIonChannelListPos(strID, bThrowError);
1640  m_aryIonChannels.RemoveAt(iPos);
1641 }
1642 
1643 bool Neuron::AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError, bool bDoNotInit)
1644 {
1645  std::string strType = Std_CheckString(strItemType);
1646 
1647  if(strType == "IONCHANNEL")
1648  {
1649  AddIonChannel(strXml, bDoNotInit);
1650  return true;
1651  }
1652 
1653  //If it was not one of those above then we have a problem.
1654  if(bThrowError)
1655  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
1656 
1657  return false;
1658 }
1659 
1660 bool Neuron::RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError)
1661 {
1662  std::string strType = Std_CheckString(strItemType);
1663 
1664  if(strType == "IONCHANNEL")
1665  {
1666  RemoveIonChannel(strID, bThrowError);
1667  return true;
1668  }
1669 
1670  //If it was not one of those above then we have a problem.
1671  if(bThrowError)
1672  THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType, "Item Type", strItemType);
1673 
1674  return false;
1675 }
1676 
1677 #pragma endregion
1678 
1679 
1680 //Node Overrides
1681 
1682 } //IntegrateFireSim
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.
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...
Definition: AnimatBase.h:49
float m_fltGTotal
Reported g total.
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.
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 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.
Definition: AnimatBase.h:43
double m_dAHPTimeConst
The after-hyperpolarizing time constant.
virtual std::string ID()
Gets the unique GUID ID of this object.
Definition: AnimatBase.cpp:167
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.
static double m_dSpikePeak
The static spike peak.
virtual void Initialize()
Initializes this object.
Definition: AnimatBase.cpp:573
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.
Calcium activation.
Definition: CaActivation.h:21
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...
Definition: AnimatBase.h:46
CStdArray< double > m_arySynG
Current conductance of each synaptic type.
std::string m_strID
The unique Id for this object.
Definition: AnimatBase.h:55
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.
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.
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.
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.
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.