Author Archive for xcosminel

BACnet MSTP – An Introduction

The MS stands for Master - Slave although in practice there are not many slaves out there.
The TP stands for Token Passing.

This flavor of BAcnet is most commonly used to connect field devices to controllers / routers / control applications.

The physical layer uses RS485 which allows up to 128 devices to be installed on a single network with a max physical length of 4000ft and speeds up to 115k baud. Using repeaters allows the length to be increased. Compare to Ethernet where the spec allows a max of 100 meters (330ft) on a single unrepeated segment.

Common baud rates are 19200, 38400 and 76800. All devices must operate at the same baud rate. More and more devices can auto sense the baud rate and configure themselves correctly.

We divide the messages on a MSTP network into two categories:
1. Overhead (token, poll for master…)
2. Application. These carry payloads that we have an interest in.

Only a device with the token can initiate an application layer message. It can send the message to any device on the network. Some messages demand an instantaneous reply, some don’t. The receiving device doesn’t need the token to respond. There is a limit to how many application layer messages a device can send before it must pass the token on.

The benefits of token passing networks are the following:
1. They are self healing
2. They can discover new devices
3. They ensure each device gets its chance
4. They avoid collisions making network performance (somewhat) deterministic

A disadvantage of the token system is that any one device gets a limited use of the bandwidth. Thus a device may need to keep an internal queue of application layer messages it wants to send, waiting to use the token. We have encountered some vendor systems which fill there queue and then drop subsequent messages without notifying the user of the problem. Limited access combined with the overhead makes it easy to use up all the bandwidth on the network if there are many devices with many objects and many properties of interest.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

BACnet Supports Discovery

In Modbus you need a data sheet to know what data is inside a field device. In BACnet you don’t. You can go-online and discover the devices on a network and then interrogate the devices so they report what data objects they contain and what properties each object supports and what the current state of each property is.

The ability to discover is an almost universal truth in BACnet but there are some limitations:

1. An obscure technicality may limit what you can learn about the object properties.
2. Devices configured as MSTP slaves cannot be discovered but most vendors don’t implement their devices as slave devices for this reason.

The only way to communicate with a slave device is to know about it in advance and configure the client appropriately.

We should also mention that most ‘Discoverers’ (or clients as we like to call them) cannot discover Vendor created proprietary properties.

There are two important practical implications of discovery:

1. If your client software is half decent you do not have to type object/properties into the configuration screens. You simply discover and then drag and drop. Unfortunately more than half the BACnet software out there is not half decent.
2. You would think you can get away without data sheets but again you are then dependent on how decent a job the device Vendor did in naming and describing their points. Bad naming, missing object descriptions, un-implemented properties like max and min values make your job harder and force you to use Vendor docs.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

BACnet MSTP Topology

Take care with the topology. The best topology is a single trunk that in-outs on the terminal blocks of each device it connects. What do mean by best ? We mean the choice which is least likely to cause problems.

Best arrangement. (Showing TX conductor for reference only)

Getting worse. Making the connections to the RS485 terminals, drops instead of connections starts to give the electrical signals all kinds of complicated paths for reflections and harmonics. Its obvious that if the drops are long and are not twisted then you also have more chance to induce noise. (Showing TX conductor for reference only)

Worst. Avoid Star configurations. They are so much harder to debug when it gets tricky. (Showing TX conductor for reference only)

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Flavors of BACnet

Flavor
Application
Affects you?
IP
  • Uses the TCP/IP protocol
  • Controller to contoller
  • Controller to HMI
  • Some field devices
On the up
Ethernet 802.3
  • Raw Ethernet Packets
Being displaced by IP
Point to Point
  • Modems and phone lines
Rare. Expected to disappear.
MS/TP
  • Field devices
Millions of installed devices.
Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

BACnet Change of Value (COV)

1.0 - Introduction

Most field devices are passive servers. They wait passively for a system to poll them for data and only then do the devices respond. A consequence of this is that the data client only knows the value of an object property when it polls for the value. If the duration of an event (change of value) is shorter than the interval between polls then the data client will not know the event occurred.

BACnet provides a solution for this by defining services to report events. These services allow a device to be transformed from a passive server to an active server since it is now capable of sending messages reporting the value of an object property based on some event rules. BACnet COV is a sub-set of the ‘Alarm and Event Services’.
This article discusses how the technology operates and then provides a discussion on some weaknesses in the COV system.

2.0 - A simplified definition of BACnet COV

Data clients subscribe to an object for COV reporting. The device monitors the value of the object property, monitors the subscription list and the change criteria. When the change criteria are met the devices sends notifications of the new value to the subscribers.

3.0 - Not all devices / objects support COV

The BACnet COV system is not a mandatory part of the protocol. Each vendor decides if they want to support it. In addition, each vendor gets to decide which properties of which objects support COV.

The device object of a COV server indicates whether there is support for COV. Beyond that you have to look for the presence of certain properties such a “COV Increment’ to tell if an object supports COV or you have to refer to the vendor documentation.

4.0 - How COV Works

Subscribe

Data Client sends messages to the device to subscribe to COV notifications.

The server must accept the subscription.

Monitor

COV Server device monitors the property values of subscribed objects and the COV change criteria.

Notify

When a change has occurred that meets the COV change criteria the server sends notifications to the subscribers or for those objects with a COV Period defined, notifications are sent based on the period if there has been no change.

Process Notification

The data client must process the notification and update the display, log, etc.

Unsubscribe / Renew Subscription

If the data client no longer needs the subscription it unsubscribe. If it needs the subscription maintained then the client should periodically re-subscribe.

The system is a little more complex than this. For example, subscriptions have durations and there is more than one way the notification can be sent.

5.0 - Key Elements of the COV Technology

COV Server :

A BACnet device that supports COV, accepts subscriptions and sends COV notifications messages to a COV Client.

COV Client :

A BACnet device, typically a SCADA or Logging application, which can subscribe for COV notification and which can process the notification messages.

Subscription :

Establishes a relationship between a COV Server and a COV Client.

Subscriptions have the following attributes :

  • Subscription to an Object or to a Property
    BACnet provides two services for subscription. One subscribes to an object and the other to a property of an object.
  • Identification of the Subscriber
    The server needs to know where to send the notifications.
  • Object Identifier
    Eg. Analog Input 1
    If subscribing to a property then the property must be identified too.
  • Lifetime
    Is indefinite or a specific number of seconds. Values can be large.
  • Notification Type
    Notification can be sent with/without requiring confirmation from the data client.
  • COV Increment
    This parameter is only used in subscriptions to object properties. If not specified in the subscription the object uses its own increment.

Notification :

A message which reports the current value of the changed property as well as the current state of the objects Status Flag property if it exists. The notification also contains the number of seconds remaining to the subscription. Confirmed notifications require a response from the COV client.

6.0 - Change Criteria

The change criteria are based on the type of subscription

Subscribe to the object :

Either of these cases trigger notification:
1) If the status flags change at all
2) If the Present Value changes:

  • Binary, Life Safty and Multistate Objects : any change to Present Value
  • Analog, Loop and Pulse Objects: change by COV_Increment

Subscribe to a property :

Either of these cases trigger notification:
1) If the status flags change at all (if the object has status flags)
2) If the Property Value changes:

  • Property is of type REAL : change by COV_Increment ( which may be defined in the subscription or may be the native increment defined in the device).
  • Property is of some other type: any change to Present Value

7.0 - Discussion and Limitations of COV

7.1 General Discussion

There are some intrinsic problems with event or change reporting systems.

In our experience it is fairly common to learn that a well configured system failed to deliver the critical information only after a significant failure. We learn the hard way that we polled for data too slowly, the logger was offline when the notification was sent or that the logger was swamped with data because of the failure of incoming feed. With this in mind we draw your attention to some if the issues you should consider.

7.1.1 - The deluge of changes problem

These event reporting systems are commonly implemented to reduce the bandwidth requirements for monitoring remote devices or to ensure that the data client sees changes whose durations are less than their minimum polling interval. When a client reduces the frequency of its polls for data or reduces which objects it polls this reduces the bandwith requirements of the system. To compensate for the lower frequency of updates a COV system may be employed.

If COV systems are employed to ‘guarantee the delivery of criticial data’ great care should be taken is assessing the so called ‘guarantee’. The guarantee is often based on the assumption that changes are infrequent and small in scope but this isn’t always the case. Often a single change can spawn a number of changes and those changes can spawn more changes in a system similar to a nuclear reaction. The more changes that occur the more notifications that must be sent. If all the changes occur in a short interval then it easy to foresee a situation where a network or data client can be deluged with notifications. Now we have to assume there is enough bandwidth to handle sending them all and that each client can handle all the incoming messages quickly. If the notifications require confirmation then the speed of the client in processing the messages is material. If there is no notification required then it is conceivable in a poor BACnet implementation that the client could drop messages when its buffer is full.

It is very difficult to test these conditions because the test requires monitoring large data sets and the test setup requires a knowledge of how changes can spawn other changes within a device and / or a system. A consequence of these difficulties is that the performance of COV systems can be unpredictable.

7.1.2 - The offline Subscriber problem

A subscriber may be offline when a notification is sent. If the subscription required confirmed notification then this could present a temporary but significant loss of bandwidth while the COS server waits the timeout period before sending the next notification. If no confirmation was required then there is no way of knowing that the subscriber was offline and even if it wanted to the COS server device cannot signal this in anyway.

The COV system does not require vendors to manage notifications sent to offline subscribers. Thus the COV server does not have to queue them and resend them. Thus, it is possible for a COV client to lose its data synchronization with the Server. The only way around this is to use occasional polling. However, if the data client was a logging system then the damage is already done and the log records will not be made.

7.2 - Specific Limitations of BACnet COV

7.2.1 - Subscriptions may be lost on reset

The BACnet spec does not require vendors to maintain the subscriptions if the device resets. Thus a reset may result in the loss of all subscriptions. Now the system is dependent on the frequency of the re-subscription by the data client. That frequency is a vendor choice too and some systems don’t send periodic re-subscriptions.

7.2.2 - Single/Multiple Subscriptions

A single data client can potentially subscribe more than once to the same data object. This is possible because in identifying itself, in the subscription, the client provides two elements of information – identifier and handle. The identifier tells the server where to send responses. The handle is a number allocated by the client for some internal purpose. Changing the handle is enough to make a subscription unique and hence it is possible to have multiple subscriptions to the same object from the same client.

7.2.3 - Subscribing to Arrays

The spec allows vendors to choose whether to support subscriptions to all or particular elements of the array.

7.2.4 - Variable Number of Subscriptions

Each vendor chooses how many subscriptions to an object / property are supported. The spec requires that at least one must be supported. You should assume the list is finite and fairly short.

Its conceivable that subscription space could be wasted by temporary subscriptions from test equipment of software thus denying room for important subscriptions.

It is important to understand how your COV client application handles and reports failed subscriptions as these events can be as important as the event they are attempting to monitor.

7.2.5 - Unconfirmed Notifications can be sent without Subscription

The spec allows a device to send unconfirmed notifications for any property of any object to any other device on the network. Thus a device can send changes of a object property that has a wide area interest such as an outside air temperature. The vendor chooses if they wish to implement this, which objects, which properties and the frequency of the notification.

7.2.6 - Notifications can be sent without a change of value

The criteria for triggering notification messages requires notifications to be sent if the Status Flags associated with the object change even if the value hasn’t changed. This is potentially, important information but a number of data client systems ignore this element of the notification data.

8.0 - Read more

Additional information on BACnet may be found at www.chipkin.com/articles

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

How to password protect a web directory.

Password protecting a web directory is useful for restricting access to important information on your website that is not intended for everyone to see.

 To password protect your web directory (using the Apache webserver) follow these steps:

 1. Create a file called “.htaccess” in the web directory you want to password protect and paste the following code into it. (change the non-bolded text to your own information)

AuthUserFile /your/directory/here/.htpasswd
AuthGroupFile /dev/null
AuthName “Secure Document”
AuthType Basic
<LIMIT GET PUT POST>
require user username
</LIMIT>

2. Create a file called “.htpasswd” into the web directory you want to password protect. Use a .htpasswd content generator to generate the code for this file (eg. http://home.flash.net/cgi-bin/pw.pl). The code output should look like:

username:****************  

(where the *s are the encrypted version of your password)

3. Browse to your website and test the protection. If the password does not work, there is likely an incorrect directory target or typo in the “.htaccess” file:

AuthUserFile /your/directory/here/.htpasswd

A good “.htpasswd” content generator can be found here:
http://home.flash.net/cgi-bin/pw.pl
More information can be found here:
http://ag.arizona.edu/ecat/web/password-protect.html

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Changing the header of a phpBB3 forum.

Changing the default header of a phpBB3 forum is easy.

I used this very useful website that is pretty self-explanatory to change the picture shown within the header:

http://www.easytutorials.org/phpbb3_styles_logo.html

Note: When you refresh your forums to see if the changes have taken place, do so by pressing SHIFT+F5. (This clears the cache and does a full refresh)

A faster way would be to rename your image to “site_logo.gif” and overwrite the default one by moving it into the “styles/*stylename*/imageset/”  folder.  The image will most likely be scaled to a default size so you must change the size manually by going into Administration Control Panel>Styles>Imagesets>Edit and under Select Image select Main Logo. Select ‘yes’ to Include Dimensions and manually type in the desired image size.

Keep in mind that if your image has a background with a solid colour, it will show up on top of the background of the header, sometimes making it look unprofessional. To fix this you must either create the image with a transparent background,  or edit the header background to match the image.

To do the latter, go to Administration Control Panel>Styles>Themes>Edit and comment out the following line by changing:

background-image: url(”{T_THEME_PATH}/images/bg_header.gif”);

to

//background-image: url(”{T_THEME_PATH}/images/bg_header.gif”);

Right on top of this line, the code “background-color: #FFFFFF;” can be seen. The “FFFFFF” part can be changed to any colour hexidecimal code (more colour codes can be found here).

When done, hit Submit and check out the new forum header (remember to refresh with SHIFT+F5).

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have