|
5 | 5 | package org.lfenergy.compas.sct.commons.scl.ln;
|
6 | 6 |
|
7 | 7 |
|
8 |
| -import org.apache.commons.lang3.tuple.Pair; |
9 | 8 | import org.lfenergy.compas.scl2007b4.model.*;
|
10 | 9 | import org.lfenergy.compas.sct.commons.dto.*;
|
11 | 10 | import org.lfenergy.compas.sct.commons.scl.ObjectReference;
|
12 | 11 | import org.lfenergy.compas.sct.commons.scl.ied.InputsAdapter;
|
13 |
| -import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceActivation; |
14 | 12 | import org.lfenergy.compas.sct.commons.scl.ldevice.LDeviceAdapter;
|
15 |
| -import org.lfenergy.compas.sct.commons.util.PrivateUtils; |
16 |
| - |
17 | 13 | import java.util.List;
|
18 |
| -import java.util.Optional; |
19 |
| -import java.util.Set; |
20 | 14 | import java.util.regex.Pattern;
|
21 | 15 | import java.util.stream.Collectors;
|
22 | 16 |
|
|
68 | 62 | */
|
69 | 63 | public class LN0Adapter extends AbstractLNAdapter<LN0> {
|
70 | 64 |
|
71 |
| - public static final DoTypeName BEHAVIOUR_DO_TYPE_NAME = new DoTypeName(BEHAVIOUR_DO_NAME); |
72 |
| - public static final DaTypeName BEHAVIOUR_DA_TYPE_NAME = getDaTypeNameForBeh(); |
73 | 65 | private static final Pattern LDEFP_DIGITAL_CHANNEL_PATTERN = Pattern.compile("DYN_LDEPF_DIGITAL CHANNEL \\d+_\\d+_BOOLEAN");
|
74 | 66 |
|
75 | 67 | /**
|
@@ -169,58 +161,6 @@ public void removeAllControlBlocksAndDatasets() {
|
169 | 161 | currentElem.unsetSampledValueControl();
|
170 | 162 | }
|
171 | 163 |
|
172 |
| - /** |
173 |
| - * Verify and update LDevice status in parent Node |
174 |
| - * |
175 |
| - * @param iedNameLDeviceInstList pair of Ied name and LDevice inst attributes |
176 |
| - * @return Set of Errors |
177 |
| - */ |
178 |
| - public Optional<SclReportItem> updateLDeviceStatus(List<Pair<String, String>> iedNameLDeviceInstList) { |
179 |
| - LDeviceActivation lDeviceActivation = new LDeviceActivation(iedNameLDeviceInstList); |
180 |
| - final String iedName = getParentAdapter().getParentAdapter().getName(); |
181 |
| - final String ldInst = getParentAdapter().getInst(); |
182 |
| - DataAttributeRef daiBehFilter = new DataAttributeRef(this, BEHAVIOUR_DO_TYPE_NAME, BEHAVIOUR_DA_TYPE_NAME); |
183 |
| - List<DataAttributeRef> daiBehList = getDAI(daiBehFilter, false); |
184 |
| - if (daiBehList.isEmpty()) { |
185 |
| - return Optional.of(buildFatalReportItem("The LDevice doesn't have a DO @name='Beh' OR its associated DA@fc='ST' AND DA@name='stVal'")); |
186 |
| - } |
187 |
| - Set<String> enumValues = getEnumValues(daiBehList.getFirst().getDaName().getType()); |
188 |
| - Optional<TCompasLDevice> optionalTCompasLDevice = PrivateUtils.extractCompasPrivate(getParentAdapter().getCurrentElem(), TCompasLDevice.class); |
189 |
| - if (optionalTCompasLDevice.isEmpty()) { |
190 |
| - return Optional.of(buildFatalReportItem("The LDevice doesn't have a Private compas:LDevice.")); |
191 |
| - } |
192 |
| - if (!optionalTCompasLDevice.get().isSetLDeviceStatus()) { |
193 |
| - return Optional.of(buildFatalReportItem("The Private compas:LDevice doesn't have the attribute 'LDeviceStatus'")); |
194 |
| - } |
195 |
| - TCompasLDeviceStatus compasLDeviceStatus = optionalTCompasLDevice.get().getLDeviceStatus(); |
196 |
| - Optional<DataAttributeRef> optionalModStVal = getDaiModStVal(); |
197 |
| - if (optionalModStVal.isEmpty()) { |
198 |
| - return Optional.of(buildFatalReportItem("The LDevice doesn't have a DO @name='Mod'")); |
199 |
| - } |
200 |
| - DataAttributeRef newDaModToSetInLN0 = optionalModStVal.get(); |
201 |
| - String initialValue = newDaModToSetInLN0.findFirstValue().orElse(""); |
202 |
| - lDeviceActivation.checkLDeviceActivationStatus(iedName, ldInst, compasLDeviceStatus, enumValues); |
203 |
| - if (lDeviceActivation.isUpdatable()) { |
204 |
| - if (!initialValue.equals(lDeviceActivation.getNewVal())) { |
205 |
| - newDaModToSetInLN0.setVal(lDeviceActivation.getNewVal()); |
206 |
| - updateDAI(newDaModToSetInLN0); |
207 |
| - } |
208 |
| - } else { |
209 |
| - if (lDeviceActivation.getErrorMessage() != null) { |
210 |
| - return Optional.of(buildFatalReportItem(lDeviceActivation.getErrorMessage())); |
211 |
| - } |
212 |
| - } |
213 |
| - return Optional.empty(); |
214 |
| - } |
215 |
| - |
216 |
| - private static DaTypeName getDaTypeNameForBeh() { |
217 |
| - DaTypeName daTypeNameBeh = new DaTypeName(); |
218 |
| - daTypeNameBeh.setName(STVAL_DA_NAME); |
219 |
| - daTypeNameBeh.setBType(TPredefinedBasicTypeEnum.ENUM); |
220 |
| - daTypeNameBeh.setFc(TFCEnum.ST); |
221 |
| - return daTypeNameBeh; |
222 |
| - } |
223 |
| - |
224 | 164 | /**
|
225 | 165 | * Update DAIs of DO InRef in all LN0 of the SCD using matching ExtRef information.
|
226 | 166 | *
|
|
0 commit comments