proportional power dropping

This commit is contained in:
aj 2020-12-01 09:54:01 +00:00
parent e6c3330291
commit 5bc129fc06
2 changed files with 5 additions and 4 deletions

View File

@ -113,8 +113,8 @@ plot(x, power_out / 1e6, 'r', 'LineWidth', 1);
% max_line = yline(MAX_P_OUT / 1e6, '-c', 'LineWidth', line_width * 0.75); % max_line = yline(MAX_P_OUT / 1e6, '-c', 'LineWidth', line_width * 0.75);
% min_line = yline(MIN_P_OUT / 1e6, '-c', 'LineWidth', line_width * 0.75); % min_line = yline(MIN_P_OUT / 1e6, '-c', 'LineWidth', line_width * 0.75);
max_line.Alpha = 0.5; % max_line.Alpha = 0.5;
min_line.Alpha = 0.5; % min_line.Alpha = 0.5;
% yline(P_IN / 1e6, '--m', 'LineWidth', line_width * 0.5); % yline(P_IN / 1e6, '--m', 'LineWidth', line_width * 0.5);

View File

@ -32,7 +32,7 @@ sim_seconds = SIMULATION_DAYS * 24 * 60 * 60;
%%%%%%% unit conversions %%%%%%% unit conversions
batt_capacity = batt_capacity * 3600; % J batt_capacity = batt_capacity * 3600; % J
BATT_FULL_LEVEL = 0.9; % battery level at which the power input decreases BATT_FULL_LEVEL = 0.8; % battery level at which the power input decreases
BATT_WARN_LEVEL = 0.4; % battery level at which the power input increases BATT_WARN_LEVEL = 0.4; % battery level at which the power input increases
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -127,7 +127,8 @@ for SECOND=1:sim_seconds
% BATTERY HIGH, DECREASE POWER IN % BATTERY HIGH, DECREASE POWER IN
elseif (battery_level(SECOND)/batt_capacity) > BATT_FULL_LEVEL elseif (battery_level(SECOND)/batt_capacity) > BATT_FULL_LEVEL
current_p_in = max(current_p_in - P_IN_INTERVAL, MIN_P_IN); percent_diff = 1 - (abs(BATT_FULL_LEVEL - (battery_level(SECOND)/batt_capacity)) / (1 - BATT_FULL_LEVEL));
current_p_in = max(current_p_in - percent_diff * P_IN_INTERVAL, MIN_P_IN);
% NEITHER, RELAX TO EFFICIENT STATE % NEITHER, RELAX TO EFFICIENT STATE
else else