-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathrun_design_compute_single.m
71 lines (56 loc) · 2.2 KB
/
run_design_compute_single.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
function run_design_compute_single()
% Compute a single inductor design.
%
% Load the ANN/regression obtained with the FEM/ANN workflow.
% Compute the specified design.
%
% Use the ANN/regression (or FEM or analytical approximation) for the computation:
% - the thermal model (hotspot and average temperatures)
% - the magnetic model (inductance, current density, flux density, and magnetic field)
%
% This function requires a running ANN Python Server (if this regression method is used).
%
% (c) 2019-2020, ETH Zurich, Power Electronic Systems Laboratory, T. Guillod
init_toolbox();
% get the type of regression to be done
fprintf('Select the simulation type:\n')
fprintf(' 1 - ANN-based model\n')
fprintf(' 2 - Analytical approximation\n')
fprintf(' 2 - FEM simulation (require COMSOL Livelink)\n')
idx = input('Enter your choice >> ');
% parse the user choice
choice_cell = {'ann', 'approx', 'fem'};
choice = get_choice(choice_cell, idx);
% compute the design
if isempty(choice)
fprintf('Invalid input\n')
else
fprintf('\n')
run_sub(choice)
plot_sub(choice)
end
end
function run_sub(eval_type)
% Run the FEM % Compute and plot a single inductor design (with different evaluation methods).
%
% Parameters:
% eval_type (str): type of the evaluation ('fem', 'ann', or approx')
% path of the file containing the exported data from the FEM/ANN
file_export = 'dataset/export.mat';
% path of the file to be written with the computed single design
file_compute_single = ['design/compute_single_' eval_type '.mat'];
% get the design parameters for the inductor
[eval_ann, data_compute] = get_design_param_compute_single(eval_type);
% compute a single inductor design
master_compute_single(file_compute_single, file_export, eval_ann, data_compute)
end
function plot_sub(eval_type)
% Run the FEM % Compute and plot a single inductor design (with different evaluation methods).
%
% Parameters:
% eval_type (str): type of the evaluation ('fem', 'ann', or approx')
% path of the file to be written with the computed single design
file_compute_single = ['design/compute_single_' eval_type '.mat'];
% plot a single inductor design
master_plot_single(file_compute_single)
end