-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMSBatteryDataAnalysisCode.m
5351 lines (4974 loc) · 289 KB
/
BMSBatteryDataAnalysisCode.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
classdef BMSBatteryDataAnalysis < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
MenuImport matlab.ui.container.Menu
MATMenu matlab.ui.container.Menu
PlotDefaultMenu matlab.ui.container.Menu
BMS_Main_PlotPanel matlab.ui.container.Panel
SOCButton matlab.ui.control.Button
CurrentButton matlab.ui.control.Button
BMS_BattCurVoltageButton matlab.ui.control.Button
BMS_MaxCellUButton matlab.ui.control.Button
BMSMinCellUButton matlab.ui.control.Button
MCU_DTCListButton matlab.ui.control.Button
VCU_AccPedalButton matlab.ui.control.Button
VCU_DTCListButton matlab.ui.control.Button
VCU_BrakePedalButton matlab.ui.control.Button
DeltCellUButton matlab.ui.control.Button
PowerButton matlab.ui.control.Button
MCU_CurCntTorButton matlab.ui.control.Button
BMS_MaxBattTButton matlab.ui.control.Button
BMS_MinBattTButton matlab.ui.control.Button
BMS_MaxCellUNumButton matlab.ui.control.Button
BMS_MinCellUNumButton matlab.ui.control.Button
BMS_MaxTModNumButton matlab.ui.control.Button
BMS_MinTModNumButton matlab.ui.control.Button
BatteryEnergyButton matlab.ui.control.Button
BMS_DeltTButton matlab.ui.control.Button
BMS_DtcListButton matlab.ui.control.Button
BMS_DCChargStaButton matlab.ui.control.Button
BMS_305_BMS_CC2StaButton matlab.ui.control.Button
ReserveButton matlab.ui.control.Button
AnalysisPlotButton matlab.ui.control.Button
FaultNumberPlotButtonGroup_2 matlab.ui.container.ButtonGroup
FaultNumberBarButton_2 matlab.ui.control.ToggleButton
BMSCellMinuButton_2 matlab.ui.control.ToggleButton
BMSCellDeltUButton_2 matlab.ui.control.ToggleButton
BMSPACKUButton_2 matlab.ui.control.ToggleButton
BMSMaxTButton_2 matlab.ui.control.ToggleButton
BMSDeltCellTButton matlab.ui.control.ToggleButton
MinuEditFieldLabel matlab.ui.control.Label
MinuEditField matlab.ui.control.EditField
DeltUEditFieldLabel matlab.ui.control.Label
DeltUEditField matlab.ui.control.EditField
PACKUEditFieldLabel matlab.ui.control.Label
PACKUEditField matlab.ui.control.EditField
MaxTEditFieldLabel matlab.ui.control.Label
MaxTEditField matlab.ui.control.EditField
DeltTEditFieldLabel matlab.ui.control.Label
DeltTEditField matlab.ui.control.EditField
BattDVDropDownLabel matlab.ui.control.Label
BattDVDropDown matlab.ui.control.DropDown
DefaultSetButton matlab.ui.control.StateButton
TabGroup matlab.ui.container.TabGroup
PlotTab_2 matlab.ui.container.Tab
UDS_BatteryStrategyPanel_2 matlab.ui.container.Panel
MinUDropDown_2Label matlab.ui.control.Label
MinUDropDown matlab.ui.control.DropDown
DeltUDropDown_2Label matlab.ui.control.Label
DeltUDropDown matlab.ui.control.DropDown
PACKUDropDown_2Label matlab.ui.control.Label
PACKUDropDown matlab.ui.control.DropDown
MAXTDropDown_2Label matlab.ui.control.Label
MAXTDropDown matlab.ui.control.DropDown
DeltTDropDown_2Label matlab.ui.control.Label
DeltTDropDown matlab.ui.control.DropDown
MinuDataButton_2 matlab.ui.control.Button
DeltUDataButton_2 matlab.ui.control.Button
PACKUDataButton_2 matlab.ui.control.Button
MaxTDataButton_2 matlab.ui.control.Button
DeltTDataButton_2 matlab.ui.control.Button
DropDown_20Label matlab.ui.control.Label
DropDown_20 matlab.ui.control.DropDown
DropDown_21Label matlab.ui.control.Label
DropDown_21 matlab.ui.control.DropDown
BatterryReportAndTestPanel_2 matlab.ui.container.Panel
SCO10DropDown_2Label matlab.ui.control.Label
SCO10DropDown_2 matlab.ui.control.DropDown
SOC30DropDown_2Label matlab.ui.control.Label
SOC30DropDown_2 matlab.ui.control.DropDown
SOC50DropDown_2Label matlab.ui.control.Label
SOC50DropDown_2 matlab.ui.control.DropDown
SOC70DropDown_2Label matlab.ui.control.Label
SOC70DropDown_2 matlab.ui.control.DropDown
SOC90DropDown_2Label matlab.ui.control.Label
SOC90DropDown_2 matlab.ui.control.DropDown
SOC20DropDown_2Label matlab.ui.control.Label
SOC20DropDown_2 matlab.ui.control.DropDown
SOC40DropDown_2Label matlab.ui.control.Label
SOC40DropDown_2 matlab.ui.control.DropDown
SOC60DropDown_2Label matlab.ui.control.Label
SOC60DropDown_2 matlab.ui.control.DropDown
SOC80DropDown_2Label matlab.ui.control.Label
SOC80DropDown_2 matlab.ui.control.DropDown
SOC100DropDown_2Label matlab.ui.control.Label
SOC100DropDown_2 matlab.ui.control.DropDown
Label_5 matlab.ui.control.Label
DropDown_22 matlab.ui.control.DropDown
Label_6 matlab.ui.control.Label
DropDown_23 matlab.ui.control.DropDown
SOCDropDownLabel matlab.ui.control.Label
SOCDropDown matlab.ui.control.DropDown
DropDown_10 matlab.ui.control.DropDown
DropDown_30 matlab.ui.control.DropDown
DropDown_50 matlab.ui.control.DropDown
DropDown_70 matlab.ui.control.DropDown
DropDown_90 matlab.ui.control.DropDown
DropDown_100 matlab.ui.control.DropDown
DropDown_80 matlab.ui.control.DropDown
DropDown_60 matlab.ui.control.DropDown
DropDown_40 matlab.ui.control.DropDown
DropDown_33 matlab.ui.control.DropDown
RawDataTab matlab.ui.container.Tab
UITable matlab.ui.control.Table
RawSOCdataTab matlab.ui.container.Tab
UITable2 matlab.ui.control.Table
DiffSOCdataTab matlab.ui.container.Tab
UITable3 matlab.ui.control.Table
HPPCTestPanel matlab.ui.container.Panel
OCVHPPCButtonGroup matlab.ui.container.ButtonGroup
DCR1Button matlab.ui.control.RadioButton
DCR2Button matlab.ui.control.RadioButton
DCR3Button matlab.ui.control.RadioButton
DCR4Button matlab.ui.control.RadioButton
HPPC1Button matlab.ui.control.RadioButton
HPPC2Button matlab.ui.control.RadioButton
DisChargePower_TableButton matlab.ui.control.Button
DisChr_OCV_SOCTableButton matlab.ui.control.Button
SOCButton_2 matlab.ui.control.Button
UIAxes matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
BarDTClistDropDownLabel matlab.ui.control.Label
BarDTClistDropDown matlab.ui.control.DropDown
BatteryTestPanel matlab.ui.container.Panel
Label matlab.ui.control.Label
ListBox matlab.ui.control.ListBox
Label_2 matlab.ui.control.Label
ListBox_2 matlab.ui.control.ListBox
Label_3 matlab.ui.control.Label
ListBox_3 matlab.ui.control.ListBox
Label_4 matlab.ui.control.Label
ListBox_4 matlab.ui.control.ListBox
end
properties (Access = private)
Data
Sdata
fieldname
fieldnamesize
filesize
curr_name
CalibrationValue
Rawdata
RawMinUdata
RawDeltUdata
RawPACKUdata
RawDeltTdata
RawMaxTdata
Calibration
SValue10
SValue20
SValue30
SValue40
SValue50
SValue60
SValue70
SValue80
SValue90
SValue100
DisData
ChrData
end
methods (Access = private)
% Menu selected function: MATMenu
function MATMenuSelected(app, event)
[filename,pathname] = uigetfile({'*.mat','MAT-files (*.mat)'},'Pick mat file','MultiSelect','on');
% 没有选择任何文件情况
if isequal(filename,0)
disp('User selected Cancel')
else
end
%选择一个文件情况
if ~iscellstr(filename)
filename=cellstr(filename);%type conversion such as C or C++ data type conversion
end
h=waitbar(0,'Please wait Import MAT file...');
steps=size(filename,2);
for step = 1:steps
% computations take place here
str=[num2str(100*step/steps),'%'];
waitbar(step / steps,h,str)
end
close(h)
Myvars={'BMS_BattSOC','BMS_MaxCellU','BMS_MaxCellUNum','BMSMinCellU','BMS_MinCellUNum','BMS_MaxBattT','BMS_MaxTModNum','BMS_MinBattT','BMS_MinTModNum','MCU_055__MCU_CurSpd','MCU_CurCntTor','BMS_BattCurCurrent','BMS_BattCurVoltage','BMS_DCChargSta','BMS_305__BMS_CC2Sta','VCU_AccPedal','VCU_BrakePedal','BMS_DtcList','VCU_DTCList','MCU_DTCList'};
% m=steps;
for i=1:steps
name=filename{1,i};
path=fullfile(pathname,name);
S(i)=load(path,Myvars{:});
if S(i).BMS_BattSOC(1,1)>10.0 || S(i).BMS_MaxCellU(1,1)>10.0 || S(i).BMS_BattSOC(2,1)>20.0
disp(name);
disp('这个数据的初始时间有问题!!!');
delete(name);
disp('此文件已被删除,不要感到惊奇,这会给你后续数据分析带来好处!')
end
end
for p=1:steps
S(p).Power(:,2)=(S(p).BMS_BattCurCurrent(:,2).*S(p).BMS_BattCurVoltage(:,2))/1000;
S(p).Power(:,1)=S(p).BMS_BattCurCurrent(:,1);
S(p).DeltT(:,2)=S(p).BMS_MaxBattT(:,2)-S(p).BMS_MinBattT(:,2);
S(p).DeltT(:,1)=S(p).BMS_MaxBattT(:,1);
S(p).Speed(:,2)=S(p).MCU_055__MCU_CurSpd(:,2)./68.55;
S(p).Speed(:,1)=S(p).MCU_055__MCU_CurSpd(:,1);
S(p).DeltCellU(:,2)=(S(p).BMS_MaxCellU(:,2)-S(p).BMSMinCellU(:,2))*1000;
S(p).DeltCellU(:,1)=S(p).BMS_MaxCellU(:,1);
end
% 读取的S数据整合
S_fname=fieldnames(S);
b=size(S_fname,1);
h1=waitbar(0,'1','Name','Please wait joint all MAT file...');
for i=1:b
Batt=0;
G=[];
stri=[num2str(100*i/b),'%'];
waitbar(i/b,h1,stri)
for j=1:steps
Batt=S(j).(S_fname{i,1})(:,1)+Batt(end);
S(j).(S_fname{i,1})(:,1)=Batt;
MediaVar=S(j).(S_fname{i,1});
G=vertcat(G,MediaVar);
end
ExtrcTable.(S_fname{i,1})=G;
end
close(h1)
app.Sdata=S;
% Joint all data
BMS_Energy_time=ExtrcTable.Power(:,1)./3600; %one column second time H power
BMS_Energy_total=ExtrcTable.Power(:,2);%kw
ExtrcTable.Energy(:,2)=cumtrapz(BMS_Energy_time,BMS_Energy_total);
ExtrcTable.Energy(:,1)=ExtrcTable.Power(:,1);
% 存储外部输入的数据到类的属性,和提供的component一样成为类使用数据在methode中构成function实现类的功能
app.Data=ExtrcTable;
app.fieldname=S_fname;
app.fieldnamesize=b;
current_dir=pathname;
current_vec=regexp(current_dir,'\','split');
current_name=current_vec{end-1};
app.curr_name=current_name;
app.filesize=steps;
% Start with data
CalibrationVlu=[];
% minU
minuthreshold=str2double(app.MinuEditField.Value);
minU_ind=find(app.Data.BMSMinCellU(:,2)<=minuthreshold);
a=size(minU_ind,1);
if a>0
CalibrationVlu.Minu(:,2)=app.Data.BMSMinCellU(minU_ind,2);
CalibrationVlu.Minu(:,1)=app.Data.BMSMinCellU(minU_ind,1);
end
disp(a)
% deltU
deltuthreshold=str2double(app.DeltUEditField.Value);
deltU_ind=find(app.Data.DeltCellU(:,2)>=deltuthreshold);
a1=size(deltU_ind,1);
if a1>0
CalibrationVlu.DeltU(:,2)=app.Data.DeltCellU(deltU_ind,2);
CalibrationVlu.DeltU(:,1)=app.Data.DeltCellU(deltU_ind,1);
end
disp(a1)
% PACKU
packuthreshold=str2double(app.PACKUEditField.Value);
PACKU_ind=find(app.Data.BMS_BattCurVoltage(:,2)<=packuthreshold);
a2=size(PACKU_ind,1);
if a2>0
CalibrationVlu.PACKU(:,2)=app.Data.BMS_BattCurVoltage(PACKU_ind,2);
CalibrationVlu.PACKU(:,1)=app.Data.BMS_BattCurVoltage(PACKU_ind,1);
end
disp(a2)
% MAXT
maxtthreshold=str2double(app.MaxTEditField.Value);
MaxT_ind=find(app.Data.BMS_MaxBattT(:,2)>=maxtthreshold);
a3=size(MaxT_ind,1);
if a3>0
CalibrationVlu.MaxT(:,2)=app.Data.BMS_MaxBattT(MaxT_ind,2);
CalibrationVlu.MaxT(:,1)=app.Data.BMS_MaxBattT(MaxT_ind,1);
end
disp(a3)
% DeltT
delttthreshold=str2double(app.DeltTEditField.Value);
DeltT_ind=find(app.Data.DeltT(:,2)>=delttthreshold);
a4=size(DeltT_ind,1);
if a4>0
CalibrationVlu.DeltT(:,2)=app.Data.DeltT(DeltT_ind,2);
CalibrationVlu.DeltT(:,1)=app.Data.DeltT(DeltT_ind,1);
end
disp(a4)
CalibrationVlue=[];
h=waitbar(0,'1','Name','正在抽取最小单体电压数据!');
%minu
if a>0
for x=1:app.filesize
CellU=app.Sdata(x).BMSMinCellU(:,2);
CellU_Time=app.Sdata(x).BMSMinCellU(:,1);
minu_ind=CellU<=minuthreshold;
minU_time=CellU_Time(minu_ind);
aa=size(minU_time,1);
str_cellu=[num2str(100*x/app.filesize),'%'];
waitbar(x/app.filesize,h,str_cellu)
for i=1:aa
BattCurCurrent=app.Sdata(x).BMS_BattCurCurrent(:,1);
minuindex=BattCurCurrent<(minU_time(i,1)+1) & BattCurCurrent>(minU_time(i,1)-1);
r1=find(minuindex,1,'first');
if ~isempty(r1)
[~,indexOfmin]=min(abs(BattCurCurrent(minuindex)-minU_time(i,1)));
indexOfmin=indexOfmin+r1-1;
Calibra(x).MinuCurrent(i,2)=app.Sdata(x).BMS_BattCurCurrent(indexOfmin,2); %find the calbri current
Calibra(x).MinuCurrent(i,1)=app.Sdata(x).BMS_BattCurCurrent(indexOfmin,1); %find the calbri current time
Calibra(x).MinuPower(i,2)=app.Sdata(x).Power(indexOfmin,2); %find the calbri power
Calibra(x).MinuPower(i,1)=app.Sdata(x).Power(indexOfmin,1); %find the calbri power time
Calibra(x).MinuPACKU(i,2)=app.Sdata(x).BMS_BattCurVoltage(indexOfmin,2); %find the calbri packvoltage
Calibra(x).MinuPACKU(i,1)=app.Sdata(x).BMS_BattCurVoltage(indexOfmin,1); % find the calbri packvoltage time
Calibra(x).MinuSOC(i,2)=app.Sdata(x).BMS_BattSOC(indexOfmin,2); %find the calbri soc
Calibra(x).MinuSOC(i,1)=app.Sdata(x).BMS_BattSOC(indexOfmin,1); %find the calbri soc corres to time
end
BMS_MaxBattT=app.Sdata(x).BMS_MaxBattT(:,1);
minumaxtind=BMS_MaxBattT<(minU_time(i,1)+1) & BMS_MaxBattT>(minU_time(i,1)-1);
r2=find(minumaxtind,1,'first');
if ~isempty(r2)
[~,indexOfmaxT]=min(abs(BMS_MaxBattT(minumaxtind)-minU_time(i,1)));
indexOfmaxT=indexOfmaxT+r2-1;
Calibra(x).MinuMaxT(i,2)=app.Sdata(x).BMS_MaxBattT(indexOfmaxT,2); %find the calbri temperature
Calibra(x).MinuMaxT(i,1)=app.Sdata(x).BMS_MaxBattT(indexOfmaxT,1);%find the calbri temperature time
end
MCU_CurSpd=app.Sdata(x).MCU_055__MCU_CurSpd(:,1);
minuspeedind=MCU_CurSpd<(minU_time(i,1)+1) & MCU_CurSpd>(minU_time(i,1)-1);
r3=find(minuspeedind,1,'first');
if ~isempty(r3)
[~,indexOfspeed]=min(abs(MCU_CurSpd(minuspeedind)-minU_time(i,1)));
indexOfspeed=indexOfspeed+r3-1;
Calibra(x).MinuSpeed(i,2)=app.Sdata(x).Speed(indexOfspeed,2); %find the speed of the vehicle
Calibra(x).MinuSpeed(i,1)=app.Sdata(x).Speed(indexOfspeed,1);% find the speed corres to time
end
end
end
end
close(h)
% Deltu data process DeltUCurrent', 'DeltUMaxT', 'DeltUPower', 'DeltUPACKU', 'DeltUPower', 'DeltUSOC', 'DeltUSpeed', 'DeltUAnalysis'
h1=waitbar(0,'1','Name','正在抽取单体压差数据!');
if a1>0
for z=1:app.filesize
DeltU=app.Sdata(z).DeltCellU(:,2);
DeltU_Time=app.Sdata(z).DeltCellU(:,1);
deltu_ind=DeltU>=deltuthreshold;
deltU_time=DeltU_Time(deltu_ind);
bb=size(deltU_time,1);
str_deltu=[num2str(100*z/app.filesize),'%'];
waitbar(z/app.filesize,h1,str_deltu)
for j=1:bb
BMS_BattCurCurrent=app.Sdata(z).BMS_BattCurCurrent(:,1);
deltuindex=BMS_BattCurCurrent<(deltU_time(j,1)+1) & BMS_BattCurCurrent>(deltU_time(j,1)-1);
s1=find(deltuindex,1,'first');
if ~isempty(s1)
[~,indexOfdeltumin]=min(abs(BMS_BattCurCurrent(deltuindex)-deltU_time(j,1)));
indexOfdeltumin=indexOfdeltumin+s1-1;
Calibra(z).DeltUCurrent(j,2)=app.Sdata(z).BMS_BattCurCurrent(indexOfdeltumin,2); %find the calbri current
Calibra(z).DeltUCurrent(j,1)=app.Sdata(z).BMS_BattCurCurrent(indexOfdeltumin,1); %find the calbri current time
Calibra(z).DeltUPower(j,2)=app.Sdata(z).Power(indexOfdeltumin,2); %find the calbri power
Calibra(z).DeltUPower(j,1)=app.Sdata(z).Power(indexOfdeltumin,1); %find the calbri power time
Calibra(z).DeltUPACKU(j,2)=app.Sdata(z).BMS_BattCurVoltage(indexOfdeltumin,2); %find the calbri packvoltage
Calibra(z).DeltUPACKU(j,1)=app.Sdata(z).BMS_BattCurVoltage(indexOfdeltumin,1); % find the calbri packvoltage time
Calibra(z).DeltUSOC(j,2)=app.Sdata(z).BMS_BattSOC(indexOfdeltumin,2); %find the calbri soc
Calibra(z).DeltUSOC(j,1)=app.Sdata(z).BMS_BattSOC(indexOfdeltumin,1); %find the calbri soc corres to time
end
MaxBattT=app.Sdata(z).BMS_MaxBattT(:,1);
deltumaxtindex=MaxBattT<(deltU_time(j,1)+1) & MaxBattT>(deltU_time(j,1)-1);
s2=find(deltumaxtindex,1,'first');
if ~isempty(s2)
[~,indexOfdeltumaxT]=min(abs(MaxBattT(deltumaxtindex)-deltU_time(j,1)));
indexOfdeltumaxT=indexOfdeltumaxT+s2-1;
Calibra(z).DeltUMaxT(j,2)=app.Sdata(z).BMS_MaxBattT(indexOfdeltumaxT,2); %find the calbri temperature
Calibra(z).DeltUMaxT(j,1)=app.Sdata(z).BMS_MaxBattT(indexOfdeltumaxT,1);%find the calbri temperature time
end
CurSpd=app.Sdata(z).MCU_055__MCU_CurSpd(:,1);
deltuspdindex=CurSpd<(deltU_time(j,1)+1) & CurSpd<(deltU_time(j,1)-1);
s3=find(deltuspdindex,1,'first');
if ~isempty(s3)
[~,indexOfdeltuspeed]=min(abs(CurSpd(:,1)-deltU_time(j,1)));
indexOfdeltuspeed=indexOfdeltuspeed+s3-1;
Calibra(z).DeltUSpeed(j,2)=app.Sdata(z).Speed(indexOfdeltuspeed,2); %find the speed of the vehicle
Calibra(z).DeltUSpeed(j,1)=app.Sdata(z).Speed(indexOfdeltuspeed,1);% find the speed corres to time
end
end
end
end
close(h1)
%Packu 'PACKU', 'PACKUCurrent', 'PACKUMaxT', 'PACKUTorque', 'PACKUPower', 'PACKUSOC', 'PACKUSpeed', 'PACKUAnalysis'
h2=waitbar(0,'1','Name','正在抽取电池包欠压数据!');
if a2>0
for k=1:app.filesize
Voltage=app.Sdata(k).BMS_BattCurVoltage(:,2);
Voltage_Time=app.Sdata(k).BMS_BattCurVoltage(:,1);
packind=Voltage<=packuthreshold;
PACKU_time=Voltage_Time(packind);
cc=size(PACKU_time,1);
str_packu=[num2str(100*k/app.filesize),'%'];
waitbar(k/app.filesize,h2,str_packu)
for s=1:cc
PACKU_CurCurrent=app.Sdata(k).BMS_BattCurCurrent(:,1);
packuindex=PACKU_CurCurrent<(PACKU_time(s,1)+1) & PACKU_CurCurrent>(PACKU_time(s,1)-1);
t1=find(packuindex,1,'first');
if ~isempty(t1)
[~,indexOfpackumin]=min(abs(PACKU_CurCurrent(packuindex)-PACKU_time(s,1)));
indexOfpackumin=indexOfpackumin+t1-1;
Calibra(k).PACKUCurrent(s,2)=app.Sdata(k).BMS_BattCurCurrent(indexOfpackumin,2); %find the calbri current
Calibra(k).PACKUCurrent(s,1)=app.Sdata(k).BMS_BattCurCurrent(indexOfpackumin,1); %find the calbri current time
Calibra(k).PACKUPower(s,2)=app.Sdata(k).Power(indexOfpackumin,2); %find the calbri power
Calibra(k).PACKUPower(s,1)=app.Sdata(k).Power(indexOfpackumin,1); %find the calbri power time
Calibra(k).PACKUSOC(s,2)=app.Sdata(k).BMS_BattSOC(indexOfpackumin,2); %find the calbri soc
Calibra(k).PACKUSOC(s,1)=app.Sdata(k).BMS_BattSOC(indexOfpackumin,1); %find the calbri soc corres to time
end
PACKU_MaxBattT=app.Sdata(k).BMS_MaxBattT(:,1);
packumaxtindex=PACKU_MaxBattT<(PACKU_time(s,1)+1) & PACKU_MaxBattT>(PACKU_time(s,1)-1);
t2=find(packumaxtindex,1,'first');
if ~isempty(t2)
[~,indexOfpackumaxT]=min(abs(PACKU_MaxBattT(packumaxtindex)-PACKU_time(s,1)));
indexOfpackumaxT=indexOfpackumaxT+t2-1;
Calibra(k).PACKUMaxT(s,2)=app.Sdata(k).BMS_MaxBattT(indexOfpackumaxT,2); %find the calbri temperature
Calibra(k).PACKUMaxT(s,1)=app.Sdata(k).BMS_MaxBattT(indexOfpackumaxT,1);%find the calbri temperature time
end
PACKU_CurSpd=app.Sdata(k).MCU_055__MCU_CurSpd(:,1);
packuspdindex=PACKU_CurSpd<(PACKU_time(s,1)+1) & PACKU_CurSpd>(PACKU_time(s,1)-1);
t3=find(packuspdindex,1,'first');
if ~isempty(t3)
[~,indexOfpackuspeed]=min(abs(PACKU_CurSpd(packuspdindex)-PACKU_time(s,1)));
indexOfpackuspeed=indexOfpackuspeed+t3-1;
Calibra(k).PACKUSpeed(s,2)=app.Sdata(k).Speed(indexOfpackuspeed,2); %find the speed of the vehicle
Calibra(k).PACKUSpeed(s,1)=app.Sdata(k).Speed(indexOfpackuspeed,1);% find the speed corres to time
end
PACKU_CurCntTor=app.Sdata(k).MCU_CurCntTor(:,1);
packuTorindex=PACKU_CurCntTor<(PACKU_time(s,1)+1) & PACKU_CurCntTor>(PACKU_time(s,1)-1);
t4=find(packuTorindex,1,'first');
if ~isempty(t4)
[~,indexOfpackuTor]=min(abs(PACKU_CurCntTor(packuTorindex)-PACKU_time(s,1)));
indexOfpackuTor=indexOfpackuTor+t4-1;
Calibra(k).PACKUTorque(s,2)=app.Sdata(k).MCU_CurCntTor(indexOfpackuTor,2); %find the calbri Torque
Calibra(k).PACKUTorque(s,1)=app.Sdata(k).MCU_CurCntTor(indexOfpackuTor,1); % find the calbri Torque time
end
end
end
end
close(h2)
% 'MaxT', 'MaxTCurrent', 'MaxTTorque', 'MaxTPACKU', 'MaxTPower', 'MaxTSOC', 'MaxTSpeed', 'MaxTAnalysis'
h3=waitbar(0,'1','Name','正在抽取电池包过温数据!');
if a3>0
for r=1:app.filesize
MaxT_ind=find(app.Sdata(r).BMS_MaxBattT(:,2)>=maxtthreshold);
MaxT_time=app.Sdata(r).BMS_MaxBattT(MaxT_ind,1);
dd=size(MaxT_ind,1);
str_maxt=[num2str(100*r/app.filesize),'%'];
waitbar(r/app.filesize,h3,str_maxt)
for m=1:dd
MaxT_Curr=app.Sdata(r).BMS_BattCurCurrent(:,1);
maxtcurrindex=MaxT_Curr<(MaxT_time(m,1)+1) & MaxT_Curr>(MaxT_time(m,1)-1);
v1=find(maxtcurrindex,1,'first');
if ~isempty(v1)
[~,indexOfmaxTmin]=min(abs(MaxT_Curr(maxtcurrindex)-MaxT_time(m,1)));
indexOfmaxTmin=indexOfmaxTmin+v1-1;
Calibra(r).MaxTPACKU(m,2)=app.Sdata(r).BMS_BattCurVoltage(indexOfmaxTmin,2); %find the calbri packu
Calibra(r).MaxTPACKU(m,1)=app.Sdata(r).BMS_BattCurVoltage(indexOfmaxTmin,1);%find the calbri packu time
Calibra(r).MaxTCurrent(m,2)=app.Sdata(r).BMS_BattCurCurrent(indexOfmaxTmin,2); %find the calbri current
Calibra(r).MaxTCurrent(m,1)=app.Sdata(r).BMS_BattCurCurrent(indexOfmaxTmin,1); %find the calbri current time
Calibra(r).MaxTPower(m,2)=app.Sdata(r).Power(indexOfmaxTmin,2); %find the calbri power
Calibra(r).MaxTPower(m,1)=app.Sdata(r).Power(indexOfmaxTmin,1); %find the calbri power time
Calibra(r).MaxTSOC(m,2)=app.Sdata(r).BMS_BattSOC(indexOfmaxTmin,2); %find the calbri soc
Calibra(r).MaxTSOC(m,1)=app.Sdata(r).BMS_BattSOC(indexOfmaxTmin,1); %find the calbri soc corres to time
end
MaxT_Speed=app.Sdata(r).MCU_055__MCU_CurSpd(:,1);
maxtspdindex=MaxT_Speed<(MaxT_time(m,1)+1) & MaxT_Speed>(MaxT_time(m,1)-1);
v2=find(maxtspdindex,1,'first');
if ~isempty(v2)
[~,indexOfmaxTspeed]=min(abs(MaxT_Speed(maxtspdindex)-MaxT_time(m,1)));
indexOfmaxTspeed=indexOfmaxTspeed+v2-1;
Calibra(r).MaxTSpeed(m,2)=app.Sdata(r).Speed(indexOfmaxTspeed,2); %find the speed of the vehicle
Calibra(r).MaxTSpeed(m,1)=app.Sdata(r).Speed(indexOfmaxTspeed,1);% find the speed corres to time
end
MaxT_Torque=app.Sdata(r).MCU_CurCntTor(:,1);
maxttorqueindex=MaxT_Torque<(MaxT_time(m,1)+1) & MaxT_Torque>(MaxT_time(m,1)-1);
v3=find(maxttorqueindex,1,'first');
if ~isempty(v3)
[~,indexOfmaxTTor]=min(abs(MaxT_Torque(maxttorqueindex)-MaxT_time(m,1)));
indexOfmaxTTor=indexOfmaxTTor+v3-1;
Calibra(r).MaxTTorque(m,2)=app.Sdata(r).MCU_CurCntTor(indexOfmaxTTor,2); %find the calbri Torque
Calibra(r).MaxTTorque(m,1)=app.Sdata(r).MCU_CurCntTor(indexOfmaxTTor,1); % find the calbri Torque time
end
end
end
end
close(h3)
% 'DeltT', 'DeltTCurrent', 'DeltTPACKU', 'DeltTMaxT', 'DeltTPower', 'DeltTSOC', 'DeltTAnalysis'
h4=waitbar(0,'1','Name','正在抽取电池包温差数据!');
if a4>0
for p=1:app.filesize
DeltT_ind=find(app.Sdata(p).DeltT(:,2)>=delttthreshold);
time=app.Sdata(p).DeltT(DeltT_ind,1);
ee=size(DeltT_ind,1);
str_deltt=[num2str(100*p/app.filesize),'%'];
waitbar(p/app.filesize,h4,str_deltt)
for q=1:ee
curr=app.Sdata(p).DeltT(:,1);
currindex=curr<(time(q,1)+1) & curr>(time(q,1)-1);
u4=find(currindex,1,'first');
if ~isempty(u4)
[~,indOfdelttcur]=min(abs(curr(currindex)-time(q,1)));
indOfdelttcur=indOfdelttcur+u4-1;
Calibra(p).DeltTCurrent(q,2)=app.Sdata(p).BMS_BattCurCurrent(indOfdelttcur,2);
Calibra(p).DeltTCurrent(q,1)=app.Sdata(p).BMS_BattCurCurrent(indOfdelttcur,1);
Calibra(p).DeltTPower(q,2)=app.Sdata(p).Power(indOfdelttcur,2);
Calibra(p).DeltTPower(q,1)=app.Sdata(p).Power(indOfdelttcur,1);
Calibra(p).DeltTPACKU(q,2)=app.Sdata(p).BMS_BattCurVoltage(indOfdelttcur,2);
Calibra(p).DeltTPACKU(q,1)=app.Sdata(p).BMS_BattCurVoltage(indOfdelttcur,1);
Calibra(p).DeltTSOC(q,2)=app.Sdata(p).BMS_BattSOC(indOfdelttcur,2);
Calibra(p).DeltTSOC(q,1)=app.Sdata(p).BMS_BattSOC(indOfdelttcur,1);
end
DeltT_MaxT=app.Sdata(p).BMS_MaxBattT(:,1);
maxtindex=DeltT_MaxT<(time(q,1)+1) & DeltT_MaxT>(time(q,1)-1);
u5=find(maxtindex,1,'first');
if ~isempty(u5)
[~,indOfdelttmaxT]=min(abs(DeltT_MaxT(maxtindex)-time(q,1)));
indOfdelttmaxT=indOfdelttmaxT+u5-1;
Calibra(p).DeltTMaxT(q,2)=app.Sdata(p).BMS_MaxBattT(indOfdelttmaxT,2);
Calibra(p).DeltTMaxT(q,1)=app.Sdata(p).BMS_MaxBattT(indOfdelttmaxT,1);
end
DeltT_Tor=app.Sdata(p).MCU_CurCntTor(:,1);
torindex=DeltT_Tor<(time(q,1)+1) & DeltT_Tor>(time(q,1)-1);
u6=find(torindex,1,'first');
if ~isempty(u6)
[~,indOfdelttTor]=min(abs(DeltT_Tor(torindex)-time(q,1)));
indOfdelttTor=indOfdelttTor+u6-1;
Calibra(p).DeltTTorque(q,2)=app.Sdata(p).MCU_CurCntTor(indOfdelttTor,2);
Calibra(p).DeltTTorque(q,1)=app.Sdata(p).MCU_CurCntTor(indOfdelttTor,1);
end
end
end
end
close(h4)
%提取的故障数据整合
C_fname=fieldnames(Calibra);
bb=size(C_fname,1);
kk=size(Calibra,2);
h11=waitbar(0,'1','Name','Please wait joint all Struct file...');
for ii=1:bb
GG=[];
stri=[num2str(100*ii/bb),'%'];
waitbar(ii/bb,h11,stri)
for jj=1:kk
MediaVar=Calibra(jj).(C_fname{ii,1});
GG=vertcat(GG,MediaVar);
end
CalibrationVlue.(C_fname{ii,1})=GG;
end
close(h11)
app.CalibrationValue=CalibrationVlue;
app.Calibration=CalibrationVlu;
end
% Button pushed function: SOCButton
function ButtonSOC_callback(app, event)
plot(app.UIAxes,app.Data.BMS_BattSOC(:,1),app.Data.BMS_BattSOC(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,'SOC');
title(app.UIAxes,app.curr_name);
end
% Button pushed function: CurrentButton
function ButtonCurrent_callback(app, event)
current=app.Data.BMS_BattCurCurrent(:,2);
current_time=app.Data.BMS_BattCurCurrent(:,1);
curind=current<1000;
current=current(curind);
current_time=current_time(curind);
plot(app.UIAxes,current_time,current,'o','MarkerSize',2);
ylabel(app.UIAxes,'BMS_BattCurCurrent');
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_BattCurVoltageButton
function ButtonPACKU_callback(app, event)
packu_row_ind=find(app.Data.BMS_BattCurVoltage(:,2)==0);
packuRow=app.Data.BMS_BattCurVoltage(:,1);
packuCol=app.Data.BMS_BattCurVoltage(:,2);
packuRow(packu_row_ind)=[];
packuCol(packu_row_ind)=[];
plot(app.UIAxes,packuRow,packuCol,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_BattCurVoltageButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MaxCellUButton
function BMS_MaxCellUButtonPushed(app, event)
maxcellu_row_ind=find(app.Data.BMS_MaxCellU(:,2)==0);
MaxCellUrow=app.Data.BMS_MaxCellU(:,1);
MaxCellUcol=app.Data.BMS_MaxCellU(:,2);
MaxCellUrow(maxcellu_row_ind)=[];
MaxCellUcol(maxcellu_row_ind)=[];
plot(app.UIAxes,MaxCellUrow,MaxCellUcol,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MaxCellUButton.Text );
% app.UIAxes.YLim=[2.50 3.80];
end
% Button pushed function: BMSMinCellUButton
function BMSMinCellUButtonPushed(app, event)
mincellu_row_ind=find(app.Data.BMSMinCellU(:,2)==0);
MinCellUrow=app.Data.BMSMinCellU(:,1);
MinCellUcol=app.Data.BMSMinCellU(:,2);
MinCellUrow(mincellu_row_ind)=[];
MinCellUcol(mincellu_row_ind)=[];
plot(app.UIAxes,MinCellUrow,MinCellUcol,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMSMinCellUButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: MCU_DTCListButton
function MCU_DTCListButtonPushed(app, event)
plot(app.UIAxes,app.Data.MCU_DTCList(:,1),app.Data.MCU_DTCList(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.MCU_DTCListButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: VCU_AccPedalButton
function VCU_AccPedalButtonPushed(app, event)
plot(app.UIAxes,app.Data.VCU_AccPedal(:,1),app.Data.VCU_AccPedal(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.VCU_AccPedalButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: VCU_DTCListButton
function VCU_DTCListButtonPushed(app, event)
plot(app.UIAxes,app.Data.VCU_DTCList(:,1),app.Data.VCU_DTCList(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.VCU_DTCListButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: VCU_BrakePedalButton
function VCU_BrakePedalButtonPushed(app, event)
plot(app.UIAxes,app.Data.VCU_BrakePedal(:,1),app.Data.VCU_BrakePedal(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.VCU_BrakePedalButton.Text );
title(app.UIAxes,app.curr_name);
end
% Button pushed function: DeltCellUButton
function DeltCellUButtonPushed(app, event)
deltuindex=find(app.Data.DeltCellU(:,2)>1000);
DeltCellU_x=app.Data.DeltCellU(:,1);
DeltCellU_y=app.Data.DeltCellU(:,2);
DeltCellU_x(deltuindex)=[];
DeltCellU_y(deltuindex)=[];
plot(app.UIAxes,DeltCellU_x,DeltCellU_y,'o','MarkerSize',2);
ylabel(app.UIAxes,app.DeltCellUButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: PowerButton
function PowerButtonPushed(app, event)
Power_Time=app.Data.Power(:,1);
Power=app.Data.Power(:,2);
powerind=Power<300;
Power=Power(powerind);
Power_Time=Power_Time(powerind);
plot(app.UIAxes,Power_Time,Power,'o','MarkerSize',2);
ylabel(app.UIAxes,app.PowerButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: MCU_CurCntTorButton
function MCU_CurCntTorButtonPushed(app, event)
plot(app.UIAxes,app.Data.MCU_CurCntTor(:,1),app.Data.MCU_CurCntTor(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.MCU_CurCntTorButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MaxBattTButton
function BMS_MaxBattTButtonPushed(app, event)
maxT_index_row=find(app.Data.BMS_MaxBattT(:,2)==-40);
MaxBattTcolone=app.Data.BMS_MaxBattT(:,1);
MaxBattTcoltwo=app.Data.BMS_MaxBattT(:,2);
MaxBattTcolone(maxT_index_row)=[];
MaxBattTcoltwo(maxT_index_row)=[];
plot(app.UIAxes,MaxBattTcolone,MaxBattTcoltwo,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MaxBattTButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MinBattTButton
function BMS_MinBattTButtonPushed(app, event)
minT_index_row=find(app.Data.BMS_MinBattT(:,2)==-40);
MinBattTcolone=app.Data.BMS_MinBattT(:,1);
MinBattTcoltwo=app.Data.BMS_MinBattT(:,2);
MinBattTcolone(minT_index_row)=[];
MinBattTcoltwo(minT_index_row)=[];
plot(app.UIAxes,MinBattTcolone,MinBattTcoltwo,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MinBattTButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MaxCellUNumButton
function BMS_MaxCellUNumButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_MaxCellUNum(:,1),app.Data.BMS_MaxCellUNum(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MaxCellUNumButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MinCellUNumButton
function BMS_MinCellUNumButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_MinCellUNum(:,1),app.Data.BMS_MinCellUNum(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MinCellUNumButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MaxTModNumButton
function BMS_MaxTModNumButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_MaxTModNum(:,1),app.Data.BMS_MaxTModNum(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MaxTModNumButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_MinTModNumButton
function BMS_MinTModNumButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_MinTModNum(:,1),app.Data.BMS_MinTModNum(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_MinTModNumButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BatteryEnergyButton
function BatteryEnergyButtonPushed(app, event)
plot(app.UIAxes,app.Data.Energy(:,1),app.Data.Energy(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BatteryEnergyButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_DeltTButton
function BMS_DeltTButtonPushed(app, event)
DeltT=app.Data.DeltT(:,2);
delttind=DeltT<25;
DeltT=DeltT(delttind);
DeltT_Time=app.Data.DeltT(:,1);
DeltT_Time=DeltT_Time(delttind);
plot(app.UIAxes,DeltT_Time,DeltT,'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_DeltTButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_DtcListButton
function BMS_DtcListButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_DtcList(:,1),app.Data.BMS_DtcList(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_DtcListButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_DCChargStaButton
function BMS_DCChargStaButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_DCChargSta(:,1),app.Data.BMS_DCChargSta(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_DCChargStaButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: BMS_305_BMS_CC2StaButton
function BMS_305_BMS_CC2StaButtonPushed(app, event)
plot(app.UIAxes,app.Data.BMS_305__BMS_CC2Sta(:,1),app.Data.BMS_305__BMS_CC2Sta(:,2),'o','MarkerSize',2);
ylabel(app.UIAxes,app.BMS_305_BMS_CC2StaButton.Text);
title(app.UIAxes,app.curr_name);
end
% Button pushed function: AnalysisPlotButton
function AnalysisPlotButtonPushed(app, event)
% Create UIFigure
% app.UIFigure1 = figure;
% app.UIFigure1.Color = [0.902 0.902 0.902];
% % Create UIAxes
% app.UIAxes1 = uiaxes(app.UIFigure1);
% title(app.UIAxes1, 'Title')
% xlabel(app.UIAxes1, '时间')
% ylabel(app.UIAxes1, 'Y')
% app.UIAxes1.FontWeight = 'bold';
% app.UIAxes1.Box = 'on';
% app.UIAxes1.XGrid = 'on';
% app.UIAxes1.YGrid = 'on';
% app.UIAxes1.Position = [0.05 0.79 0.2 0.2]; % piexl
% app.UIAxes1.Position = [71 526 284 133];
% plot(app.UIAxes1,app.Data.BMS_BattCurCurrent(:,1),app.Data.BMS_BattCurCurrent(:,2),'o','MarkerSize',2)
% plot(app.UIAxes2,app.Data.BMS_DCChargSta(:,1),app.Data.BMS_DCChargSta(:,2),'o','MarkerSize',2);
end
% Selection changed function: FaultNumberPlotButtonGroup_2
function FaultNumberPlotButtonGroup_2SelectionChanged(app, event)
% Start with a fresh plot
cla(app.UIAxes2,'reset')
CalibrationVlu=[];
% minU
minuthreshold=str2double(app.MinuEditField.Value);
minU_ind=find(app.Data.BMSMinCellU(:,2)<=minuthreshold);
a=size(minU_ind,1);
if a>0
CalibrationVlu.Minu(:,2)=app.Data.BMSMinCellU(minU_ind,2);
CalibrationVlu.Minu(:,1)=app.Data.BMSMinCellU(minU_ind,1);
end
% deltU
deltuthreshold=str2double(app.DeltUEditField.Value);
deltU_ind=find(app.Data.DeltCellU(:,2)>=deltuthreshold);
a1=size(deltU_ind,1);
if a1>0
CalibrationVlu.DeltU(:,2)=app.Data.DeltCellU(deltU_ind,2);
CalibrationVlu.DeltU(:,1)=app.Data.DeltCellU(deltU_ind,1);
end
% PACKU
packuthreshold=str2double(app.PACKUEditField.Value);
PACKU_ind=find(app.Data.BMS_BattCurVoltage(:,2)<=packuthreshold);
a2=size(PACKU_ind,1);
if a2>0
CalibrationVlu.PACKU(:,2)=app.Data.BMS_BattCurVoltage(PACKU_ind,2);
CalibrationVlu.PACKU(:,1)=app.Data.BMS_BattCurVoltage(PACKU_ind,1);
end
% MAXT
maxtthreshold=str2double(app.MaxTEditField.Value);
MaxT_ind=find(app.Data.BMS_MaxBattT(:,2)>=maxtthreshold);
a3=size(MaxT_ind,1);
if a3>0
CalibrationVlu.MaxT(:,2)=app.Data.BMS_MaxBattT(MaxT_ind,2);
CalibrationVlu.MaxT(:,1)=app.Data.BMS_MaxBattT(MaxT_ind,1);
end
% DeltT
delttthreshold=str2double(app.DeltTEditField.Value);
DeltT_ind=find(app.Data.DeltT(:,2)>=delttthreshold);
a4=size(DeltT_ind,1);
if a4>0
CalibrationVlu.DeltT(:,2)=app.Data.DeltT(DeltT_ind,2);
CalibrationVlu.DeltT(:,1)=app.Data.DeltT(DeltT_ind,1);
end
switch app.FaultNumberPlotButtonGroup_2.SelectedObject.Text
case 'FaultNumberBar'
fieldnam=fieldnames(CalibrationVlu);
FaultNum=structfun(@length,CalibrationVlu);
fname=cellstr(fieldnam);
c=categorical(fname);
bar(app.UIAxes2,c,FaultNum);
ylabel(app.UIAxes2,'故障出现次数');
title(app.UIAxes2,app.curr_name);
legend(app.UIAxes2,'不同类故障出现次数计');
app.UIAxes2.YGrid ='on';
case 'BMSCellMinu'
value_minu=CalibrationVlu.Minu(:,2);
jj=2.7;
for ij=1:16
mediavar=find(value_minu>=jj & value_minu<(jj+0.02));
index_len_minu(1,ij)=length(mediavar);
jj=jj+0.02;
end
cc_minu = categorical({'2.7-2.72','2.72-2.74','2.74-2.76','2.76-2.78','2.78-2.8','2.8-2.82','2.82-2.84','2.84-2.86','2.86-2.88','2.88-2.9','2.9-2.92','2.92-2.94','2.94-2.96','2.96-2.98','2.98-3.0','3.0-3.12'});
bar(app.UIAxes2,cc_minu,index_len_minu);
ylabel(app.UIAxes2,'故障出现次数');
title(app.UIAxes2,app.curr_name);
legend(app.UIAxes2,'单体欠压一级故障频次直方图');
app.UIAxes2.YGrid ='on';
case 'BMSCellDeltU'
value_deltu=CalibrationVlu.DeltU(:,2);
jj=20;
for ik=1:29
mediavar1=find(value_deltu>=jj & value_deltu<(jj+20));
index_len_deltu(1,ik)=length(mediavar1);
jj=jj+20;
end
cc_deltu = categorical({'20-40','40-60','60-80','80-100','100-120','120-140','140-160','160-180','180-200','200-220','220-240','240-260','260-280','280-300','300-320','320-340','340-360','360-380','380-400','400-420','420-440','440-460','460-480','480-500','500-520','520-540','540-560','560-580','580-600'});
bar(app.UIAxes2,cc_deltu,index_len_deltu);
ylabel(app.UIAxes2,'故障出现次数');
legend(app.UIAxes2,'单体压差一级故障频次直方图');
title(app.UIAxes2,app.curr_name);
app.UIAxes2.YGrid ='on';
case 'BMSPACKU'
packuvalue=CalibrationVlu.PACKU(:,2);
jj=300;
for ii=1:15
mediavar2=find(packuvalue>=jj & packuvalue<(jj+5));
index_len_packu(1,ii)=length(mediavar2);%在300-305范围内的PACKU的频次
jj=jj+5;
end
cc_packu=categorical({'300-305','305-310','310-315','315-320','320-325','325-330','330-335','335-340','340-345','345-350','350-355','355-360','360-365','365-370','370-375'});
bar(app.UIAxes2,cc_packu,index_len_packu);
ylabel(app.UIAxes2,'故障出现次数');
title(app.UIAxes2,app.curr_name);
legend(app.UIAxes2,'PACKU一级故障频次直方图');
app.UIAxes2.YGrid ='on';
case 'BMSMaxT'
value_overt=CalibrationVlu.MaxT(:,2);
jj=47;
for in=1:6
mediavar3=find(value_overt>=jj & value_overt<(jj+1));
index_len_overt(1,in)=length(mediavar3);
jj=jj+1;
end
cc_overt = categorical({'47-48','48-49','49-50','50-51','51-52','52-53'});
bar(app.UIAxes2,cc_overt,index_len_overt);
ylabel(app.UIAxes2,'故障出现次数');
legend(app.UIAxes2,'过温一级故障频次直方图');
title(app.UIAxes2,app.curr_name);
app.UIAxes2.YGrid ='on';
case 'BMSDeltCellT'
value_deltt=CalibrationVlu.DeltT(:,2);
jj=2;
for im=1:13
mediavar4=find(value_deltt>=jj & value_deltt<(jj+1));
index_len_deltt(1,im)=length(mediavar4);
jj=jj+1;
end
cc_deltt = categorical({'2-3','3-4','4-5','5-6','6-7','7-8','8-9','9-10','10-11','11-12','12-13','13-14','14-15'});
bar(app.UIAxes2,cc_deltt,index_len_deltt);
ylabel(app.UIAxes2,'故障出现次数');
legend(app.UIAxes2,'温差一级故障频次直方图');
title(app.UIAxes2,app.curr_name);
app.UIAxes2.YGrid ='on';
end
end
% Value changed function: DefaultSetButton
function DefaultSetButtonValueChanged(app, event)
app.MinuEditField.Value='3';
app.DeltUEditField.Value='200';
app.PACKUEditField.Value='372';
app.MaxTEditField.Value = '49';
app.DeltTEditField.Value = '7';
end
% Value changed function: MinUDropDown
function MinUDropDownValueChanged(app, event)
value=app.MinUDropDown.Value;
switch value
case 'Minu'
plot(app.UIAxes,app.Calibration.(value)(:,1),app.Calibration.(value)(:,2),'o','MarkerSize',6,'Color','red');
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
% datacursormode(app.UIFigure)
case 'MinuCurrent'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuMaxT'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuPower'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuPACKU'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuSOC'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuSpeed'
plot(app.UIAxes,app.CalibrationValue.(value)(:,1),app.CalibrationValue.(value)(:,2),'o','MarkerSize',6,'LineWidth',0.5);
ylabel(app.UIAxes,value);
title(app.UIAxes,app.curr_name);
case 'MinuAnalysis'
% plot(data.CalibrationVlue.MinUCurrent(:,1),data.CalibrationVlue.MinUCurrent(:,2),'o','MarkerSize',4,'LineWidth',0.5,'Color','red');
% xlabel('时间');
% ylabel('MinUCurrent');
% title(current_name);
% plot(data.CalibrationVlue.MinUMaxT(:,1),data.CalibrationVlue.MinUMaxT(:,2),'o','MarkerSize',4,'LineWidth',0.5);
% xlabel('时间');
% ylabel('MinUMaxT');
% title(current_name);
% plot(data.CalibrationVlue.MinUPower(:,1),data.CalibrationVlue.MinUPower(:,2),'o','MarkerSize',4,'LineWidth',0.5,'Color','red');
% xlabel('时间');
% ylabel('MinUPower');
% title(current_name);
% plot(data.CalibrationVlue.MinUSOC(:,1),data.CalibrationVlue.MinUSOC(:,2),'o','MarkerSize',4,'LineWidth',0.5);
% xlabel('时间');
% ylabel('MinUSOC');
% title(current_name);
end
end