BAS-310 · Lesson 10 of 12 · 23 min
Gateways and integrating third-party equipment
▶ Video coming soon A video version of this lesson is on the way.
Ninefield Tower had two gateways, and Prakash used both to teach the difference between a gateway that does its job and one that merely seems to. The first was the podium protocol converter from lesson 1, which read the 2004 rooftop controllers and would be removed in December once RTU-2, RTU-3 and RTU-4 had new controllers. The second was the 2019 lighting gateway in the penthouse, which presented each floor's DALI lighting zones to the BAS as BACnet objects. "Both say BACnet on the label," he said. "One of them tells you when it has lost its devices. The other just keeps showing you the last values it got, forever."
What a gateway does
A gateway translates between two different protocols at the level of the data itself. On one side it talks, say, Modbus, LonWorks, KNX, DALI or a manufacturer's proprietary protocol to the equipment. On the other side it presents BACnet objects to the building system. Inside it holds a mapping: this Modbus register becomes that Analog Input, scaled this way; this BACnet Binary Output write becomes that coil. A BACnet router, by contrast, only passes BACnet messages between BACnet networks, unchanged; it understands addresses, not data.
Every gateway is therefore two clients and two servers at once, and every value it presents is a copy. It polls the equipment side at some rate, stores the answers, and serves the stored values to BACnet clients. A BACnet client reading the gateway is reading the gateway's copy, which may be seconds or minutes old, or stale if the equipment side has failed. Understanding that a gateway's values are copies, with an age, is most of what there is to know about gateways.
Integration starts with a points list
Third-party equipment such as a chiller, boiler, generator, drive or lighting system may hold hundreds of values. The building system needs only some of them, and an integration that tries to read everything is slow, cluttered and hard to support. The first step is an integration points list, agreed between the design engineer, the equipment supplier and the controls contractor, that lists each value to be shared, its direction, its type and units, how it is scaled, how often it is needed and what happens if it is lost.
Ninefield lighting gateway (2019), floor 6 — sample integration points list
Point name BACnet object Direction Source in lighting system Update On loss
NF.LTG6.ZN1-OCC BV-601 read zone 1 occupied state COV assume occupied
NF.LTG6.ZN1-STAT BV-611 read zone 1 lights on or off COV none
NF.LTG6.ZN1-OVR BV-621 write (pr 8) zone 1 override request on command release after 2 h
NF.LTG6.SCHED BV-691 write (pr 16) floor occupied schedule on change floor schedule holds
NF.LTG.GW-COMM BV-900 read gateway to floor controllers COV alarm, flag all LTGEach column of a points list prevents a particular kind of trouble. Direction prevents the building system writing to something it should only read. Priority, for written values, prevents conflicts with operators and other writers, as lesson 7 explained. Update method sets the load on the gateway and the age of the data. And the response to loss, the column most often left blank, decides what the building system does when the gateway or the equipment stops answering.
Scaling and units
Gateways often have to convert values as well as translate them. A Modbus drive might report its speed as an integer in tenths of a hertz, its current in hundredths of an ampere and a fault as a code number. The gateway's mapping must apply the right scale and offset and assign the right BACnet engineering unit, and the integration test must check each value against the equipment's own display.
Worked problem
Checking a gateway scaling
One of the podium rooftop units' supply fans is driven by a variable frequency drive whose register map gives output frequency as an unsigned integer in units of 0.01 Hz. The gateway maps it to an Analog Input with a scale of 0.1 by mistake. The register reads 4,750. What does the drive's display show, what does the BAS show, and what should the scale be?
Show solution
- Drive display: 4,750 × 0.01 = 47.50 Hz.
- BAS with the wrong scale: 4,750 × 0.1 = 475 Hz.
- Correct scale: 0.01, giving 47.50 Hz in the BAS.
Answer: 475 Hz is obviously impossible for a fan drive, so this error would be caught quickly. An error in the other direction, showing 4.75 Hz instead of 47.5, might pass as a fan running very slowly, which is why every mapped value needs checking against the device, not only a glance for absurd numbers.
Polling rates and the age of data
A gateway polling a slow serial network can only refresh so many values per second, as the Modbus example in lesson 8 showed. The podium protocol converter took 36 s to cycle through 72 values. Adding more points to a gateway makes every point older, not just the new ones. The points list should set a needed update interval for each value and the gateway's total load should be checked against what its equipment network can carry.
| Kind of value | Typical update interval | Reason |
|---|---|---|
| Alarms and fault states | Change of value, or 5 to 10 s | Operators need to know promptly |
| Equipment status (running, enabled) | 10 to 30 s | Used in interlocks and graphics |
| Temperatures and pressures for monitoring | 30 to 60 s | They change slowly |
| Energy totals | 5 to 15 min | Used for trends and reports |
| Configuration values | On demand only | Rarely change; reading them often wastes capacity |
Commands need the same thought. A write from the BAS to a gateway is stored, then sent to the equipment on the gateway's next cycle, so a command can take as long to arrive as a value takes to come back. Interlocks that depend on fast responses, such as a fan proving within 30 s of a start command, may need their timers lengthened when the start goes through a slow gateway, or better, should be hardwired.
Detecting stale data
The most dangerous gateway failure is the silent one. If the link from the gateway to the equipment fails, some gateways set the Reliability of every affected object to COMMUNICATION_FAILURE and the FAULT flag, as lesson 2 described, so the BAS knows the values are no longer real. Others keep serving the last values they received, with no flags at all. Ninefield's podium converter was the second kind: in August, when RTU-1's controller died, the BAS went on showing RTU-1's last supply temperature and a running fan for two days, until a tenant complained.
When a gateway cannot report stale data itself, the integration must detect it another way. The usual method is a heartbeat: a value on the equipment side that changes regularly, such as a counter or a clock, mapped through the gateway. If the BAS sees the heartbeat stop changing for longer than a set time, it raises an alarm and treats every value from that gateway as unreliable.
Worked problem
Setting a heartbeat alarm
The lighting gateway's floor controllers each provide a seconds counter that the gateway reads every 15 s. The supervisory controller reads the gateway's copy of that counter every 30 s. How long should the supervisory controller wait without seeing a change before alarming, if it should tolerate one missed gateway poll and one missed read of its own?
Show solution
- Worst normal age of a value at the supervisory controller: one gateway poll interval plus one read interval: 15 + 30 = 45 s.
- Tolerating one missed gateway poll and one missed read adds another 15 + 30 = 45 s.
- Alarm delay: 45 + 45 = 90 s.
Answer: An alarm after about 90 s without change, rounded up to 2 minutes in practice, catches a failed link without nuisance alarms from a single missed poll.
Who is responsible for what
Integration crosses contracts. The equipment supplier provides and configures the equipment's communication card or gateway; the controls contractor maps it into the BAS; the electrical contractor may supply power to the gateway; the design engineer writes the requirements; and the commissioning agent tests the result. When something does not work, each can reasonably point at another. Good specifications include a responsibility matrix that assigns every task, from setting the card's address to testing each point, to one party.
| Task | Usually done by |
|---|---|
| Provide and configure the equipment's BACnet or Modbus card | Equipment supplier or its service technician |
| Provide the register map or PICS and object list | Equipment supplier |
| Agree the integration points list | Engineer, equipment supplier and controls contractor together |
| Run the network cable and terminate it at the equipment | Controls contractor |
| Map points, build graphics, trends and alarms | Controls contractor |
| Test every point end to end against the equipment display | Controls contractor, witnessed by the commissioning agent |
| Document addresses, settings and the final points list | Controls contractor, with the equipment supplier's settings |
When to keep a gateway and when to replace it
Gateways are often the right answer: for equipment whose controls must stay the manufacturer's, such as a chiller, a lighting system or a generator, a well-configured gateway or communication card is how integration should work. They are a poor long-term answer when they translate an obsolete controller protocol into BACnet, as Ninefield's podium converter did, because the obsolete controllers behind them cannot be replaced like for like. BAS-210's RTU-1 project was the start of the cure; once all four rooftop units have native BACnet controllers on network 204, the converter will be removed and a whole layer of translation, delay and stale data will go with it.
Prakash's last advice of the evening was about documents. "The gateway's configuration is part of the system. Back it up, with its firmware version, like any controller. The day it fails, the mapping is the only thing that matters, and the person who made it will have moved on."
Writing through a gateway
Reads through a gateway are forgiving: a slow or stale value is a nuisance. Writes need more care, because a command passes through two protocols and two sets of rules on its way to the equipment. A BACnet write to a gateway's object arrives with a priority, but the Modbus register behind it has no priority array. The gateway either passes every write straight through, so that the last writer wins, or keeps its own priority array and sends the winning value to the register. The integration sheet should say which, because it decides whether an operator's command and a program's command can fight.
Some equipment also stores written values in memory that wears out after a limited number of writes. A program that writes a setpoint to such a device every few seconds, even when the value has not changed, can wear out that memory within a few years. The usual rules are to write only when the value changes, to limit the rate of writes in the gateway or the program, and to check the equipment documentation for any warning about frequent writes. Where a device offers a separate register for values that change often, that register should be used.
| Write rule | Reason |
|---|---|
| Write only on change | Reduces traffic and wear on stored memory |
| Agree the priority used for each write | Avoids silent fights between operator and program commands |
| Read back after writing | Confirms the equipment accepted the value |
| Check the equipment's local or remote mode | Writes are ignored or refused in local mode |
| Record every writable point on the integration sheet | Makes clear what the BAS is allowed to change |
Backing up the gateway
A gateway's mapping table is as much a part of the system as a controller's program, and losing it is just as costly. The configuration file belongs in the same backup routine as the controllers, with the gateway's firmware version recorded beside it, as Quillon has done since the Morrow House firmware problem described in BAS-210. When a gateway fails, a replacement loaded from a current backup can be running within an hour; one rebuilt from the integration sheet alone can take a day.
Common mistakes
MistakeMapping every available value from a piece of equipment.
InsteadMap only the values on the agreed integration points list.
MistakeLeaving the response to loss blank on the points list.
InsteadState what the BAS does if each value stops updating.
MistakeTrusting a gateway's values without a way to detect stale data.
InsteadUse the gateway's reliability flags or a heartbeat alarm.
MistakeChecking scaled values only for absurd numbers.
InsteadCompare each value with the equipment's own display.
MistakeForgetting to back up the gateway's configuration.
InsteadBack up the mapping and record its firmware with the controller backups.
Summary and key terms
- A gateway translates data between protocols; a router only passes BACnet messages between BACnet networks.
- Every gateway value is a copy with an age; the gateway polls one side and serves the other.
- An integration points list states each value's object, direction, priority, scaling, update method and response to loss.
- Scaling and units must be checked against the equipment's own display.
- Adding points to a slow gateway makes every point older; commands are delayed the same way.
- Silent stale data is the most dangerous gateway failure; detect it with reliability flags or a heartbeat.
- A responsibility matrix assigns each integration task to one party.
- Gateway
- A device that translates data between two different protocols.
- Integration points list
- The agreed list of values shared between equipment and the BAS, with their details.
- Mapping
- A gateway's table connecting each value on one protocol to an object on the other.
- Scaling
- The multiplier and offset that turn a raw value into engineering units.
- Stale data
- A value that is no longer being updated but is still being shown.
- Heartbeat
- A regularly changing value used to prove that a link is alive.
- Responsibility matrix
- A table assigning each integration task to one party.
Practice problems
Work each problem on paper first, then reveal the answer to check.
A register reads 2,310 with a scale of 0.01 A. What is the current?
Show answer
23.10 A.
A gateway polls every 20 s and the BAS reads it every 60 s. What is the worst normal age of a value?
Show answer
20 + 60 = 80 s.
Using the same rule as the example, what heartbeat alarm delay would you set for that gateway?
Show answer
80 + 80 = 160 s, about 3 minutes.
A gateway shows a chiller running for two days after the chiller lost power. What was missing from the integration?
Show answer
A way to detect stale data, such as a heartbeat or reliability flags.
Who should provide a chiller's register map or PICS?
Show answer
The equipment supplier.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.