GSoC Project Idea 10.4: Realtime simulations

Brian 2 can generate code in a so-called "standalone mode", where it generates a full set of code files that encapsulate the full simulation without references to external libraries (apart from the standard library). Furthermore, it allows to combine high-level simulation code (differential equations, etc.) with user-specified low-level functions written in the target language (e.g. C++). This can be used to connect a neural simulation to external input (e.g. from a camera or a microphone) or to actuators (e.g. a motor). These features make Brian 2 potentially highly suited to write neural simulation code that runs on an external device such as a robot. However, currently the simulation time advances in fixed time step, completely independent from the "real time". To make Brian more useful in such contexts, we would therefore like two support

two modes of "realtime" simulation:

  1. a mechanism that slows down a simulation so that its progress matches the realtime
  2. a mechanism that adapts the simulation time step so that it matches the real time that has passed since the last update

Skills: C++ and Python programming, experience with Brian or other neural simulators helpful
Mentors: Marcel Stimberg, Dan Goodman

Hi, I had some questions about this project:

  1. Regarding the end goal of the project, would e.g. testing on a robot be part of the deliverables?
  2. Do you have specialized libraries/resources in mind for real-time synchronization? (On first thought, I would guess it could be done by coupling the simulation with the system’s clock).

Hi, thanks for your interest in the project.

  1. No, testing on an actual robot is not part of the project – if you have one available and manage to get Brian code onto it, please go ahead, though :slight_smile: Short of an actual robot, a good test will be to run code that works with realtime input, e.g. from a camera or a microphone. Two examples that could be adapted accordingly are https://brian2.readthedocs.io/en/stable/examples/advanced.opencv_movie.html and https://github.com/brian-team/brian2_paper_examples/blob/master/example_4_microphone.ipynb
  2. Yes, the system clock is all that I would consider for now. Note that we are not looking for something like strict real-time computing (which would need a real-time operating system, etc.). It is rather about adapting the simulation speed to approximately match real-time.