- Edit SclParser.java to set current timestamp.

- Edit SclParser.java to let the Parsed CID/SCD (ServerModel) returns some attributes and Values that programmer may need after parsing.
- Let each returned LogicalDevice that returned from the ServerModel to return their LogicalNodes and some attributes after parsing.
- Let each returned LogicalNode that returned from the LogicalDevice that returned from the ServerModel to return their DataObjects and some attributes after parsing.
- Let FcDataObject returns some attributes after parsing.
- Let FcModelNode returns some attibutes after parsing.
pull/33/head
Abdelaziz Said 4 years ago
parent c8f49bdc47
commit 9191f42895

@ -17,6 +17,7 @@ import com.beanit.asn1bean.ber.types.BerNull;
import com.beanit.iec61850bean.internal.mms.asn1.Data; import com.beanit.iec61850bean.internal.mms.asn1.Data;
import com.beanit.iec61850bean.internal.mms.asn1.TypeDescription; import com.beanit.iec61850bean.internal.mms.asn1.TypeDescription;
import com.beanit.iec61850bean.internal.mms.asn1.UtcTime; import com.beanit.iec61850bean.internal.mms.asn1.UtcTime;
import java.time.Instant; import java.time.Instant;
import java.util.Date; import java.util.Date;
@ -65,6 +66,41 @@ public final class BdaTimestamp extends BasicDataAttribute {
return ((0xff & value[4]) << 16 | (0xff & value[5]) << 8 | (0xff & value[6])); return ((0xff & value[4]) << 16 | (0xff & value[5]) << 8 | (0xff & value[6]));
} }
public Date getDate() {
if (value == null || value.length == 0) {
return null;
}
long time =
getSecondsSinceEpoch() * 1000L
+ (long) (((float) getFractionOfSecond()) / (1 << 24) * 1000 + 0.5);
return new Date(time);
}
public void setDate(Date date) {
if (value == null) {
value = new byte[8];
}
int secondsSinceEpoch = (int) (date.getTime() / 1000L);
int fractionOfSecond = (int) ((date.getTime() % 1000L) / 1000.0 * (1 << 24));
// 0x8a = time accuracy of 10 and LeapSecondsKnown = true, ClockFailure
// = false, ClockNotSynchronized = false
value =
new byte[] {
(byte) ((secondsSinceEpoch >> 24) & 0xff),
(byte) ((secondsSinceEpoch >> 16) & 0xff),
(byte) ((secondsSinceEpoch >> 8) & 0xff),
(byte) (secondsSinceEpoch & 0xff),
(byte) ((fractionOfSecond >> 16) & 0xff),
(byte) ((fractionOfSecond >> 8) & 0xff),
(byte) (fractionOfSecond & 0xff),
(byte) 0x8a
};
}
@Override @Override
public void setValueFrom(BasicDataAttribute bda) { public void setValueFrom(BasicDataAttribute bda) {
byte[] srcValue = ((BdaTimestamp) bda).getValue(); byte[] srcValue = ((BdaTimestamp) bda).getValue();
@ -183,13 +219,17 @@ public final class BdaTimestamp extends BasicDataAttribute {
return ((value[7] & 0x1f)); return ((value[7] & 0x1f));
} }
/** Sets Timestamp the empty byte array (indicating an invalid Timestamp) */ /**
* Sets Timestamp the empty byte array (indicating an invalid Timestamp)
*/
@Override @Override
public void setDefault() { public void setDefault() {
value = new byte[8]; value = new byte[8];
} }
/** Sets Timestamp to current time */ /**
* Sets Timestamp to current time
*/
public void setCurrentTime() { public void setCurrentTime() {
setInstant(Instant.now()); setInstant(Instant.now());
} }

@ -14,6 +14,7 @@
package com.beanit.iec61850bean; package com.beanit.iec61850bean;
import com.beanit.iec61850bean.internal.mms.asn1.Data; import com.beanit.iec61850bean.internal.mms.asn1.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -30,10 +31,17 @@ import java.util.List;
*/ */
public class FcDataObject extends FcModelNode { public class FcDataObject extends FcModelNode {
public FcDataObject(ObjectReference objectReference, Fc fc, List<FcModelNode> children) { private final List<FcModelNode> fcModelNodes;
private String doType;
private String cdc;
public FcDataObject(ObjectReference objectReference, Fc fc, List<FcModelNode> children) {
this.fcModelNodes = children;
super.setDataAttributes(children);
this.children = new LinkedHashMap<>((int) ((children.size() / 0.75) + 1)); this.children = new LinkedHashMap<>((int) ((children.size() / 0.75) + 1));
this.objectReference = objectReference; this.objectReference = objectReference;
for (ModelNode child : children) { for (ModelNode child : children) {
this.children.put(child.getReference().getName(), child); this.children.put(child.getReference().getName(), child);
child.setParent(this); child.setParent(this);
@ -92,4 +100,20 @@ public class FcDataObject extends FcModelNode {
child.setValueFromMmsDataObj(iterator.next()); child.setValueFromMmsDataObj(iterator.next());
} }
} }
public String getDoType() {
return doType;
}
public void setDoType(String doType) {
this.doType = doType;
}
public String getCdc() {
return cdc;
}
public void setCdc(String cdc) {
this.cdc = cdc;
}
} }

@ -13,22 +13,16 @@
*/ */
package com.beanit.iec61850bean; package com.beanit.iec61850bean;
import static java.nio.charset.StandardCharsets.UTF_8; import com.beanit.iec61850bean.internal.mms.asn1.*;
import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccess;
import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection;
import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection.SelectAccess; import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection.SelectAccess;
import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection.SelectAccess.Component; import com.beanit.iec61850bean.internal.mms.asn1.AlternateAccessSelection.SelectAccess.Component;
import com.beanit.iec61850bean.internal.mms.asn1.BasicIdentifier;
import com.beanit.iec61850bean.internal.mms.asn1.Identifier;
import com.beanit.iec61850bean.internal.mms.asn1.ObjectName;
import com.beanit.iec61850bean.internal.mms.asn1.Unsigned32;
import com.beanit.iec61850bean.internal.mms.asn1.VariableDefs;
import com.beanit.iec61850bean.internal.mms.asn1.VariableSpecification;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import static java.nio.charset.StandardCharsets.UTF_8;
public abstract class FcModelNode extends ModelNode { public abstract class FcModelNode extends ModelNode {
Fc fc; Fc fc;
@ -36,6 +30,24 @@ public abstract class FcModelNode extends ModelNode {
private ServerAssociation selected = null; private ServerAssociation selected = null;
private TimerTask task = null; private TimerTask task = null;
private String daType;
private BdaType basicType = null;
private String sAddr;
private String daiVal;
private boolean dchg;
private boolean dupd;
private boolean qchg;
private String bType;
private List<FcModelNode> bdas;
private short valueShort;
private byte[] valueBytes;
private byte valueByte;
private boolean valueBoolean;
private int valueInt;
private long valueLong;
public Fc getFc() { public Fc getFc() {
return fc; return fc;
} }
@ -249,4 +261,125 @@ public abstract class FcModelNode extends ModelNode {
} }
return sb.toString(); return sb.toString();
} }
public String getDaType() {
return daType;
}
public void setDaType(String daType) {
this.daType = daType;
}
public BdaType getBasicType() {
return basicType;
}
public void setBasicType(BdaType basicType) {
this.basicType = basicType;
}
public String getsAddr() {
return sAddr;
}
public void setsAddr(String sAddr) {
this.sAddr = sAddr;
}
public String getDaiVal() {
return daiVal;
}
public void setDaiVal(String daiVal) {
this.daiVal = daiVal;
}
public boolean isDchg() {
return dchg;
}
public void setDchg(boolean dchg) {
this.dchg = dchg;
}
public boolean isDupd() {
return dupd;
}
public void setDupd(boolean dupd) {
this.dupd = dupd;
}
public boolean isQchg() {
return qchg;
}
public void setQchg(boolean qchg) {
this.qchg = qchg;
}
public String getbType() {
return bType;
}
public void setbType(String bType) {
this.bType = bType;
}
public List<FcModelNode> getDataAttributes() {
return bdas;
}
public FcModelNode setDataAttributes(List<FcModelNode> bdas) {
this.bdas = bdas;
return this;
}
public short getValueShort() {
return valueShort;
}
public void setValueShort(short valueShort) {
this.valueShort = valueShort;
}
public byte[] getValueBytes() {
return valueBytes;
}
public void setValueBytes(byte[] valueBytes) {
this.valueBytes = valueBytes;
}
public byte getValueByte() {
return valueByte;
}
public void setValueByte(byte valueByte) {
this.valueByte = valueByte;
}
public boolean isValueBoolean() {
return valueBoolean;
}
public void setValueBoolean(boolean valueBoolean) {
this.valueBoolean = valueBoolean;
}
public int getValueInt() {
return valueInt;
}
public void setValueInt(int valueInt) {
this.valueInt = valueInt;
}
public long getValueLong() {
return valueLong;
}
public void setValueLong(long valueLong) {
this.valueLong = valueLong;
}
} }

