10
10
import org .lfenergy .compas .scl2007b4 .model .*;
11
11
import org .lfenergy .compas .sct .commons .dto .*;
12
12
import 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 ;
15
13
import org .lfenergy .compas .sct .commons .scl .SclElementAdapter ;
16
14
import 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 ;
19
15
import org .lfenergy .compas .sct .commons .scl .ied .IEDAdapter ;
20
16
import org .lfenergy .compas .sct .commons .scl .ln .AbstractLNAdapter ;
21
17
import org .lfenergy .compas .sct .commons .scl .ln .LN0Adapter ;
22
18
import org .lfenergy .compas .sct .commons .scl .ln .LNAdapter ;
23
- import org .lfenergy .compas .sct .commons .util .ActiveStatus ;
24
19
import org .lfenergy .compas .sct .commons .util .ControlBlockEnum ;
25
20
import org .lfenergy .compas .sct .commons .util .MonitoringLnClassEnum ;
26
21
import org .lfenergy .compas .sct .commons .util .Utils ;
27
22
28
23
import java .util .*;
29
24
30
- import static org .lfenergy .compas .sct .commons .util .CommonConstants .*;
31
25
import static org .lfenergy .compas .sct .commons .util .Utils .copySclElement ;
32
26
33
27
/**
63
57
@ Slf4j
64
58
public class LDeviceAdapter extends SclElementAdapter <IEDAdapter , TLDevice > {
65
59
66
- private static final long INTG_PD_VALUE_FOR_FC_MX = 2000L ;
67
-
68
60
private static final String DA_SETSRCREF = "setSrcRef" ;
69
- private static final String CYC_REPORT_TYPE = "CYC" ;
70
61
71
62
/**
72
63
* Constructor
@@ -78,43 +69,6 @@ public LDeviceAdapter(IEDAdapter parentAdapter, TLDevice currentElem) {
78
69
super (parentAdapter , currentElem );
79
70
}
80
71
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
-
118
72
/**
119
73
* Check if node is child of the reference node
120
74
*
@@ -483,15 +437,4 @@ private String createVal(TExtRef tExtRef) {
483
437
return sourceLdName + "/" + lnClass + "." + tExtRef .getSrcCBName ();
484
438
}
485
439
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
-
497
440
}
0 commit comments