- config file generator/static model generator: added support for SampledValueControl.smpMod (LIB61850-67)

pull/476/head
Michael Zillgith 2 years ago
parent 1c1e3766da
commit 4a5a092796

@ -93,7 +93,7 @@ SCL.xsd">
</DataSet> </DataSet>
<SampledValueControl name="MSVCB01" datSet="PhsMeas1" <SampledValueControl name="MSVCB01" datSet="PhsMeas1"
smvID="xxxxMUnn01" smpRate="80" nofASDU="1" confRev="1"> smvID="xxxxMUnn01" smpRate="80" nofASDU="1" confRev="1" smpMod="SmpPerPeriod">
<SmvOpts refreshTime="false" sampleSynchronized="true" <SmvOpts refreshTime="false" sampleSynchronized="true"
security="false" dataRef="false" /> security="false" dataRef="false" />

@ -16,8 +16,7 @@ public class SampledValueControl {
private int nofASDU; private int nofASDU;
private boolean multicast = false; private boolean multicast = false;
private SmvOpts smvOpts; private SmvOpts smvOpts;
private SmpMod smpMod = SmpMod.SMP_PER_PERIOD;
public SampledValueControl(Node smvControlNode) throws SclParserException { public SampledValueControl(Node smvControlNode) throws SclParserException {
this.name = ParserUtils.parseAttribute(smvControlNode, "name"); this.name = ParserUtils.parseAttribute(smvControlNode, "name");
@ -49,9 +48,24 @@ public class SampledValueControl {
Node smvOptsNode = ParserUtils.getChildNodeWithTag(smvControlNode, "SmvOpts"); Node smvOptsNode = ParserUtils.getChildNodeWithTag(smvControlNode, "SmvOpts");
this.smvOpts = new SmvOpts(smvOptsNode); this.smvOpts = new SmvOpts(smvOptsNode);
}
String smpModString = ParserUtils.parseAttribute(smvControlNode, "smpMod");
if (smpModString != null) {
if (smpModString.equals("SmpPerPeriod")) {
smpMod = SmpMod.SMP_PER_PERIOD;
}
else if (smpModString.equals("SmpPerSec")) {
smpMod = SmpMod.SMP_PER_SECOND;
}
else if (smpModString.equals("SecPerSmp")) {
smpMod = SmpMod.SEC_PER_SMP;
}
else {
throw new SclParserException(smvControlNode, "Invalid smpMod value " + smpModString);
}
}
}
public String getName() { public String getName() {
return name; return name;
@ -89,4 +103,7 @@ public class SampledValueControl {
return smvOpts; return smvOpts;
} }
public SmpMod getSmpMod() {
return smpMod;
}
} }

@ -0,0 +1,56 @@
package com.libiec61850.scl.model;
/*
* Copyright 2023 Michael Zillgith
*
* This file is part of libIEC61850.
*
* libIEC61850 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libIEC61850 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
*
* See COPYING file for the complete license text.
*/
public enum SmpMod
{
SMP_PER_PERIOD(0),
SMP_PER_SECOND(1),
SEC_PER_SMP(2);
private int value;
private SmpMod(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public boolean compare(int i)
{
return (value == i);
}
public static SmpMod fromValue(int val)
{
SmpMod[] errors = SmpMod.values();
for (int i = 0; i < errors.length; i++) {
if (errors[i].compare(val))
return errors[i];
}
return SmpMod.SMP_PER_PERIOD;
}
}

@ -186,7 +186,7 @@ public class DynamicModelGenerator {
output.print(svcb.getSmvID() + " "); output.print(svcb.getSmvID() + " ");
output.print(svcb.getDatSet() + " "); output.print(svcb.getDatSet() + " ");
output.print(svcb.getConfRev() + " "); output.print(svcb.getConfRev() + " ");
output.print("0" + " "); output.print(svcb.getSmpMod().getValue() + " ");
output.print(svcb.getSmpRate() + " "); output.print(svcb.getSmpRate() + " ");
output.print(svcb.getSmvOpts().getIntValue() + " "); output.print(svcb.getSmvOpts().getIntValue() + " ");
output.print(svcb.isMulticast() ? "0" : "1"); output.print(svcb.isMulticast() ? "0" : "1");

@ -1011,7 +1011,9 @@ public class StaticModelGenerator {
svString += svCB.getSmvOpts().getIntValue() + ", "; svString += svCB.getSmvOpts().getIntValue() + ", ";
svString += "0, " + svCB.getSmpRate() + ", "; svString += svCB.getSmpMod().getValue() + ", ";
svString += svCB.getSmpRate() + ", ";
svString += svCB.getConfRev() + ", "; svString += svCB.getConfRev() + ", ";

Loading…
Cancel
Save