Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
riseclipse-validator-scl2003
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RiseClipseGroup
riseclipse-validator-scl2003
Commits
1df71bc8
Commit
1df71bc8
authored
5 years ago
by
Dominique Marcadet
Browse files
Options
Downloads
Patches
Plain Diff
handle conditions MOln0 and MFln0 for DataAttribute
parent
cefc3656
No related branches found
Branches containing commit
No related tags found
1 merge request
!11
Resolve "complete validation by NSD"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fr.centralesupelec.edf.riseclipse.iec61850.scl.tools/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/validator/nsd/DataAttributePresenceConditionValidator.java
+79
-95
79 additions, 95 deletions
...alidator/nsd/DataAttributePresenceConditionValidator.java
with
79 additions
and
95 deletions
fr.centralesupelec.edf.riseclipse.iec61850.scl.tools/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/validator/nsd/DataAttributePresenceConditionValidator.java
+
79
−
95
View file @
1df71bc8
...
...
@@ -25,10 +25,14 @@ import java.util.Map.Entry;
import
org.eclipse.emf.common.util.BasicDiagnostic
;
import
org.eclipse.emf.common.util.Diagnostic
;
import
org.eclipse.emf.common.util.DiagnosticChain
;
import
org.eclipse.emf.common.util.EList
;
import
fr.centralesupelec.edf.riseclipse.iec61850.nsd.CDC
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.AbstractDataObject
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.DA
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.DO
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.DOType
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.SDO
;
import
fr.centralesupelec.edf.riseclipse.iec61850.scl.validator.RiseClipseValidatorSCL
;
import
fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole
;
import
fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole
;
...
...
@@ -70,8 +74,8 @@ public class DataAttributePresenceConditionValidator {
// private HashMap< String, Pair< Integer, Integer > > mandatoryMultiRange;
// private HashMap< String, Pair< Integer, Integer > > optionalMultiRange;
// private HashSet< String > mandatoryIfSubstitutionElseForbidden;
//
private HashSet< String > mandatoryInLLN0ElseOptional;
//
private HashSet< String > mandatoryInLLN0ElseForbidden;
private
HashSet
<
String
>
mandatoryInLLN0ElseOptional
;
private
HashSet
<
String
>
mandatoryInLLN0ElseForbidden
;
// private HashSet< String > mandatoryIfNameSpaceOfLogicalNodeDeviatesElseOptional;
// private HashSet< String > mandatoryIfNameSpaceOfDataObjectDeviatesElseOptional;
// private HashSet< String > mandatoryIfAnalogValueIncludesIElseForbidden;
...
...
@@ -102,8 +106,8 @@ public class DataAttributePresenceConditionValidator {
}
public
void
reset
()
{
for
(
String
d
o_
:
presentDA
.
keySet
()
)
{
presentDA
.
put
(
d
o_
,
null
);
for
(
String
d
a
:
presentDA
.
keySet
()
)
{
presentDA
.
put
(
d
a
,
null
);
}
}
...
...
@@ -369,15 +373,13 @@ public class DataAttributePresenceConditionValidator {
break
;
case
"MOln0"
:
// Element is mandatory in the context of LLN0; otherwise optional
console
.
warning
(
"[NSD setup] NOT IMPLEMENTED: DataAttribute "
+
name
+
" declared as \"MOln0\" in PresenceCondition"
);
// if( mandatoryInLLN0ElseOptional == null ) mandatoryInLLN0ElseOptional = new HashSet<>();
// mandatoryInLLN0ElseOptional.add( name );
if
(
mandatoryInLLN0ElseOptional
==
null
)
mandatoryInLLN0ElseOptional
=
new
HashSet
<>();
mandatoryInLLN0ElseOptional
.
add
(
name
);
break
;
case
"MFln0"
:
// Element is mandatory in the context of LLN0; otherwise forbidden
console
.
warning
(
"[NSD setup] NOT IMPLEMENTED: DataAttribute "
+
name
+
" declared as \"MFln0\" in PresenceCondition"
);
// if( mandatoryInLLN0ElseForbidden == null ) mandatoryInLLN0ElseForbidden = new HashSet<>();
// mandatoryInLLN0ElseForbidden.add( name );
if
(
mandatoryInLLN0ElseForbidden
==
null
)
mandatoryInLLN0ElseForbidden
=
new
HashSet
<>();
mandatoryInLLN0ElseForbidden
.
add
(
name
);
break
;
case
"MOlnNs"
:
// Element is mandatory if the name space of its logical node deviates from the name space of the containing
...
...
@@ -1000,101 +1002,83 @@ public class DataAttributePresenceConditionValidator {
// presCond: "MOln0" :
// Element is mandatory in the context of LLN0; otherwise optional
// Usage in standard NSD files (version 2007B): DataAttribute
// if( mandatoryInLLN0ElseOptional != null ) {
//
// }
if
(
mandatoryInLLN0ElseOptional
!=
null
)
{
EList
<
AbstractDataObject
>
adoList
=
doType
.
getReferredByAbstractDataObject
();
for
(
AbstractDataObject
ado
:
adoList
)
{
if
(
ado
instanceof
DO
)
{
DO
do_
=
(
DO
)
ado
;
if
(
"LLN0"
.
equals
(
do_
.
getParentLNodeType
().
getLnClass
()
))
{
for
(
String
attribute
:
mandatoryInLLN0ElseOptional
)
{
DA
da
=
presentDA
.
get
(
attribute
);
if
(
da
==
null
)
{
diagnostics
.
add
(
new
BasicDiagnostic
(
Diagnostic
.
ERROR
,
RiseClipseValidatorSCL
.
DIAGNOSTIC_SOURCE
,
0
,
"[NSD validation] DA "
+
attribute
+
" is mandatory in DOType (line "
+
doType
.
getLineNumber
()
+
") with LNClass LLN0"
,
new
Object
[]
{
doType
}
));
res
=
false
;
}
}
}
}
else
{
// ado instanceof SDO
}
}
}
// presCond: "MFln0" :
// Element is mandatory in the context of LLN0; otherwise forbidden
// Usage in standard NSD files (version 2007B): DataAttribute
// if( mandatoryInLLN0ElseForbidden != null ) {
//
// }
// presCond: "MOlnNs" :
// Element is mandatory if the name space of its logical node deviates from the name space of the containing
// logical device, otherwise optional. See IEC 61850-7-1 for use of name space
// Usage in standard NSD files (version 2007B): DataAttribute
// TODO: The meaning is not clear.
/*
if( mandatoryIfNameSpaceOfLogicalNodeDeviatesElseOptional != null ) {
for( String name : mandatoryIfNameSpaceOfLogicalNodeDeviatesElseOptional ) {
for( AnyLN anyLN : lNodeType.getReferredByAnyLN() ) {
Optional< DOI > namPlt1 =
anyLN
.getDOI()
.stream()
.filter( doi -> "NamPlt".equals( doi.getName() ))
.findFirst();
if( ! namPlt1.isPresent() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : cannot find DOI \"NamPlt\" in AnyLN" );
continue;
}
Optional< DAI > lnNs =
namPlt1
.get()
.getDAI()
.stream()
.filter( dai -> "lnNs".equals( dai.getName() ))
.findFirst();
if( ! lnNs.isPresent() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : cannot find DAI \"lnNs\"" );
continue;
}
if( ! lnNs.get().isSetVal() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : no Val in \"lnNs\"" );
continue;
}
LN0 ln0 = anyLN.getParentLDevice().getLN0();
Optional< DOI > namPlt2 =
ln0
.getDOI()
.stream()
.filter( doi -> "NamPlt".equals( doi.getName() ))
.findFirst();
if( ! namPlt2.isPresent() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : cannot find DOI \"NamPlt\" in LN0" );
continue;
}
Optional< DAI > ldNs =
namPlt2
.get()
.getDAI()
.stream()
.filter( dai -> "ldNs".equals( dai.getName() ))
.findFirst();
if( ! ldNs.isPresent() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : cannot find DAI \"ldNs\"" );
continue;
}
if( ! ldNs.get().isSetVal() ) {
console.warning( "[NSD validation] while validating presence condition \"MOlnNs\" of LNodeTYPE (line " + lNodeType.getLineNumber()
+ ") in AnyLN (line " + anyLN.getLineNumber() + ") : no Val in \"ldNs\"" );
continue;
if
(
mandatoryInLLN0ElseForbidden
!=
null
)
{
EList
<
AbstractDataObject
>
adoList
=
doType
.
getReferredByAbstractDataObject
();
for
(
AbstractDataObject
ado
:
adoList
)
{
if
(
ado
instanceof
DO
)
{
DO
do_
=
(
DO
)
ado
;
if
(
"LLN0"
.
equals
(
do_
.
getParentLNodeType
().
getLnClass
()
))
{
for
(
String
attribute
:
mandatoryInLLN0ElseForbidden
)
{
DA
da
=
presentDA
.
get
(
attribute
);
if
(
da
==
null
)
{
diagnostics
.
add
(
new
BasicDiagnostic
(
Diagnostic
.
ERROR
,
RiseClipseValidatorSCL
.
DIAGNOSTIC_SOURCE
,
0
,
"[NSD validation] DA "
+
attribute
+
" is mandatory in DOType (line "
+
doType
.
getLineNumber
()
+
") with LNClass LLN0"
,
new
Object
[]
{
doType
}
));
res
=
false
;
}
}
}
if( ! ( lnNs.get().getVal().equals( ldNs.get().getVal() ))) {
if( presentDA.get( name ) == null ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"[NSD validation] DA " + name + " is mandatory in LN in DOType (line " + lNodeType.getLineNumber() + ") with LNClass "
+ cdc.getName() + " because logical node name space deviates from logical device name space",
new Object[] { lNodeType } ));
res = false;
else
{
for
(
String
attribute
:
mandatoryInLLN0ElseForbidden
)
{
DA
da
=
presentDA
.
get
(
attribute
);
if
(
da
!=
null
)
{
diagnostics
.
add
(
new
BasicDiagnostic
(
Diagnostic
.
ERROR
,
RiseClipseValidatorSCL
.
DIAGNOSTIC_SOURCE
,
0
,
"[NSD validation] DA "
+
attribute
+
" is forbidden in DOType (line "
+
doType
.
getLineNumber
()
+
") with LNClass "
+
do_
.
getParentLNodeType
().
getLnClass
(),
new
Object
[]
{
doType
}
));
res
=
false
;
}
}
}
}
else
{
// ado instanceof SDO
}
}
}
*/
// presCond: "MOlnNs" :
// Element is mandatory if the name space of its logical node deviates from the name space of the containing
// logical device, otherwise optional. See IEC 61850-7-1 for use of name space
// Usage in standard NSD files (version 2007B): DataAttribute
// TODO: The meaning is not clear.
// if( mandatoryIfNameSpaceOfLogicalNodeDeviatesElseOptional != null ) {
//
// }
// presCond: "MOdataNs" :
// Element is mandatory if the name space of its data object deviates from the name space of its logical node,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment