Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program

The following example describes the linking of two digital inputs with the corresponding objects and the PLC.

  1. Create a BACnet adapter and server (see "Example: Create BACnet adapters and servers")
  2. Link the state of the bus coupler under which the hardware terminal was added with the BACnet server
  3. a) Right-click on couplerState
  4. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 1:
  5. b) In the subsequent dialog select BusState of the bus coupler selected (ATTENTION: deselect "Exclude other Devices" and "Exclude same Image" and select "All Types") and confirm with "OK"
  6. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 2:
  7. c) Confirm the subsequent dialog with "OK"
  8. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 3:
  9. The first BinaryInput object under the previously created BACnet server is now added
  10. a) Right-click on the BACnet server and select "Append Object..."
  11. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 4:
  12. b) In the subsequent dialog select the module "BACnet Binary Input Object" and confirm with "OK"
  13. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 5:
  14. For setting the property "Reliability" of the BinaryInput object the bus number of the bus state linked under 2 above has to be set in the BACnet object (bus index "0"):
  15. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 6:
  16. For subsequent mapping onto the PLC the corresponding properties should be added to the cyclic I/O mapping. To this end the following properties should be selected as a minimum:
  17. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 7:
  18. Subsequently the link between the hardware terminal and the BACnet object is created. To this end RawIoBinaryBoolValue has to be linked with the corresponding bit of the hardware terminal:
  19. a) Right-click on RawIoBinaryBoolValue under the BACnet object "BI_0" and select "Change Link..."
  20. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 8:
  21. b) In the subsequent dialog select the symbol "Input" of the corresponding hardware terminal (ATTENTION: deselect "Exclude other Devices" and "Exclude same Image" and select "Matching Size") and confirm with "OK"
  22. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 9:
  23. The library "TcBACnet.lib" can be used for accessing BACnet objects from a PLC runtime. It makes all objects available as function blocks with the corresponding I/O points for the mapping in the System Manager. In the following example a PLC project with an instance of the function "FB_BACnet_BinaryInput" with name "BI_0" is created. The function is inserted into the PLC program "DEMO" as follows (The "DEMO" program is in turn called in the "MAIN" program. Program "MAIN" is added to the task configuration as a task). The function block instance "Device" enables access to the device object and the server state and has to be transferred to the function block instance "BI_0":
  24. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 10:
  25. Once the PLC project is compiled it has to be made available in the System Manager. Right-click on the symbol "PLC - Configuration". Afterwards by means of "Append PLC Project..." add the TPY file of the previously compiled PLC project:
  26. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 11:
  27. Once the PLC project has been added, all I/O variables of the PLC program are available in the System Manager. The global instance "fbBACnet_Adapter" of type FB_BACnet_Adapter is available in each PLC project linked via the library "TcBACnet.lib". It is used for accessing the BACnet network adapter, its AMS NetID and the link status. The I/O variables under the instance now have to be linked with the I/O points of the BACnet adapter:
  28. a) Right-click on the symbol ".fbBACnet_adapter._AmsNetID" and select "Change Link..."
  29. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 12:
  30. b) In the subsequent dialog select the AmsNetID of the BACnet device (ATTENTION: deselect "Exclude other Devices" and select "Matching Size") and confirm with "OK"
  31. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 13:
  32. Repeat step 9 with "DeviceStatus" of the BACnet adapter
  33. The process data inputs: "_SystemStatus", "_ObjIdentifier" and outputs: "_ServerControl" of the device object have to be linked in the same way. This maps the status of the BACnet server and the local device object to the PLC.
  34. a) Create process data for the device object:
  35. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 14:
  36. b) Create link between PLC and I/O process data.
  37. All I/O signals of the PLC/BACnet function block "BI_0" now have to be linked with the actual BACnet object. The links are established in the same way as specified under item 9 ("_PresentValue" and "_StatusFlags"):
  38. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 15:
  39. To check the function without active PLC runtime, the configuration of the BACnet device and the hardware terminals can be tested in Free Run mode:
  40. a) Select "Reload I/O Devices (F4)" from the toolbar or press F4
  41. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 16:
  42. b) Select "Toggle Free Run State (Ctrl-F5)" from the toolbar or press CTRL+F5
  43. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 17:
  44. c) The I/O bus of the target system should then switch to RUN. The state of the hardware input can now be monitored in the Online tab of the BACnet object "BI_0". The property Present_Value no. 85 represents the logical state of the hardware input. Using the context menu of "Online" tab, the Auto Update mode should be activated in advance (see chapter "BACnet objects and properties").
  45. After a successful test in "Free Run" mode the configuration has to be activated permanently. To this end activate the configuration as usual via the symbol "Activate Configuration" from the toolbar or by pressing CTRL+SHIFT+F4 (this loads the configuration into the target system):
  46. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 18:
  47. This is followed by loading of the PLC runtime:
  48. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 19:
  49. and starting in RUN mode:
  50. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 20:
  51. The states of the BACnet object can be monitored via the Online view of the "DEMO" program. The state of signal Present_Value represents the logical state of the hardware input:
  52. Example: Manual linking of hardware (terminal), BACnet BinaryInput and PLC program 21: