Author Archives: niroshinie

PhD Project: Quality of Service- Aware Edge-Fog-Cloud technologies for Smart Grid

Quality of Service (QoS)-aware edge and fog technologies play a crucial role in optimizing the performance and reliability of smart grid systems. Smart grids integrate advanced communication and information technologies into the traditional power grid to enable real-time monitoring, control, and management of electricity generation, distribution, and consumption [1]. Edge and fog technologies facilitate real-time data analytics at the grid’s edge, enabling immediate insights into power consumption patterns, grid stability, and potential faults [2, 3]. This information can be utilized to optimize energy distribution, predict demand, and prevent potential failures. QoS-aware edge and fog technologies also prioritize low-latency communication for time-critical applications, such as grid monitoring, protection, and control. This minimizes communication delays and enhances the overall grid performance.

However, applying edge and fog technologies to a smart grid architecture is non-trivial due to challenges with distributed ownership, connectivity, data fusion, data storage, load-balancing and issues with security and privacy [4].

This project investigates how edge, fog and cloud technologies can be used to improve the QoS of the smart grid and also improve the computational and communication latency of the grid data.


[1] Judge, M.A., Khan, A., Manzoor, A. and Khattak, H.A., 2022. Overview of smart grid implementation: Frameworks, impact, performance and challenges. Journal of Energy Storage49, p.104056.

[2] Al-Turjman, F. and Abujubbeh, M., 2019. IoT-enabled smart grid via SM: An overview. Future generation computer systems96, pp.579-590.

[3] Veloso, A.F.D.S., de Moura, M.C., Mendes, D.L.D.S., Junior, J.V., Rabêlo, R.A. and Rodrigues, J.J., 2021, October. Towards sustainability using an edge-fog-cloud architecture for demand-side management. In 2021 IEEE International Conference on Systems, Man, and Cybernetics (SMC) (pp. 1731-1736). IEEE.

[4] Li, J., Gu, C., Xiang, Y. and Li, F., 2022. Edge-cloud Computing Systems for Smart Grid: State-of-the-art, Architecture, and Applications. Journal of Modern Power Systems and Clean Energy10(4), pp.805-817.

PhD Project: Design and Development of Inclusive IoT Systems

The Internet of Things (IoT) has transformed the way humans interact with technology, offering pervasive computation and connectivity [1]. However, ensuring inclusivity in IoT design is essential to cater to the diverse needs of users such as disabilities, gender diversity, and neurodiversity [2, 3].  Building inclusive IoT systems is non-trivial due the complexity of IoT technology, which encompasses heterogenous interconnected sensors, actuators, devices and services that work together. Ensuring inclusivity across this complex network of devices and services requires specialized knowledge and expertise. Furthermore, there are also challenges with identifying diverse user needs, lack of standards and guidelines, costs, education and awareness [4, 5].

This research aims to investigate and address the diverse aspects involved in the design and development of inclusive IoT ecosystems, for selected domains such as digital health/education/smart cities.

By understanding and accommodating these aspects, the outcomes of this project will contribute to create technology that is accessible, empowering, and beneficial to all individuals, and therefore sustainable in the long-term.


[1] Kirimtat, A., Krejcar, O., Kertesz, A. and Tasgetiren, M.F., 2020. Future trends and current state of smart city concepts: A survey. IEEE access8, pp.86448-86467. Kirimtat, A., Krejcar, O., Kertesz, A. and Tasgetiren, M.F., 2020. Future trends and current state of smart city concepts: A survey. IEEE access8, pp.86448-86467.

[2] Soares Guedes, L., Gibson, R.C., Ellis, K., Sitbon, L. and Landoni, M., 2022, October. Designing with and for People with Intellectual Disabilities. In Proceedings of the 24th International ACM SIGACCESS Conference on Computers and Accessibility (pp. 1-6).

[3] Strengers, Y. and Kennedy, J., 2021. The smart wife: Why Siri, Alexa, and other smart home devices need a feminist reboot. MIT Press.

[4] Davis J. U., Devine J., Ellis K., Fleet C., Fogarty J., Follmer S., Gotfrid T., Hodges S., Hofmann, M., Kushalnagar, R., Mankoff, J., Reinders, S., Seyed, T., Stangl, A., Wobbrock, J., Wu, T., Yang, X., 2021. Challenges to Inclusive and Accessible Prototyping, Isotyping and Production. Accessible Computer Science Education Fall Workshop, Microsoft Research

[5] Hamidi, F., 2019. DIY Assistive technology prototyping platforms: an international perspective. IEEE Pervasive Computing18(4), pp.12-16.

The role of mobile devices in the Internet of Things

Much of the conversation about IoT focuses on sensors, cloud services, RFIDs and big data. Eg: uploading sensor data to a central point, storing and manipulating large volumes of data, which is then manipulated to gain meaningful information, tagging objects/people with unique identifiers, etc

