Skip to content

Commit

Permalink
feat(#362): RSR-812 - Use generated JAXB class for configuration of C…
Browse files Browse the repository at this point in the history
…ommunication of Control Blocks

Signed-off-by: massifben <[email protected]>
  • Loading branch information
massifben committed Dec 15, 2023
1 parent 1724e0e commit 95ee0d5
Show file tree
Hide file tree
Showing 17 changed files with 995 additions and 979 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import org.junit.jupiter.api.Test;
import org.lfenergy.compas.scl2007b4.model.LN0;
import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.sct.commons.ControlBlockService;
import org.lfenergy.compas.sct.commons.ControlBlockEditorService;
import org.lfenergy.compas.sct.commons.SclService;
import org.lfenergy.compas.sct.commons.SubstationService;
import org.lfenergy.compas.sct.commons.api.ControlBlockEditor;
import org.lfenergy.compas.sct.commons.api.SclEditor;
import org.lfenergy.compas.sct.commons.api.SubstationEditor;
import org.lfenergy.compas.sct.commons.dto.HeaderDTO;
import org.lfenergy.compas.sct.commons.exception.ScdException;
import org.lfenergy.compas.sct.commons.scl.ControlService;
import org.lfenergy.compas.sct.commons.scl.SclElementAdapter;
import org.lfenergy.compas.sct.commons.scl.SclRootAdapter;
import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceAdapter;
Expand All @@ -33,7 +34,7 @@ class SclAutomationServiceIntegrationTest {
private SclAutomationService sclAutomationService ;
private static final SclEditor sclEditor = new SclService() ;
private static final SubstationEditor substationEditor = new SubstationService() ;
private static final ControlBlockEditor controlBlockEditor = new ControlBlockService() ;
private static final ControlBlockEditor controlBlockEditor = new ControlBlockEditorService(new ControlService()) ;

private HeaderDTO headerDTO;

Expand Down
19 changes: 18 additions & 1 deletion sct-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/resources/xsd/LDEPF_Config_file_v2.xsd</source>
<source>${project.basedir}/src/main/resources/xsd/LDEPF.xsd</source>
</sources>
<xjbSources>
<xjbSource>${project.basedir}/src/main/resources/binding_configuration.xjb</xjbSource>
Expand Down Expand Up @@ -214,6 +214,23 @@
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
<execution>
<id>cbcom</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/src/main/resources/xsd/GSE_SMV_CB_COM.xsd</source>
</sources>
<xjbSources>
<xjbSource>${project.basedir}/src/main/resources/binding_configuration.xjb</xjbSource>
</xjbSources>
<packageName>org.lfenergy.compas.sct.commons.model.cbcom</packageName>
<noPackageLevelAnnotations>true</noPackageLevelAnnotations>
<clearOutputDir>false</clearOutputDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import org.lfenergy.compas.scl2007b4.model.SCL;
import org.lfenergy.compas.scl2007b4.model.TExtRef;
import org.lfenergy.compas.sct.commons.dto.ControlBlockNetworkSettings;
import org.lfenergy.compas.sct.commons.dto.FcdaForDataSetsCreation;
import org.lfenergy.compas.sct.commons.dto.SclReportItem;
import org.lfenergy.compas.sct.commons.model.cbcom.CBCom;
import org.lfenergy.compas.sct.commons.util.Utils;

import java.util.List;
Expand All @@ -22,7 +22,7 @@
* <ol>
* <li>{@link ControlBlockEditor#createDataSetAndControlBlocks(SCL, Set) <em>Create DataSet and ControlBlock based on the <b>TExtRef</b></em>}</li>
* <li>{@link ControlBlockEditor#createDataSetAndControlBlocks(SCL, String, Set) <em>Create DataSet and ControlBlock based on the <b>TExtRef</b> in given <b>IED</b></em>}</li>
* <li>{@link ControlBlockEditor#createDataSetAndControlBlocks(SCL, String,String, Set) <em>Create DataSet and ControlBlock based on the <b>TExtRef</b> in given <b>IED</b> and <b>LDevice</b></em>}</li>
* <li>{@link ControlBlockEditor#createDataSetAndControlBlocks(SCL, String, String, Set) <em>Create DataSet and ControlBlock based on the <b>TExtRef</b> in given <b>IED</b> and <b>LDevice</b></em>}</li>
* <li>{@link ControlBlockEditor#configureNetworkForAllControlBlocks <em>Configure the network for the <b>ControlBlocks</b></em>}</li>
* <li>{@link ControlBlockEditor#removeAllControlBlocksAndDatasetsAndExtRefSrcBindings <em>Removes all ControlBlocks and DataSets for all LNs in <b>SCL</b></em>}</li>
* <li>{@link ControlBlockEditor#analyzeDataGroups(SCL)} <em>Checks Control Blocks, DataSets and FCDA number limitation into Access Points </em>}</li>
Expand Down Expand Up @@ -85,17 +85,11 @@ public interface ControlBlockEditor {
* - the Communication/SubNetwork/ConnectedAP/GSE element, for the GSEControl blocks
* - the Communication/SubNetwork/ConnectedAP/SMV element, for the SampledValueControl blocks
*
* @param scd input SCD object. The object will be modified with the new DataGSESet and SMV elements
* @param controlBlockNetworkSettings a method tha gives the network configuration information for a given ControlBlock
* @param rangesPerCbType provide NetworkRanges for GSEControl and SampledValueControl. NetworkRanges contains :
* start-end app APPID range (long value), start-end MAC-Addresses (Mac-Addresses values: Ex: "01-0C-CD-01-01-FF")
* @param scd input SCD object. The object will be modified with the new GSE and SMV elements
* @param cbCom communication settings to configure Control Block Communication
* @return list of encountered errors
* @see Utils#macAddressToLong(String) for the expected MAC address format
* @see ControlBlockNetworkSettings
* @see ControlBlockNetworkSettings.RangesPerCbType
* @see ControlBlockNetworkSettings.NetworkRanges
*/
List<SclReportItem> configureNetworkForAllControlBlocks(SCL scd, ControlBlockNetworkSettings controlBlockNetworkSettings,
ControlBlockNetworkSettings.RangesPerCbType rangesPerCbType);
List<SclReportItem> configureNetworkForAllControlBlocks(SCL scd, CBCom cbCom);

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2023 RTE FRANCE
//
// SPDX-License-Identifier: Apache-2.0

package org.lfenergy.compas.sct.commons.scl;

import org.lfenergy.compas.scl2007b4.model.*;

import java.util.stream.Stream;

public class ControlService {

public <T extends TControl> Stream<T> getControls(TAnyLN tAnyLN, Class<T> tControlClass){
if (tControlClass == TGSEControl.class && tAnyLN instanceof TLN0 tln0 && tln0.isSetGSEControl()){
return tln0.getGSEControl().stream().map(tControlClass::cast);
} else if (tControlClass == TSampledValueControl.class && tAnyLN instanceof TLN0 tln0 && tln0.isSetSampledValueControl()){
return tln0.getSampledValueControl().stream().map(tControlClass::cast);
} else if (tControlClass == TReportControl.class && tAnyLN.isSetReportControl()){
return tAnyLN.getReportControl().stream().map(tControlClass::cast);
} else if (tControlClass == TLogControl.class){
return tAnyLN.getLogControl().stream().map(tControlClass::cast);
}
return Stream.empty();
}

}
Loading

0 comments on commit 95ee0d5

Please sign in to comment.