scl parser can now handle multiple IEDs in a single scl file

pull/11/head
Stefan Feuerhahn 7 years ago
parent 0200a86cb1
commit 1d5b09e0fc

@ -568,7 +568,7 @@ public final class ClientAssociation {
if (decodedResponsePdu.getConfirmedRequestPDU() != null) {
incomingResponses.add(decodedResponsePdu);
throw clientReceiver.getLastIOException();
throw new IOException("connection was closed", clientReceiver.getLastIOException());
}
testForInitiateErrorResponse(decodedResponsePdu);

@ -52,7 +52,7 @@ public class SclParser {
private Document doc;
private String iedName;
private List<ServerModel> serverModels = null;
private List<ServerModel> serverModels = new ArrayList<>();
private boolean useResvTmsAttributes = false;
private final List<LnSubDef> dataSetDefs = new ArrayList<>();
@ -100,21 +100,28 @@ public class SclParser {
throw new SclParseException("No IED section found!");
}
Node nameAttribute = iedList.item(0).getAttributes().getNamedItem("name");
for (int z = 0; z < iedList.getLength(); z++) {
Node iedNode = iedList.item(z);
useResvTmsAttributes = false;
Node nameAttribute = iedNode.getAttributes().getNamedItem("name");
iedName = nameAttribute.getNodeValue();
if ((iedName == null) || (iedName.length() == 0)) {
throw new SclParseException("IED must have a name!");
}
NodeList iedElements = iedList.item(0).getChildNodes();
NodeList iedElements = iedNode.getChildNodes();
serverModels = new ArrayList<>(iedElements.getLength());
for (int i = 0; i < iedElements.getLength(); i++) {
Node element = iedElements.item(i);
String nodeName = element.getNodeName();
if ("AccessPoint".equals(nodeName)) {
serverModels.add(createAccessPoint(element).serverModel);
ServerSap serverSap = createAccessPoint(element);
if (serverSap != null) {
serverModels.add(serverSap.serverModel);
}
}
else if ("Services".equals(nodeName)) {
NodeList servicesElements = element.getChildNodes();
@ -129,6 +136,7 @@ public class SclParser {
}
}
}
}
private void readTypeDefinitions() throws SclParseException {
@ -185,10 +193,6 @@ public class SclParser {
}
}
if (serverSap == null) {
throw new SclParseException("AccessPoint has no server!");
}
return serverSap;
}

Loading…
Cancel
Save