-
Notifications
You must be signed in to change notification settings - Fork 106
Support co2_aoer in WattTime #611
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 0017. Signal Type in WattTime v3 Data Source | ||
|
||
## Status | ||
|
||
Proposed | ||
|
||
## Context | ||
|
||
WattTime v3 API has been supported since [Carbon Aware SDK v1.5.0](https://carbon-aware-sdk.greensoftware.foundation/blog/release-v1.5). As we mentioned in [ADR-0015](https://carbon-aware-sdk.greensoftware.foundation/docs/architecture/decisions/watt-time-v3), `signal_type` has been added in each endpoints which the SDK will access since v3 API. We should be able to set following parameters to it, but it can't in Carbo Aware SDK. | ||
|
||
https://watttime.org/data-science/data-signals/ | ||
|
||
| Signal Type | Description | | ||
|---|---| | ||
| `co2_moer` | Marginal Operating Emissions Rate of carbon dioxide. | | ||
| `co2_aoer` | Average Operating Emissions Rate of carbon dioxide. | | ||
|
||
According to [Green Software Practitioners](https://learn.greensoftware.foundation/carbon-awareness#marginal-carbon-intensity), "marginal" means the carbon intensity of the power plant that would have to be employed to meet any new demand. On the other hand, "average" means the average of all of power plants. It should be chosen by Carbon Aware SDK user because which value is needed depends on the user. | ||
|
||
`co2_moer` is hard-coded until Carbon Aware SDK v1.7.0 (at least). | ||
|
||
## Decision | ||
|
||
The proposal is for adding a new parameter for Signal Type in WattTime Data Source. | ||
|
||
## Update Changes | ||
|
||
We will introduce new parameter for data source configuration of WattTime as following. | ||
|
||
### appsettings.json | ||
|
||
```json | ||
"WattTime": { | ||
"Type": "WattTime", | ||
"Username": "username", | ||
"Password": "password", | ||
"BaseURL": "https://api.watttime.org/v3/", | ||
"SignalType": "co2_aoer" | ||
} | ||
``` | ||
|
||
### environment variable | ||
|
||
```bash | ||
DataSources__Configurations__WattTime__SignalType=co2_aoer | ||
``` | ||
|
||
## Green Impact | ||
|
||
Neutral |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace CarbonAware.DataSources.WattTime.Constants; | ||
|
||
internal class SignalTypes | ||
public enum SignalTypes | ||
{ | ||
public const string co2_moer = "co2_moer"; | ||
co2_moer, | ||
co2_aoer | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of string literal "co2_moer" use the enum you created with nameof(MyEnum.EnumValue) or toString (happy with either approach) that way we ensure we're passing in enum limited values in the tests, and if we update the enums (or if wattime update their api) we can update the tests quickly. String literals were a massive issue with the wattime v3 API updates. |
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.
Awesome, thank you!