YOUR FEEDBACK
Verizon Becomes a Counter-Android Linux Convert
JNels wrote: Hey - Jeffrey Nelson here at Verizon Wireless. Not a bit of ...
SOA World Conference
Virtualization Conference
$200 Savings Expire May 16, 2008... – Register Today!


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TODAY'S TOP SOA & WEBSERVICES LINKS


Monitoring Air Pollution in Real Time Using XML - A reliable and cost-effective open source solution

Digg This!

A few years ago there was no indication that XML could play an important role in computer-based process control. However, fast development and the spread of XML to different fields, and emerging trends in the field of automation, have changed the situation tremendously.

Several factors support the application of XML in this field:

  • The penetration of the Internet and intranets in manufacturing processes
  • The need to use a standard, nonproprietary format for data exchange
  • Interconnection between business information and process control systems
This article describes an XML-based system used for monitoring air quality at Tuzla Canton, Bosnia-Herzegovina. The system includes measurement stations at different locations, as shown in Figure 1.

After user analysis and discussions with the client, the Cantonal Environmental Protection Agency at Tuzla, the decision was made not to use the routine solution to the problem, the SCADA (supervisory control and data acquisition) system. The main arguments for this decision were that the SCADA system has a multi-dimension structure, and several features would be not used in this application. In addition, the price for SCADA would be significantly higher and developing the SCADA application would take longer than developing a solution using open source resources. Another advantage of this approach is that it's easier to make custom-designed applications than to work with SCADA, which isn't so flexible.

Several measurement stations collect air quality data, which must be processed and stored in local systems and sent to the central computer where it is processed and stored in a database. If alarm messages are sent, the corresponding activity is performed. The data stored in the archive can be analyzed and shown to users - clients on the intranet who can demand different reports that are available for different times from different locations.

In this system there are several points where XML technologies can be used to improve efficiency. Here are some possibilities:

  • Creation of an XML document at the local station that will be sent to the central computer
  • Analysis of an arriving XML document at the central computer searching for alerts
  • Storage of the data from an arriving XML document to the database in the central computer
  • Extraction of data from the archive and generation of an XML document that will be processed on the server and sent to the user
  • Use of XSLT for creation of an SVG document that will be transferred using Batik to graphic presentation on the user's PC
The Solution
After discussion with the client, the Cantonal Environment Protection Agency, the following solution was developed.

Data from each station's measurement devices is sent to an OPTO 22 PLC (programmable logical controller) system. The OPTO 22 generates XML text string messages. This is an advantage compared to the other PLC systems, which generate messages as streams of bits. XML documents travel over phone lines to a central computer. An application program uses XSLT to generate new XML documents in a more suitable form. The central computer parses these XML documents for data analysis using JDOM.

JDOM is, quite simply, a tool that creates a Java representation of an XML document. JDOM provides a way to represent that document for easy and efficient reading, manipulation, and writing. It has a straightforward API, is lightweight and fast, and is optimized for the Java programmer. It's an alternative to DOM and SAX, although it integrates well with both.

JDOM generates and sends new XML documents to the database where the data is stored and to the Java Message Service (JMS). The JMS API improves programmer productivity by defining a common set of messaging concepts and programming strategies that will be supported by all JMS technology-compliant messaging systems where the type publish is used.

The central computer, JBoss server (intranet), connects clients. Users on the client select different applications generated from the XML document sent from the server. The screen generation process consists of the following steps:

  1. Transformation of XML to the SVG document using XSLT
  2. The Java application uses the Batik library for presenting SVG on the user's screen
The following data is collected from the measurement stations.
  • Concentration of sulphur oxides (SOx)
  • Concentration of nitrogen oxides (NOx)
  • Concentration of dust particles
  • Temperature
  • Direction of wind
  • Velocity of wind
  • Air temperature
  • Air humidity
  • Precipitation
  • Air pressure
  • Sun radiation
  • Concentration of carbon monoxide (CO)
  • Concentration of ozone (O3)
  • Concentration of methane
Data is collected from different instruments connected to the OPTO 22 PLC system, organized in the XML document (part of it is shown in Listing 1; code listings are available at www.sys-con.com/sourcec.cfm), and sent to the central computer as text strings. Here the elements present the following data:
  • <reply> is the root element whose attributes contain information about station type, its identification number, and the time when the reply was sent to the central computer.
  • <parameter> element with the attribute value of "name equals system" contains data about system settings.
  • <parameter name="WIND" > contains information about wind.
  • <parameter name="SO2" > contains information about sulpur dioxide concentration.
  • <parameter name="NO" > contains information about nitrogen monoxide concentration.
The other measurements are described in same way.

The XML document that presents the status of devices at different measurement stations is transformed by the XSLT document for further processing; part of it is shown in Listing 2.

This XSLT document generates the XML shown in Listing 3, which is used in further processing. This transformation is realized from a Java application and JDOM; a part of it is shown in Listing 4.

The new XML document is sent to the Web server using JMS; the Web server is realized under JBoss. In the application layer, the XML document is parsed and analyzed. Depending on the incoming data, different actions can be triggered. For example, if the SO2 concentration is higher than acceptable, an alarm is generated.

