Collecting and storing
Collecting data have always been interesting and there have been several projects for collecting temperatures. It started with a AS3145KT, a small PIC board that read four DS1820 and send the temperature readings on a serial port (yes it was the mid nineties). Temperatures indoor, outdoor, brine (heat exchange pump) and hot water out was monitored. The data was collected by a service running on a Windows NT 4 computer and stored in an Access data base. The Acess db was not that optimal because after about three weeks the database file have grown to about three megs and the service come to a grinding halt, spending all time trying to update the database. It was solved by copying the file and empty the database, but it was a real mess to merge the data together afterwards. Well the MySql real database appeared and after that the data size was not a problem.
Now the presentation was a challenge. Wading through temperature readings with a 10 seconds resolution isn’t nice! So now some data consolidation / compression was needed. Fortunately I discovered RRDTools in time before I manage to do something on my own. An excellent package providing both data consolidation and presentation. BUT it was written in old faithful C. Well it was possible to wrap the program or start it as a process from inside the logger service, but that was to messy.
RRD From C to Java to C# (and back)
After some digging the RRD4J project surfaced but Java was not my first choice. At that time I was a hard dying C++ / C# programmer in the MSDN trenches. Actually I was forced into Java (Java EJB3 on Jboss to be exact) at my assignment so the obvious solution was to port RRD4J to C#! Now RRD4N (.NET) was born and a new logger design started. The port was not optimal and I manage to introduce a nasty bug that showed up years later. I also made an effort to separate the data storing from the presentation, as we where told to do in 2005, but that made the implementation over complicated. Eventually I switched back to Java but that’s another post).
The old logger service was a simple piece of software just listening on the serial port and writing the data to the database every 10 seconds. The fine resolution was needed for the heater hot water return but a waste when it comes to outdoor temperature. It was time for a bit more sophisticated logger. This time it has to be in C# because it’s 2008 and C# is still a preferred language.
To be continued…..