-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArbin_files.m
106 lines (82 loc) · 2.89 KB
/
Arbin_files.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
function Arbin_files(app)
prompt = {'Enter number of cell ids to analyse:'};
dlgtitle = 'Input';
dims = [1 50];
definput = {'1'};
answer = inputdlg(prompt,dlgtitle,dims,definput);
val = str2double(answer);
if isempty(answer)
app.Arbin_status =0;
return
end
File_count= {}; % initial file count for each cell id
app.Cells = ([]);
for icell = 1:val
str_op = num2str(icell);
str1 = ['Enter the name of cell id:',' ',str_op];
prompt1 = {str1};
dlgtitle1 = 'Cell name';
dims = [1 50];
definput2 = {'AGM 001'};
cell_name = inputdlg(prompt1,dlgtitle1,dims,definput2);
if isempty(cell_name)
app.Arbin_status =0;
return
end
%name_cell=convertCharsToStrings(cell_name );
app.Cells(icell).name = cell_name;
[files, pathname] = uigetfile({'*.csv', 'CSV Files (*.csv)'; ...
'*.*', 'All Files (*.*)'}, ...
'Data Import', 'MultiSelect', 'on');
if isequal(files,0)
app.Arbin_status =0;
return
end
d = uiprogressdlg(app.BatteryAnalyticUIFigure,'Title','Please Wait',...
'Message','Loading files...','ShowPercentage',"on");
if iscell(files)
number_files= size(files,2);
else
number_files=1;
end
cell_id = struct([]);
app.File_count{icell} =num2str(number_files);
for ifille = 1: number_files
d.Value = ifille/number_files;
if iscell(files)
file = files(ifille);
file=char(file);
filename = fullfile(pathname,file);
else
filename = fullfile(pathname,files);
end
cell_id(ifille).Data = readtable(filename, 'PreserveVariableNames',true);
if size(cell_id(ifille).Data,2)>15 % Some files add additional empty column
cell_id(ifille).Data = cell_id(ifille).Data(:,1:19);
end
cell_id(ifille).Data.Properties.VariableNames= {'DataPoint','DateAndTime','RunTime',...
'StepTime','CycleNumber','StepNumber','Current','Potential','Power','ChargeCapacity',...
'Ah_step','ChargeEnergy','DischargeEnergy','ACResistence','dVdt',...
'DCResistance','ICA','DVA','Temperature'};
%Ah_step = DischargeCapacity
end
app.Cells(icell).data = cell_id ;
end
%Add_parameters_to_Novonix(app)
%Couloumbic_charge_slippage(app)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55
% Sort files according to cell serial numbers/name
value ={};
numcells= size(app.Cells,2);
for cell_id = 1: numcells
val= [app.Cells(cell_id).name];
vall = char(val);
value =[value; vall];
end
app.uniqcellname = value;
app.UniqSerial = value; % may be ask user to manually add it
% if size(app.Cells,2)>1 || size(app.Cells.data,2)>1
appState(app)
% end
app.Arbin_status = 1;
end