@ -19,7 +19,11 @@ import java.util.List;
public final class LogicalDevice extends ModelNode { public final class LogicalDevice extends ModelNode {
private final List<LogicalNode> logicalNodes;
private String ldInst;
public LogicalDevice(ObjectReference objectReference, List<LogicalNode> logicalNodes) { public LogicalDevice(ObjectReference objectReference, List<LogicalNode> logicalNodes) {
this.logicalNodes = logicalNodes;
children = new LinkedHashMap<>((int) ((logicalNodes.size() / 0.75) + 1)); children = new LinkedHashMap<>((int) ((logicalNodes.size() / 0.75) + 1));
this.objectReference = objectReference; this.objectReference = objectReference;
for (LogicalNode logicalNode : logicalNodes) { for (LogicalNode logicalNode : logicalNodes) {
@ -36,4 +40,16 @@ public final class LogicalDevice extends ModelNode {
} }
return new LogicalDevice(objectReference, childCopies); return new LogicalDevice(objectReference, childCopies);
} }
public List<LogicalNode> getLogicalNodes() {
return logicalNodes;
}
public String getLdInst() {
return ldInst;
}
public void setLdInst(String ldInst) {
this.ldInst = ldInst;
}
} }

@ -28,7 +28,14 @@ public final class LogicalNode extends ModelNode {
private final Map<String, Urcb> urcbs = new HashMap<>(); private final Map<String, Urcb> urcbs = new HashMap<>();
private final Map<String, Brcb> brcbs = new HashMap<>(); private final Map<String, Brcb> brcbs = new HashMap<>();
private final List<FcDataObject> dataObjects;
private String prefix;
private String lnClass;
private String lnInst;
private String lnType;
public LogicalNode(ObjectReference objectReference, List<FcDataObject> fcDataObjects) { public LogicalNode(ObjectReference objectReference, List<FcDataObject> fcDataObjects) {
this.dataObjects = fcDataObjects;
children = new LinkedHashMap<>(); children = new LinkedHashMap<>();
for (Fc fc : Fc.values()) { for (Fc fc : Fc.values()) {
this.fcDataObjects.put(fc, new LinkedHashMap<String, FcDataObject>()); this.fcDataObjects.put(fc, new LinkedHashMap<String, FcDataObject>());
@ -59,8 +66,7 @@ public final class LogicalNode extends ModelNode {
dataObjectsCopy.add((FcDataObject) obj.copy()); dataObjectsCopy.add((FcDataObject) obj.copy());
} }
LogicalNode copy = new LogicalNode(objectReference, dataObjectsCopy); return new LogicalNode(objectReference, dataObjectsCopy);
return copy;
} }
public List<FcDataObject> getChildren(Fc fc) { public List<FcDataObject> getChildren(Fc fc) {
@ -134,4 +140,36 @@ public final class LogicalNode extends ModelNode {
} }
return sb.toString(); return sb.toString();
} }
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getLnClass() {
return lnClass;
}
public void setLnClass(String lnClass) {
this.lnClass = lnClass;
}
public String getLnInst() {
return lnInst;
}
public void setLnInst(String lnInst) {
this.lnInst = lnInst;
}
public String getLnType() {
return lnType;
}
public void setLnType(String lnType) {
this.lnType = lnType;
}
} }

