func (this *SpikingNeuron) Simulate(simulation *sim.Simulation, neuronManager *group.NeuronManager) { I := float64(0) steps := simulation.GetSteps() tau := simulation.GetTau() timeSeries := simulation.GetTimeSeries() start := simulation.GetStart() T1 := simulation.GetT() uu := make([]float64, len(timeSeries)) this.SetOutputs(make([]float64, len(timeSeries))) for t, i := start, 0; t < steps; t, i = t+tau, i+1 { timeSeries[i] = t this.ScopedSimulation(I, i, t, T1, tau, uu, neuronManager) if neuronManager != nil { // fmt.Println("Neuron", this.GetId(), "released the lock"); time.Sleep(time.Millisecond) neuronManager.OuterUnlock() // fmt.Println("Neuron", this.GetId(), "is waiting..."); time.Sleep(time.Millisecond) neuronManager.GetInnerWaitGroup().Wait() time.Sleep(time.Millisecond * 2) // fmt.Println("Neuron", this.GetId(), "is finished at time", t); } } simulation.SetTimeSeries(timeSeries) if neuronManager != nil { // fmt.Println("Finished", this.GetId()); neuronManager.DoneWaitGroup() } }