opcua-client-nodeset · master
Docs · Spec · BACnet

BACnet — Building Automation

BACnet — building automation interop. The largest spec in the package by codec count: 44 typed structures, 36 enums, covering devices, objects, alarms, schedules, trend logs.

OPC UA companion specification for BACnet — the building- automation protocol covering HVAC, lighting, access control, fire alarms. The OPC UA side surfaces BACnet's object model, alarm acknowledgements, schedules, trend logs through OPC UA reads / writes / subscriptions.

What's in the package

Artefact Count
Enums 36
DTOs 44
Codecs 44
Registrars 1 (BACnetRegistrar)

The largest spec in the package — by codec count, by enum count, by file count. Loading it brings in a substantial amount.

Loading

php examples/bacnet/load.php
use PhpOpcua\Client\ClientBuilder;
use PhpOpcua\Nodeset\BACnet\BACnetRegistrar;

$client = ClientBuilder::create()
    ->loadGeneratedTypes(new BACnetRegistrar())
    ->connect('opc.tcp://bms-gateway.local:4840');

Direct dependencies

None — BACnet is a root spec. The package consciously does not hook BACnet to DI; BACnet's identification model differs enough that overlaying DI would be misleading.

Notable types

The 44 DTOs cover BACnet's "primitive" structured values:

  • SchedulingTimeValueDataType, DateValueDataType, DailyScheduleDataType, WeeklyScheduleDataType, CalendarEntryDataType.
  • AlarmsLogRecordDataType, LogDataDataType, EventTransitionBitsDataType, EventNotificationSubscriptionDataType.
  • Object addressingObjectIdentifierDataType, DeviceObjectReferenceDataType, DeviceObjectPropertyReferenceDataType.
  • Network configurationRouterEntryDataType, AddressBindingDataType, BACnetIPModeDataType.

For a trend-log read:

php examples/bacnet/read-trend.php
use PhpOpcua\Nodeset\BACnet\Types\LogRecordDataType;

$records = $client->read('ns=N;s=Building.Trends.AHU1.SupplyTemp')->getValue();

foreach ($records as $record) {
    if ($record instanceof LogRecordDataType) {
        // $record->Timestamp, $record->Sequence, $record->LogDatum
    }
}

Notable enums

36 enums — too many to list. The categories:

  • Object typesBACnetObjectTypeEnumeration (catalog of every standard BACnet object class)
  • Service typesBACnetConfirmedServiceChoiceEnumeration, BACnetUnconfirmedServiceChoiceEnumeration
  • Engineering unitsBACnetEngineeringUnitsEnumeration (the full BACnet unit catalogue — Pa, °C, kWh, …)
  • Event / alarm stateBACnetEventStateEnumeration, BACnetEventTypeEnumeration, BACnetEventTransitionBitsEnumeration
  • OperationalBACnetReliabilityEnumeration, BACnetSilencedStateEnumeration, BACnetServiceSupportedEnumeration

Use the namespace PhpOpcua\Nodeset\BACnet\Enums\* to autocomplete through the set.