Skip to content

Nerve simulation in Silverlight

NerveModel

If you have Silverlight 2 installed, you should see the full nerve simulation to the right. Otherwise, you’ll should just see a screenshot.

It’s not much, but I implemented the Hodgkin-Huxley nerve model in Silverlight. I did it as a learning exercise. I was originally inspired to create it by a project within Microsoft that I believe has become Semblio. I learned many things along the way.

Most of my learnings are on the project page.

After all these years, units and sign still cause headaches. In my case, it was mostly because I was combining the models as explained on different pages and they sometimes used opposite voltage  conventions.

The charting system in the Silverlight Control Toolkit is awesome but too slow for streaming data. If you data is static, use it. If you want to stream data into it, then be prepared for work. I abandoned it and coded my own simple system from scratch.

BackgroundWorker can get backed up. Using this class, a background worker thread can send progress messages to the UI thread. This allowed me to put the simulation on a background thread and keep the UI responsive. However, if the response to the progress message is slow enough then the progress messages can back up and effectively freeze things. It would be nice if it froze all background work until the UI can empty the progress message queue. Also, the only message that the UI can send to the worker is “Cancel” so if you want to implement “Pause/Resume” you need to use a separate synchronization primitive.

In the end, the performance of Silverlight in this case pleasantly surprised me.

Post a Comment

Your email is never published nor shared. Required fields are marked *