예제 #1
0
        protected virtual void OnDendriteGrowthEvent(EventArgs_DendriteGrowth e)
        {
            EventHandler <EventArgs_DendriteGrowth> handler = DendriteGrowthEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #2
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);
        }
        private static void RespondToDendriteGrowthEvent(object sender, EventArgs_DendriteGrowth e)
        {
            Console.WriteLine("ProcessManager received dendrite growth event.");
            //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);
            }
        }