Smartphones with short range communication:

But mobile devices, such as smartphones have an important role to play as well. Smartphones themselves can be sensors, but more importantly, smartphones have one unique property; they are always accompanied by a human. Therefore they can be proxies for human actors, interacting with other IoT devices on behalf of human users, while allowing the users to override at any given time. Smartphones/tablets can utilise built-in short range protocols such as Wi-Fi Direct, Bluetooth and LTE Direct to directly connect with each other and other IoT devices. This can create an inter-connected ecosystem of machine + human intelligence.

Crowd-powered IoT

Having access to such an ecosystem means that people can collaborate with each other in novel ways. For example, lets say you want to have a series of videos transcribed. To make it more complex, the videos are in Japanese, and you only know English.

Well, what if you can do this:

– You first compress the videos. Alternatively if they’re on your mobile device, and you cannot efficiently compress any/all of them, you can transfer some/all of them to your friends’ more capable tablet/laptop via a short range wireless protocol, and have them transmit back the compressed files.

– You then seek out people who are able and willing to transcribe your videos (possibly for a price, but we will come back to that later) by accessing the inter-connected ecosystem, and transmit the compressed files to them (their mobile devices).

– Your ‘recruits’ will then transcribe the videos using their human knowledge (linguistic knowledge – translate Japanese dialogue in video to English, and type it in English text) and send you the transcribed text after they’ve completed.

Of course this is a rather simplistic example, but that’s just a gist of how mobile devices can be part of a a crowd powered resource cloud.

Incentive management & Security

This concept relies on people agreeing to share their resources. One might ask, why should I let a stranger use my mobile device’s computational resources (not to mention the security/privacy issues) and why should I spend my time solving someone else’s problems?

This is why incentives (social?monetary?) are important, as is providing a secure environment. In any case, crowd-powered problem solving is not actually a ground breaking concept, when considering successful projects like Wikipedia, file sharing systems, SETI etc and although these occupy different technology spaces, there are lessons to be learnt.

Check out the following for further investigation:

There is a considerable amount of work been done in this area, in different levels. “Mobile Clouds: Exploiting Distributed Resources in Wireless, Mobile and Social Network” is a good book that talks in length about similar things.

Hyrax: Cloud Computing on Mobile Devices using MapReduce is one of the earliest research in this area.

HTC Power To Give is a crowd-powered smartphone app where smartphone users can volunteer their mobile devices’ unused resources to a computational grid to solve research questions in medicine, science and ecology.



Running the Distributed Mandelbrot app

This app (download from Google play) demonstrates sharing jobs on mobile devices using Wi-Fi Direct. This is a prototype developed as proof-of-concept for the Honeybee model for my PhD dissertation. In this app, we generate the Mandelbrot set, with the aid of multiple mobile devices.

Delegator & workers:
The device that offloads work to other devices is referred to as the delegator, and the devices that take on work are referred to as the workers.

Step 01:
Since Wi-Fi Direct is still relatively new, some implementations are somewhat unpredictable. Therefore, I would recommend that the devices be ‘primed’ to use Wi-Fi Direct (especially the p2p group formation) before you run the app. Here’s what to do:

  1. Disconnect from any Wi-Fi network that the device is connected to. A live Wi-Fi connection can sometimes interfere with Wi-Fi Direct transmission. Keep Wi-Fi ‘on’, but ‘forget’ any networks that the device automatically connects to.wifiDisc
  2. Switch on Wi-Fi Direct.                                       wifidon
  3. In this example, we will use 3 devices. The device ‘Android_1’ will be the delegator, and the other 2 will be workers. We will now manually pair the devices and create a Wi-Fi p2p group, where the delegator is the p2p Group Owner (GO). The delegator needs to be the GO as only the GO can ‘see’ and connect to other devices. In the app, this is done programmatically. However, for some devices, things run smoother if the process is manually done first.
  4. Click ‘Search for devices’ on all 3.                       wifidSearchall
  5. Use Android_1 to connect to the other 2 devices.                                  connect3
  6. Done! Now disconnect the 2 devices before running the app. discon1


Step 02:
Now the app is ready to run. Run it on all three devices. Select option ‘Look for work’ on the workers (Android 2 & Android 3 in this example). Select ‘Share my work with others’ on the delegator (Android_1), and type the number of ‘iterations’ for the Mandelbrot algorithm. The higher the number of iterations are, the more resource intense the task becomes.


Step 03:
Click ‘Look for work’ on the worker devices.


Step 04:
Click ‘Look for other devices’ on the delegator device. This will start the resource discovery on the delegator and soon, the worker devices will be displayed as a list. Click on each entry on the list to connect to each worker.



Step 05:

