- 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,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);

Loading…
Cancel
Save