예제 #1
0
        public int TryRemoveFromBuffer() //tested
        {
            Neurotransmitter removed = buffer.Take();
            int charge = removed.Charge;

            int oldMembranePotential = membranePotential;

            //affect local membrane potential
            int currentMembranePotential = Interlocked.Add(ref membranePotential, charge);


            //decide whether change was significant enough to add to SecondaryMessenger
            if (Math.Abs(currentMembranePotential - oldMembranePotential) > significantVoltageChange)
            {
                messenger.AddEvent(DateTime.Now);

                //check whether dendrite growth state threshold reached
                if (state == 0 && messenger.IsGrowthStateTriggered(DateTime.Now))
                {
                    SetGrowthState();
                }
            }

            return(charge);
        }
예제 #2
0
        public void Produce() //tested
        {
            if (dendrite == null)
            {
                Console.WriteLine("Dendrite is NULL.");
                return; //nothing to produce to
            }

            Console.WriteLine("Task_InputAxon {0} is producing...", Id);
            while (DateTime.Now - start < runLength)
            {
                Thread.Sleep(axon.ProductionFrequency);
                Neurotransmitter newest = new Neurotransmitter(neurotransmitterMagnitude);
                dendrite.AddToBuffer(newest);

                //Console.WriteLine("Task_InputAxon {0} added {1} to dendrite {2} buffer.", Id, newest.Charge, dendrite.Id);
            }//end while

            Console.WriteLine("Task_InputAxon {0} is done.", Id);
        }
예제 #3
0
 //public methods
 public void AddToBuffer(Neurotransmitter nt)
 {
     buffer.Add(nt);
 }