@ -41,6 +41,17 @@ public class SclParser {
private String iedConnectedAP; private String iedConnectedAP;
ConnectionParam connectionParm; ConnectionParam connectionParm;
private final Map<String, ConnectionParam> iedConnectionMap = new HashMap<>(); private final Map<String, ConnectionParam> iedConnectionMap = new HashMap<>();
private String iedManufacturer;
Map<String, String> descMap;
private List<String> ldsInsts;
private List<String> ldsRefs;
private Set<String> lnSet;
private Map<String, Set<String>> lns;
private final HashSet<String> lnS = new HashSet<>();
private final Map<String, String> cdcDOMap = new HashMap<>();
private Map<String, String> daiDescMap;
private List<LogicalDevice> logicalDevices;
private SclParser() { private SclParser() {
} }
@ -125,6 +136,9 @@ public class SclParser {
Node nameAttribute = iedNode.getAttributes().getNamedItem("name"); Node nameAttribute = iedNode.getAttributes().getNamedItem("name");
Node manufacturerAttr = iedNode.getAttributes().getNamedItem("manufacturer");
iedManufacturer = manufacturerAttr.getNodeValue();
iedName = nameAttribute.getNodeValue(); iedName = nameAttribute.getNodeValue();
if ((iedName == null) || (iedName.length() == 0)) { if ((iedName == null) || (iedName.length() == 0)) {
throw new SclParseException("IED must have a name!"); throw new SclParseException("IED must have a name!");
@ -242,6 +256,12 @@ public class SclParser {
if (element.getNodeName().equals("Server")) { if (element.getNodeName().equals("Server")) {
ldsInsts = new ArrayList<>();
ldsRefs = new ArrayList<>();
descMap = new HashMap<>();
daiDescMap = new HashMap<>();
logicalDevices = new ArrayList<>();
ServerModel server = createServerModel(element); ServerModel server = createServerModel(element);
Node namedItem = iedServer.getAttributes().getNamedItem("name"); Node namedItem = iedServer.getAttributes().getNamedItem("name");
@ -267,7 +287,9 @@ public class SclParser {
Node element = elements.item(i); Node element = elements.item(i);
if (element.getNodeName().equals("LDevice")) { if (element.getNodeName().equals("LDevice")) {
lns = new HashMap<>();
logicalDevices.add(createNewLDevice(element)); logicalDevices.add(createNewLDevice(element));
this.logicalDevices.add(createNewLDevice(element));
} }
} }
@ -285,6 +307,17 @@ public class SclParser {
dataSetDefs.clear(); dataSetDefs.clear();
serverModel.setConnectionParam(iedConnectionMap.get(iedName)); serverModel.setConnectionParam(iedConnectionMap.get(iedName));
serverModel.setIedName(iedName);
serverModel.setIedManufacturer(iedManufacturer);
serverModel.setLns(lns);
serverModel.setLnS(lnS);
serverModel.setDos(cdcDOMap);
serverModel.setLdsInsts(ldsInsts);
serverModel.setLdsRefs(ldsRefs);
serverModel.setDescriptions(descMap);
serverModel.setdAIDescriptions(daiDescMap);
serverModel.setLogicalDevices(logicalDevices);
return serverModel; return serverModel;
} }
@ -311,15 +344,20 @@ public class SclParser {
throw new SclParseException("Required attribute \"inst\" in logical device not found!"); throw new SclParseException("Required attribute \"inst\" in logical device not found!");
} }
ldsInsts.add(inst);
NodeList elements = ldXmlNode.getChildNodes(); NodeList elements = ldXmlNode.getChildNodes();
List<LogicalNode> logicalNodes = new ArrayList<>(); List<LogicalNode> logicalNodes = new ArrayList<>();
String ref; String ref;
if ((ldName != null) && (ldName.length() != 0)) { if ((ldName != null) && (ldName.length() != 0)) {
ref = ldName; ref = ldName;
ldsRefs.add(ref);
} else { } else {
ref = iedName + inst; ref = iedName + inst;
ldsRefs.add(ref);
} }
lnSet = new HashSet<>();
for (int i = 0; i < elements.getLength(); i++) { for (int i = 0; i < elements.getLength(); i++) {
Node element = elements.item(i); Node element = elements.item(i);
@ -328,8 +366,10 @@ public class SclParser {
logicalNodes.add(createNewLogicalNode(element, ref)); logicalNodes.add(createNewLogicalNode(element, ref));
} }
} }
lns.put(ref, lnSet);
LogicalDevice lDevice = new LogicalDevice(new ObjectReference(ref), logicalNodes); LogicalDevice lDevice = new LogicalDevice(new ObjectReference(ref), logicalNodes);
lDevice.setLdInst(inst);
return lDevice; return lDevice;
} }
@ -350,17 +390,24 @@ public class SclParser {
Node node = attributes.item(i); Node node = attributes.item(i);
String nodeName = node.getNodeName(); String nodeName = node.getNodeName();
if (nodeName.equals("inst")) { switch (nodeName) {
case "inst":
inst = node.getNodeValue(); inst = node.getNodeValue();
} else if (nodeName.equals("lnType")) { break;
case "lnType":
lnType = node.getNodeValue(); lnType = node.getNodeValue();
} else if (nodeName.equals("lnClass")) { break;
case "lnClass":
lnClass = node.getNodeValue(); lnClass = node.getNodeValue();
} else if (nodeName.equals("prefix")) { break;
case "prefix":
prefix = node.getNodeValue(); prefix = node.getNodeValue();
break;
} }
} }
lnSet.add(prefix + lnClass + inst);
if (inst == null) { if (inst == null) {
throw new SclParseException("Required attribute \"inst\" not found!"); throw new SclParseException("Required attribute \"inst\" not found!");
} }
@ -372,6 +419,7 @@ public class SclParser {
} }
String ref = parentRef + '/' + prefix + lnClass + inst; String ref = parentRef + '/' + prefix + lnClass + inst;
lnS.add(ref);
LnType lnTypeDef = typeDefinitions.getLNodeType(lnType); LnType lnTypeDef = typeDefinitions.getLNodeType(lnType);
@ -390,6 +438,12 @@ public class SclParser {
NamedNodeMap doiAttributes = childNode.getAttributes(); NamedNodeMap doiAttributes = childNode.getAttributes();
Node nameAttribute = doiAttributes.getNamedItem("name"); Node nameAttribute = doiAttributes.getNamedItem("name");
Node cdcAttribute = doiAttributes.getNamedItem("desc");
if (cdcAttribute != null) {
descMap.put(ref + "." + nameAttribute.getNodeValue(), cdcAttribute.getNodeValue());
}
if (nameAttribute != null && nameAttribute.getNodeValue().equals(dobject.getName())) { if (nameAttribute != null && nameAttribute.getNodeValue().equals(dobject.getName())) {
doiNodeFound = childNode; doiNodeFound = childNode;
} }
@ -397,7 +451,7 @@ public class SclParser {
} }
dataObjects.addAll( dataObjects.addAll(
createFcDataObjects(dobject.getName(), ref, dobject.getType(), doiNodeFound)); createFcDataObjects(dobject.getName(), ref, dobject.getType(), doiNodeFound, dobject.getType()));
} }
// look for ReportControl // look for ReportControl
@ -417,6 +471,12 @@ public class SclParser {
dataSetDefs.add(new LnSubDef(childNode, lNode)); dataSetDefs.add(new LnSubDef(childNode, lNode));
} }
} }
lNode.setPrefix(prefix);
lNode.setLnClass(lnClass);
lNode.setLnInst(inst);
lNode.setLnType(lnType);
return lNode; return lNode;
} }
@ -528,8 +588,7 @@ public class SclParser {
} }
} }
DataSet dataSet = new DataSet(lNode.getReference().toString() + '.' + name, dsMembers, false); return new DataSet(lNode.getReference().toString() + '.' + name, dsMembers, false);
return dataSet;
} }
private List<Rcb> createReportControlBlocks(Node xmlNode, String parentRef) private List<Rcb> createReportControlBlocks(Node xmlNode, String parentRef)
@ -795,7 +854,7 @@ public class SclParser {
} }
private List<FcDataObject> createFcDataObjects( private List<FcDataObject> createFcDataObjects(
String name, String parentRef, String doTypeID, Node doiNode) throws SclParseException { String name, String parentRef, String doTypeID, Node doiNode, String type) throws SclParseException {
DoType doType = typeDefinitions.getDOType(doTypeID); DoType doType = typeDefinitions.getDOType(doTypeID);
@ -805,6 +864,10 @@ public class SclParser {
String ref = parentRef + '.' + name; String ref = parentRef + '.' + name;
String cdc = doType.getCdc();
cdcDOMap.put(ref, cdc);
List<ModelNode> childNodes = new ArrayList<>(); List<ModelNode> childNodes = new ArrayList<>();
for (Da dattr : doType.das) { for (Da dattr : doType.das) {
@ -812,10 +875,22 @@ public class SclParser {
// look for DAI node with the name of the DA // look for DAI node with the name of the DA
Node iNodeFound = findINode(doiNode, dattr.getName()); Node iNodeFound = findINode(doiNode, dattr.getName());
if (iNodeFound != null) {
NamedNodeMap daiAttributes = iNodeFound.getAttributes();
if (daiAttributes != null) {
Node nameAttribute = daiAttributes.getNamedItem("name");
Node cdcAttribute = daiAttributes.getNamedItem("desc");
if (cdcAttribute != null) {
daiDescMap.put(ref + "." + nameAttribute.getNodeValue(), cdcAttribute.getNodeValue());
}
}
}
if (dattr.getCount() >= 1) { if (dattr.getCount() >= 1) {
childNodes.add(createArrayOfDataAttributes(ref + '.' + dattr.getName(), dattr, iNodeFound)); childNodes.add(createArrayOfDataAttributes(ref + '.' + dattr.getName(), dattr, iNodeFound));
} else { } else {
childNodes.add( FcModelNode fcModelNode =
createDataAttribute( createDataAttribute(
ref + '.' + dattr.getName(), ref + '.' + dattr.getName(),
dattr.getFc(), dattr.getFc(),
@ -823,7 +898,12 @@ public class SclParser {
iNodeFound, iNodeFound,
false, false,
false, false,
false)); false
);
fcModelNode.setbType(dattr.getbType());
fcModelNode.setDaType(dattr.getType());
childNodes.add(fcModelNode);
} }
} }
@ -837,7 +917,7 @@ public class SclParser {
Node iNodeFound = findINode(doiNode, sdo.getName()); Node iNodeFound = findINode(doiNode, sdo.getName());
childNodes.addAll(createFcDataObjects(sdo.getName(), ref, sdo.getType(), iNodeFound)); childNodes.addAll(createFcDataObjects(sdo.getName(), ref, sdo.getType(), iNodeFound, type));
} }
Map<Fc, List<FcModelNode>> subFCDataMap = new LinkedHashMap<>(); Map<Fc, List<FcModelNode>> subFCDataMap = new LinkedHashMap<>();
@ -855,7 +935,10 @@ public class SclParser {
for (Fc fc : Fc.values()) { for (Fc fc : Fc.values()) {
if (subFCDataMap.get(fc).size() > 0) { if (subFCDataMap.get(fc).size() > 0) {
fcDataObjects.add(new FcDataObject(objectReference, fc, subFCDataMap.get(fc))); FcDataObject fcDataObject = new FcDataObject(objectReference, fc, subFCDataMap.get(fc));
fcDataObject.setDoType(type);
fcDataObject.setCdc(cdc);
fcDataObjects.add(fcDataObject);
} }
} }
@ -937,8 +1020,11 @@ public class SclParser {
Node iNodeFound = findINode(iXmlNode, bda.getName()); Node iNodeFound = findINode(iXmlNode, bda.getName());
subDataAttributes.add( FcModelNode fcModelNode = createDataAttribute(ref + '.' + bda.getName(), fc, bda, iNodeFound, dchg, dupd, qchg);
createDataAttribute(ref + '.' + bda.getName(), fc, bda, iNodeFound, dchg, dupd, qchg)); fcModelNode.setDaType(bda.getType());
fcModelNode.setbType(bda.getbType());
subDataAttributes.add(fcModelNode);
} }
return new ConstructedDataAttribute(new ObjectReference(ref), fc, subDataAttributes); return new ConstructedDataAttribute(new ObjectReference(ref), fc, subDataAttributes);
} }
@ -1141,7 +1227,7 @@ public class SclParser {
BdaTimestamp bda = new BdaTimestamp(new ObjectReference(ref), fc, sAddr, dchg, dupd); BdaTimestamp bda = new BdaTimestamp(new ObjectReference(ref), fc, sAddr, dchg, dupd);
if (val != null) { if (val != null) {
// TODO // TODO
throw new SclParseException("parsing configured value for TIMESTAMP is not supported yet."); bda.setDate(new Date(System.currentTimeMillis()));
} }
return bda; return bda;
} else if (bType.equals("Enum")) { } else if (bType.equals("Enum")) {

@ -28,6 +28,17 @@ public final class ServerModel extends ModelNode {
private final Map<String, Brcb> brcbs = new HashMap<>(); private final Map<String, Brcb> brcbs = new HashMap<>();
private ConnectionParam connectionParam; private ConnectionParam connectionParam;
private String iedName;
private String iedManufacturer;
private List<String> ldsInsts;
private List<String> ldsRefs;
private List<String> lnsRefs;
private Map<String, Set<String>> lns;
private HashSet<String> lnS;
private Map<String, String> descriptions;
private Map<String,String> dAIDescriptions;
private Map<String, String> dos;
private List<LogicalDevice> logicalDevices;
public ServerModel(List<LogicalDevice> logicalDevices, Collection<DataSet> dataSets) { public ServerModel(List<LogicalDevice> logicalDevices, Collection<DataSet> dataSets) {
children = new LinkedHashMap<>(); children = new LinkedHashMap<>();
@ -402,4 +413,92 @@ public final class ServerModel extends ModelNode {
public void setConnectionParam(ConnectionParam connectionParam) { public void setConnectionParam(ConnectionParam connectionParam) {
this.connectionParam = connectionParam; this.connectionParam = connectionParam;
} }
public String getIedName() {
return iedName;
}
public void setIedName(String iedName) {
this.iedName = iedName;
}
public String getIedManufacturer() {
return iedManufacturer;
}
public void setIedManufacturer(String iedManufacturer) {
this.iedManufacturer = iedManufacturer;
}
public List<String> getLdsInsts() {
return ldsInsts;
}
public void setLdsInsts(List<String> ldsInsts) {
this.ldsInsts = ldsInsts;
}
public List<String> getLdsRefs() {
return ldsRefs;
}
public void setLdsRefs(List<String> ldsRefs) {
this.ldsRefs = ldsRefs;
}
public List<String> getLnsRefs() {
return lnsRefs;
}
public void setLnsRefs(List<String> lnsRefs) {
this.lnsRefs = lnsRefs;
}
public Map<String, Set<String>> getLns() {
return lns;
}
public void setLns(Map<String, Set<String>> lns) {
this.lns = lns;
}
public HashSet<String> getLnS() {
return lnS;
}
public void setLnS(HashSet<String> lnS) {
this.lnS = lnS;
}
public Map<String, String> getDescriptions() {
return descriptions;
}
public void setDescriptions(Map<String, String> descriptions) {
this.descriptions = descriptions;
}
public Map<String, String> getdAIDescriptions() {
return dAIDescriptions;
}
public void setdAIDescriptions(Map<String, String> dAIDescriptions) {
this.dAIDescriptions = dAIDescriptions;
}
public Map<String, String> getDos() {
return dos;
}
public void setDos(Map<String, String> dos) {
this.dos = dos;
}
public List<LogicalDevice> getLogicalDevices() {
return logicalDevices;
}
public void setLogicalDevices(List<LogicalDevice> logicalDevices) {
this.logicalDevices = logicalDevices;
}
} }

@ -14,11 +14,12 @@
package com.beanit.iec61850bean.internal.scl; package com.beanit.iec61850bean.internal.scl;
import com.beanit.iec61850bean.SclParseException; import com.beanit.iec61850bean.SclParseException;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import java.util.ArrayList;
import java.util.List;
public final class DoType extends AbstractType { public final class DoType extends AbstractType {
// attributes not needed: cdc, iedType // attributes not needed: cdc, iedType
@ -26,12 +27,16 @@ public final class DoType extends AbstractType {
public List<Da> das = new ArrayList<>(); public List<Da> das = new ArrayList<>();
public List<Sdo> sdos = new ArrayList<>(); public List<Sdo> sdos = new ArrayList<>();
private String cdc;
public DoType(Node xmlNode) throws SclParseException { public DoType(Node xmlNode) throws SclParseException {
super(xmlNode); super(xmlNode);
if (xmlNode.getAttributes().getNamedItem("cdc") == null) { if (xmlNode.getAttributes().getNamedItem("cdc") == null) {
throw new SclParseException("Required attribute \"cdc\" not found in DOType!"); throw new SclParseException("Required attribute \"cdc\" not found in DOType!");
} else {
cdc = xmlNode.getAttributes().getNamedItem("cdc").getNodeValue();
} }
NodeList elements = xmlNode.getChildNodes(); NodeList elements = xmlNode.getChildNodes();
@ -46,4 +51,8 @@ public final class DoType extends AbstractType {
} }
} }
} }
public String getCdc() {
return cdc;
}
} }

@ -14,16 +14,18 @@
package com.beanit.iec61850bean.internal.scl; package com.beanit.iec61850bean.internal.scl;
import com.beanit.iec61850bean.SclParseException; import com.beanit.iec61850bean.SclParseException;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import java.util.ArrayList;
import java.util.List;
public final class LnType extends AbstractType { public final class LnType extends AbstractType {
// attributes not needed: lnClass, iedType // attributes not needed: lnClass, iedType
public List<Do> dos = new ArrayList<>(); public List<Do> dos = new ArrayList<>();
private String lnClass;
public LnType(Node xmlNode) throws SclParseException { public LnType(Node xmlNode) throws SclParseException {
@ -31,6 +33,8 @@ public final class LnType extends AbstractType {
if (xmlNode.getAttributes().getNamedItem("lnClass") == null) { if (xmlNode.getAttributes().getNamedItem("lnClass") == null) {
throw new SclParseException("Required attribute \"lnClass\" not found in LNType!"); throw new SclParseException("Required attribute \"lnClass\" not found in LNType!");
} else {
lnClass = xmlNode.getAttributes().getNamedItem("lnClass").getNodeValue();
} }
NodeList elements = xmlNode.getChildNodes(); NodeList elements = xmlNode.getChildNodes();
@ -42,4 +46,12 @@ public final class LnType extends AbstractType {
} }
} }
} }
public String getLnClass() {
return lnClass;
}
public void setLnClass(String lnClass) {
this.lnClass = lnClass;
}
} }

Loading…
Cancel
Save