Class AbstractLNAdapter<T extends TAnyLN>
java.lang.Object
org.lfenergy.compas.sct.commons.scl.SclElementAdapter<LDeviceAdapter,T>
org.lfenergy.compas.sct.commons.scl.ied.AbstractLNAdapter<T>
- Direct Known Subclasses:
LN0Adapter
,LNAdapter
public abstract class AbstractLNAdapter<T extends TAnyLN>
extends SclElementAdapter<LDeviceAdapter,T>
A representation of the model object
AbstractLNAdapter
.
The following features are supported:
- Adapter
- Principal functions
Returns the value of the inst attribute
Returns the value of the lnClass attribute
Returns the value of the lnType attribute
Returns the logical node name LNName = prefix + lnClass + lnInst
Returns the value of the TExtRef containment reference list
Returns the value of the TExtRef containment reference list By ExtRefSignalInfo
Returns the value of the DataAttributeRef containment reference By filter
Returns DAI (sGroup, value) containment reference list By DataAttributeRef filter
Returns the value of the TDataSet object reference By the value of the name attribute
Returns the value of the ControlBlock containment reference list that match datSet value of given TDataSet
Add TPrivate under this object
Remove all ControlBlock
- Checklist functions
ObjectReference: LDName/LNName.DataName[.DataName[…]].DataAttributeName[.DAComponentName[ ….]] LDName = "name" attribute of IEDName element + "inst" attribute of LDevice element LNName = "prefix" + "lnClass" + "lnInst"
- See Also:
-
Field Summary
FieldsFields inherited from class org.lfenergy.compas.sct.commons.scl.SclElementAdapter
currentElem, parentAdapter
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractLNAdapter
(LDeviceAdapter parentAdapter, T currentElem) Constructor -
Method Summary
Modifier and TypeMethodDescriptionaddControlBlock
(ControlBlock controlBlock) Creates Control Block in specified LNode in current IEDprotected DOIAdapter
Adds DO in LNodestatic LNAdapterBuilder
builder()
void
checkExtRefInfoCoherence
(ExtRefInfo extRefInfo) Verify the coherence of ExtRef info.createControlBlockIfNotExists
(String cbName, String id, String datSet, ControlBlockEnum controlBlockEnum) Create ControlBlock if there is no ControlBlock of the same type (controlBlockEnum) and with the same cbName in this LN/LN0.createDataSetIfNotExists
(String dataSetName, ControlBlockEnum controlBlockEnum) Adds DataSet in specified LNode in current IED/AccessPoint.createDoiSdiDaiChainIfNotExists
(String dataTypeRef, boolean setValImportOnCreate) Return the DAI (in DOI/SDI/DAI chain) matching the given data reference name If it does not exist, create the missing DOI/SDI/DAI elements in this LN/LN0 if needed, based on the given parameters DOI is the equivalent of the DO SDI is the equivalent of a type with bType="Struct".extractExtRefFromExtRefInfo
(@NonNull ExtRefInfo extRefInfo) Finds ExtRef from LNfindControlBlock
(String name, ControlBlockEnum controlBlockEnum) findDataSetByName
(String dataSetName) findDoiAdapterByName
(String doiName) Find DOI in this LN/LN0 by nameprotected Optional<IDataAdapter>
findMatch
(DoTypeName doTypeName, DaTypeName daTypeName) Search for DAI that match the given defined-DO (do.sdo1[.sdo2 ...sdo_n]) and defined-DA (da.bda1[.bda2...bda_n]) where 'sdo_n' points to a DOType that contains 'da'generateControlBlockId
(String ldName, String cbName) Generate a ControlBlock Id based on the current LN and the given ldName (ldName can be different from the parent LD.name)protected List<ControlBlock>
getControlBlocks
(List<TDataSet> tDataSets, TServiceType serviceType) Gets all Control Blocks from LNode for specified Service Type (GOOSE, SMV and REPORT) and Data SetsgetControlBlocksForMatchingFCDA
(@NonNull ExtRefInfo extRefInfo) Gets Control Blocks matching FCDA compatible with specified in extRefInfoprotected SclRootAdapter
Gets root ScdgetDAI
(DataAttributeRef dataAttributeRef, boolean updatableOnly) Returns a list of Data Attribute Reference for DataAttribute (updatable or not)protected Optional<DataAttributeRef>
Get the value of "Mod.stVal" of the current LNgetDAIValues
(DataAttributeRef dataAttributeRef) Gets DAI values for specified DA in summaraized Data Type TemplategetDataSetByName
(String dataSetName) Gets Data Set in LNode by its nameretrieves all DataSets for which at least one FCDA matches with data given in ExtRefInfo for external bindingGets SCL DataTypeTemplategetDOIAdapterByName
(String doiName) Get DOI in this LN/LN0 by namegetEnumValues
(String enumType) Returns sets of enum value for given DataAttributeRef objectGets all ExtRefsgetExtRefs
(ExtRefSignalInfo filter) Gets all ExtRefs matches specified ExtRef infoFinds all FCDAs in DataSet of Control Block feeding ExtRefabstract String
abstract String
Gets linked IED as parentGets linked LDevice as parentabstract String
getTControlsByType
(Class<V> cls) finds all Control Blocks by Service Type (GOOSE, SampleValue, Report).boolean
hasControlBlock
(String cbName, ControlBlockEnum controlBlockEnum) Checks if specified Control Block is present in LNboolean
Check whether the LN has an Inputs nodevoid
isExtRefExist
(ExtRefSignalInfo signalInfo) Checks for ExtRef signal existence in target LNboolean
matches
(ObjectReference objRef) Checks given reference matches with DataSet or ReportControl or DataTypeTemplate element for calling LNode in SCL fileprotected boolean
matchesDataAttributes
(String dataAttribute) Checks if given attibrute corresponds to DataSet or ReportControl in LNodeprotected void
overrideAttributesFromDAI
(DataAttributeRef dataAttributeRef) Update given DataAttributeRef DAI datas from LNodevoid
Removes all ControlBlocks and DataSets from current LNvoid
Removes all ExtRefs source binding data'sstreamControlBlocks
(ControlBlockEnum controlBlockEnum) void
updateDAI
(@NonNull DataAttributeRef dataAttributeRef) Updates DAI in LN/LN0 section.void
updateExtRefBinders
(ExtRefInfo extRefInfo) Update LNode ExtRefs data with ExtRefInfo dataprotected void
updateExtRefBindingInfo
(TExtRef extRef, ExtRefInfo extRefInfo) Updates ExtRef with data from ExtRefInfoupdateExtRefSource
(ExtRefInfo extRefInfo) Updates ExtRef source binding data's based on given data in extRefInfoMethods inherited from class org.lfenergy.compas.sct.commons.scl.SclElementAdapter
addPrivate, amChildElementRef, amRootElement, buildFatalReportItem, customInit, elementXPath, getXPath, setCurrentElem
-
Field Details
-
MOD_DO_TYPE_NAME
-
STVAL_DA_TYPE_NAME
-
-
Constructor Details
-
AbstractLNAdapter
Constructor- Parameters:
parentAdapter
- Parent container referencecurrentElem
- Current reference
-
-
Method Details
-
builder
-
getElementClassType
-
getLNClass
-
getLNInst
-
getPrefix
-
getEnumValues
Returns sets of enum value for given DataAttributeRef object- Parameters:
enumType
- enum Type- Returns:
- Enum value list
-
findDataSetByName
-
findDoiAdapterByName
Find DOI in this LN/LN0 by name- Parameters:
doiName
- name of the DOI to look for- Returns:
- DOIAdapter when found or else empty Optional.
-
getDOIAdapterByName
Get DOI in this LN/LN0 by name- Parameters:
doiName
- name of the DOI to look for- Returns:
- DOIAdapter when found or else empty Optional.
- Throws:
ScdException
- when DOI not found
-
getDOIAdapters
-
getLnType
-
getExtRefs
Gets all ExtRefs- Returns:
- list of LNode ExtRefs elements
-
getExtRefs
Gets all ExtRefs matches specified ExtRef info- Parameters:
filter
- ExtRef filter value- Returns:
- list of TExtRef
-
hasInputs
public boolean hasInputs()Check whether the LN has an Inputs node- Returns:
- true if the LN has an Inputs node
-
isExtRefExist
Checks for ExtRef signal existence in target LN- Parameters:
signalInfo
- ExtRef signal data to check
-
updateExtRefBinders
Update LNode ExtRefs data with ExtRefInfo data- Parameters:
extRefInfo
- contains new data for LNode ExtREf update- Throws:
ScdException
- throws when mandatory data are missing
-
updateExtRefBindingInfo
Updates ExtRef with data from ExtRefInfo- Parameters:
extRef
- ExtRef to updateextRefInfo
- contains new data for LNode ExtREf update
-
getControlBlocksForMatchingFCDA
Gets Control Blocks matching FCDA compatible with specified in extRefInfo- Parameters:
extRefInfo
- ExtRef signal data for which Control Blocks should be found (contain binding info to match with FCDA)- Returns:
- list of ControlBlock object as ControlBlocks of LNode matching FCDA and ExtRef
-
getControlBlocks
Gets all Control Blocks from LNode for specified Service Type (GOOSE, SMV and REPORT) and Data Sets- Parameters:
tDataSets
- Data Sets for which Control Blocks are neededserviceType
- Service Type of Control Blocks needed- Returns:
- list of ControlBlock objects
-
getTControlsByType
finds all Control Blocks by Service Type (GOOSE, SampleValue, Report).- Type Parameters:
V
- inference parameter for Type of Control Block to find- Parameters:
cls
- Type of Control Block- Returns:
- all Control Blocks matching a Service Type
-
hasControlBlock
Checks if specified Control Block is present in LN- Parameters:
cbName
- name of the control block to look forcontrolBlockEnum
- type of control block to look for- Returns:
- true if a ControlBlock of type controlBlockEnum named cbName exists in LN, else false
-
getDataSetMatchingExtRefInfo
retrieves all DataSets for which at least one FCDA matches with data given in ExtRefInfo for external binding- Parameters:
filter
- contains data for external binding which should match with FCDAs values- Returns:
- list of Data for which at least one FCDA matches with filter datas
-
updateExtRefSource
Updates ExtRef source binding data's based on given data in extRefInfo- Parameters:
extRefInfo
- new data for ExtRef source binding data- Returns:
- TExtRef object as update ExtRef with new source binding data
- Throws:
ScdException
- throws when mandatory data of ExtRef are missing
-
checkExtRefInfoCoherence
Verify the coherence of ExtRef info. This method look up the TExtRef that matches the signal info in this LNode. Then verify the coherence between the ExtRef's binding info and the given binding info. If the ExtRef info contains a source information ( ControlBlock info),it verifies that the CB and dataset it points to, exists within and existing binder IED.- Parameters:
extRefInfo
- ExtRef information (signal, binding and source info)- Throws:
ScdException
- throws exception if- the given binding info doesn't match the found TExtRef's binding info.
- the given binding info doesn't refer to an existing IED, LDevice and LNode in the SCL
- given source info references unknown control block
-
extractExtRefFromExtRefInfo
Finds ExtRef from LN- Parameters:
extRefInfo
- ExtRef information (signal, binding and source info)- Returns:
- TExtRef matching given
-
getDAI
public List<DataAttributeRef> getDAI(DataAttributeRef dataAttributeRef, boolean updatableOnly) throws ScdException Returns a list of Data Attribute Reference for DataAttribute (updatable or not)- Parameters:
dataAttributeRef
- Data Attribute Reference (used as filter)updatableOnly
- true to retrieve DataTypeTemplate's related to only updatable DAI, false to retrieve all- Returns:
- List of Data Attribute Reference (updatable or not)
- Throws:
ScdException
- SCD illegal arguments exception
-
overrideAttributesFromDAI
Update given DataAttributeRef DAI datas from LNode- Parameters:
dataAttributeRef
- summarized Data Type Template object to update DAI datas
-
getParentLDevice
Gets linked LDevice as parent- Returns:
- IEDAdapter object
-
getParentIed
Gets linked IED as parent- Returns:
- IEDAdapter object
-
getCurrentScd
Gets root Scd- Returns:
- SclRootAdapter object
-
getDataTypeTemplateAdapter
Gets SCL DataTypeTemplate- Returns:
- DataTypeTemplateAdapter object
-
findMatch
Search for DAI that match the given defined-DO (do.sdo1[.sdo2 ...sdo_n]) and defined-DA (da.bda1[.bda2...bda_n]) where 'sdo_n' points to a DOType that contains 'da'- Parameters:
doTypeName
- defined-DO (do.sdo1[.sdo2 ...sdo_n])daTypeName
- defined-DA (da.bda1[.bda2...bda_n])- Returns:
- Optional of DAIAdapter for the matched DAI
-
updateDAI
Updates DAI in LN/LN0 section. It will create the missing DOI/SDI/DAI in this LN/LN0 if needed. Be careful, this method does not check that the given dataAttributeRef is allowed by the lnType of this LN/LN0. It does not even check if dataAttributeRef exists in DataTypeTemplate section. That means that it will create the missing DOI/SDI/DAI, even if it is not consistent with DataTypeTemplate section. It is the caller responsibility to ensure the consistency between the given dataAttributeRef and the lnType of this LN/LN0 (which points to DataTypeTemplate section). See 9.3.5 "LN0 and other Logical Nodes" of IEC 61850-6. If given dataAttributeRef.isUpdatable() is false, the method does nothing (it will not check if DA/BDA is updatable in DataTypeTemplate section). This method will not remove any Val, it will only create new Val or replace existing Val (for example if dataAttributeRef.getDaName().getDaiValues() is empty, it does nothing)- Parameters:
dataAttributeRef
- summarized Data Type Temple containing new DA val- Throws:
ScdException
- when given dataAttributeRef is missing DoName or DaName
-
createDoiSdiDaiChainIfNotExists
Return the DAI (in DOI/SDI/DAI chain) matching the given data reference name If it does not exist, create the missing DOI/SDI/DAI elements in this LN/LN0 if needed, based on the given parameters DOI is the equivalent of the DO SDI is the equivalent of a type with bType="Struct". It can be a SDO, DA or BDA. DOI is the equivalent of the final leaf : DA or BDA with bType != "Struct". Be careful, this method does not check that the given data type is allowed by the lnType of this LN/LN0. It does not even check if the data type exists in DataTypeTemplate section. That means that it will create the missing DOI/SDI/DAI, even if it is not consistent with DataTypeTemplate section. It is the caller responsibility to ensure the consistency between the given data type and the lnType of this LN/LN0 (which refer to DataTypeTemplate section). See 9.3.5 "LN0 and other Logical Nodes" of IEC 61850-6.- Parameters:
dataTypeRef
- Reference name of data : DO/SDO/DA/BDA names, in order from parent to child, separated by a period (Ex: "Do1.da1", "Do2.sdoA.sdoB.da2.bdaA.bdaB")setValImportOnCreate
- when this method creates the DAI, it will set DAI.valImport attribute with this parameter- Returns:
- adapter for existing DAI or created DAI.
-
addDOI
Adds DO in LNode- Parameters:
name
- DOI name- Returns:
- added DOIAdapter object
-
getLNodeName
-
matches
Checks given reference matches with DataSet or ReportControl or DataTypeTemplate element for calling LNode in SCL file- Parameters:
objRef
- reference to compare with LNode datas- Returns:
- Boolean value of check result
-
matchesDataAttributes
Checks if given attibrute corresponds to DataSet or ReportControl in LNode- Parameters:
dataAttribute
- attribute to check- Returns:
- Boolean value of check result
-
getDataSetByName
Gets Data Set in LNode by its name- Parameters:
dataSetName
- Data Set name- Returns:
- optional of DataSetInfo
-
getDAIValues
Gets DAI values for specified DA in summaraized Data Type Template- Parameters:
dataAttributeRef
- summaraized Data Type Template containing DA datas- Returns:
- map of Setting Group and it's VAL
-
removeAllControlBlocksAndDatasets
public void removeAllControlBlocksAndDatasets()Removes all ControlBlocks and DataSets from current LN -
removeAllExtRefSourceBindings
public void removeAllExtRefSourceBindings()Removes all ExtRefs source binding data's -
createDataSetIfNotExists
public DataSetAdapter createDataSetIfNotExists(String dataSetName, ControlBlockEnum controlBlockEnum) Adds DataSet in specified LNode in current IED/AccessPoint. The AccessPoint must have DataSet creation capabilities- Parameters:
dataSetName
- Name of the dataSetcontrolBlockEnum
- GOOSE, SMV or REPORT service type- Throws:
ScdException
- throws when IED does not have DataSet creation capabilities- See Also:
-
addControlBlock
Creates Control Block in specified LNode in current IED- Parameters:
controlBlock
- Control Block data to add to this LN- Returns:
- created ControlBlockAdapter object
- Throws:
ScdException
- throws when inconsistency between given ControlBlock and IED configuration
-
findControlBlock
public Optional<ControlBlockAdapter> findControlBlock(String name, ControlBlockEnum controlBlockEnum) -
streamControlBlocks
-
createControlBlockIfNotExists
public ControlBlockAdapter createControlBlockIfNotExists(String cbName, String id, String datSet, ControlBlockEnum controlBlockEnum) Create ControlBlock if there is no ControlBlock of the same type (controlBlockEnum) and with the same cbName in this LN/LN0. When the controlBlock already exists, the id and datSet attributes are NOT updated with the given values.- Parameters:
cbName
- cbName of the controlBlock to look for. When not found, the cbName of the controlBlock to create.id
- When controlBlock not found, the id of the controlBlock to createdatSet
- the datSet of the controlBlock to createcontrolBlockEnum
- the type of ControlBlock to create- Returns:
- existing controlBlock if a controlBlock of the same type and with same cbName was found in this LN/LN0, otherwise the created ControlBlock. The returned ControlBlock is always a child of this LN/LN0.
-
generateControlBlockId
Generate a ControlBlock Id based on the current LN and the given ldName (ldName can be different from the parent LD.name)- Parameters:
ldName
- LD name to use for generating the idcbName
- name of the ControlBlock- Returns:
- "ldName/LnPrefixLnClassLnInst.cbName". Blank values are omitted (e.g "IEDNAME1LD1/LLN0.CBNAME1")
-
getFCDAs
Finds all FCDAs in DataSet of Control Block feeding ExtRef- Parameters:
tExtRef
- Fed ExtRef- Returns:
- list of all FCDA in DataSet of Control Block
-
getDaiModStValValue
Get the value of "Mod.stVal" of the current LN- Returns:
- Mod.stVal value if present, else empty Optional
-
getDaiModStVal
-