public Neuron(DateTime start, List <Task> tasks) { state = CellGrowthState.NoGrowth; body = new CellBody(start); dendrites = new List <Dendrite>(); axons = new List <Axon>(); this.start = start; main_tasks = tasks; //look at the previous 2 seconds int days = 0; int hours = 0; int minutes = 0; int seconds = 2; int milliseconds = 0; TimeSpan window = new TimeSpan(days, hours, minutes, seconds, milliseconds); secondary = new SecondaryMessenger(start, 2, window); //if there are 2 action potentials within the window InitializeDendrites(); InitializeAxons(); //add event to listen for body.ActionPotentialEvent += ReceiveActionPotentialEvent; }
//test for action potential event public void ReceiveActionPotentialEvent(object sender, ActionPotentialEventArgs e) { Console.WriteLine("received action potential event"); //add to secondary messenger for checking secondary.AddEvent(DateTime.Now); if (secondary.GrowthStateAchieved(DateTime.Now)) { state = CellGrowthState.Growth; this.SignalCellGrowthEvent(); //add new dendrite(s) } }