From 20d94127592e528d3c72559817f9064e414c42bc Mon Sep 17 00:00:00 2001 From: Brian Mirletz Date: Wed, 27 Nov 2024 15:57:51 -0700 Subject: [PATCH] Change get state and params to reference to speed up code --- shared/lib_battery.cpp | 4 ++-- shared/lib_battery.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/lib_battery.cpp b/shared/lib_battery.cpp index 34ce99418..8ef3bc76c 100644 --- a/shared/lib_battery.cpp +++ b/shared/lib_battery.cpp @@ -790,9 +790,9 @@ double battery_t::getAvailabilityLoss(size_t lifetimeIndex) { return losses->getAvailabilityLoss(lifetimeIndex); } -battery_state battery_t::get_state() { return *state; } +battery_state& battery_t::get_state() { return *state; } -battery_params battery_t::get_params() { return *params; } +battery_params& battery_t::get_params() { return *params; } void battery_t::set_state(const battery_state& tmp_state, double dt_hr) { *state = tmp_state; diff --git a/shared/lib_battery.h b/shared/lib_battery.h index 9b2331ce7..9b1059184 100644 --- a/shared/lib_battery.h +++ b/shared/lib_battery.h @@ -420,9 +420,9 @@ class battery_t { // Get the adjust loss at the current timestep double getAvailabilityLoss(size_t lifetimeIndex); - battery_state get_state(); + battery_state& get_state(); - battery_params get_params(); + battery_params& get_params(); // The simulation time tracked by last_idx is dependent on the timestep. // If the previous state was using a different timestep, such as via ChangeTimestep, set the dt_hr (which is in battery_params)