-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFailures_FullLine2.m
55 lines (50 loc) · 2.81 KB
/
Failures_FullLine2.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function[LineFail,AnchorFail,TurbFail,LineStrengths,AnchorStrengths,...
TurbFailState,TurbX,TurbY] =...
Failures_FullLine2(AnchorStrengths,AnchorDemands,LineStrengths,...
LineDemands,TurbFail,TurbX,TurbY,TList,ALC,D)
%% Start with line failures
LineFail = LineDemands >= LineStrengths;
%% Next, find anchor failures
AnchorFail = AnchorDemands >= AnchorStrengths;
% Set failed anchor capacities equal to zero so that they continue to be
% failed
AnchorStrengths(AnchorFail) = 0;
% Next, fail the lines connected to the failed anchors
LF = ALC(AnchorFail,:);
% LineFail2 = LineFail;
LineFail(LF(LF~=0),:) = 1;
LineStrengths(LineFail) = 0;
%Next, update the turbine failure state and indicate if a turbine has
%failed
TurbFailState = LineFail;
TurbFailState = sum(TurbFailState,2);
TurbFailState(TurbFailState>0) = 1;
TurbFailState = reshape(TurbFailState,3,[])';
%% Now update the location of the turbines !!!!!!!!!!!!! NEED TO UPDATE THIS FOR MULTIPLE ANGLES AND ACTUAL SURGE AND DRIFTS !!!!!!!!!!!!!!
% Add turbine displacements with no failures
n_ind = any(TurbFailState,2);
for i = TList(n_ind)
lf = TurbFailState(i,:);
if lf(1) == 0 && lf(2) == 0 && lf(3) == 0 %sum(lf == [0 0 0]) == 3 % strcmp(lf,'0 0 0')
TurbX(i) = TurbX(i) + D(1,1); %Displacements(1).Surge;
TurbY(i) = TurbY(i) + D(1,2); %Displacements(1).Sway;
elseif lf(1) == 1 && lf(2) == 0 && lf(3) == 0 %sum(lf == [1 0 0]) == 3 % strcmp(lf,'1 0 0')
TurbX(i) = TurbX(i) + D(2,1); % 418.8 + Displacements(2).Surge;
TurbY(i) = TurbY(i) + D(2,2); % 0 + Displacements(2).Sway;
elseif lf(1) == 0 && lf(2) == 1 && lf(3) == 0 %sum(lf == [0 1 0]) == 3 %strcmp(lf,'0 1 0')
TurbX(i) = TurbX(i) + D(3,1); % -209.4 + Displacements(3).Surge;
TurbY(i) = TurbY(i) + D(3,2); % 362.7 + Displacements(3).Sway;
elseif lf(1) == 0 && lf(2) == 0 && lf(3) == 1 %sum(lf == [0 0 1]) == 3 % strcmp(lf,'0 0 1')
TurbX(i) = TurbX(i) + D(4,1); % -209.4 + Displacements(4).Surge;
TurbY(i) = TurbY(i) + D(4,2); % -362.7 + Displacements(4).Sway;
elseif lf(1) == 1 && lf(2) == 1 && lf(3) == 0 %sum(lf == [1 1 0]) == 3 % strcmp(lf,'1 1 0')
TurbX(i) = TurbX(i) + D(5,1); % 418.8 + Displacements(5).Surge;
TurbY(i) = TurbY(i) + D(5,2); % 725.4 + Displacements(5).Sway;
elseif lf(1) == 1 && lf(2) == 0 && lf(3) == 1 %sum(lf == [1 0 1]) == 3 % strcmp(lf,'1 0 1')
TurbX(i) = TurbX(i) + D(6,1); % 418.8 + Displacements(6).Surge;
TurbY(i) = TurbY(i) + D(6,2); % -725.4 + Displacements(6).Sway;
elseif lf(1) == 0 && lf(2) == 1 && lf(3) == 1 % sum(lf == [0 1 1]) == 3% strcmp(lf,'0 1 1')
TurbX(i) = TurbX(i) + D(7,1); % 837.6 + Displacements(6).Surge;
TurbY(i) = TurbY(i) + D(7,2); % 0 + Displacements(6).Sway;
end
end