public int TryRemoveFromBuffer()
        {
            Neurotransmitter removed = buffer.Take();

            Interlocked.Add(ref membranePotential, removed.ElectricalPotential);
            //Console.WriteLine("Dendrite {0} Membrane Potential is \t\t\t{1}", Id, membranePotential);
            return(removed.ElectricalPotential);
        }
示例#2
0
        public void Produce(Dendrite dt, TimeSpan runLength)
        {
            DateTime start = DateTime.Now;

            //Console.WriteLine("Task_Input {0} is working...", Id);
            while (DateTime.Now - start < runLength)
            {
                Thread.Sleep(Frequency);
                Neurotransmitter newest = new Neurotransmitter(true);
                dt.AddToBuffer(newest);

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

            //Console.WriteLine("Task_Input {0} is done.", Id);
        }//end Work()
 public void AddToBuffer(Neurotransmitter nt)
 {
     buffer.Add(nt);
 }