This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
plots_FS_PSH_IEEE39.m
158 lines (136 loc) · 3.81 KB
/
plots_FS_PSH_IEEE39.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
%% Plots parameters
% Select mode to plot
Mode = 1; % 0-> Pumping mode, 1-> Turbine (generating) mode
%% Load MATLAB variables from workspace
currentFolder = pwd;
name_folder = 'Data\'; % Folder where the data is saved
if Mode == 0
name_data = strcat(name_folder,'FS_PSH_IEEE39_load_event_PUMP');
elseif Mode == 1
name_data = strcat(name_folder,'FS_PSH_IEEE39_load_event_GEN');
end
out = load(strcat(name_data));
out = out.strsav2;
%Simulation time
time = out.tout;
%Output active power
P_FS = out.P_FS;
%Output reactive power
Q_FS = out.Q_FS;
%Output voltage
V_RMS_FS = out.V_RMS_FS;
%Output current
I_RMS_FS = out.I_RMS_FS;
%Wr
gate_pos_turb = out.gate_pos_turb;
%Stator active power
w= out.w;
%% PLOT FOR P, Q, V, I, gate_pos_turb, Wr
x_dim = 400;
y_dim = 280;
% Output Active Power
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,P_FS/1e6)
grid on
ylabel('Active Power (MW)')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([-190 -70])
filename = "Output_Active_Power_FS_PSH_PUMPING";
a2 = axes();
a2.Position = [0.220 0.220 0.25 0.25]; % xlocation, ylocation, xsize, ysize
plot(time(250000:310000), P_FS(250000:310000)/1e6); axis tight
ylim([-128 -124])
grid on
elseif Mode == 1
ylim([40 160])
filename = "Output_Active_Power_FS_PSH_GENERATING";
a2 = axes();
a2.Position = [0.220 0.220 0.25 0.25]; % xlocation, ylocation, xsize, ysize
plot(time(250000:310000), P_FS(250000:310000)/1e6); axis tight
ylim([98 102])
grid on
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)
% Output Reactive Power
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,Q_FS/1e6)
grid on
ylabel('Reactive Power (Mvar)')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([-200 100])
filename = "Output_Reactive_Power_FS_PSH_PUMPING";
elseif Mode == 1
ylim([-200 80])
filename = "Output_Reactive_Power_FS_PSH_GENERATING";
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)
% Output Voltage
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,V_RMS_FS/1e3)
grid on
ylabel('Voltage RMS (kV)')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([17.5 18.8])
filename = "Output_Voltage_FS_PSH_PUMPING";
elseif Mode == 1
ylim([17.5 18.8])
filename = "Output_Voltage_FS_PSH_GENERATING";
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)
% Output Current
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,I_RMS_FS/1e3)
grid on
ylabel('Current RMS (kA)')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([3 7])
filename = "Output_Current_FS_PSH_PUMPING";
elseif Mode == 1
ylim([2.5 6.7])
filename = "Output_Current_FS_PSH_GENERATING";
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)
% Gate Opening (Turbine)
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,gate_pos_turb)
grid on
ylabel('Per Unit')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([0 0.1])
filename = "Gate_Opening_FS_PSH_PUMPING";
elseif Mode == 1
ylim([0.4 0.425])
filename = "Gate_Opening_FS_PSH_GENERATING";
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)
% Rotor Angular Speed
f = figure;
f.Position(3:4) = [x_dim y_dim];
plot(time,w)
grid on
ylabel('Angular Speed (Per Unit)')
xlabel('Time (s)')
xlim([70 300])
if Mode == 0
ylim([0.99 1.01])
filename = "Rotor_Angular_Speed_FS_PSH_PUMPING";
elseif Mode == 1
ylim([0.99 1.01])
filename = "Rotor_Angular_Speed_FS_PSH_GENERATING";
end
exportgraphics(f,strcat(currentFolder,'\Pictures\',filename,'.png'),'Resolution',250)