- Java tools: static model code generator creates IP address for ClientLN even if optionl attribute ClientLN.apRef is not present

pull/147/head
Michael Zillgith 7 years ago
parent 549de2f7ed
commit e7f4fd8ebb

@ -91,7 +91,7 @@
<TrgOps period="true" />
<OptFields seqNum="true" timeStamp="true" dataSet="true" reasonCode="true" configRef="true" />
<RptEnabled max="1">
<ClientLN iedName="remoteClient" apRef="accessPoint1" ldInst="LD0" lnClass="IHMI" lnInst="1"/>
<ClientLN iedName="remoteClient" ldInst="LD0" lnClass="IHMI" lnInst="1"/>
</RptEnabled>
</ReportControl>

@ -1091,9 +1091,32 @@ 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) {
if (com != null) {
for (SubNetwork subNetWork : com.getSubNetworks()) {
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) {
@ -1103,6 +1126,10 @@ public class StaticModelGenerator {
return ip.getText();
}
}
}
}
}
}
return null;
}
@ -1148,7 +1175,7 @@ public class StaticModelGenerator {
String iedName = clientLN.getIedName();
String apRef = clientLN.getApRef();
if ((iedName != null) && (apRef != null)) {
if (iedName != null) {
String ipAddress = getIpAddressByIedName(sclParser, iedName, apRef);
try {

Loading…
Cancel
Save