- Java tools: moved minTime, maxTime from GSEControl to GSE; updated

GOOSE server example CID file
pull/244/head
Michael Zillgith 5 years ago
parent fd6dbfaf8e
commit ecd4d44d8f

@ -20,6 +20,8 @@
<P type="MAC-Address">01-0c-cd-01-00-01</P> <P type="MAC-Address">01-0c-cd-01-00-01</P>
<P type="APPID">1000</P> <P type="APPID">1000</P>
</Address> </Address>
<MinTime>1000</MinTime>
<MaxTime>3000</MaxTime>
</GSE> </GSE>
<GSE ldInst="GenericIO" cbName="gcbAnalogValues"> <GSE ldInst="GenericIO" cbName="gcbAnalogValues">
<Address> <Address>
@ -86,7 +88,7 @@
<RptEnabled max="1" /> <RptEnabled max="1" />
</ReportControl> </ReportControl>
<GSEControl appID="events" name="gcbEvents" type="GOOSE" datSet="Events" confRev="2" minTime="1000" maxTime="3000" /> <GSEControl appID="events" name="gcbEvents" type="GOOSE" datSet="Events" confRev="2" />
<GSEControl appID="analog" name="gcbAnalogValues" type="GOOSE" datSet="AnalogValues" confRev="2"/> <GSEControl appID="analog" name="gcbAnalogValues" type="GOOSE" datSet="AnalogValues" confRev="2"/>
<DOI name="Mod"> <DOI name="Mod">

