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.
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:
- Devices cannot be reprogrammed with the client to develop and deploy client app to the device.
- You have the exposure of data through connectivity means
- You can poll the devices for specific parameters through Usermanual
- You have connected your smart devices through LAN via Wi-Fi or Ethernet
- Communication can be done to the devices via standard protocols
- 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.