Skip to content

Commit

Permalink
Change get state and params to reference to speed up code
Browse files Browse the repository at this point in the history
  • Loading branch information
brtietz committed Nov 27, 2024
1 parent dd1fe7e commit 20d9412
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions shared/lib_battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions shared/lib_battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 20d9412

Please sign in to comment.