November 2006
  
AutomatedBuildings.com

Innovations in Comfort, Efficiency, and Safety Solutions.
Belimo

(Click Message to Learn More)


BACnet Web Services in Action

If you are a little curious and you want to see a BACnet Web Service up and running then this article is for you.

  Chris Gurtler
SCADA Engine

Overview

By now you would have heard about the release of the new ASHRAE Addendum for BACnet Web Services, but I suspect many people are a little confused by what it is and what it's used for. If you are a little curious and you want to see a BACnet Web Service up and running then this article is for you. You will be surprised to see just how easy it is to integrate real time data into just about any application with a Web Service.

Articles
Interviews
Releases
New Products
Reviews
Forums
Sponsors
Archives
Past Issues
AutomatedBuildings.com

ABB

Let's assume that you have a BACnet System, and your customer wants to read some real time data out of your system. He says that he wants to display the temperature of the Main Foyer onto his intranet site. Now there are many different ways that each Vendor could do this and you may be charged a lot of money for the privilege. Some of these solutions may be good, some of them bad, but wouldn't it be nice if there was a standard way to do this? The good news is that there is, it's very easy, and it's all possible with a BACnet Web Service.

We will start our demonstration with a .Net application, and then in the next article we describe how it's done by using a Web browser with just HTML and Java script.

Web Service Installation

The first thing you need to do is get yourself a Web Service, and if you don't have one, then all you need to do is download the evaluation version from SCADA Engine. Follow the installation instructions, and you should have your Web Service looking like the figure below. If you already have your own BACnet Web Service, then that's ok, these instructions will work with any BACnet Web Service from any Vendor.

Scada Engine BACnet Web Service

Web Service Paths

A BACnet Web Service uses the concept of a path to reference a Value. The Path names are a little like the file names on your PC. Each PC may have a different list of files and the names of the files are going to be different from one PC to the next. The same goes for a BACnet Web Service, the names of the paths depend on the site.

In the SCADA Engine Web Service the path is built up from the BACnet Address using the following convention :-
/[Network]/[Device]/[ObjectType]/[Instance]

So the path to AV 0 in the above screen shot is /2/11/2/0 and it's value is 72. To give the path a more readable name, we could create a "Reference" path, but we leave that to the next article.

Reading Data

To read the Value there is a service called getValue which takes the path as an input and returns the value for this path. If I want to read the value of AV 0 then the syntax would look like :-
getValue("", "/2/11/2/0")

Create a VB Application

Now that you have the background information for the BACnet Web Service, and you have installed your own BAcnet Web Service, you are ready to build your own application.

Let's assume that Analog Value 1 represents the temperature of the Main Foyer that our customer wants to have displayed onto his web site. We can see that it's value is 72, and it's path is /2/11/2/0

Open your Visual Studio 2005, create a new Windows Application Project, which we shall call bacnet, click OK.

New Project

Adding Web Reference

We shall now add a Web Reference to the BACnet Application, well this is almost like adding a reference to a COM/ActiveX objects, but when we add a Web Reference we now have access to all the XML web service on the BACnet Web Service. Open your Solution Explorer, right click the References and click Add Web Reference, alternatively you could select Project menu and click Add Web Reference.

In the window Add Web Reference type c:\program files\scada engine\bacnet web service\bacnet.wsdl in the address bar (please make sure you type exactly as shown, as this URL is case sensitive)

Adding Web Reference

After you enter the URL and press Enter and the BACnet Web Service is loaded you should see screen like the Figure above also the Add Reference button is enabled, click Add Reference button to add this web reference to our project.

In the Solution Explorer Window click on the Web Reference to see a BACnetWS Web Reference, which we have added.

Web reference

Add a Textbox to the Form and call it TextBox1.

Cut and paste the following code into the Code View of the Form

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim a As BACnetWS.bacnet = New BACnetWS.bacnet()

    TextBox1.Text = a.getValue("", "/2/11/2/0")

  End Sub

End Class

Running the Application

Now we have finished coding our application, run the application now and check to see if the value returned is the same as that from the BACnet System. You should see a form with a textbox like the one shown below.

We have assumed that Analog Value 1 represents the temperature of the Main Foyer that our customer wants to have displayed onto his web site, and we can see that it's value is displayed as 72.

Form 1

Now you must have realized how simple it is to incorporate BACnet Web Services in your application. In the next article I plan to show how real time data can be displayed in a web page.

footer

cube
[Click Banner To Learn More]

[Home Page]  [The Automator]  [About]  [Subscribe ]  [Contact Us]

Events

Want Ads

Our Sponsors

Resources