-
Notifications
You must be signed in to change notification settings - Fork 17
Fix BatteryElectrochemEODEOL model #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Thank you for opening this PR. Each PR into dev requires a code review. For the code review, look at the following:
|
5219bed
to
fcc21fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job with a very complex task.
I think there one more wrinkle with qMax to unravel, then we should be done
'xnMin': 0.0, | ||
'xpMax': 1.0, | ||
'xpMin': 0.4, | ||
'qMax': 7600/0.6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need qMax here anymore. Now it is calculated from qMobile as we go since qMobile is changing.
This means your helper function will have to receive qMax as a parameter now.
There are 2 derived x0 from qMax that I don't think you need anymore either. since it's dependent on another state those will then need to be calculated when you call init
We can talk more about this tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion while we wait to finalize the qMax changes
self.assertEqual(result.event_states[-1], {'EOD': np.float64(0.08759698870698607), 'InsufficientCapacity': 0.0}) | ||
|
||
''' | ||
Test that the combined model has the same result if print is True or False. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great comment, very clear!
with self.assertWarns(UserWarning): | ||
batt.parameters['Ro'] = 10 | ||
''' | ||
Test that the combined model has the same results as the original model. The related changes can be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can try to make this just a tad more specific. I'm wondering if, months from now when we've forgotten this issue, we'll be confused with what we mean by "original model". Similarly, I wonder if we'll understand the hardcoded values below. I like that you link to the PR, this is great, but maybe we could also make the text just a bit more descriptive? This is just an idea, edit as desired:
"Test that the current combined model has the same results as an initial implementation. Note that this initial implementation is no longer in ProgPy. While we have confidence in the quantitative results, a development challenged forced the need for a separate EODEOL model. In the below test, some values from this initial implementation are hard-coded for testing purposes. (See link for more detail)."
Address #199 with [Option 3] by reworking the combined
BatteryElectroChemEODEOL
model so that the relevant parameters do not change inside the model and instead stay as states. This prevents the overriding behavior withqMobile
,tDiffusion
, andRo
in the original implementation. The parameters affected by side effects are now handled locally in their respective functions.This way, we can still use LazySim so
event_state
can be calculated only as needed without intermediate printing. This option is less memory intensive than [Option 1] and less computationally expensive than [Option 2]. The main downside is some instances of duplicated code. There is some refactoring introduced to help mitigate this.