private static void RespondToDendriteGrowthEvent(object sender, EventArgs_DendriteGrowth e)
        {
            TimeSpan difference = DateTime.Now.Subtract(start);
            String   s          = difference.Seconds + "." + difference.Milliseconds;

            Console.WriteLine("ProcessManager received dendrite growth event at " + s);
            //Dendrite dendrite = neuron.GetDendrite(e.DendriteId);

            //add Tasks to produce to dendrites added
            //====================================================================//
            //                               input                                //
            //====================================================================//
            //Producers to send neurotransmitters to dendrites
            for (int i = 0; i < NUM_INPUTAXON_PRODUCERS; i++)
            {
                Task newest = Task.Factory.StartNew((val) =>
                {
                    int id         = (int)val;
                    InputAxon axon = new InputAxon(nextInputAxonId++, INPUTAXON_PRODUCTION_FREQUENCY, 0);
                    inputs.Add(axon);
                    new Task_InputAxon(id, runLength, axon, INPUT_MAGNITUDE, start).ConnectAndProduce(neuron);
                }, nextInputAxonTaskId++);
                tasks.Add(newest);
            }
        }
        protected virtual void OnDendriteGrowthEvent(EventArgs_DendriteGrowth e)
        {
            EventHandler <EventArgs_DendriteGrowth> handler = DendriteGrowthEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Пример #3
0
        //DendriteGrowthEvent code
        private void RaiseDendriteGrowthEvent(DateTime when) //tested
        {
            Console.WriteLine("Dendrite Growth event raised.");

            //action inside dendrite
            Interlocked.Add(ref numAvailableSynapses, numSynapsesToAddInGrowthEvent);

            //restore no growth state
            SetNoGrowthState();


            //event
            EventArgs_DendriteGrowth args = new EventArgs_DendriteGrowth(when, this.Id);

            OnDendriteGrowthEvent(args);
        }