% script: runSixScenarios % % Run the six capacity-estimation examples from sections 4.19 through 4.21 % of the textbook. % Copyright (c) 2016 by Gregory L. Plett of % University of Colorado Colorado Springs (UCCS). % % This work is licensed under a Creative Commons % Attribution-NonCommercial-ShareAlike 4.0 Intl. License, v. 1.0 % % It is provided "as is", without express or implied warranty, for % educational and informational purposes only. % % This file is provided as a supplement to: Plett, Gregory L., "Battery % Management Systems, Volume II, Equivalent-Circuit Methods," Artech House, % 2015. close all clear all scenarios = ones([6 1]); % set to 1 to run a test scenario, 0 to skip % Scenario 1: if scenarios(1), Q0 = 10; % true initial capacity maxI = 30*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = 0; % rate of change of capacity Qnom = 0; % nominal capacity xmax = 0.2; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) m = 300; % number of measurements between capacity estimates theCase = 1; % case 1 = fixed update interval socnoise = sqrt(2)*0.01; % standard deviation of SOC estimates gamma = 1; % forgetting factor plotParams.title = 'HEV Scenario 1'; plotParams.ytick = 9.5:0.1:10.5; % Set random-number seed to get same results each time. % Comment out to get different results each time. RandStream.setGlobalStream(RandStream('mt19937ar','seed',8)); runScenario end % Scenario 2: if scenarios(2), Q0 = 10; % true initial capacity maxI = 30*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = 0; % rate of change of capacity Qnom = 0.99*Q0; % nominal capacity xmax = 0.2; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) m = 300; % number of measurements between capacity estimates theCase = 1; % case 1 = fixed update interval socnoise = sqrt(2)*0.01; % standard deviation of SOC estimates gamma = 1; % forgetting factor plotParams.title = 'HEV Scenario 2'; plotParams.ytick = 9.5:0.1:10.5; RandStream.setGlobalStream(RandStream('mt19937ar','seed',8)); runScenario end % Scenario 3: if scenarios(3), Q0 = 10; % true initial capacity maxI = 30*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = -0.001; % rate of change of capacity Qnom = 0.99*Q0; % nominal capacity xmax = 0.2; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) m = 300; % number of measurements between capacity estimates theCase = 1; % case 1 = fixed update interval socnoise = sqrt(2)*0.01; % standard deviation of SOC estimates gamma = 0.99; % forgetting factor plotParams.title = 'HEV Scenario 3'; plotParams.ytick = 8.7:0.2:10.5; RandStream.setGlobalStream(RandStream('mt19937ar','seed',8)); runScenario end % Scenario 4: if scenarios(4), Q0 = 100; % true initial capacity maxI = 5*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = 0; % rate of change of capacity Qnom = 0.99*Q0; % nominal capacity xmax = 0.4; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) theCase = 1; m = 7200; % case 1 = fixed update interval socnoise = sqrt(2)*0.01; % standard deviation of SOC estimates gamma = 1; % forgetting factor plotParams.title = 'EV Scenario 1'; plotParams.ytick = 97:1:103; RandStream.setGlobalStream(RandStream('mt19937ar','seed',5)); runScenario end % Scenario 5: if scenarios(5), Q0 = 100; % true initial capacity maxI = 5*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = 0; % rate of change of capacity Qnom = 0.99*Q0; % nominal capacity xmax = 0.8; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) theCase = 2; mode = 0.5; sigma = 0.6; % case 2 = random update interval socnoise = 0.01; % standard deviation of SOC estimates gamma = 1; % forgetting factor plotParams.title = 'EV Scenario 2'; plotParams.ytick = 98:0.5:101; RandStream.setGlobalStream(RandStream('mt19937ar','seed',4)); runScenario end % Scenario 6: if scenarios(6), Q0 = 100; % true initial capacity maxI = 5*Q0; % must be able to measure current up to +/- maxI precisionI = 2^10; % 10-bit precision on current sensor slope = -0.01; % rate of change of capacity Qnom = 0.99*Q0; % nominal capacity xmax = 0.8; % max change in SOC between capacity estimates xmin = -xmax; % min change in SOC (signed) theCase = 2; mode = 0.5; sigma = 0.6; % case 2 = random update interval socnoise = 0.01; % standard deviation of SOC estimates gamma = 0.98; % forgetting factor plotParams.title = 'EV Scenario 3'; plotParams.ytick = 89:1:103; RandStream.setGlobalStream(RandStream('mt19937ar','seed',5)); runScenario end