- 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" /> <TrgOps period="true" />
<OptFields seqNum="true" timeStamp="true" dataSet="true" reasonCode="true" configRef="true" /> <OptFields seqNum="true" timeStamp="true" dataSet="true" reasonCode="true" configRef="true" />
<RptEnabled max="1"> <RptEnabled max="1">
<ClientLN iedName="remoteClient" apRef="accessPoint1" ldInst="LD0" lnClass="IHMI" lnInst="1"/> <ClientLN iedName="remoteClient" ldInst="LD0" lnClass="IHMI" lnInst="1"/>
</RptEnabled> </RptEnabled>
</ReportControl> </ReportControl>

@ -1091,16 +1091,43 @@ public class StaticModelGenerator {
private String getIpAddressByIedName(SclParser sclParser, String iedName, String apRef) 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) {
Address address = ap.getAddress();
if (address != null) { for (SubNetwork subNetWork : com.getSubNetworks()) {
P ip = address.getAddressParameter("IP");
if (ip != null) for (ConnectedAP ap : subNetWork.getConnectedAPs()) {
return ip.getText();
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,7 +1175,7 @@ public class StaticModelGenerator {
String iedName = clientLN.getIedName(); String iedName = clientLN.getIedName();
String apRef = clientLN.getApRef(); String apRef = clientLN.getApRef();
if ((iedName != null) && (apRef != null)) { if (iedName != null) {
String ipAddress = getIpAddressByIedName(sclParser, iedName, apRef); String ipAddress = getIpAddressByIedName(sclParser, iedName, apRef);
try { try {

Loading…
Cancel
Save