diff --git a/examples/server_example_goose/simpleIO_direct_control_goose.cid b/examples/server_example_goose/simpleIO_direct_control_goose.cid index 7e287e73..8f443989 100644 --- a/examples/server_example_goose/simpleIO_direct_control_goose.cid +++ b/examples/server_example_goose/simpleIO_direct_control_goose.cid @@ -20,6 +20,8 @@

01-0c-cd-01-00-01

1000

+ 1000 + 3000
@@ -59,36 +61,36 @@ - + - + - + - + - - - - + + + + status-only diff --git a/tools/model_generator/src/com/libiec61850/scl/communication/ConnectedAP.java b/tools/model_generator/src/com/libiec61850/scl/communication/ConnectedAP.java index 26abfbeb..d9765b04 100644 --- a/tools/model_generator/src/com/libiec61850/scl/communication/ConnectedAP.java +++ b/tools/model_generator/src/com/libiec61850/scl/communication/ConnectedAP.java @@ -86,12 +86,12 @@ public class ConnectedAP { return smvs; } - public PhyComAddress lookupGSEAddress(String logicalDeviceName, String name) { + public GSE lookupGSE(String logicalDeviceName, String name) { for (GSE gse : this.getGses()) { if (gse.getLdInst().equals(logicalDeviceName)) { if (gse.getCbName().equals(name)) - return gse.getAddress(); + return gse; } } diff --git a/tools/model_generator/src/com/libiec61850/scl/communication/GSE.java b/tools/model_generator/src/com/libiec61850/scl/communication/GSE.java index eb56e1bf..e2ddbb99 100644 --- a/tools/model_generator/src/com/libiec61850/scl/communication/GSE.java +++ b/tools/model_generator/src/com/libiec61850/scl/communication/GSE.java @@ -31,6 +31,9 @@ public class GSE { private String ldInst; private String cbName; + private int minTime = -1; + private int maxTime = -1; + private PhyComAddress address; public GSE(Node gseNode) throws SclParserException { @@ -40,6 +43,18 @@ public class GSE { if ((ldInst == null) || (cbName == null)) throw new SclParserException(gseNode, "GSE is missing required attribute"); + Node minTimeNode = ParserUtils.getChildNodeWithTag(gseNode, "MinTime"); + + if (minTimeNode != null) { + minTime = Integer.parseInt(minTimeNode.getTextContent()); + } + + Node maxTimeNode = ParserUtils.getChildNodeWithTag(gseNode, "MaxTime"); + + if (maxTimeNode != null) { + maxTime = Integer.parseInt(maxTimeNode.getTextContent()); + } + Node addressNode = ParserUtils.getChildNodeWithTag(gseNode, "Address"); if (addressNode == null) @@ -55,6 +70,14 @@ public class GSE { public String getCbName() { return cbName; } + + public int getMinTime() { + return minTime; + } + + public int getMaxTime() { + return maxTime; + } public PhyComAddress getAddress() { return address; diff --git a/tools/model_generator/src/com/libiec61850/scl/communication/PhyComAddress.java b/tools/model_generator/src/com/libiec61850/scl/communication/PhyComAddress.java index c4ff7e10..b2d370b6 100644 --- a/tools/model_generator/src/com/libiec61850/scl/communication/PhyComAddress.java +++ b/tools/model_generator/src/com/libiec61850/scl/communication/PhyComAddress.java @@ -50,7 +50,7 @@ public class PhyComAddress { throw new SclParserException(addressNode, "VLAN-ID value out of range"); } else if (type.equals("VLAN-PRIORITY")) { - vlanPriority = new Integer(pNode.getTextContent()); + vlanPriority = Integer.parseInt(pNode.getTextContent()); } else if (type.equals("APPID")) { appId = Integer.parseInt(pNode.getTextContent(), 16); diff --git a/tools/model_generator/src/com/libiec61850/scl/model/GSEControl.java b/tools/model_generator/src/com/libiec61850/scl/model/GSEControl.java index 73309921..8c032f77 100644 --- a/tools/model_generator/src/com/libiec61850/scl/model/GSEControl.java +++ b/tools/model_generator/src/com/libiec61850/scl/model/GSEControl.java @@ -34,8 +34,6 @@ public class GSEControl { private int confRev = 1; private String appID; private boolean fixedOffs = false; - private int minTime = -1; - private int maxTime = -1; public GSEControl(Node gseControlNode) throws SclParserException { @@ -57,17 +55,6 @@ public class GSEControl { if (fixedOffs != null) this.fixedOffs = fixedOffs; - String minTimeStr = ParserUtils.parseAttribute(gseControlNode, - "minTime"); - String maxTimeStr = ParserUtils.parseAttribute(gseControlNode, - "maxTime"); - - if (minTimeStr != null) - minTime = new Integer(minTimeStr); - - if (maxTimeStr != null) - maxTime = new Integer(maxTimeStr); - String typeString = ParserUtils.parseAttribute(gseControlNode, "type"); if (typeString != null) @@ -101,12 +88,4 @@ public class GSEControl { return fixedOffs; } - public int getMinTime() { - return minTime; - } - - public int getMaxTime() { - return maxTime; - } - } diff --git a/tools/model_generator/src/com/libiec61850/tools/DynamicModelGenerator.java b/tools/model_generator/src/com/libiec61850/tools/DynamicModelGenerator.java index 5321094d..fdbdb40a 100644 --- a/tools/model_generator/src/com/libiec61850/tools/DynamicModelGenerator.java +++ b/tools/model_generator/src/com/libiec61850/tools/DynamicModelGenerator.java @@ -3,7 +3,7 @@ package com.libiec61850.tools; /* * DynamicModelGenerator.java * - * Copyright 2014-2016 Michael Zillgith + * Copyright 2014-2020 Michael Zillgith * * This file is part of libIEC61850. * @@ -35,6 +35,7 @@ import com.libiec61850.scl.DataAttributeDefinition; import com.libiec61850.scl.SclParser; import com.libiec61850.scl.SclParserException; import com.libiec61850.scl.communication.ConnectedAP; +import com.libiec61850.scl.communication.GSE; import com.libiec61850.scl.communication.PhyComAddress; import com.libiec61850.scl.model.AccessPoint; import com.libiec61850.scl.model.DataAttribute; @@ -153,10 +154,15 @@ public class DynamicModelGenerator { for (GSEControl gcb : logicalNode.getGSEControlBlocks()) { LogicalDevice ld = logicalNode.getParentLogicalDevice(); + GSE gse = null; PhyComAddress gseAddress = null; - if (connectedAP != null) - gseAddress = connectedAP.lookupGSEAddress(ld.getInst(), gcb.getName()); + if (connectedAP != null) { + gse = connectedAP.lookupGSE(ld.getInst(), gcb.getName()); + + if (gse != null) + gseAddress = gse.getAddress(); + } else System.out.println("WARNING: IED \"" + ied.getName() + "\" has no connected access point!"); @@ -170,9 +176,14 @@ public class DynamicModelGenerator { else output.print('0'); output.print(' '); - output.print(gcb.getMinTime()); - output.print(' '); - output.print(gcb.getMaxTime()); + if (gse != null) { + output.print(gse.getMinTime()); + output.print(' '); + output.print(gse.getMaxTime()); + } + else { + output.print("-1 -1"); + } output.print(' '); if (gseAddress == null) { diff --git a/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java b/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java index a68df455..6f0a41b3 100644 --- a/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java +++ b/tools/model_generator/src/com/libiec61850/tools/StaticModelGenerator.java @@ -3,7 +3,7 @@ package com.libiec61850.tools; /* * StaticModelGenerator.java * - * Copyright 2013-2016 Michael Zillgith + * Copyright 2013-2020 Michael Zillgith * * This file is part of libIEC61850. * @@ -1027,8 +1027,10 @@ public class StaticModelGenerator { for (GSEControl gseControlBlock : gseControlBlocks) { - PhyComAddress gseAddress = connectedAP.lookupGSEAddress(logicalDeviceName, gseControlBlock.getName()); + GSE gse = connectedAP.lookupGSE(logicalDeviceName, gseControlBlock.getName()); + PhyComAddress gseAddress = gse.getAddress(); + String gseString = ""; String phyComAddrName = ""; @@ -1082,8 +1084,8 @@ public class StaticModelGenerator { else gseString += "NULL, "; - gseString += gseControlBlock.getMinTime() + ", "; - gseString += gseControlBlock.getMaxTime() + ", "; + gseString += gse.getMinTime() + ", "; + gseString += gse.getMaxTime() + ", "; currentGseVariableNumber++;