Skip to content
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

Removed unnecessary covariance get() #132

Merged
merged 2 commits into from
Jul 23, 2020
Merged

Removed unnecessary covariance get() #132

merged 2 commits into from
Jul 23, 2020

Conversation

teubert
Copy link
Contributor

@teubert teubert commented Jul 22, 2020

Just saw this unnecessary line when debugging with Ed. Fixes #130

Also, noticed that we were returning temperature in °C but it's calculated in K. Updated to return in K, removing a single operation from the inner loop. (#133)

Added a few comments describing UKF variables

@teubert teubert requested a review from jason-watkins July 22, 2020 21:16
@teubert teubert added A: Predictors Area: Predictors C: Cleanup Category: PRs that clean code up or issues documenting cleanup. E: Easy Call for participation: Experience needed to fix: Easy / not muchEffort PR: Delete Branch The PR's source branch should be deleted on merge PR: Merge The PR should be merged as soon as all checks have passed. labels Jul 22, 2020
@teubert teubert linked an issue Jul 22, 2020 that may be closed by this pull request
@@ -117,8 +117,7 @@ namespace PCOE {
Matrix Pxx(model.getStateSize(), model.getStateSize());
for (unsigned int xIndex = 0; xIndex < model.getStateSize(); xIndex++) {
xMean[xIndex][0] = state[xIndex][MEAN];
std::vector<double> covariance = state[xIndex].getVec(COVAR());
Pxx.row(xIndex, state[xIndex].getVec(COVAR(0)));
Pxx.row(xIndex, state[xIndex].getVec(COVAR()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Are COVAR() and COVAR(0) equivalent in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they are

@teubert teubert linked an issue Jul 23, 2020 that may be closed by this pull request
@@ -416,7 +416,7 @@ SystemModel::output_type BatteryModel::outputEqn(double,

auto z_new = getOutputVector();
// Set outputs
z_new[OUT::TEMP] = Tb - 273.15;
z_new[OUT::TEMP] = Tb;
Copy link
Contributor

@jason-watkins jason-watkins Jul 23, 2020

Choose a reason for hiding this comment

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

I don't think I like this... Since we don't have proper unit analysis, this silently changes the model's API. How are we going to communicate this change effectively?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now, the main tools we have to communicate the change are the release notes and the documentation. That is, unless we were to incorporate some sort of unit analysis like this library (except supporting C++11):
https://github.com/nholthaus/units

I am also on the fence on this for the same reasons. In the end I wanted to go for it because 1. it's in the most computationally expensive function of the innermost loop of the prediction step. 2. it's the lesser used output (voltage is more important. and 3. At this point we don't have many users.

That said, I am still on the fence, so if you prefer not to make this change I can reverse it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought some more about this and I think you're right. I reverted this commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. I've been working on my own unit analysis library off and on when I have some spare time. Eventually it will be good enough to consider incorporating it into GSAP and other projects.

@jason-watkins jason-watkins merged commit 04f9bcc into develop Jul 23, 2020
@teubert teubert deleted the simple_bugfix branch July 23, 2020 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Predictors Area: Predictors C: Cleanup Category: PRs that clean code up or issues documenting cleanup. E: Easy Call for participation: Experience needed to fix: Easy / not muchEffort PR: Delete Branch The PR's source branch should be deleted on merge PR: Merge The PR should be merged as soon as all checks have passed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This seems unnecessary- let's use kelvin all throughout. Unnecessary Line
2 participants