Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

BACnet Elevator Example

This project was designed as an example of a BACnet IP server that implments Elevator groups, lifts, Escalator objects using C# and the CAS BACnet stack.

The server device has a fixed set of BACnet objects:

  • Elevator group (1000) - This elevator group contains only escalators.
    • Escalator A (1001)
    • Escalator B (1002)
  • Elevator group (2000) - This elevator group contains only lifts.
    • Lift C (2001)
    • Lift D (2002)
    • Double deck lift
      • Lift E Top deck (2003)
      • Lift F Bottom deck (2003)
  • Lift G (2005) - This lift does not belong to a elevator group. Has two doors (Front and Rear)
  • Escalator H (1003) - This escalators does not belong to a elevator group
  • Positive integer value (1) - This is the machine room ID for Elevator group (1000)
  • Positive integer value (2) - This is the machine room ID for Elevator group (2000)
*-------------------**------------------------------*| | | || |======| |======| | | *------* | |======|| |======| |======| | | | E | | |======|| |======| |======| | | | 2003 | | |======|| |======| |======| | | *------**------**------* | *------* |======|| |= A ==| |= B ==| | | | C | | D | | F | | | G | |= H ==|| | 1001 | | 1002 | | | | 2001 | | 2002 | | 2004 | | | 2005 | | 1003 || |======| |======| | | *------**------| *------* | *------* |======|| 1000 | | 2000 | ^^*-------------------**------------------------------* | |^^^ | \--- Single escalator without group
| | | \------------ Single lift without group, with double doors
| | \----------------------- Double decker Lift
| \--------------------------------- Mulitple of lifts in this elevator group
\------------------------------------------------------------- Mulitple of escalator in this elevator group

CAS BACnet Stack Elevator groups, lifts, Escalator functions

The specific function in the CAS BACnet stack for adding or manupliating the Elevator groups, lifts, Escalator object types.

AddElevatorGroupObject

Adds an Elevator Group Object. The device must be added first before this function can be called. The Elevator Group Object references various Lift or Escalator objects. If adding escalators or lifts to an Elevator Group Object, users must add the Elevator Group object first.

boolBACnetStack_AddElevatorGroupObject(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t machineRoomId, constuint8_t groupId, constbool isGroupOfLifts,
constbool supportLandingCallStatus)
  • deviceInstance [IN] - The instance number of the device that owns this Elevator Group Object.
  • objectInstance [IN] - The instance number of this Elevator Group Object.
  • machineRoomId [IN] - The instance number of the Positive Integer Value Object whose present value property represents the Machine Room ID. If the Positive Integer Value Object does not exist, this function will create it.
  • groupId [IN] - The group ID for this Elevator Group object.
  • isGroupOfLifts [IN] - A flag that sets the Elevator Group object to be a group of Lift Objects (true) or Escalator Objects (false).
  • supportLandingCallStatus [IN] - A flag to enable the Landing Calls and Landing Call Control properties.

return True if successful, false if failed.

AddLiftOrEscalatorObject

Adds a Lift or Escalator Object. The device must be added first before this function can be called. If adding to an Elevator Group Object, the Elevator Group object must be created first.

boolBACnetStack_AddLiftOrEscalatorObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t elevatorGroupInstance,
constuint8_t groupId, constuint8_t installationId)
  • deviceInstance [IN] - The instance number of the device that owns this Lift or Escalator Object.
  • objectType [IN] - The object type of this object. Must be either Lift or Escalator.
  • objectInstance [IN] - The instance number of this Lift or Escalator Object.
  • elevatorGroupInstance [IN] - The instance number of the Elevator Group Object that this Lift or Escalator Object belongs to. If none exists, use 4194303 to specify that this Lift or Escalator Object is not part of an Elevator Group Object.
  • groupId [IN] - The groupId assigned to this Lift or Escalator Object.
  • installationId [IN] - The installationId assigned to this Lift or Escalator Object. If this Lift or Escalator Object belongs to an Elevator Group Object, it must have a unique installationId among all other Lift or Escalator Objects in the Elevator Group Object.

return True if successful, false if failed.

SetLiftHigherLowerDeck

