Hi!
However, this does not completely solve the problem: now, for the second run of Simulate() the simulation is empty until the end of the previous run, and then the second run starts. I mean:
nest.Simulate(250) # -> generates a simulation from 0 to 250 vm.n_events = 0 # data from previous runs is gone nest.Simulate(250). # -> This simulation goes from 250 to 500. It shows empty results between 0 and 250 for V, and the actual simulation between 250 and 500 for V.
If we examine the voltmeter.events content after both runs, the entry 'times' shows values between 250 and 500, so the command vm.n_events = 0 resets the contents (I checked it), but NOT some internal time counter.
Indeed. The setting I gave you only removes the events from the /specific/ device you’re using it on. Nothing else.
You can also reset time by calling |nest.biological_time = 0|. However, that comes with a big fat warning message printed to your screen for good reasons.
Should I do a full nest.ResetKernel() and rebuilt everything (i.e., the network) for EACH run? No problem, although it sounds strange to me... ;-)
Short answer: Yes. This is what you should do.
There is an ongoing discussion https://github.com/nest/nest-simulator/issues/2337 about resetting the /network state/ instead of completely destroying it (i.e. using |ResetKernel|) and rebuilding it. A short summary for why we don’t support that is that if you ask four people what a hypothetical |ResetNetwork| function should do, you probably get five different opinions and is extremely hard to track and reset each and every variable involved in the simulation and it is not even clear to what they should be reset to. Also see #1919 https://github.com/nest/nest-simulator/pull/1919 and the example |pynest/examples/store_restore_network.py| that resulted from it.
Cheers, Jochen!