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

improved handling if not earliest forested value if provided #126

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

lwluc
Copy link
Collaborator

@lwluc lwluc commented Dec 13, 2024

No description provided.

@lwluc lwluc requested a review from maxbehr801 December 13, 2024 05:52
validateNotNull(optimalForecastedCarbon, "actual Carbon");
validateNotNull(savedCarbonPercentage, "saved Carbon");
evaluateValidations();
}

public Carbon calculateReduction() {
if (carbonWithoutOptimization == null) {
return optimalForecastedCarbon;
Copy link
Collaborator

Choose a reason for hiding this comment

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

How can optimalForecastedCarbon be the calculated reduction, if carbonWithoutOptimization is null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was an assumption I made. But yes it should be more transparent. We should add it to the docs.

final boolean emissionReduction = earliestForecastedValue.getValue() > optimalValue.getValue();
return emissionReduction && optimalTime.isInFuture();
}

public double calculateSavedCarbonDelta() {
if (earliestForecastedValue == null) {
return 0.0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question as previous comment

return earliestForecastedValue.getValue() - optimalValue.getValue();
}

public double calculateSavedCarbonPercentage() {
if (earliestForecastedValue == null) {
return 100;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question as previous comment

new Carbon(emissionTimeframe.getOptimalValue().getValue()),
new Percentage(emissionTimeframe.calculateSavedCarbonPercentage())
);
}
// execution is optimal currently
return new CarbonReduction(
new Delay(false, 0),
new Carbon(emissionTimeframe.getEarliestForecastedValue().getValue()),
new Carbon(emissionTimeframe.getEarliestForecastedValue().getValue()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this a bug?

@lwluc lwluc force-pushed the prepareRelease2_1_5 branch from f0de9c1 to 1def252 Compare January 3, 2025 12:17
@lwluc lwluc force-pushed the carbon-aware-computing-fix branch from e50c2a5 to 10f3fd4 Compare January 3, 2025 12:17
@maxbehr801 maxbehr801 merged commit 9a220c0 into prepareRelease2_1_5 Jan 10, 2025
2 checks passed
@maxbehr801 maxbehr801 deleted the carbon-aware-computing-fix branch January 10, 2025 12:16
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