@ -86,12 +86,12 @@ public class ConnectedAP {
return smvs; return smvs;
} }
public PhyComAddress lookupGSEAddress(String logicalDeviceName, String name) { public GSE lookupGSE(String logicalDeviceName, String name) {
for (GSE gse : this.getGses()) { for (GSE gse : this.getGses()) {
if (gse.getLdInst().equals(logicalDeviceName)) { if (gse.getLdInst().equals(logicalDeviceName)) {
if (gse.getCbName().equals(name)) if (gse.getCbName().equals(name))
return gse.getAddress(); return gse;
} }
} }

@ -31,6 +31,9 @@ public class GSE {
private String ldInst; private String ldInst;
private String cbName; private String cbName;
private int minTime = -1;
private int maxTime = -1;
private PhyComAddress address; private PhyComAddress address;
public GSE(Node gseNode) throws SclParserException { public GSE(Node gseNode) throws SclParserException {
@ -40,6 +43,18 @@ public class GSE {
if ((ldInst == null) || (cbName == null)) if ((ldInst == null) || (cbName == null))
throw new SclParserException(gseNode, "GSE is missing required attribute"); 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"); Node addressNode = ParserUtils.getChildNodeWithTag(gseNode, "Address");
if (addressNode == null) if (addressNode == null)
@ -56,6 +71,14 @@ public class GSE {
return cbName; return cbName;
} }
public int getMinTime() {
return minTime;
}
public int getMaxTime() {
return maxTime;
}
public PhyComAddress getAddress() { public PhyComAddress getAddress() {
return address; return address;
} }

@ -50,7 +50,7 @@ public class PhyComAddress {
throw new SclParserException(addressNode, "VLAN-ID value out of range"); throw new SclParserException(addressNode, "VLAN-ID value out of range");
} }
else if (type.equals("VLAN-PRIORITY")) { else if (type.equals("VLAN-PRIORITY")) {
vlanPriority = new Integer(pNode.getTextContent()); vlanPriority = Integer.parseInt(pNode.getTextContent());
} }
else if (type.equals("APPID")) { else if (type.equals("APPID")) {
appId = Integer.parseInt(pNode.getTextContent(), 16); appId = Integer.parseInt(pNode.getTextContent(), 16);

@ -34,8 +34,6 @@ public class GSEControl {
private int confRev = 1; private int confRev = 1;
private String appID; private String appID;
private boolean fixedOffs = false; private boolean fixedOffs = false;
private int minTime = -1;
private int maxTime = -1;
public GSEControl(Node gseControlNode) throws SclParserException { public GSEControl(Node gseControlNode) throws SclParserException {
@ -57,17 +55,6 @@ public class GSEControl {
if (fixedOffs != null) if (fixedOffs != null)
this.fixedOffs = fixedOffs; 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"); String typeString = ParserUtils.parseAttribute(gseControlNode, "type");
if (typeString != null) if (typeString != null)
@ -101,12 +88,4 @@ public class GSEControl {
return fixedOffs; return fixedOffs;
} }
public int getMinTime() {
return minTime;
}
public int getMaxTime() {
return maxTime;
}
} }

@ -3,7 +3,7 @@ package com.libiec61850.tools;
/* /*
* DynamicModelGenerator.java * DynamicModelGenerator.java
* *
* Copyright 2014-2016 Michael Zillgith * Copyright 2014-2020 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
@ -35,6 +35,7 @@ import com.libiec61850.scl.DataAttributeDefinition;
import com.libiec61850.scl.SclParser; import com.libiec61850.scl.SclParser;
import com.libiec61850.scl.SclParserException; import com.libiec61850.scl.SclParserException;
import com.libiec61850.scl.communication.ConnectedAP; import com.libiec61850.scl.communication.ConnectedAP;
import com.libiec61850.scl.communication.GSE;
import com.libiec61850.scl.communication.PhyComAddress; import com.libiec61850.scl.communication.PhyComAddress;
import com.libiec61850.scl.model.AccessPoint; import com.libiec61850.scl.model.AccessPoint;
import com.libiec61850.scl.model.DataAttribute; import com.libiec61850.scl.model.DataAttribute;
@ -153,10 +154,15 @@ public class DynamicModelGenerator {
for (GSEControl gcb : logicalNode.getGSEControlBlocks()) { for (GSEControl gcb : logicalNode.getGSEControlBlocks()) {
LogicalDevice ld = logicalNode.getParentLogicalDevice(); LogicalDevice ld = logicalNode.getParentLogicalDevice();
GSE gse = null;
PhyComAddress gseAddress = null; PhyComAddress gseAddress = null;
if (connectedAP != null) if (connectedAP != null) {
gseAddress = connectedAP.lookupGSEAddress(ld.getInst(), gcb.getName()); gse = connectedAP.lookupGSE(ld.getInst(), gcb.getName());
if (gse != null)
gseAddress = gse.getAddress();
}
else else
System.out.println("WARNING: IED \"" + ied.getName() + "\" has no connected access point!"); System.out.println("WARNING: IED \"" + ied.getName() + "\" has no connected access point!");
@ -170,9 +176,14 @@ public class DynamicModelGenerator {
else else
output.print('0'); output.print('0');
output.print(' '); output.print(' ');
output.print(gcb.getMinTime()); if (gse != null) {
output.print(gse.getMinTime());
output.print(' '); output.print(' ');
output.print(gcb.getMaxTime()); output.print(gse.getMaxTime());
}
else {
output.print("-1 -1");
}
output.print(' '); output.print(' ');
if (gseAddress == null) { if (gseAddress == null) {

@ -3,7 +3,7 @@ package com.libiec61850.tools;
/* /*
* StaticModelGenerator.java * StaticModelGenerator.java
* *
* Copyright 2013-2016 Michael Zillgith * Copyright 2013-2020 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
@ -1027,7 +1027,9 @@ public class StaticModelGenerator {
for (GSEControl gseControlBlock : gseControlBlocks) { 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 gseString = "";
@ -1082,8 +1084,8 @@ public class StaticModelGenerator {
else else
gseString += "NULL, "; gseString += "NULL, ";
gseString += gseControlBlock.getMinTime() + ", "; gseString += gse.getMinTime() + ", ";
gseString += gseControlBlock.getMaxTime() + ", "; gseString += gse.getMaxTime() + ", ";
currentGseVariableNumber++; currentGseVariableNumber++;

Loading…
Cancel
Save