Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
otvam committed May 6, 2020
1 parent bafda07 commit aa41ea2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions source_ann/ann_example/ann_data/get_ann_param.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
% - 'rel_abs': relative error (absolute value)
% - 'rel_sign': relative error (with sign)
var_out = {};
var_out{end+1} = struct('name', 'y_1', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'y_2', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'y_1', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');
var_out{end+1} = struct('name', 'y_2', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% control the splitting of the samples between training and testing:
% - ratio_train: ratio of the samples used for training
Expand Down
6 changes: 3 additions & 3 deletions source_ann/ann_matlab/@AnnManager/disp_fom_train.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function disp_hist(tag, fom_train, fom_test, type)
% tag (str): name of the variable
% fom_train (struct): figures of merit of the variable (training)
% fom_test (struct): figures of merit of the variable (testing)
% type (str): type of the variable ('set' or 'abs' or 'rel')
% type (str): type of the variable ('set' or 'rel_abs' or 'abs_abs' or 'rel_sign' or 'abs_sign')

hold('on')
switch type
Expand All @@ -116,14 +116,14 @@ function disp_hist(tag, fom_train, fom_test, type)
ylabel('n [1]')
vec_train = [fom_train.v_min fom_train.v_max];
vec_test = [fom_test.v_min fom_test.v_max];
case 'abs'
case {'abs_abs', 'abs_sign'}
histogram(fom_train.vec)
histogram(fom_test.vec)
xlabel('x [1]')
ylabel('n [1]')
vec_train = [fom_train.v_min fom_train.v_max fom_train.v_avg fom_train.v_prc_99];
vec_test = [fom_test.v_min fom_test.v_max fom_test.v_avg fom_test.v_prc_99];
case 'rel'
case {'rel_abs', 'rel_sign'}
histogram(1e2.*fom_train.vec)
histogram(1e2.*fom_test.vec)
xlabel('err [%]')
Expand Down
12 changes: 6 additions & 6 deletions source_inductor/inductor_fem_ann/master_assemble.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ function master_assemble(file_assemble, folder_fem, make_zip)
fprintf('assemble\n')
[diff, n_tot, n_sol, model_type, file_model, inp, out_fem] = fem_ann.get_assemble(folder_fem);

% make a zip file and remove the folder
if make_zip==true
fprintf('zip\n')
fem_ann.get_zip(folder_fem);
end

% compute the analytical results
fprintf('approx\n')
out_approx = fem_ann.get_out_approx(model_type, inp);
Expand All @@ -35,6 +29,12 @@ function master_assemble(file_assemble, folder_fem, make_zip)
fprintf(' n_tot = %d\n', n_tot)
fprintf(' n_sol = %d\n', n_sol)

% make a zip file and remove the folder
if make_zip==true
fprintf('zip\n')
fem_ann.get_zip(folder_fem);
end

% save data
fprintf('save\n')
save(file_assemble, '-v7.3', 'diff', 'n_sol', 'n_tot', 'inp', 'out_fem', 'out_approx', 'model_type', 'file_model')
Expand Down
18 changes: 9 additions & 9 deletions source_input/get_fem_ann_data_train.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,32 +98,32 @@
var_out = {};
if strcmp(model_type, 'mf')
% inductance (for a single turn)
var_out{end+1} = struct('name', 'L_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'L_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% quasi-RMS flux density, integral of B^beta, normalized for one turn and 1A, for the core losses
var_out{end+1} = struct('name', 'B_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'B_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% RMS current density, integral of J^2, normalized for one turn and 1A, for the LF winding losses
var_out{end+1} = struct('name', 'J_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'J_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% RMS magnetic density, integral of H^2, normalized for one turn and 1A, for the HF winding losses
var_out{end+1} = struct('name', 'H_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'H_norm', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');
end
if strcmp(model_type, 'ht')
% maximum temperature elevation of the core, for the thermal limit
var_out{end+1} = struct('name', 'dT_core_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'dT_core_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% average temperature elevation of the core, for the losses
var_out{end+1} = struct('name', 'dT_core_avg', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'dT_core_avg', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% maximum temperature elevation of the winding, for the thermal limit
var_out{end+1} = struct('name', 'dT_winding_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'dT_winding_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% average temperature elevation of the winding, for the losses
var_out{end+1} = struct('name', 'dT_winding_avg', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'dT_winding_avg', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');

% maximum temperature elevation of the insulation, for the thermal limit
var_out{end+1} = struct('name', 'dT_iso_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_sign');
var_out{end+1} = struct('name', 'dT_iso_max', 'use_nrm', true, 'var_trf', 'none', 'var_norm', 'min_max', 'var_err', 'rel_abs');
end

% control the splitting of the samples between training and testing:
Expand Down

0 comments on commit aa41ea2

Please sign in to comment.