Sets the HigherDeck and LowerDeck properties of the Lift Object. If the HigherDeck and LowerDeck properties have not been enabled for this Lift Object, then this function will enable them. This function is used to specify a Lift Object as a Multi-Deck Lift. If the Lift Object is the highest deck, then set the higherObjectInstance to 4194303. If the Lift Object is the lowest deck, then set the lowerObjectInstance to 4194303.

boolBACnetStack_SetLiftHigherLowerDeck(
constuint32_t deviceInstance, constuint32_t objectInstance,
constuint32_t higherDeckObjectInstance, constuint32_t lowerDeckObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectInstance [IN] - The instance of the Lift object to update.
  • higherDeckObjectInstance [IN] - The instance of a Lift object that is a higher deck to this Lift object. If this Lift Object is the highest deck, then set this to 4194303.
  • lowerDeckObjectInstance [IN] - The instance of a Lift object that is a lower deck to this Lift object. If this Lift Object is the lowest deck, then set this to 4194303.

return True if successful, otherwise false.

SetLiftOrEscalatorEnergyMeterRef

Sets the EnergyMeterRef property of a Lift or Escalator object. If the EnergyMeterRef property has not been enabled for this Lift or Escalator object, then this function will enable it.

If a Lift object already has the EnergyMeter property enabled and if the energyMeterRefObjectInstance is not set to 4194303, then the CAS BACnet Stack will use a value of 0.0 for the Energy Meter propery. Note: The above only applies to Lift objects, not Escalator objects

From the Spec: If the Energy_Meter_Ref property is present and initialized (contains an instance other than 4194303), then the Energy_Meter property, if present, shall contain a value of 0.0.

boolBACnetStack_SetLiftOrEscalatorEnergyMeterRef(
constuint32_t deviceInstance, constuint16_t objectType,
constuint32_t objectInstance, constbool energyMeterRefUseDevice,
constuint32_t energyMeterRefDeviceInstance, constuint16_t energyMeterRefObjectType,
constuint32_t energyMeterRefObjectInstance)
  • deviceInstance [IN] - The instance of the device that contains the Lift object.
  • objectType [IN] - The BACnet Object Type of this object. Must be either Lift or Escalator. See #CASBACnetStack::BACnetObjectType for more info.
  • objectInstance [IN] - The instance of the Lift object to update.
  • energyMeterRefUseDevice [IN] - Flag that specifies whether the energy meter reference has a device identifier (true) or not (false).
  • energyMeterRefDeviceInstance [IN] - The instance of the Device that contains the object that is the Energy Meter Ref.
  • energyMeterRefObjectType [IN] - The BACnet Object Type of the object that is the Energy Meter Ref. #CASBACnetStack::BACnetObjectType for more info.
  • energyMeterRefObjectInstance [IN] - The instance of the object that is the Energy Meter Ref.

Alarms and Events

Use the following functions to enable alarms and events for Lifts and Escalator objects.

AddNotificationClassObject

First, add a Notification Class object. The Notification Class object contains all the information of how to handle event notifications.

boolBACnetStack_AddNotificationClassObject(
constuint32_t deviceInstance, constuint32_t objectInstance, constuint8_t toOffNormalPriority, constuint8_t toFaultPriority, constuint8_t toNormalPriority, constbool toOffNormalAckRequired, constbool toFaultAckRequired, constbool toNormalAckRequired)
  • deviceInstance [in] - The instance number of the device that owns this Notification Class Object.
  • objectInstance [in] - The instance number of this Notification Class Object.
  • toOffNormalPriority [in] - The priority for To_OffNormal events. Values are 0-255.
  • toFaultPriority [in] - The priority for To_Fault events. Values are 0-255.
  • toNormalPriority [in] - The priority for To_Normal events. Values are 0-255
  • toOffNormalAckRequired [in] - Whether the To_OffNormal events must be acknowledged (true) or not (false);
  • toFaultAckRequired [in] - Whether the To_Fault events must be acknowledged (true) or not (false);
  • toNormalAckRequired [in] - Whether the To_Normal events must be acknowledged (true) or not (false);

AddRecipientToNotificationClass

Once the Notification Class object has been created, the next step is to add a recipient to the Notification Class. A recipient is the BACnet Device that will receive the notifications as well as the days and times that it can receive them.

This gets added to an existing Notification Class Object, therefore, a Notification Class Object must exist before this function can be called.

boolBACnetStack_AddRecipientToNotificationClass(
constuint32_t deviceInstance, constuint32_t notificationClassInstance, constuint8_t validDays, constuint8_t fromTimeHour, constuint8_t fromTimeMinute, constuint8_t fromTimeSecond, constuint8_t fromTimeHundrethSecond, constuint8_t toTimeHour, constuint8_t toTimeMinute, constuint8_t toTimeSecond, constuint8_t toTimeHundrethSecond, constuint32_t processIdentifier, constbool issueConfirmedNotifications, constbool transitionToOffNormal, constbool transitionToFault, constbool transitionToNormal, constbool useRecipientDeviceChoice, constuint32_t recipientDeviceInstance, constbool useRecipientAddressChoice, constuint16_t recipientNetworkNumber, constuint8_t* recipientMacAddress, constuint32_t recipientMacAddressLength);
  • deviceInstance [in] - The instance number of the device that owns the Notification Class Object.
  • notificationClassInstance [in] - The instance number of the Notification Class Object to add this recipient to.
  • validDays [in] - A byte that represents each of the valid days that this recipient can receive notifications. Bit 0 = Monday, Bit 7 = Sunday. For all days set to 127 or 0x7F.
  • fromTimeHour [in] - The hour value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeMinute [in] - The minute value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeSecond [in] - The second value of the start time that this recipient can receive notifications. Default: 0
  • fromTimeHundrethSecond [in] - The hundreth-second value of the start time that this recipient can receive notifications. Default: 0
  • toTimeHour [in] - The hour value of the end time that this recipient can receive notifications. Default: 23
  • toTimeMinute [in] - The minute value of the end time that this recipient can receive notifications. Default: 59
  • toTimeSecond [in] - The second value of the end time that this recipient can receive notifications. Default: 59
  • toTimeHundrethSecond [in] - The hundreth second value of the end time that this recipient can receive notifications. Default: 99
  • processIdentifier [in] - The handle of a process within the recipient device that is to receive the event notifications.
  • issueConfirmedNotifications [in] - Whether to send confirmed notifications (true) or unconfirmed notifications (false).
  • transitionToOffNormal [in] - Whether this recipient should be sent To_OffNormal events (true) or not (false).
  • transitionToFault [in] - Whether this recipient should be sent To_Fault events (true) or not (false).
  • transitionToNormal [in] - Whether this recipient should be sent To_Normal events (true) or not (false).
  • useRecipientDeviceChoice [in] - Whether this recipient is a Device Identifier (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both. Currently disabled.
  • recipientDeviceInstance [in] - If the recipient is a Device Identifier, this is the device instance of the recipient. Currently disabled.
  • useRecipientAddressChoice [in] - Whether this recipient is an Address (true) or not (false). Only useRecipientDeviceChoice or useRecipientAddressChoice may be true, not both.
  • recipientNetworkNumber [in] - If the recipient is an Address, this is the network number of the recipient. 0 = local network.
  • recipientMacAddress [in] - The BACnet MAC Address of the recipient. If BACnet IP, this is the 6-octet byte representation of the IP Address and Port of the device.
  • recipientMacAddressLength [in] - The number of bytes of the macAddress. If BACnet IP, this should be 6.

EnableAlarmsAndEventsForObject

After at least one recipient has been added, it is time to enable alarms and events for each object that will support intrinsic alarming. To start this process, call the EnableAlarmsAndEventsForObject function to setup some preliminary alarm and event settings.

The object and the notification class object must exist before calling this function, otherwise the function will return false.

boolBACnetStack_EnableAlarmsAndEventsForObject(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constuint32_t notificationClassInstance, constuint8_t notifyType, constbool enableToOffNormalEvent, constbool enableToFaultEvent, constbool enableToNormalEvent, constbool enableEventDetection)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • notificationClassInstance [in] - The instance number of the notification class object that will handle the event notifications generated by this object.
  • notifyType [in] - The type of notifications that this object generates. 0 = Alarm, 1 = Event.
  • enableToOffNormalEvent [in] - Whether the To_OffNormal event is enabled (true) or not (false). Default: true.
  • enableToFaultEvent [in] - Whether the To_Fault event is enabled (true) or not (false). Default: true.
  • enableToNormalEvent [in] - Whether the To_Normal event is enabled (true) or not (false). Default: true.
  • enableEventDetection [in] - Whether event detection is enabled (true) or not (false). Default: true

Set up the intrinsic event and fault algorithms

After alarms and events have been enabled on the object, enable either the intrinsic event algorithm or the instric fault algorithm or both. The type of event or fault algorithm to use intrinsically will be determined by the ObjectType.
Since this example only uses Lifts and Escalators, then they will use the following algorithms:

  • Event Algorithm: ChangeOfState monitoring the PassengerAlarms property
  • Fault Algorithm: FaultsListed monitoring the FaultSignals property

For other intrinsic algorithm/object combinations, please refer to the CAS BACnet Stack - Alarms and Events pdf manual.

To enable these algorithm, use the functions described below:

SetIntrinsicChangeOfStateAlgorithmBool

To enable the intrinsic ChangeOfState event algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetIntrinsicChangeOfStateAlgorithmBool(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constbool alarmValue, constuint32_t timeDelay, constbool useTimeDelayNormal, constuint32_t timeDelayNormal, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • alarmValue [in] - What the alarm value is
  • timeDelay [in] - The time in seconds that the offnormal conditions must exist before an offnormal event state is indicated.
  • useTimeDelayNormal [in] - Whether to use a different time delay value for the timeDelayNormal, or just use the timeDelay value.
  • timeDelayNormal [in] - The time in seconds that the Normal conditions must exist before a normal event state is indicated.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

SetFaultOutOfRangeAlgorithmReal

To enable the intrinsic FaultsListed fault algorithm, use the following function. Note: the object must exist first and must have called the EnableAlarmsAndEventsForObject function before calling this one.

boolBACnetStack_SetFaultOutOfRangeAlgorithmReal(
constuint32_t deviceInstance, constuint16_t objectType, constuint32_t objectInstance, constfloat faultLowLimit, constfloat faultHighLimit, constbool enable)
  • deviceInstance [in] - The instance number of the device that owns this object.
  • objectType [in] - The object type of the object for alarms and events.
  • objectType [in] - The object instance of the object for alarms and events.
  • enable [in] - Whether to enable (true) or disable (false) this algorithm. Default: true

Alarms and Events Callbacks

Some alarm and event functionality requires callback functions.
As of version 3.26.0 of the CAS BACnet Stack, the only Alarm and Event service that can use a callback is the following:

  • AcknowledgeAlarm

CallbackAcknowledgeAlarm

The CallbackAcknowledgeAlarm function is a callback function that a user implement and registers with the CAS BACnet Stack to authorize alarm acknowledges and to log them. This callback is called when the CAS BACnet Stack receives an AcknowledgeAlarm BACnet message.

The primary use of this callback is to validate acknowledgement source, to determine if it is authorized to acknowledge alarms. Users can also use this callback to log the acknowledges.

bool(*FPCallbackAcknowledgeAlarm) (
constuint32_t deviceInstance,
constuint32_t acknowledgingProcessIdentifier,
constuint16_t eventObjectType,
constuint32_t eventObjectInstance,
constuint16_t eventStateAcknowledged,
constuint8_t eventTimeStampYear,
constuint8_t eventTimeStampMonth,
constuint8_t eventTimeStampDay,
constuint8_t eventTimeStampWeekday,
constuint8_t eventTimeStampHour,
constuint8_t eventTimeStampMinute,
constuint8_t eventTimeStampSecond,
constuint8_t eventTimeStampHundrethSecond,
constchar* acknowledgementSource,
constuint32_t acknowledgementSourceLength,
constuint8_t acknowledgementSourceEncoding,
constbool timeOfAcknowledgementIsTime,
constbool timeOfAcknowledgementIsSequenceNumber,
constbool timeOfAcknowledgementIsDateTime,
constuint8_t timeOfAcknowledgementYear,
constuint8_t timeOfAcknowledgementMonth,
constuint8_t timeOfAcknowledgementDay,
constuint8_t timeOfAcknowledgementWeekday,
constuint8_t timeOfAcknowledgementHour,
constuint8_t timeOfAcknowledgementMinute,
constuint8_t timeOfAcknowledgementSecond,
constuint8_t timeOfAcknowledgementHundrethSecond,
constuint16_t timeOfAcknowledgementSequenceNumber,
uint32_t * errorCode)
  • deviceInstance [in] - The BACnet device instance receiving the AcknowledgeAlarm request.
  • acknowledgingProcessIdentifier [in] - The acknowledging process.
  • eventObjectType [in] - The type of the object that created the event notification being acknowledged.
  • eventObjectInstance [in] - The instance of the object that created the event notification being acknowledged.
  • eventStateAcknowledged [in] - The event state of the event notification being acknowledged.
  • eventTimeStampYear [in] - The year of the timestamp of the event notification being acknowledged.
  • eventTimeStampMonth [in] - The month of the timestamp of the event notification being acknowledged.
  • eventTimeStampDay [in] - The day of the timestamp of the event notification being acknowledged.
  • eventTimeStampWeekday [in] - The weekday of the timestamp of the event notification being acknowledged.
  • eventTimeStampHour [in] - The hour of the timestamp of the event notification being acknowledged.
  • eventTimeStampMinute [in] - The minute of the timestamp of the event notification being acknowledged.
  • eventTimeStampSecond [in] - The second of the timestamp of the event notification being acknowledged.
  • eventTimeStampHundrethSecond [in] - The hundtreth second of the timestamp of the event notification being acknowledged.
  • acknowledgementSource [in] - The identity of the operator or process that is acknowledging the event.
  • acknowledgementSourceLength [in] - The length of the acknowledgement source.
  • acknowledgementSourceEncoding [in] - The encoding of the acknowledgment source.
  • timeOfAcknowledgementIsTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementHour, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementIsSequenceNumber [in] - A flag that specifies that the user is acknowledging the event using a SequenceNumber for the Time of Acknowledgement. Uses the timeOfAcknowledgementSequenceNumber parameter. All others will be ignored.
  • timeOfAcknowledgementIsDateTime [in] - A flag that specifies that the user is acknowledging the event using a Time for the Time of Acknowledgement. Uses the timeOfAcknowledgementYear, timeOfAcknowledgementMonth, timeOfAcknowledgementDay, timeOfAcknowledgementHour, timeOfAcknowledgementWeekday, timeOfAcknowledgementMinute, timeOfAcknowledgementSecond, timeOfAcknowledgementHundrethSecond parameters. All others will be ignored.
  • timeOfAcknowledgementYear [in] - The year of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementMonth [in] - The month of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementDay [in] - The day of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementWeekday [in] - The weekday of the Time of Acknowledgement if it is a DateTime.
  • timeOfAcknowledgementHour [in] - The hour of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementMinute [in] - The minute of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSecond [in] - The second of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementHundrethSecond [in] - The hundrethSecond of the Time of Acknowledgement if it is a DateTime or Time.
  • timeOfAcknowledgementSequenceNumber [in] - The sequence number of the Time of Acknowledgement if it is a SequenceNumber.
  • errorCode [out] - The error that a user sets in the callback if the AcknowledgeAlarm fails. Usually will be SERVICE_REQUEST_DENIED (29)

RegisterCallbackAcknowledgeAlarm

To register the CallbackAcknowledgeAlarm, use the following function:

voidBACnetStack_RegisterCallbackAcknowledgeAlarm(bool(*FPCallbackAcknowledgeAlarm))
  • FPCallbackAcknowledgeAlarm [in] - The function pointer for the CallbackAcknowledgeAlarm function. See #CASBACnetStack::FPCallbackAcknowledgeAlarm for more info.

Enumerations

Enumerations used by the Elevator groups, Lift, Escalator object types properties.

Elevator Group Object Type

Group_Mode

This property, of type BACnetLiftGroupMode, shall convey the operating mode of the group of lifts.

BACnetLiftGroupMode Enumeration
  • unknown (0) - The current operating mode of the lift group is unknown.
  • normal (1) - The lift group is in normal operating mode.
  • down-peak (2) - Most passengers want to leave the building.
  • two-way (3) - Many passengers want to get to, or leave, a particular floor.
  • four-way (4) - Many passengers want to move between two particular floors.
  • emergency-power (5) - The whole lift group is operating under an emergency power supply.
  • up-peak (6) - Most passengers gather at the main terminal, usually the ground floor, to get to different floors of the building

Lift Object Type

Car_Moving_Direction

This property, of type BACnetLiftCarDirection, represents whether or not this lift's car is moving, and if so, in which direction. Car_Moving_Direction can take on one of these values:

  • UNKNOWN (0) - The current moving direction of the lift is unknown.
  • STOPPED (2) - The lift car is not moving.
  • UP (3) - The lift car is moving upward.
  • DOWN (4) - The lift car is moving downward.

Car_Assigned_Direction

This property, of type BACnetLiftCarDirection, represents the direction the lift is assigned to move, based on current car calls. Car_Assigned_Direction can take on these values:

  • UNKNOWN (0) - The direction assigned to the lift is unknown.
  • NONE (1) - No direction is assigned to the lift car.
  • UP (3) - The lift car is assigned to move upward.
  • DOWN (4) - The lift car is assigned to move downward.
  • UP_AND_DOWN (5) - The lift car is assigned to either move upward or downward.
  • A vendor may use other proprietary enumeration values to allow proprietary lift car direction assignments other than those defined by the standard. For proprietary extensions

Car_Door_Status

BACnetDoorStatus ::= ENUMERATED

  • closed (0)
  • opened (1)
  • unknown (2)
  • door-fault (3)
  • unused (4)
  • none (5)
  • closing (6)
  • opening (7)
  • safety-locked (8)
  • limited-opened (9)

Car_Door_Command

BACnetLiftCarDoorCommand ::= ENUMERATED

  • none (0)
  • open (1)
  • close (2)

Car_Mode

BACnetLiftCarMode ::= ENUMERATED

  • unknown (0)
  • normal (1), -- in service
  • vip (2)
  • homing (3)
  • parking (4)
  • attendant-control (5)
  • firefighter-control (6)
  • emergency-power (7)
  • inspection (8)
  • cabinet-recall (9)
  • earthquake-operation (10)
  • fire-operation (11)
  • out-of-service (12)
  • occupant-evacuation (13)

Car_Drive_Status

BACnetLiftCarDriveStatus ::= ENUMERATED

  • unknown (0)
  • stationary (1)
  • braking (2)
  • accelerate (3)
  • decelerate (4)
  • rated-speed (5)
  • single-floor-jump (6)
  • two-floor-jump (7)
  • three-floor-jump (8)
  • multi-floor-jump (9)

Fault_Signals

BACnetLiftFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • governor-and-safety-gear-fault (2)
  • lift-shaft-device-fault (3)
  • power-supply-fault (4)
  • safety-interlock-fault (5)
  • door-closing-fault (6)
  • door-opening-fault (7)
  • car-stopped-outside-landing-zone (8)
  • call-button-stuck (9)
  • start-failure (10)
  • controller-supply-fault (11)
  • self-test-failure (12)
  • runtime-limit-exceeded (13)
  • position-lost (14)
  • drive-temperature-exceeded (15)
  • load-measurement-fault (16)

Escalator Object Type

Operation_Direction

BACnetEscalatorOperationDirection ::= ENUMERATED

  • unknown (0)
  • stopped (1)
  • up-rated-speed (2)
  • up-reduced-speed (3)
  • down-rated-speed (4)
  • down-reduced-speed (5)

Escalator_Mode

BACnetEscalatorMode ::= ENUMERATED

  • unknown (0)
  • stop (1)
  • up (2)
  • down (3)
  • inspection (4)
  • out-of-service (5)

Fault_Signals

BACnetEscalatorFault ::= ENUMERATED

  • controller-fault (0)
  • drive-and-motor-fault (1)
  • mechanical-component-fault (2)
  • overspeed-fault (3)
  • power-supply-fault (4)
  • safety-device-fault (5)
  • controller-supply-fault (6)
  • drive-temperature-exceeded (7)
  • comb-plate-fault (8)

Building

This project also auto built using Gitlab CI on every commit.

To build this project, copy the CAS BACnet Stack DLL/SO file into the project output directory. Then using the following command to build run with donet

cd BACnetElevatorExample
dotnet publish -c Release
cd ../bin/netcoreapp2.1/publish/
--- Copy libCASBACnetStack_x64_Release.so into the /bin/netcoreapp2.1/publish/ folder ---
dotnet BACnetElevatorExample.dll

Windows

A Visual studios 2019 project is included with this project.

About

A example of a BACnet IP Elevator group, Escalator, and Lift server made with CSharp

Topics

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages