-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBetriebs_Phase.m
61 lines (52 loc) · 1.72 KB
/
Betriebs_Phase.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
56
57
58
59
60
61
classdef Betriebs_Phase < matlab.System
% untitled2 Add summary here
%
% This template includes the minimum set of functions required
% to define a System object with discrete state.
% Public, tunable properties
properties
end
properties(DiscreteState)
end
% Pre-computed constants
properties(Access = private)
end
methods(Access = protected)
function setupImpl(obj)
% Perform one-time calculations, such as computing constants
end
function [Phase,Fault_State] = stepImpl(obj,t_f,v,v_dot)
% Implement algorithm. Calculate Phase as a function of input u and
% discrete states.
Current_time = getCurrentTime(obj);
if t_f < 20 && Current_time == t_f
Fault_State = 1;
if v < 0
if v_dot < 0
Phase = 1;
elseif v_dot == 0
Phase = 2;
else
Phase = 3;
end
elseif v > 0
if v_dot > 0
Phase = 5;
elseif v_dot == 0
Phase = 6;
else
Phase=7;
end
else
Phase = 4;
end
else
Fault_State = 0;
Phase = nan;
end
end
function resetImpl(obj)
% Initialize / reset discrete-state properties
end
end
end