-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDetectChangedElements.m
40 lines (28 loc) · 1.13 KB
/
DetectChangedElements.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function[LinesChanged,AnchorsChanged] = DetectChangedElements(LinesImpactedOld,...
AnchorsImpactedOld,LineFail,AnchorFail,...
AnchAnchConnect,LineLineConnect,AnchLineConnect,...
LineAnchConnect,LineConnect,TurbLineConnect,...
TurbAnchConnect,AnchTurbConnect,nn,LinesImpacted,AnchorsImpacted)
%% Find failed lines and check to see if anything has changed
% Through current formulation, lines impacted by failed anchors are already
% failed, no need to detect them separately
LineFail = any(LineFail,2);
LI = LineLineConnect(LineFail==1,:);
LI = LI(:);
LinesImpacted(LI) = 1;
lc = LinesImpacted-LinesImpactedOld;
LinesChanged = lc~=0;
%% Find failed anchors and check to see if anything has changed
% Need to find anchors associated with failed lines, as well as anchors
% associated with failed anchors
%Anchors impacted by lines
AI = LineAnchConnect(LineFail==1,:);
AI = AI(:);
AnchorsImpacted(AI) = 1;
% Anchors impacted by anchors
AA = AnchAnchConnect(AnchorFail==1,:);
AA = AA(:);
AA(AA==0) = [];
AnchorsImpacted(AA) = 1;
ac = AnchorsImpacted-AnchorsImpactedOld;
AnchorsChanged = ac~=0;