Skip to content

{NREL#146}_fix_stack_overflow_error_time_to_fill#173

Merged
nreinicke merged 2 commits intoNatLabRockies:mainfrom
clintonsteiner:NREL#146_Stack_overflow_error_time_to_fill
Apr 24, 2023
Merged

{NREL#146}_fix_stack_overflow_error_time_to_fill#173
nreinicke merged 2 commits intoNatLabRockies:mainfrom
clintonsteiner:NREL#146_Stack_overflow_error_time_to_fill

Conversation

@clintonsteiner
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Collaborator

@robfitzgerald robfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking the initiative to fix the actual problem here. a few requests, particularly to expose the default via HiveConfig. thanks! 🐝

Comment thread tests/test_powercurve_ops.py Outdated


class TestPowercurveOps(TestCase):
def test_time_to_fill(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give it a name that implies what is being tested, something like test_time_to_fill_when_near_full

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed

charger: Charger,
target_soc: Ratio,
sim_timestep_duration_seconds: Seconds,
min_delta_energy_change: Ratio = 0.0001
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great. to set this default value, could you:

  • pass this default in from here
  • everywhere it's called, for example here, you could grab it from the environment (see below for example)
  • default configuration is set in the default hive.yaml file, you can add the row min_delta_energy_change: 0.0001 after schedule_type.
min_delta_energy_change = env.config.sim.min_delta_energy_change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

time_charged = _fill(vehicle)
vehicle, time_delta = mechatronics.add_energy(vehicle, charger, sim_timestep_duration_seconds)

delta = abs(prev_energy - vehicle.energy.get(charger.energy_type)) / prev_energy
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, one more thing i just noticed. we need to catch the case that prev_energy is not zero, which is possible if the user sets a vehicles.csv entry at 0% soc with at-home charging. please include that along with a unit test. and that covers at least those extrema edge cases of [0,1] values i think.

to deal with the grid throttle scenario, what might be a good thing in the future would be to pass some max charge time argument. that at least can be set to int((sim.end_time - sim.sim_time) / sim.timestep_duration_seconds) .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll make a comment in the doc string and we can make a new issue

@clintonsteiner clintonsteiner force-pushed the NREL#146_Stack_overflow_error_time_to_fill branch from 2016911 to ca5b569 Compare April 24, 2023 22:27
@clintonsteiner
Copy link
Copy Markdown
Contributor Author

Updated commit, I think I addressed all changes?

@clintonsteiner clintonsteiner force-pushed the NREL#146_Stack_overflow_error_time_to_fill branch 3 times, most recently from e212a45 to c9f833a Compare April 24, 2023 22:51
@clintonsteiner clintonsteiner force-pushed the NREL#146_Stack_overflow_error_time_to_fill branch from c9f833a to 169ef6a Compare April 24, 2023 22:58
Copy link
Copy Markdown
Collaborator

@nreinicke nreinicke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks for addressing those changes.

@nreinicke nreinicke merged commit 9b2b610 into NatLabRockies:main Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants