BACnet Access to Remote Devices

2.1k Views Asked by At

I'm using bacnet4j to get access to remote devices.

Right now I can access 1 of 3 devices fine, but can not for the other 2. Using the BACnet discovery tool I set the correct port and BBMD address and find the following list:

  1. Device 92068: BACnetDemo at IP:bac1 on net 50 with MAC localnet:45:186:192
  2. Device 2100: BACnet Route at IP:bac1 on net 50 with MAC localnet:59:186:192
  3. Device 1001: 001 - 001 - CBM24 at IP:bac1 on net 1201 with MAC 1

Here is the java code:

    import com.serotonin.bacnet4j.LocalDevice;
    import com.serotonin.bacnet4j.RemoteDevice;
    import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
    import com.serotonin.bacnet4j.npdu.ip.IpNetworkUtils;
    import com.serotonin.bacnet4j.transport.DefaultTransport;
    import com.serotonin.bacnet4j.transport.Transport;
    import com.serotonin.bacnet4j.type.constructed.Address;

    public class Application {

    static LocalDevice localDevice1;

    public static void main(String[] args) {

       IpNetwork network1 = new IpNetwork("255.255.255.255", 12345);
       Transport transport1 = new DefaultTransport(network1);
       transport1.addNetworkRouter(1001, IpNetworkUtils.toOctetString("IP:Port"));

      localDevice1 = new LocalDevice(92068, transport1);

      try {
        localDevice1.initialize();
        System.out.println("initialized");
        Address address1 = new Address(IpNetworkUtils.toOctetString("IP:port"));
        RemoteDevice d1 = localDevice1.findRemoteDevice(address1, 92068);
        System.out.println(d1);

        Address address2 = new Address(1001, IpNetworkUtils.toOctetString("IP:port"));
        RemoteDevice d2 = localDevice1.findRemoteDevice(address2, 1001);
        System.out.println(d2);

      } catch (Exception e) {
        System.out.println(e.toString());
      } finally {
        localDevice1.terminate();
      }
     }
    }

I get a timeout at:

   RemoteDevice d2 = localDevice1.findRemoteDevice(address2, 1001);

Every time I run this I can't get access to the Device / Routers 2100 and 1001. I tried accessing them directly, the router approach above, using different local devices. Anyone got any idea?

The 2 devices 2100 and 1001 have objects associated with them, but the other item doesn't.

Anyone have ideas what I am doing wrong?

1

There are 1 best solutions below

0
On

Oliver

It seems to me that you are trying to mix client and server modes in your app. (Not being familiar with Serotonin, just BACnet). A description of your physical setup would help: It seems that you have:

  • a real IP to MSTP router, device 2100, local Network Number 50, 'far' Network Number 1201
  • a real MSTP device Device Instance 1001, MAC 1, on the far network 1201
  • a virtual device 92068, within your Java app, with your app acting as a BACnet server

Now with your app acting as a client you 'discover' 92068 (at least, I assume so since you never mentioned problems here).

Then, again, with your app as a BACnet client you try to discover the Device Instance 1001, which is external to your box, will require a global (or remote), but not local, broadcast to reach via the real router.

I think your problem is the Serotonin library may be fine acting as a BACnet server, but not as a client.