%% Battery parameters

%% ModuleType1
ModuleType1.SOC_vec = [0, .1, .25, .5, .75, .9, 1]; % Vector of state-of-charge values, SOC
ModuleType1.T_vec = [278, 293, 313]; % Vector of temperatures, T, K
ModuleType1.V0_mat = [3.49, 3.5, 3.51; 3.55, 3.57, 3.56; 3.62, 3.63, 3.64; 3.71, 3.71, 3.72; 3.91, 3.93, 3.94; 4.07, 4.08, 4.08; 4.19, 4.19, 4.19]; % Open-circuit voltage, V0(SOC,T), V
ModuleType1.V_range = [0, inf]; % Terminal voltage operating range [Min Max], V
ModuleType1.R0_mat = [.0117, .0085, .009; .011, .0085, .009; .0114, .0087, .0092; .0107, .0082, .0088; .0107, .0083, .0091; .0113, .0085, .0089; .0116, .0085, .0089]; % Terminal resistance, R0(SOC,T), Ohm
ModuleType1.AH = 27; % Cell capacity, AH, A*hr
ModuleType1.R1_mat = [.0109, .0029, .0013; .0069, .0024, .0012; .0047, .0026, .0013; .0034, .0016, .001; .0033, .0023, .0014; .0033, .0018, .0011; .0028, .0017, .0011]; % First polarization resistance, R1(SOC,T), Ohm
ModuleType1.tau1_mat = [20, 36, 39; 31, 45, 39; 109, 105, 61; 36, 29, 26; 59, 77, 67; 40, 33, 29; 25, 39, 33]; % First time constant, tau1(SOC,T), s
ModuleType1.R2_mat = [.0109, .0029, .0013; .0069, .0024, .0012; .0047, .0026, .0013; .0034, .0016, .001; .0033, .0023, .0014; .0033, .0018, .0011; .0028, .0017, .0011]; % Second polarization resistance, R2(SOC,T), Ohm
ModuleType1.tau2_mat = [20, 36, 39; 31, 45, 39; 109, 105, 61; 36, 29, 26; 59, 77, 67; 40, 33, 29; 25, 39, 33]; % Second time constant, tau2(SOC,T), s
ModuleType1.thermal_mass = 100; % Thermal mass, J/K
ModuleType1.AmbientResistance = 25; % Cell level ambient thermal path resistance, K/W
ModuleType1.CellBalancingClosedResistance = 0.01; % Cell balancing switch closed resistance, Ohm
ModuleType1.CellBalancingOpenConductance = 1e-8; % Cell balancing switch open conductance, 1/Ohm
ModuleType1.CellBalancingThreshold = 0.5; % Cell balancing switch operation threshold
ModuleType1.CellBalancingResistance = 50; % Cell balancing shunt resistance, Ohm

%% ParallelAssemblyType1
ParallelAssemblyType1.SOC_vec = [0, .1, .25, .5, .75, .9, 1]; % Vector of state-of-charge values, SOC
ParallelAssemblyType1.T_vec = [278, 293, 313]; % Vector of temperatures, T, K
ParallelAssemblyType1.V0_mat = [3.49, 3.5, 3.51; 3.55, 3.57, 3.56; 3.62, 3.63, 3.64; 3.71, 3.71, 3.72; 3.91, 3.93, 3.94; 4.07, 4.08, 4.08; 4.19, 4.19, 4.19]; % Open-circuit voltage, V0(SOC,T), V
ParallelAssemblyType1.V_range = [0, inf]; % Terminal voltage operating range [Min Max], V
ParallelAssemblyType1.R0_mat = [.0117, .0085, .009; .011, .0085, .009; .0114, .0087, .0092; .0107, .0082, .0088; .0107, .0083, .0091; .0113, .0085, .0089; .0116, .0085, .0089]; % Terminal resistance, R0(SOC,T), Ohm
ParallelAssemblyType1.AH = 27; % Cell capacity, AH, A*hr
ParallelAssemblyType1.R1_mat = [.0109, .0029, .0013; .0069, .0024, .0012; .0047, .0026, .0013; .0034, .0016, .001; .0033, .0023, .0014; .0033, .0018, .0011; .0028, .0017, .0011]; % First polarization resistance, R1(SOC,T), Ohm
ParallelAssemblyType1.tau1_mat = [20, 36, 39; 31, 45, 39; 109, 105, 61; 36, 29, 26; 59, 77, 67; 40, 33, 29; 25, 39, 33]; % First time constant, tau1(SOC,T), s
ParallelAssemblyType1.R2_mat = [.0109, .0029, .0013; .0069, .0024, .0012; .0047, .0026, .0013; .0034, .0016, .001; .0033, .0023, .0014; .0033, .0018, .0011; .0028, .0017, .0011]; % Second polarization resistance, R2(SOC,T), Ohm
ParallelAssemblyType1.tau2_mat = [20, 36, 39; 31, 45, 39; 109, 105, 61; 36, 29, 26; 59, 77, 67; 40, 33, 29; 25, 39, 33]; % Second time constant, tau2(SOC,T), s
ParallelAssemblyType1.thermal_mass = 100; % Thermal mass, J/K
ParallelAssemblyType1.AmbientResistance = 25; % Cell level ambient thermal path resistance, K/W
ParallelAssemblyType1.CellBalancingClosedResistance = 0.01; % Cell balancing switch closed resistance, Ohm
ParallelAssemblyType1.CellBalancingOpenConductance = 1e-8; % Cell balancing switch open conductance, 1/Ohm
ParallelAssemblyType1.CellBalancingThreshold = 0.5; % Cell balancing switch operation threshold
ParallelAssemblyType1.CellBalancingResistance = 50; % Cell balancing shunt resistance, Ohm

%% Battery initial targets

%% ModuleAssembly1.Module1
ModuleAssembly1.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly1.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly1.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly1.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly1.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly1.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly1.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly2.Module1
ModuleAssembly2.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly2.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly2.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly2.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly2.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly2.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly2.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly3.Module1
ModuleAssembly3.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly3.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly3.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly3.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly3.Module1.temperatureCellModel = repmat(298.15 , 17, 1); % Cell model temperature, K
ModuleAssembly3.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly3.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly4.Module1
ModuleAssembly4.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly4.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly4.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly4.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly4.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly4.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly4.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly5.Module1
ModuleAssembly5.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly5.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly5.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly5.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly5.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly5.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly5.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly6.Module1
ModuleAssembly6.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly6.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly6.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly6.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly6.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly6.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly6.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly7.Module1
ModuleAssembly7.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly7.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly7.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly7.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly7.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly7.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly7.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

%% ModuleAssembly8.Module1
ModuleAssembly8.Module1.iCellModel = repmat(0, 17, 1); % Cell model current (positive in), A
ModuleAssembly8.Module1.vCellModel = repmat(0, 17, 1); % Cell model terminal voltage, V
ModuleAssembly8.Module1.socCellModel = repmat(1, 17, 1); % Cell model state of charge
ModuleAssembly8.Module1.numCyclesCellModel = repmat(0, 17, 1); % Cell model discharge cycles
ModuleAssembly8.Module1.temperatureCellModel = repmat(298.15, 17, 1); % Cell model temperature, K
ModuleAssembly8.Module1.vParallelAssembly = repmat(0, 17, 1); % Parallel Assembly Voltage, V
ModuleAssembly8.Module1.socParallelAssembly = repmat(1, 17, 1); % Parallel Assembly state of charge

% Suppress MATLAB editor message regarding readability of repmat
%#ok<*REPMAT>