Thursday, April 25, 2013

How to save Meta-Constructs


last week I was working on programming the "Link"-functionality of two or more sensors or constructs.

Click button "Link" on start screen:

This window pops up:

After finding a link-connection, there must run a background process, which reads the existing sensor data, connects them and saves a new brunch in the versioning system.

At the beginning I was not sure, how I should realize that with C#. I was thinking of stuff like threads.
After research in the Internet and asking friends, I now decided to use Windows Services.

When the user clicks on the button "Add" a new service is added to the system with the name of the new meta construct. This service takes over all the work in the background:

It works really well! :-)

My C#-Project called "Simulation" installs and starts my Windows Service project called "MetaConstructService". Witch clicking the button "Delete" it is also possible to uninstall it.

The Service reads out the parameter it needs from a XML-configuration file, that looks like that:

     <add key="ServiceName" value="Simulation_NewConstruct" />
     <add key="Destination" value="D:\newconst.txt" />
     <add key="CommitMsg" value="(Humditiy + Temperature) * 3" />
     <add key="data_Humditiy" value="D:\\newconst2.txt" />
     <add key="data_Temperature" value="D:\\newconst2.txt" />

All the Code is available at Github ( At the moment I am just storing a dummy content. I am not sure, how I link the sensors together. They won't have the exact timestamp. Maybe just linking the datasets with the most actual dates.

Concerning your comments of an older post of mine, I store each sensor data now like that in my .txt-files: timestamp;data


1 comment:

  1. great to see your progress :)

    I am on holidays the next days but will def. check out your code next week. In regard to your first chapters, I will send you the feedback today by mail. just so far: there are some improvements we have to talk about but the direction you are heading is fine ;)