-
Notifications
You must be signed in to change notification settings - Fork 1
/
cell_protocol.m
32 lines (27 loc) · 1.05 KB
/
cell_protocol.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
function [tt, uu] = cell_protocol(params)
% A function to manually define or generate a protocol from data. This
% function is called by set_protocol.m. The outputs are the vector of time
% points tt and corresponding input values uu. There may be up to 3 inputs:
% current (A), temperature (deg. C) and measured voltage (V) in that order.
% Load parameters
[mn, hr, Crate, CtoK] = struct2array(params, {'mn','hr','Crate','CtoK'});
% Define the protocol
t_end = 30*mn; % time period (s)
u1 = @(t) 0.5*Crate; % current (A)
u2 = @(t) 25; % external temperature (deg. C)
u3 = @(t) 3.5+0.5*t/t_end; % voltage (V)
u4 = @(t) 0; % current derivative (A/s) **must match u1(t)**
u5 = @(t) 0; % external temperature derivative (K/s) **must match u2(t)**
% Compute the discrete time protocol
nt = 100;
tt(1:nt,1) = linspace(0,t_end,nt)';
uu(1:nt,1) = u1(tt);
uu(1:nt,2) = u2(tt);
uu(1:nt,3) = u3(tt);
uu(1:nt,4) = u4(tt);
uu(1:nt,5) = u5(tt);
% Or, load the protocol from file
% load('Data/Examples/drive_cycle.parquet','time','current');
% tt = time;
% uu = current;
end