diff --git a/examples/server_example_basic_io/simpleIO_direct_control.cid b/examples/server_example_basic_io/simpleIO_direct_control.cid index ad1a69c6..1bc0fabc 100644 --- a/examples/server_example_basic_io/simpleIO_direct_control.cid +++ b/examples/server_example_basic_io/simpleIO_direct_control.cid @@ -91,7 +91,7 @@ - + diff --git a/tools/model_generator/genmodel.jar b/tools/model_generator/genmodel.jar index 4d6ee5d4..34e4bfb2 100644 Binary files a/tools/model_generator/genmodel.jar and b/tools/model_generator/genmodel.jar differ diff --git a/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java b/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java index c8febe3b..5bc26a10 100644 --- a/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java +++ b/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java @@ -1091,16 +1091,43 @@ public class StaticModelGenerator { private String getIpAddressByIedName(SclParser sclParser, String iedName, String apRef) { - ConnectedAP ap = sclParser.getConnectedAP(iedName, apRef); + Communication com = sclParser.getCommunication(); - if (ap != null) { - Address address = ap.getAddress(); + if (com != null) { - if (address != null) { - P ip = address.getAddressParameter("IP"); + for (SubNetwork subNetWork : com.getSubNetworks()) { - if (ip != null) - return ip.getText(); + for (ConnectedAP ap : subNetWork.getConnectedAPs()) { + + if (apRef != null) { + boolean isMatching = false; + + String apName = ap.getApName(); + + if (apName != null) { + if (apName.equals(apRef)) + isMatching = true; + } + + if (isMatching == false) + continue; + } + + String apIedName = ap.getIedName(); + + if (apIedName != null) { + if (apIedName.equals(iedName)) { + Address address = ap.getAddress(); + + if (address != null) { + P ip = address.getAddressParameter("IP"); + + if (ip != null) + return ip.getText(); + } + } + } + } } } @@ -1148,8 +1175,8 @@ public class StaticModelGenerator { String iedName = clientLN.getIedName(); String apRef = clientLN.getApRef(); - if ((iedName != null) && (apRef != null)) { - String ipAddress = getIpAddressByIedName(sclParser, iedName, apRef); + if (iedName != null) { + String ipAddress = getIpAddressByIedName(sclParser, iedName, apRef); try { InetAddress inetAddr = InetAddress.getByName(ipAddress);