forked from Lucast85/BMSino-Matlab-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_setup.m
58 lines (48 loc) · 2.24 KB
/
test_setup.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
classdef test_setup < handle % handle class
%setup initialize test parameters
% ...
properties( Constant = true )
DCDC_SERIALPORT = 'COM2' % COM port
BMSINO_SERIALPORT = 'COM5' % COM port
BMSINO_BAUDRATE = 115200 % bps
DCDC_BAUDRATE = 38400 % bps
MAX_TEST_TIME = 14400; % seconds
CELLS_NUMBER = 6; % possible only 4, 5 or 6 cells each BMSino
end
properties
BMSino;
B3603;
time = NaN * ones(1, test_setup.MAX_TEST_TIME);
BatteryCurrent = NaN * ones(1, test_setup.MAX_TEST_TIME);
CellVoltage = NaN * ones(test_setup.CELLS_NUMBER, test_setup.MAX_TEST_TIME);
CellVoltage_filtered = NaN * ones(test_setup.CELLS_NUMBER, test_setup.MAX_TEST_TIME);
BatteryVoltage=NaN * ones(1, test_setup.MAX_TEST_TIME);
CellTemperatures = NaN * ones(test_setup.CELLS_NUMBER, test_setup.MAX_TEST_TIME);
CellBalancingStatus = NaN * ones(test_setup.CELLS_NUMBER, test_setup.MAX_TEST_TIME);
BMSTemperature = NaN * ones(1, test_setup.MAX_TEST_TIME);
test_balance_window = 100;
StoredCharge = NaN * ones(1, test_setup.MAX_TEST_TIME);
prev_voltages_value = NaN * ones(test_setup.CELLS_NUMBER, 1);
cell_lost_current = NaN * ones(test_setup.CELLS_NUMBER,1);
prev_current_SetPoint;
prev_current_time = 0;
start_current_time = 0;
start_current_SetPoint = 0;
start_bal_time = 0;
prev_bal_time = 0;
end
methods
function obj = test_setup()
%test_setup Build the objects to run the test
% clear all intruments objects connected on serial port
delete(instrfindall);
% Create BMSino and DCDC objects
obj.BMSino = Battery('Batteria_6s1p_test_NCR18650'); % BMSino with Garbuglia-Unterhost FW
obj.BMSino.COMinit(obj.BMSINO_BAUDRATE, obj.BMSINO_SERIALPORT);
%pause(0.1);
obj.B3603 = DCDC('B3603'); % Calibrated B3603 with custom FW (Luca Buccolini)
obj.B3603.COMinit(obj.DCDC_BAUDRATE, obj.DCDC_SERIALPORT);
%pause(0.1);
end
end
end