BACnet API
Learn more about how you can use the BACnet API to control BACnet devices in LabVIEW. See below for some of the resources we have at Testeract that help you communicate with BACnet devices.
What is BACnet?
BACnet is the American Society of Heating, Refrigerating and Air-Conditioning Engineers' Building Automation and Control networking protocol. It is a flexible standard used in building systems such as heating, air conditioning, light control, fire detection, etc. The standard itself is object oriented and lends itself to a LabVIEW implementation.
Testeract has extensive experience with talking to BACnet devices in LabVIEW. We have developed a class-based API natively in LabVIEW that communicates over both BACnet-IP and BACnet MSTP and could easily be extended to other BACnet-supported interface layers.
Get the free 7-day trial.
-
Installing
-
Adding Your License
-
Detailed Help
Installing the BACnet API
- Download the package from our website
- Make sure VIPM is installed on your computer
- Install the package
- Run LabVIEW as Administrator (choose the version you want)
- Run VI Package Manager as Administrator
- Click "Show Menubar" icon
- Click "File" > "Upload Package File(s)"
- Select the File
- Click "Add To Library & Install"
- Wait for "Installed" "No Errors" results to pop up
Steps for adding your license serial number:
- Pay for license
- Receive Email with your serial number
- Open NI License Manager
- Select the "Activate Software" Button
- Choose the "Enter a serial number" option from the drop down
- Add the new serial number to the BACnet API item in the list
- Click "Activate"
Latest Version: 1.2.2
Software and operating system requirements:
LabVIEW 2017 or higher, supported on LabVIEW RT
Windows 10 or higher
Design
The architecture for this API is designed to capture the entire breadth of the BACnet specification. However, only limited functionality is currently implemented. The API is currently able to
- Function as a device on a BACnet serial MSTP or BACnet/IP network (replies to Who-Is with I-Am)
- Read/write Present Value for Analog/Binary Input/Output/Value object types
- Issue Change of Value (COV) requests to reduce network usage
- The official BACnet Standard document: https://www.bacnetinternational.org/page/BACnetStandard
- BACnet Stack: http://bacnet.sourceforge.net/
You will also need to initialize a BACnet object for each object you want to talk to using "Object.lvclass:Initialize B.IP Object.vi" or the generic "Object.lvclass:Initialize.vi". The class returned from this initialize will be an input to any reads or writes.
Errors
Custom error codes: 404120-404159
In order to properly see the Endigit BACnet API errors in LabVIEW, the package copies Endigit-BACnet-API-errors.txt to "LabVIEW\project\errors\".
Examples
Select Help»Find Examples from LabVIEW to launch the NI Example Finder. Navigate to "Browse»Directory Structure»Endigit»Endigit BACnet API" folder to access the examples. You can modify an example VI to fit an application, or you can copy and paste from one or more examples into a VI that you create.
You can also find the examples for Endigit BACnet API in the "...labview\examples\Endigit\Endigit BACnet API\" folder.
"Local Port (0xBAC0)" is the local port you want to use to create the UDP socket. The default is 0xBAC0, but this can be any available port. You will receive messages and replies from other devices on this port.
"Instance (7)" (optional) uniquiely identifies this device object from other device objects at this IP address and port. This is up to you to define. Doesn't much matter because only one device can be on a given UDP port anyway.
"Object Name" (optional) is inserted into the "object_name" property of the device, which may be read by other devices.
"Objects" (optional) is an array of objects that you want this device to own. If you are wanting to host objects and values for other devices to read/write from/to, then initiaize them using "Object.lvclass:Initialize.vi" and pass them in here.
"BACnet Out" (output) is the BACnet class used for all other API methods.
"Baud Rate" is the defined baud rate for the serial network you are connecting to.
"Address" uniquely identifies your device on the serial network. Must not collide with any other devices on the network.
"BACnet Out" (output) is the BACnet class used for all other API methods.
"Type" is the type of the object you want to read from or write to. Tested types with this API are Analog/Binary Input/Output/Value. You will need to get this from your specific BACnet configuration."Instance" uniquiely identifies the object of a given type at the specified address. You will need to get this from your specific BACnet configuration.
"Remote Port (0xBAC0)" is the port on the remote device you want to read from and write to. You can have multiple objects on a port and multiple ports on a device. You will need to get this from your specific BACnet configuration.
"Write Priority (0)" (optional) defines the relative priority of objects for arbitration. Valid options are 1-16, with 1 being the highest priority. A '0' will cause the property to not be written (less bandwidth usage), defaulting the priority to a 16.
"Object Out" (output) is the BACnet object used in the read and write methods.
"Object In" is the object you want to write to. See "Initialize B.IP Object.vi".
"Property (Present Value)" is the property of "Object In" that you want to write to. This enum contains all of the properties in the BACnet specification, but only Present Value has been thoroughly tested.
"Value" is the value you want to write to the object property. For analogs, this gets converted to a single. For booleans, 0 is false, everything else is true.
"Timeout (10000 ms)" (optional) defines the maximum time to wait for a reply. If no reply is received by this time, the VI returns a timeout error.
"BACnet Out" (output) is the BACnet class used for all other API methods.
"Object In" is the object you want to read from. See "Initialize B.IP Object.vi".
"Property (Present Value)" is the property of "Object In" that you want to read from. This enum contains all of the properties in the BACnet specification, but only Present Value has been thoroughly tested.
"Timeout (10000 ms)" (optional) defines the maximum time to wait for a reply. If no reply is received by this time, the VI returns a timeout error.
"BACnet Out" (output) is the BACnet class used for all other API methods.
"Value" (output) is the value of the property that you read from.
"BACnet In" is the BACnet class and it must be initialized before being called here.
"BACnet In" is the BACnet class used for all other API methods. Each initialized instance should be closed when it is no longer needed.