1010import org .lfenergy .compas .scl2007b4 .model .*;
1111import org .lfenergy .compas .sct .commons .dto .*;
1212import org .lfenergy .compas .sct .commons .exception .ScdException ;
13- import org .lfenergy .compas .sct .commons .model .cb_po .PO ;
14- import org .lfenergy .compas .sct .commons .model .cb_po .TFCDAFilter ;
1513import org .lfenergy .compas .sct .commons .scl .SclElementAdapter ;
1614import org .lfenergy .compas .sct .commons .scl .dtt .DataTypeTemplateAdapter ;
17- import org .lfenergy .compas .sct .commons .scl .ied .ControlBlockAdapter ;
18- import org .lfenergy .compas .sct .commons .scl .ied .DataSetAdapter ;
1915import org .lfenergy .compas .sct .commons .scl .ied .IEDAdapter ;
2016import org .lfenergy .compas .sct .commons .scl .ln .AbstractLNAdapter ;
2117import org .lfenergy .compas .sct .commons .scl .ln .LN0Adapter ;
2218import org .lfenergy .compas .sct .commons .scl .ln .LNAdapter ;
23- import org .lfenergy .compas .sct .commons .util .ActiveStatus ;
2419import org .lfenergy .compas .sct .commons .util .ControlBlockEnum ;
2520import org .lfenergy .compas .sct .commons .util .MonitoringLnClassEnum ;
2621import org .lfenergy .compas .sct .commons .util .Utils ;
2722
2823import java .util .*;
2924
30- import static org .lfenergy .compas .sct .commons .util .CommonConstants .*;
3125import static org .lfenergy .compas .sct .commons .util .Utils .copySclElement ;
3226
3327/**
6357@ Slf4j
6458public class LDeviceAdapter extends SclElementAdapter <IEDAdapter , TLDevice > {
6559
66- private static final long INTG_PD_VALUE_FOR_FC_MX = 2000L ;
67-
6860 private static final String DA_SETSRCREF = "setSrcRef" ;
69- private static final String CYC_REPORT_TYPE = "CYC" ;
7061
7162 /**
7263 * Constructor
@@ -78,43 +69,6 @@ public LDeviceAdapter(IEDAdapter parentAdapter, TLDevice currentElem) {
7869 super (parentAdapter , currentElem );
7970 }
8071
81- /**
82- * Create DataSet and ReportControl Blocks for the HMI with the given FCDAs.
83- * DataSet and ReportControl are created in LN0, even if FCDA refers to another LN.
84- *
85- * @param po object containing list of FCDA for which we must create the DataSet and ReportControl
86- */
87- public void createHmiReportControlBlocks (PO po ) {
88- LN0Adapter ln0 = getLN0Adapter ();
89- if (!ln0 .getDaiModStValValue ().map (ActiveStatus ::fromValue ).map (ActiveStatus .ON ::equals ).orElse (false )) return ;
90- po .getFCDAs ().getFCDA ().stream ()
91- .filter (tfcdaFilter -> getInst ().equals (tfcdaFilter .getLdInst ()) && tfcdaFilter .isSetLnClass ())
92- .forEach (tfcdaFilter -> (tfcdaFilter .getLnClass ().equals (TLLN0Enum .LLN_0 .value ()) ?
93- Optional .of (ln0 ) // ln0 Mod stVal "ON" has already been checked, no need to check it again
94- :
95- findLnAdapter (tfcdaFilter .getLnClass (), tfcdaFilter .getLnInst (), tfcdaFilter .getPrefix ()).filter (lnAdapter -> lnAdapter .getDaiModStValValue ().map (ActiveStatus ::fromValue ).map (ActiveStatus .ON ::equals ).orElse (true )))
96- .map (sourceLn -> sourceLn .getDAI (new DataAttributeRef (toFCDA (tfcdaFilter )), false ))
97- .filter (das -> das .stream ().anyMatch (da -> TFCEnum .fromValue (tfcdaFilter .getFc ().value ()) == da .getFc ())) // getDAI does not filter on DA.
98- .ifPresent (dataAttributeRefs -> createHmiReportCB (ln0 , tfcdaFilter )));
99- }
100-
101- private void createHmiReportCB (LN0Adapter ln0 , TFCDAFilter tfcdaFilter ) {
102- TFCDA fcda = toFCDA (tfcdaFilter );
103- String dataSetSuffix = getInst ().toUpperCase (Locale .ENGLISH ) + ATTRIBUTE_VALUE_SEPARATOR + tfcdaFilter .getReportType ().substring (0 , 2 ) + "PO" ;
104- String dataSetName = DATASET_NAME_PREFIX + dataSetSuffix ;
105- DataSetAdapter dataSet = ln0 .createDataSetIfNotExists (dataSetName , ControlBlockEnum .REPORT );
106- dataSet .createFCDAIfNotExists (fcda .getLdInst (), fcda .getPrefix (), fcda .getLnClass ().getFirst (), fcda .getLnInst (), fcda .getDoName (), fcda .getDaName (), fcda .getFc ());
107- String cbName = CONTROLBLOCK_NAME_PREFIX + dataSetSuffix ;
108- String cbId = ln0 .generateControlBlockId (getLdName (), cbName );
109- ControlBlockAdapter controlBlockAdapter = ln0 .createControlBlockIfNotExists (cbName , cbId , dataSetName , ControlBlockEnum .REPORT );
110- if (tfcdaFilter .getReportType ().equals (CYC_REPORT_TYPE )) {
111- TReportControl tReportControl = (TReportControl ) controlBlockAdapter .getCurrentElem ();
112- tReportControl .setIntgPd (INTG_PD_VALUE_FOR_FC_MX );
113- tReportControl .getTrgOps ().setDchg (false );
114- tReportControl .getTrgOps ().setQchg (false );
115- }
116- }
117-
11872 /**
11973 * Check if node is child of the reference node
12074 *
@@ -483,15 +437,4 @@ private String createVal(TExtRef tExtRef) {
483437 return sourceLdName + "/" + lnClass + "." + tExtRef .getSrcCBName ();
484438 }
485439
486- private TFCDA toFCDA (TFCDAFilter tfcdaFilter ) {
487- TFCDA tfcda = new TFCDA ();
488- tfcda .setLdInst (tfcdaFilter .getLdInst ());
489- tfcda .getLnClass ().add (tfcdaFilter .getLnClass ());
490- tfcda .setPrefix (tfcdaFilter .getPrefix ());
491- tfcda .setLnInst (tfcdaFilter .getLnInst ());
492- tfcda .setDoName (tfcdaFilter .getDoName ());
493- tfcda .setFc (TFCEnum .fromValue (tfcdaFilter .getFc ().value ()));
494- return tfcda ;
495- }
496-
497440}
0 commit comments