Hacking Java EE 5 is good for the environment!

GreenFire.dev.java.net is an opensource project which goal is to manage heating systems in convenient and efficient way. It is acually a bunch of ejb-jars (created with Netbeans 5.5, 5.5.1, and 6.0)  which are
deployed as an EAR to Glassfish v2. GreenFire abstracts early from the proprietary vendor extensions - the whole management is heating system independent. GreenFire consists of the following building blocks:

GreenFire's conceptual architecture 

Diagram created with Netbeans UML plugin.

GreenFire wakes up every 5 minutes (the archiver, actually the heartbeat - implemented by a timer bean) completes the following tasks:

  • It gathers the data (heating + configuration, weather forecast) and passes it to the „brain“
  • The brain is asked what to do (heating on/off, etc.)
  • The decision is passed to the integration layer and executed
  • All the data is stored in the Derby DB and can be used in reports.

The „brain“ dowloads a script from an URL (Glassfish as well). It has access to all the data (JPA entities) and can decide what to do.
The data in the JavaDB is used for reports and monitoring independently (it stores every 5 minutes all the data since about 2 years – and performs still very well -> no problems).
The Reporting-UI is accessing JavaDB to read the decisions and interesting data like external temperature, weather etc. – not directly the heating system (decoupling – the serial port seems not to be thread safe).
However the current data is broadcasted every five minutes using JMS internally (inside the application server) the shoal.dev.java.net / fishfarm.dev.java.net framework as well and can be accessed with every device (currently multi-media system, PCs, working on Java ME) over W-LAN. Even the following widget is updated by the JMS/Shoal heartbeat:

The rules for the heating should be changed without redeploying and especially recompiling the application.
For the implementation the Fluid Kernel, Persistent Anemic Objects, Lookup Utility etc.. pattern were used (see: http://p4j5.dev.java.net).

At the creation time Groovy was chosen (JDK 1.5 time, no JSR-223) for the implementation of the rules. In the next release JavaScript is going to be used (is already shipped with Java 6, faster and totally sufficient for greenfire‘s purposes). GreenFire is running since 2 years in my house - the energy saving is considerable (over 30%).


Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition

airhacks.fm the podcast:

Stay in touch: airhacks.news.

Comments:

Hello,

may i ask how you where able to collect data from your house; temperature, solar energy gain , etc? And also, how did you pass this data on to your JAVA program?

Posted by Aric Holland on May 02, 2008 at 04:31 AM CEST #

Hi Adam,

I'm in particular interested in the integration part where java meets the hardware.
What kind of electronics did you use ? Any hints/recommendations for further investigations ?

Cheers,

Markus

Posted by MM on September 09, 2009 at 08:20 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
realworldpatterns.com
...the last 150 posts
...the last 10 comments
License