The delegator would have already started executing jobs in Step 04, in parallel to its resource discovery procedure. Workers start executing jobs as soon as they connect. Although this is not visible on the app, you can see this taking place in the logcat output in the ADT if you connect the devices to a computer through USB.

Some useful log cat tags 
There are several debug tags in the program, that can be used to monitor the program execution. Some of these are as follows:

Jobs done: use on the delegator device. Shows the number of jobs done so far.
Queenbee: use on the delegator device. Shows the end result after the task completes. This outputs the total program time, battery level and no. of jobs done by each device.
RANDOM: use on the delegator device. Shows the heartbeats of the worker devices connected. If a timestamp==null becomes false, this signifies a worker has disconnected. The delegator will add the said worker’s jobs back to the job pool in this case.

Screen Shot 2014-08-19 at 2.36.21 PM

A screenshot of the Logcat output using the ADT plug-in in Eclipse.

Some experiments to try out:

  • Disconnect one or more workers while they are working.
  • Try out the continuous resource discovery by introducing workers at random intervals.
  • Increase\decrease the iteration count.
  • Use heterogenous devices (in terms of computation capability). Which device combinations give the most speedup?

Step 06:

the delegator will display the generated Mandelbrot image upon task completion. Some program stats will also be shown. Exit the program and start again if you want to do more experiments.


Android Adventures – Keeping alive a Bluetooth connection

Continuing my adventures into the Android domain, I wanted to have a Bluetooth connection between two nodes, going indefinitely, until one node sends a termination signal. Between the time of initializing the connection, and termination, the two nodes may exchange messages at random intervals.Now, the Bluetooth chat example provided in is very helpful. I did use some of the code, but my client connection was defined in the Activity class itself, as a inner class extending Thread:

