Conversation
Contributor
Author
|
@mrchrisadams when you've got some time, can you please mark my homework. |
Contributor
Author
|
Added values and tests for the SWDM v4 Rating Scale to this update |
mrchrisadams
approved these changes
May 29, 2024
10 tasks
Contributor
Author
|
Thanks @mrchrisadams I've fixed those constants & refactored a bit of code that was duplicated within and across models. This is ready to merge & should be the final code change before publishing v0.16.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Triage
Type of change
Please select any of the below items that are appropriate.
This pull request:
Related issue/s
Please list below any issues this pull request is related to.
Docs changes required
Do any changes made in this pull request require parts of the CO2.js documentation to be updated?
If you answered "Yes", please create an corresponding issue in our Developer Documentation repository.
Describe the changes made in this pull request
As clearly as possible, describe the changes made in the pull request. You should at least detail "what changes have been made" and "what the results of these changes will be".
These changes add the newer Sustainable Web Design Model version 4 calculation into CO2.js. This update DOES NOT remove the existing version 3 methodology which will continue to remain the default in CO2.js for the time being. Developers will have the option to opt-in to using the update version 4 methodology in their projects. They can do this when instantiating a new CO2 object that using the Sustainable Web Design Model. Code examples are below:
The
versionkey accepts a value of typenumberthat must equal to 4. If that is not set, then the version 3 calculations are used by CO2.js.Changes to outputs
Functionality wise, there are no changes between version 3 and version 4 of CO2.js. The
perByte,perVisit,perByteTrace, andperVisitTracefunctions all remain the same and accept the same inputs in both versions. The outputs of these functions also do no change by default.However, when using the
perByteTraceorperVisitTracefunctions, developers can now pass in agreenHostingFactorvalue for use in the estimates. This value is used by the respective calculation if thegreenparameter passed into the function isfalse. Whengreen === truethen theGREEN_HOSTING_FACTORused is set to1.0. This reflects a continuation of the functionality that exists in Sustainable Web Design version 3 when changing the grid intensity of the data center segment (see: #197)Another important change to the output is seen when users select to return results per segment. These give a more detailed breakdown of the emissions estimates across each system segment. In SWDM version 4, emissions estimates are further separated into
operationalandembodiedemissions. These are now all returned when a user asks for segmented results.Other things to note
The SWD Rating Scale has not yet been added to the version 4 methodology. It could be included later in this PR, or via another PR if this one gets merged first.