-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFVS.m
175 lines (122 loc) · 5.6 KB
/
FVS.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
classdef FVS < handle
% class PV system behaviour
% CTU UCEEB, Petr Wolf
% Last modified: 14.06.2019
% Version hist.: added PoutSet
properties
Irr ; %irradiance on module place
Tamb %ambient temeprature
Tcell %cell temperature
PoutReal % real output, possible limitation of system (e.g. battery charged) included
PoutSet %overwriting output power
par
% PV system properties
%{
.Pinst installed power
.Kt temperature coeff. of power
.Eff overall efficiency
.Plim limitation on output power by FVS (e.g. by inverter)
.IrrLim irradiation limit
.Noct nominal operating cell temeprature of module
.Nambt nominal ambient temperature
%}
end
properties (Access = protected)
end
properties (Constant)
par0 = struct(...
'Pinst' , 1000,...
'Kt' , -0.4,...
'Eff' , 0.94,...
'Plim' , Inf,...
'IrrLim' , 1000,...
'Noct' , 48,...
'Nambt',15 );
end
properties (Dependent)
PVTable ; %synchronized data timetable, [Time, Irr, Tamb, Tcell, Power]
Pout= Profile; % output power
end
methods
function obj = FVS()
%PVsystem Construct an instance of this class
obj.Irr = Profile(); %irradiance on module place
obj.Tamb = Profile(); %ambient temeprature
obj.Tcell= Profile(); %cell temperature
obj.PoutReal = Profile(); % real output, possible limitation of system (e.g. battery charged) included
obj.PoutSet = Profile(); %overwriting output power
obj.par = obj.par0;
end
%%
function obj = setDef(obj)
%set deafult parameters
obj.par = obj.par0;
end
%%
function PVTable1 = get.PVTable(obj)
if ~isempty(obj.Irr.Profile1) %irrad data loaded
if isempty(obj.Tamb.Profile1)
TAMB = timetable( obj.Irr.Profile1.Time(1) , NaN);
else
TAMB=obj.Tamb.Profile1;
end
if isempty(obj.Tcell.Profile1)
TCELL = timetable( obj.Irr.Profile1.Time(1) , NaN);
else
TCELL=obj.Tcell.Profile1;
end
POWER = timetable( obj.Irr.Profile1.Time(1) , NaN);
%}
%Irr limits
IRR = obj.Irr.Profile1;
if isfloat(obj.par.IrrLim) && ~isnan(obj.par.IrrLim) && ~isempty(obj.par.IrrLim)
IRR { IRR{:,1} > obj.par.IrrLim,: } = obj.par.IrrLim;
end
PVTable1 = synchronize ( IRR,TAMB , TCELL , POWER ) ;
PVTable1.Properties.VariableNames = {'Irr','Tamb', 'Tcell', 'Power'};
%Calculate Tcell1
% 1.using direct defined values
Tcell1= PVTable1.Tcell;
% 2.using Tamb or Ttypical
Tamb1=PVTable1.Tamb;
Tamb1( ~isfloat(Tamb1) | isnan(Tamb1) ) = obj.par.Nambt;
Tcell1(~isfloat(Tcell1) | isnan(Tcell1) )= Tamb1 (~isfloat(Tcell1) | isnan(Tcell1) ) ...
+ (obj.par.Noct - 20) ./800 .* PVTable1.Irr(~isfloat(Tcell1) | isnan(Tcell1)) ;
% Kt
if isempty(obj.par.Kt)
Kt1=obj.par0.Kt;
else
Kt1=obj.par.Kt;
end
if ~isempty(obj.par.Pinst)
PVTable1.Power(:) = obj.par.Pinst* obj.par.Eff * PVTable1.Irr(:) ./ 1000 .*( 1 - (25 - Tcell1) .* Kt1/100 );
% power limit
if isfloat(obj.par.Plim) && ~isnan(obj.par.Plim) && ~isempty(obj.par.Plim)
PVTable1.Power (PVTable1.Power > obj.par.Plim) = obj.par.Plim;
end
else
% warning('Pinst not defined')
end
%close all
%stackedplot(obj.PVTable)
% PVTable1=obj.Irr.Stat;
else %irrad data not loaded
PVTable1 = timetable(); %(NaT,NaN,NaN,NaN,NaN);
end
end
%%
function Pout1 = get.Pout(obj) %calculate the output power
if ~isempty(obj.PVTable)
Pout1=Profile();
if isempty (obj.PoutSet.Profile1 )
Pout1.Profile1 = timetable( obj.PVTable.Time(:), obj.PVTable{:,4} );
else %Pout was overwritten
Pout1.Profile1 = obj.PoutSet.Profile1;
end
else
Pout1=Profile();
end
% Pout1 = 1;
end
end
end