On the application level, JDOM navigates and modifies the XML document. Data extracted from the XML document is saved in MySQL using JDBC. Data, rather than the entire XML document, is saved so it can be analyzed later in the context of a different application.

JDOM generates new XML that is sent to other clients, as shown in Listing 5.

Users on clients select different applications by clicking on different icons on the map. Applications are generated using XSLT stylesheets to transform XML documents sent by the Web server, in the SVG document. Listing 6 shows part of a typical XSLT stylesheet that dynamically generates corresponding SVG documents.

The user interface is Java, and the Batik library supports drawing the SVG documents onscreen. The following classes are imported from the Batik, DOM, and SVG libraries.

import org.apache.batik.swing.JSVGCanvas;
import org.apache.batik.swing.gvt.
GVTTreeRendererAdapter;
import org.apache.batik.swing.gvt.
GVTTreeRendererEvent;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGDocument;

Running Java code generates Figures 2 and 3.

Conclusion
Typically, applications such as the one described in this article are realized using a SCADA system. SCADA systems are complex and offer several options that have not been used in this application. The client asked for cheap and reliable solutions, so we decided to use XML in combination with JBoss and MySQL. Because we used JDOM and a library of Java classes, the development time was relatively short, and minimal programmer resources were required.

Our approach has several advantages:

  • It is based on open source and is platform independent. When developed, it operates on all systems because it uses Java and XML technologies. Most SCADA systems work under Windows operating systems and can present significant costs for the whole system.
  • It is more flexible in that tasks are easily distributed between programmers.
  • To add a new application, only a new XSLT file needs to be developed.
  • The programming package can easily be extended to adapt to new requirements.
The system was successfully installed and tested, and works effectively as a real-time application in the Canton of Tuzla in Bosnia-Herzegovina. The system was developed and implemented by Artes, a small Slovenian company specializing in IT applications in power plants and environmental pollution monitoring using XML and Java.

We think that the approach described in this article will be used in the future in systems that have a large collection of data that has to be processed and shown on an intranet. One example of a potential application is the development of an intranet-based information system for a distributed electricity production system.

Resources

  • Kelly Carey and Stanko Blatnik. XML Content and Data. Prentice Hall, 2002.
  • Kelly Carey and Stanko Blatnik. Design Concepts with Code: An Approach for Developers. Apress, 2003.
  • JBoss: www.jboss.org/index.html
  • JDOM: www.jdom.org

    ...

    Acknowledgements: The authors would like to thank Artes Group, Jure Londrandt, Damijan Onisak and Slavko Sadl.

    About Stanko Blatnik
    Stanko Blatnik teaches Web development (XML, SVG) online for the University of Sarajevo and directs a nonprofit institute in Velenje, Slovenia: the Institute for Symbolic Analysis of Information Technologies. Stanko has a doctorate degree in theoretical particle physics from the University of Zagreb.

    About Ruslan Kadyrov
    Ruslan Kadyrov has a doctorate degree in solid state physics from University at Tomsk, Siberia. Ruslan's work includes researcher in Material Science Institute at Tomsk and software developer at Jozef Stefan Institute at Ljubljana, Slovenia. Currently, he works as leading programmer at Artes company in Velenje, developing complex applications using Java and XML.

    About Kelly Carey
    Kelly Carey teaches digital media/Internet services courses at West Valley College in Saratoga, California. Kelly has a doctorate degree from the University of San Francisco in organizational leadership with an emphasis on the Pacific Rim.

  • Derek wrote: Is it possible for the authors to post a copy of the "Figure 1" referred to in the text? Thanks.
    read & respond »
    XML JOURNAL LATEST STORIES . . .
    EDI to XML: A Practical Approach
    While EDI transactions account for most worldwide commercial activity, XML-based alternatives are beginning to gain traction. According to Forrester Research, stateful XML, stateless XML, and even flat file exchanges are all projected to grow at a faster rate than EDI over the next few
    3rd International Virtualization Conference & Expo: Themes & Topics
    From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
    Red Hat Named "Platinum Sponsor" of Virtualization Conference & Expo
    Red Hat is a trusted open source provider. Red Hat offers enterprise customers a long-term plan for building infrastructures on the quality and innovation of open source. Combining open source operating system platform, Red Hat Enterprise Linux, together with applications, management
    JustSystems Contributes Key XBRL Rendering Technology to Financial Community
    JustSystems announced that it is contributing intellectual property rights for its invention of eXtensible Business Reporting Language (XBRL) rendering technologies to XBRL International, the standards body responsible for the oversight of the XBRL specification. The invention, known a
    JustSystems Launches Campaign for XBRL Success
    JustSystems announced its campaign to help organizations adopt XBRL (eXtensible Business Reporting Language), the XML-based standard for communicating financial and business information. In related news, JustSystems also announced that it has contributed intellectual property rights of
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON FEATURED WHITEPAPERS


    ADS BY GOOGLE
    BREAKING XML NEWS
    Woodstream Selects EXTOL Business Integrator to Improve Business Processes, Customer Collaboration and Internal Integration
    Woodstream, providers of pet, lawn-care and animal-friendly brands such as Perky-Pet,