From 5bc129fc06048a27344e9e9b278a02753b25fa18 Mon Sep 17 00:00:00 2001 From: aj Date: Tue, 1 Dec 2020 09:54:01 +0000 Subject: [PATCH] proportional power dropping --- maths/mission_power_model.m | 4 ++-- maths/power_sim.m | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/maths/mission_power_model.m b/maths/mission_power_model.m index 85aa745..694a5d9 100644 --- a/maths/mission_power_model.m +++ b/maths/mission_power_model.m @@ -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); % min_line = yline(MIN_P_OUT / 1e6, '-c', 'LineWidth', line_width * 0.75); -max_line.Alpha = 0.5; -min_line.Alpha = 0.5; +% max_line.Alpha = 0.5; +% min_line.Alpha = 0.5; % yline(P_IN / 1e6, '--m', 'LineWidth', line_width * 0.5); diff --git a/maths/power_sim.m b/maths/power_sim.m index 2b7760b..5179995 100644 --- a/maths/power_sim.m +++ b/maths/power_sim.m @@ -32,7 +32,7 @@ sim_seconds = SIMULATION_DAYS * 24 * 60 * 60; %%%%%%% unit conversions 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -127,7 +127,8 @@ for SECOND=1:sim_seconds % BATTERY HIGH, DECREASE POWER IN 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 else