-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwindow_class.m
executable file
·185 lines (154 loc) · 8.79 KB
/
window_class.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
176
177
178
179
180
181
182
183
184
185
% =================================================================================================
% Class for computing the winding window related parameter of a component.
% =================================================================================================
%
% Define an interface for:
% - the losses of the windings
% - the geometry of the winding
% - the type of magnetic component
% - the equivalent circuit
%
% =================================================================================================
%
% Warning: Only the winding window is considered.
% The core related parameters are only partially considered.
% The computations are based on a 2D mirroring method which is inacurate geometries.
%
% =================================================================================================
%
% See also:
% - window_geom_abstract (abtract class for the window geometry)
% - window_component_abstract (abtract class for the component defintion)
% - winding_mirroring (abstraction layer for the mirroring method)
% - mirroring_method (implementation of the mirroring method)
%
% =================================================================================================
% (c) 2021, T. Guillod, BSD License
% =================================================================================================
classdef window_class < handle
%% init
properties (SetAccess = private, GetAccess = private)
window_geom_obj % instance of window_geom
window_component_obj % instance of window_component
winding_mirroring_obj % instance of winding_mirroring
mirroring_method_obj % instance of mirroring_method
end
%% init
methods (Access = public)
function self = window_class(class, core, window, winding)
% get the core geometrical data
% - class - struct with function handlers on the abstract classes
% - bc - struct with the boundary condition
% - geom - struct with the window geometry
% - winding - struct with the winding parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% init the window geometry manager (with the user specified class)
self.window_geom_obj = class.window_geom_class(core, window);
% init the window component manager (with the user specified class)
window = self.window_geom_obj.get_window();
self.window_component_obj = class.window_component_class(window, winding);
% init the abstraction layer for the mirroring method
air_gap = self.window_geom_obj.get_air_gap();
winding_conductor = self.window_component_obj.get_winding_conductor();
self.winding_mirroring_obj = winding_mirroring(air_gap, winding_conductor);
% init the mirroring method
conductor = self.winding_mirroring_obj.get_conductor();
bc = self.window_geom_obj.get_bc();
self.mirroring_method_obj = mirroring_method(bc, conductor);
end
end
%% public api
methods (Access = public)
function type = get_type(self)
% get the component type
% - type - str with the component type
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
type = self.window_component_obj.get_type();
end
function V = get_copper_volume(self)
% get the copper volume of the wires of all windings
% - V - scalar with the volume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
V = self.window_component_obj.get_copper_volume();
end
function V = get_conductor_volume(self)
% get the total (copper and insulation) volume of the wires of all windings
% - V - scalar with the volume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
V = self.window_component_obj.get_conductor_volume();
end
function V = get_window_volume(self)
% get the volume of the winding window
% - V - scalar with the volume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
V = self.window_component_obj.get_window_volume();
end
function m = get_mass(self)
% get the mass of all windings
% - m - scalar with the mass
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m = self.window_component_obj.get_mass();
end
function fig = get_plot(self)
% make a plot with the window geometry
% - fig - handler of the created figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get the data
plot_data_conductor = self.window_component_obj.get_plot_data();
plot_data_geom = self.window_geom_obj.get_plot_data();
plot_data_geom_sub = self.window_geom_obj.get_plot_data_sub();
% find the title
str_bc = sprintf('bc = %s', plot_data_geom_sub.type);
str_n = sprintf('n = %d', plot_data_conductor.n_conductor);
str_z = sprintf('z = %.1f mm / linear', 1e3.*plot_data_geom.z);
msg = [str_bc ' / ' str_n ' / ' str_z];
% set the the plot
fig = figure();
title(msg, 'interpreter', 'none');
xlabel('x [mm]');
ylabel('y [mm]');
axis('equal');
hold('on');
% plot winding window
rectangle('Position', 1e3.*[-plot_data_geom.d./2.0 -plot_data_geom.h./2.0 plot_data_geom.d plot_data_geom.h],'FaceColor', [0.5 0.5 0.5], 'LineStyle','none')
% plot symmetry axis for BC
for i=1:length(plot_data_geom_sub.sym)
plot(1e3.*plot_data_geom_sub.sym{i}.x, 1e3.*plot_data_geom_sub.sym{i}.y, 'g')
end
% plot air gap
plot(1e3.*plot_data_geom_sub.x_gap, 1e3.*plot_data_geom_sub.y_gap, 'xr')
% plot the conductors
for i=1:plot_data_conductor.n_conductor
x = plot_data_conductor.x(i);
y = plot_data_conductor.y(i);
d_c = plot_data_conductor.d_c(i);
rectangle('Position', 1e3.*[x-d_c./2.0 y-d_c./2.0 d_c d_c], 'Curvature', 1.0, 'FaceColor', [0.9 0.5 0.0], 'LineStyle','none')
end
end
function circuit = get_circuit(self)
% get the equivalent circuit of the core with the corresponding source
% - circuit - struct with the equivalent circuit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L = self.mirroring_method_obj.get_L();
inductance = self.winding_mirroring_obj.parse_inductance(L);
circuit = self.window_component_obj.parse_circuit(inductance);
end
function losses = get_losses(self, stress)
% get the winding losses with a given stress (current, frequency, temperature, etc.)
% - stress - stress applied to the component
% - losses - struct with the winding losses
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check data
validateattributes(stress.f_vec, {'double'},{'row', 'nonnegative', 'nonempty', 'nonnan', 'real','finite'});
validateattributes(stress.T, {'double'},{'scalar', 'nonempty', 'nonnan', 'real','finite'});
% get the conductor current
excitation = self.window_component_obj.parse_excitation(length(stress.f_vec), stress.current);
I_vec = self.winding_mirroring_obj.parse_excitation(excitation);
% get the winding magnetic field
H = self.mirroring_method_obj.get_H_norm_conductor(I_vec);
magnetic_field = self.winding_mirroring_obj.parse_magnetic_field(H);
% compute the losses
losses = self.window_component_obj.get_losses(stress.f_vec, stress.T, excitation, magnetic_field);
end
end
end