public class MyActivity extends Activity {
 //some code here that does the work in the activity
   private class MyThread extends Thread {
        private final BluetoothSocket socket;
private final BluetoothDevice device;
private WorkerInfo worker;
        public MyThread(WorkerInfo pInfo) {
BluetoothSocket tmp = null;
device = pInfo.getDevice();
worker = pInfo;
try {

UUID uuid = UUID.fromString(CommonConstants.WORKER_UUID);
tmp = device.createRfcommSocketToServiceRecord(uuid);

} catch (IOException e) {
socket = tmp;

public void run() {
try {
// Connect the device through the socket. This will block
// until it succeeds or throws an exception
worker.isConnected = true;
if (D)
Log.d(TAG, “connected”);

String devName = socket.getRemoteDevice().getName();
String devAddr = socket.getRemoteDevice().getAddress();
Log.d(TAG, “connected to ” + devName + “:” + devAddr
+ “at DelegatorThread ” + this.getId());
Thread t = new Thread(new Reader(socket.getInputStream()));
} catch (IOException connectException) {



I would call the MyThread to start() at the click of a Button, and then open an OutputStream on another Button click and write to the other node. This went fine. Then after several minutes, I wanted this to read from the other device. This is where it went wrong.
For some reason, after writing, my connection just dies. When the other device tries to write, it gets a connection reset by peer exception. However, if instead of waiting for several minutes, the other device wrote back immediately, the connection is kept alive.

there were two things I could do :

  1. Keep the connection alive by exchanging random bytes of data. I tried this out by implementing a KeepAliveClient thread and a KeepAliveServer thread. These would write and read small messages indefinitely till the actual message/s is/are ready to be transmitted. This could be done so that the actual messages are preceded by a special pattern so that the reader knows it has to switch from KeepAlive mode to actual Reading mode. After reading the actual message, it again switches back to KeepAlive mode.
  2. Share the Bluetooth object instance across Activities using the singleton model as suggested here. I implemented this version as well:

Put the MyThread into a seperate public class, and instantiate and start this thread from a singleton   class.  I call the method in singleton class from my Activity. This worked as well.

I’m not entirely sure the reason a singleton object method works though. Will continue working in the 2nd method because obviously it is more efficient (not having to keep transmitting), and hopefully things will clear out in future experiments 🙂

Bluetooth support on Android Emulator

I have been playing around with Android lately, and one thing that annoyed me is the emulator does not support Bluetooth (as opposed to J2ME emulator, which does).
So if you do not have an actual Android device (like me), and you want to do Bluetooth/WiFi programming, you run in to a problem.Fortunately, there is a way out – Install the Android image on a VM and use your own Bluetooth device. This is what I did:

  1. Download Androidx86 from This is an .iso file, so you’d need something like VMWare or VirtualBox to run it. Me, I use VirtualBox.
  2. When creating the virtual machine, you need to set the type of guest OS as Linux instead of Other.
  3. After creating the virtual machine, set the network adapter to ‘Bridged’.
  4. Start the VM and select ‘Live CD VESA’ at boot.
  5. Now you need to find out the ip of this VM. Go to terminal in VM (use Alt+F1 & Alt+F7 to toggle) and use the netcfg command to find this.
  6. Now you need open a command prompt and go to your android install folder (on host). This is usually C:Program FilesAndroidandroid-sdkplatform-tools>.
  7. Type adb connect IP_ADDRESS
  8. There done! Now you need to add Bluetooth. Plug in your USB Bluetooth dongle.
  9. In VirtualBox screen, go to Devices>USB devices. Select your dongle.
  10. Done! now your Android VM has Bluetooth. Try powering on Bluetooth and discovering/paring with other devices.
  11. Now all that remains is to go to Eclipse, and run your program. The Android AVD manager should show the VM as a device on the list.

I found these links helpful. Perhaps you would too:

Happy coding!

Presenting my first paper at IITC

Last Wednesday I got to present my paper titled ‘Morpholocal Parser for Sinhala verbs’ at IITC, BMICH. It was based on my undergrad thesis… which I realized I’d almost forgotton about on the morning of the presentation!

Anyway I was originally planning to go to office and leave for bmich by 12 but I had this panic attack that I didnt remember anything I was gonna talk about so I decided to take the whole day off 🙁 And spent till like 11.20 poring over the slides at home.

So to cut a long stressful story short I went there by 12.15 but spent 15 more minutes trying to find ‘Commitee Room A’. Those people at the front sent me a regular ‘Parangiya Kotte giya vage’ tour around the darned bmich. At noon in Colombo this sort of excursion can make you really annoyed. And all this in a sari!!#$??##

My presentation was under ‘Localization and Local Language Processing Applications’ and was to be the last of the session which was about at 3pm. After that Black Magic thingie they served for lunch I was pretty de-stressed and relaxed so the presentation went OK.

Here’s the abstract of my paper if you’re interested:
This paper presents a morphological parser capable of analyzing and generating Sinhala verbs. Morphological analysis and generation plays a vital role in many applications related to natural language processing, such as spell checkers, grammar checkers, intelligent information retrieval, machine translation and other complex applications. The parser consists of a lexicon of more than 400 verb stems and handles 45 inflectional rules for each stem. Analyses produces the verb stem together with its feature tags depicting verb class, person, number, tense, gender, mood, voice, etc. The parser is modelled in the framework of two level morphology model using Xerox finite state morphology tools. To our knowledge, this is the first such parser for Sinhala verbs.

Keywords: Morphology, Natural Language Processing, Parsing, Sinhala

I was dissapointed with the turnout though. Maybe because it was the last day of the conference..But it was nice to be told that your research was interesting and that people were impressed! which I was told by 2 total strangers during tea 🙂 Since your collegues would say this to you anyway coz they’re just being nice it was good to hear it from strangers 😀

But the nicest part came while I was on my way back to the office to catch my transport… Several of my friends texted me to tell me that they had watched the whole thing on internet (UCSC tv)! Too bad I didn’t know about that before..Hmm on second thought better that I didn’t know..Would’ve freaked out probably!

Trials of Win Word

Although I generally use Windows platform and hence Word for most of my document writing, I have always used Latex for academic writing purposes.
One reason being of course that back in uni, formatting using Latex was mandatory. In fact for my undergrad thesis I used a Sinhala Latex called SinTex since I needed to include Sinhala fonts which were not included in the general MikTex distribution.
But mostly I find Latex to be much more easier to use since its a pretty well structured way of doing things.
You dont need to worry about floating tables and images with captions randomly appearing all over the place…well sort of. 🙂 Latex mostly takes care of them for you..So you dont have to spend time dragging and right-clicking and answering wizards. Latex is basically mouse-free!
However due to the fact that I dont have my favourite Latex editor LEd and the MikTex distribution on my (new) computer I have been reduced to seek the help of Mr.Word 2007 to write this research paper 🙁

Weell its not that bad..
But citations are a pain. For one thing it takes too much time. It takes at least 2 seconds for the citation box thingy to appear once you click on it.
And the citation format I needed which was numerical with square brackets was not included (which means something like this [1]). Fortunately the formats are in .xsl files inside Word and I was able to add my format. 🙂

Still, I’m having trouble over positioning tables and captions. The caption goes to one place and the table goes to another place!

I didnot have the pdf conversion addin either. But thanks to the internet have been able to get a download (yippie!)

One plus is that I dont need to convert images into .epf . AND I dont have to run the DVI viewer to see what the document actually looks like. This is a major plus when adjusting margins and page width/heights.

In 2 days have only been able to write 1.5 pages (!) AND the actual content has already been written, this is only to format. I get frustrated after half an hour of trying to drag my table to the place where I want it to go but Word thinks it knows better than me. Hmph.

So which is better, Latex or Word?
Word has a lot of nice glitz which would be really nice for things like resumes and reports but in terms of academic writing I’d definitely go for Latex.