Task Parallel Library – Internet of Things

We want to implement a energy monitoring system with the help of C# library which has interface with an Embedded System and relevant controllers attached to it. Its essential that we communicate with these devices and understand the data trends they provide. This would help to build the intelligence through some machine learning algorithms and there by improving the intelligence of these devices.Smart Home

The challenge in doing this is to have a master controller or a service which can talk to these devices are different intervals sequentially or parallel so that it can be more realistic and efficient. While I was looking at developing this kind of app I was looking at c# to implement a multitasking to communicate with these devices at different intervals in parallel. Thanks to TPL the Task Parallel Library of .NET Framework. Before I started writing these post I read about the TPL on  Introduction to TPL , Parallel Tasks in .NET 4.0 – Dotnetcurry and Understanding Task Parallelism Framework (TPL) using C#. These are really good articles to hit the ground pretty fast.

The rationale behind looking at this option is to evaluate how we can make best use of concurrency to collect data from devices and pass it on to the Message queues like Mqtt/RabbitMQ. This scenario would be very much helpful when you have the following scenarios with respect to M2M or IoT:

  1. Devices cannot be reprogrammed with the client to develop and deploy client app to the device.
  2. You have the exposure of data through connectivity means
  3. You can poll the devices for specific parameters through Usermanual
  4. You have connected your smart devices through LAN via Wi-Fi or Ethernet
  5. Communication can be done to the devices via standard protocols

Why TPL?

  • Need to interact with the devices concurrently
  • The topics needs to be monitored and can invoke parallel tasks based on the nature of message
  • The parallel tasks could be like sending Alerts, Notifications, Writing logs, etc.,
  • Tasks should all be done in an async manner

In the another post, I will try and see how we can accomplish this with the help of TPL.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s