是否有人在BACnet服务器上构建了多个带有bacnet4j的虚拟本地设备? 要做到这一点需要做些什么?
这基本上是否可行?
答案 0 :(得分:0)
是的,您可以使用bacnet4j创建BACnet服务器。以下示例显示如何使用模拟值BACnet对象设置设备:
IpNetwork network = new IpNetwork("10.78.20.255", 0xBAC5);
Transport transport = new Transport(network);
// create device with random device number
int localDeviceID = 10000 + (int) ( Math.random() * 10000);
LocalDevice localDevice = new LocalDevice(localDeviceID, transport);
localDevice.initialize();
System.out.println("Local device is running with device id " + localDeviceID);
// create sample BACnet object
ObjectIdentifier objectId = new ObjectIdentifier(ObjectType.analogValue, 1);
BACnetObject object = new BACnetObject(localDevice, objectId);
localDevice.addObject(object);
请注意,您必须确保对象标识符(示例中的模拟值1)在设备上是唯一的。