2. Introduction
• BACnet adalah sebuah protokol komunikasi untuk kendali peralatan
otomasi pada bangunan.
• BACnet sudah diadopsi oleh ISO menjadi standar ISO16484-5
• BACnet pertama kali dikembangkan oleh ASHRAE pada tahun 1987,
lalu di adopsi ANSI/ISO pada tahun 2003. Dan pada tahun 2017 sudah
memiliki 1000 vendor id
3. Protocol Overview
• The BACnet protocol defines a number of services that are used to
communicate between building devices. The protocol services include
Who-Is, I-Am, Who-Has, I-Have, which are used for Device and Object
discovery. Services such as Read-Property and Write-Property are
used for data sharing. As of ANSI/ASHRAE 135-2016, the BACnet
protocol defines 60 object types that are acted upon by the services.
• The BACnet protocol defines a number of data link / physical layers,
including ARCNET, Ethernet, BACnet/IP, BACnet/IPv6, BACnet/MSTP,
Point-To-Point over RS-232, Master-Slave/Token-Passing over RS-485,
ZigBee, and LonTalk.
4. FAQ (1)
• What is BACnet?
• BACnet is "a data communication protocol for building automation and control networks." A data
communication protocol is a set of rules governing the exchange of data over a computer network.
The rules take the form of a written specification (in BACnet's case they are also on compact disk)
that spells out what is required to conform to the protocol.
• What kinds of things are covered by BACnet's "rules"?
• Everything from what kind of cable to use to how to form a particular request or command in a
standard way. What makes BACnet special is that the rules relate specifically to the needs of
building automation and control equipment, i.e., they cover things like how to ask for the value of
a temperature, define a fan operating schedule, or send a pump status alarm.
5. FAQ(2)
• But every manufacturer's system in different! How can BACnet possibly do all these things in a standard way?
• The trick is that BACnet provides a standard way of representing the functions of any device, as long as it has these functions. Examples are
analog and binary inputs and outputs, schedules, control loops, and alarms. This standardized model of a device represents these common
functions as collections of related information called "objects," each of which has a set of "properties" that further describe it. Each analog
input, for instance, is represented by a BACnet "analog input object" which has a set of standard properties like present value, sensor type,
location, alarm limits, and so on. Some of these properties are required while others are optional. One of the object's most important
properties is its identifier, a sort of numerical name that allows BACnet to unambiguously access it. Once devices have common
"appearances" on the network in terms of their objects and properties, it's easy to envision messages that can manipulate this information
in a standard way.
• OK, so what kinds of messages does BACnet define?
• Because BACnet is based on a "client-server" model of the world, BACnet messages are called "service requests." A client machine sends a
service request to a server machine that then performs the service and reports the result to the client. BACnet currently defines 35 message
types that are divided into 5 groups or classes. For example, one class contains messages for accessing and manipulating the properties of
the objects described above. A common one is the "ReadProperty" service request. This message causes the server machine to locate the
requested property of the requested object and send its value back to the client. Other classes of services deal with alarms and events; file
uploading and downloading; managing the operation of remote devices; and virtual terminal functions.
6. FAQ(3)
• Is BACnet limited only to HVAC equipment? Can it be used with fire/life safety, lighting control, and other building automation systems?
• Absolutely. In fact, if you think about it, BACnet already contains most of the capabilities required for non-HVAC communications. These
include the ability to read and write binary, analog, and text data; schedule control actions; send event and alarm notifications; and so on.
Nonetheless, the committee realized that these capabilities might not cover all situations and developed the standard with an eye toward
accommodating future, unknown building automation and control applications. As a result, one of the real strengths of the BACnet model
that emerged from this consideration is that it can be easily extended. If a vendor comes up with some new functionality for which
communication is required, the vendor can add new properties to existing object types or create new object types that are accessed in
exactly the same way as the eighteen defined in the standard. This is not only expected, it is encouraged. Moreover, a vendor could even
dream up new services that go beyond the standard ones. Of course, proprietary features may not be interoperable without vendor
cooperation.
• I keep hearing about "interoperability" but I like the vendor I deal with now. Does BACnet require multivendor installations?
• Definitely not. BACnet is just a protocol. It makes possible the interconnection of different vendors' equipment that uses BACnet, but in no
way requires it. Since many vendors will probably choose, sooner or later, to use BACnet as their "native" protocol, you could easily end up
with a single-vendor BACnet system. Also, I agree with you. I would much prefer to deal with a single, or at most a couple of vendors. The
issue is making sure their pencils stay sharp at bid time!
7. FAQ(4)
• What about connecting BACnet systems together? What networking options are there for BACnet?
• Good point! Up until now I have just been talking about the BACnet object-oriented model and the various services or message types. You still need to
pick an appropriate network technology to connect everything together. The BACnet committee spent a lot of time on this part of the standard. We
ended up with 5 different options, each of which fills a particular niche in terms of the price/performance tradeoff. The first is Ethernet, the fastest at 10
Mbps with 100 Mbps also recently available. ("Mbps" stands for "millions of bits per second.") Ethernet is also likely to be the most expensive in terms of
cost per device. Next comes ARCNET at 2.5 Mbps. Both Ethernet and ARCNET can use a variety of physical media – coaxial cable, twisted pairs, even fiber
optic cable. For devices with lower requirements in terms of speed, BACnet defines the MS/TP (master-slave/token-passing) network designed to run at
speeds of 1 Mbps or less over twisted pair wiring. Echelon's LonTalk network can also be used on various media. All of these networks are examples of
"local area networks" or LANs. BACnet also defines a dial-up or "point-to-point" protocol called PTP for use over phone lines or hardwired EIA-232
connections. A key point is that BACnet messages can, in principle, be transported by any network technology, if and when it becomes cost-effective to
do so.
• You mentioned that BACnet can use LonTalk. Does that mean that any equipment that uses LonTalk can automatically talk to BACnet systems?
• Unfortunately not. LonTalk is Echelon's specification for a recently developed LAN technology that many people thought would be a useful addition to
the BACnet standard. BACnet uses LonTalk to convey BACnet messages in an identical manner to the way BACnet messages are transported by Ethernet,
ARCNET, and MS/TP. Confusion stems from the fact that Echelon has its own generic control language that is also transported by LonTalk. In order for
LonTalk devices to be interoperable, even using Echelon's language, there has to be agreement between implementers as to what the generic messages
mean in a particular context. To obtain such agreements, Echelon has set up the LonMark Program which has working groups made up of people from
each industry that are trying to reach implementers' agreements on how to use Echelon's proprietary control language in a common way for their
applications. The point is that the BACnet language and the Echelon language are fundamentally different and devices using one of the languages can
never interoperate directly with devices using the other, even though they might possibly share a common LonTalk LAN.
8. FAQ(5)
• I like the idea of BACnet but what about all my existing DDC systems? Can
BACnet help tie them together too?
• Maybe, maybe not. In order for a BACnet device, say an operator workstation,
to talk to non-BACnet devices like your existing DDC system from XYZ Controls,
you need an intervening gateway. A "gateway" is like a United Nations
translator that can speak two languages. On one side it speaks BACnet, on the
other side the XYZ protocol of your legacy system. Naturally the most likely
source for such a gateway would be the XYZ company and they may, or may
not, choose to develop one.
• What if some of my DDC systems are on Ethernet and some are on, say,
MS/TP. Is there any way to connect them together?
• Yes. Besides allowing the use of different LANs, the BACnet standard also
specifies how to build routers. "Routers" are simply devices that connect
multiple networks together. The networks may be of the same or different
types.
DDC for HVAC System
http://www.automatedbuildings.com/news/oct08/articles/lama/080927122101lama.htm
9. *Example DDC to BACnet System
https://controltrends.org/building-automation-and-integration/04/ddc-training-with-the-bascontrol22-for-
colleges-and-training-centers-interested-in-providing-direct-digital-control-ddc-system-training/
10. FAQ(6)
• Now I'm confused. What's the difference between a router and a gateway?
• I don't blame you. A lot of people use the terms almost interchangeably. In BACnet a router is a device that
passes a message from one network to another without changing the form or content of the message. If the
networks are of different types, the addresses, error checking, in short, the "packaging," of the message may get
changed, much as you would repackage an ordinary U. S. Postal Service letter if you were going to send it further
using FedEx or UPS. A gateway, on the other hand, opens the letter, translates it into a second language if
possible, puts it back into some type of envelope or another, then sends it on. Obviously, it can take more time
and energy to do a translation than to simply forward a message so gateways are more complicated machines
than routers.
• Do BACnet routers really exist?
• Sure. In fact, at the BACnet demonstration booth in Atlanta in February 1995 (sponsored by the National
Institute of Standards and Technology's (NIST) BACnet Interoperability Testing Consortium), we had controllers
running on all the BACnet network types, except PTP, and all interoperating. To interconnect them, we had an
Ethernet-ARCNET router, an Ethernet-MS/TP router, and an Ethernet-LonTalk router.
12. BACnet network
The concept of a BACnet network made up of one or more IP subnets is described.
1. Management of broadcasts of all types (local, remote, global), and thereby the use of BACnet unconfirmed services, is specified both
within and between BACnet/IP and non-BACnet/IP, i.e., traditional, BACnet networks.
2. Broadcast management is accomplished by defining the capabilities of a new device called a BACnet Broadcast Management Device
(BBMD). Alternatively, IP Multicast may be used.
3. BACnet/IP communication is implemented by defining a new protocol layer called the "BACnet Virtual Link Layer" or BVLL. The advantages
are many: this approach is readily extensible to other, future transport mechanisms such as IPv6, ATM, Sonet, and so on. Second, the
concept of defining an extensible mechanism for peer-to-peer management of BACnet messages - beyond merely solving the broadcast
limitations of the Internet - means that other manipulations, such as encryption/decryption and compression/decompression can be
performed outside of the process of generating BACnet APDU/NPDUs, i.e., without altering the existing standard.
4. Provision is made for "foreign" devices to join BACnet/IP networks and thus, potentially, a BACnet internetwork. This part of the
specification addresses, among other things, the requirements for remote workstation access, including access via SLIP or PPP.
5. Routing between BACnet/IP and non-BACnet/IP networks is specified, including the case where IP and non-IP BACnet devices reside on the
same LAN.
6. Routing between multiple BACnet/IP networks is specified.
13. BACnet Topology
Essentially, a Building Management System (BMS) connects to a data aggregator. That aggregator
connects to different zones or applications via MS/TP connections, or to different IP devices via IP
connections. Data is shared from the zones or devices, up to the aggregator and BMS. Simple!
https://optigo.net/blog/what-does-bacnet-topology-look
15. Scheider Electric BACnet Solution
https://www.iot-now.com/wp-content/uploads/2019/08/Bacnet-topology_compliance.png
16. BACnet Simulation (1)
• A laptop
• Download Yabe (Yet another BACnet explorer)
https://sourceforge.net/projects/yetanotherbacnetexplorer/
• That's it
17. BACnet Simulation (2)
• Run Yabe
• Click + green button
• Choose BAC0
• Choose IP
• Click Add
Yabe will listen on UDP 47808 or
0xBAC0 in hex.
BAC1 on 47809,
BAC2 on 47810, and so on
18. BACnet Simulation (3)
• Run a device simulator
• Yabe comes with at 2 simulator .exe
• Bacnet.Room.Simulator.exe (GUI for room
temperature)
• Wheather2_to_Bacnet.exe (CLI weather sensor)
Both device is automatically read on Yabe Explorer
19. BACnet Simulation (3)
192.168.1.100
192.168.1.101
Run Yabe & Bacnet.Room.Simulator here
Run Bacnet.Room.Simulator,
or Weather2_to_Bacnet here
Yabe will automatically detect all devices
(from laptop & PC). Event on different
port (of course, you need to add
BAC1/BAC2 or else listener on Yabe.
20. BACnet Programming(1)
• Install Python 3 (at least 3.5)
• pip install BAC0
• That's all library you need before coding minimal app on BACnet. But
if you want a complete package, please install:
• pip install netifaces
• pip install bokeh
• pip install pandas
• pip install flask
• pip install flask_bootstrap
21. BACnet Programming(2)
• Close all previous BACnet app (Yabe, Room, Weather)
• Code:
import BAC0
bacnet = BAC0.lite()
• This code will start BAC0 system on background, and lister to UDP
0xBAC0.
22. BACnet Programming(3)
• Now run 1 or 2 device simulator
• Type this command on REPL:
bacnet.discover(networks='known')
• Or add this line to your .py file & re-run the script:
• print(bacnet.discover(networks='known')
1 device detected
23. BACnet Programming(4)
• To do BAC0 complete mode, do this:
bacnet = BAC0.connect()
• The connect function will
automatically detect dependency. If
you already have all the
dependencies needed (flask,
flask_bootstrap, bokeh, pandas), it
will switches to complete mode
(with web server started).
Otherwise, it will launch lite mode,
event if you use BAC0.connect
command
• Open browser with this address:
http://localhost:8111
25. BACnet Programming(6)
• Now we'll try to create new device
using BAC0
• Copy and save this script as
bac0device.py
• Cont. on next page or copy it from
here
https://pastebin.com/awXmG4ip
• This script is a modified version of
BAC0 unit test. You can find it here
https://github.com/ChristianTrembla
y/BAC0/blob/master/tests/manual_t
est_create_device.py
from collections import namedtuple
import time
import BAC0
from BAC0.core.devices.local.models import (
analog_input,
analog_output,
analog_value,
binary_input,
binary_output,
binary_value,
multistate_input,
multistate_output,
multistate_value,
date_value,
datetime_value,
temperature_input,
temperature_value,
humidity_input,
humidity_value,
character_string,
)
from BAC0.core.devices.local.object import ObjectFactory
from BAC0.core.devices.local.models import make_state_text
def add_points(qty_per_type, device):
ObjectFactory.clear_objects()
basic_qty = qty_per_type - 1
# Analog Inputs
# Default... percent
for _ in range(basic_qty):
_new_objects = analog_input(presentValue=99.9)
_new_objects = multistate_value(presentValue=2)
# Supplemental with more details, for demonstration
_new_objects = analog_input(
name="ZN-T",
properties={"units": "degreesCelsius"},
description="Zone Temperature",
presentValue=37,
)
26. BACnet Programming(6)
• Run the script
• It will create a new device with
id 101, for 60 seconds.
from collections import namedtuple
import time
import BAC0
from BAC0.core.devices.local.models import (
analog_input,
analog_output,
analog_value,
binary_input,
binary_output,
binary_value,
multistate_input,
multistate_output,
multistate_value,
date_value,
datetime_value,
temperature_input,
temperature_value,
humidity_input,
humidity_value,
character_string,
)
from BAC0.core.devices.local.object import ObjectFactory
from BAC0.core.devices.local.models import make_state_text
def add_points(qty_per_type, device):
ObjectFactory.clear_objects()
basic_qty = qty_per_type - 1
# Analog Inputs
# Default... percent
for _ in range(basic_qty):
_new_objects = analog_input(presentValue=99.9)
_new_objects = multistate_value(presentValue=2)
# Supplemental with more details, for demonstration
_new_objects = analog_input(
name="ZN-T",
properties={"units": "degreesCelsius"},
description="Zone Temperature",
presentValue=37,
)
states = make_state_text(["Normal", "Alarm", "Super Emergency"])
_new_objects = multistate_value(
description="An Alarm Value",
properties={"stateText": states},
name="BIG-ALARM",
is_commandable=True,
presentValue = 1,
)
# All others using default implementation
for _ in range(qty_per_type):
_new_objects = analog_output(presentValue=89.9)
_new_objects = analog_value(presentValue=79.9)
_new_objects = binary_input()
_new_objects = binary_output()
_new_objects = binary_value()
_new_objects = multistate_input()
_new_objects = multistate_output()
_new_objects = date_value()
_new_objects = datetime_value()
_new_objects = character_string(presentValue="Hello World",
is_commandable=True)
_new_objects.add_objects_to_application(device)
def network_and_devices():
device_app = BAC0.lite(port=47808, deviceId=101)
add_points(1, device_app)
print("Will be closed in a minute...")
time.sleep(60)
network_and_devices()
27. BACnet Programming(6)
• This is the result of detected device on
Yabe
• Learn more of BAC0 here
https://bac0.readthedocs.io/en/latest/
• Since BAC0 depends on bacpypes, it
would be helpful if you also read
bacpypes document
https://bacpypes.readthedocs.io/en/la
test/
28. Wanna Play with More Device Variant?
• Download Bacnet Simulator
from scadaengine here
http://www.scadaengine.com/d
ownloads/BACnetSimulator_5.0.
31.exe
• It's 30 days free
• It has a lot of simulated devices,
such ass: Access Door, Elevator,
Escalator, etc
29. Other Resources
• Read more about bacnet here http://www.bacnet.org or
http://www.bacnet.org/Developer/
• Download other free bacnet tools here
http://bacnet.sourceforge.net/
• Perhaps you need more experiments, download bacnet-tools here
https://sourceforge.net/projects/bacnet/files/bacnet-tools/