npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@undp/carbon-credit-calculator

v1.1.2

Published

Carbon Credit Calculator

Downloads

911

Readme

Carbon Registry - Credit Calculation

Introduction

The library includes the implementations carbon credits calculation for different sectors. Currently implemented only two of the sectors which are Agriculture and Energy.

Sectors

According to the UNFCCC - CDM (Clean Development Mechanism) methodologies, identified sectors are as follows,

  1. Energy industries (renewable / non-renewable sources)
  2. Energy distribution
  3. Energy demand
  4. Manufacturing industries
  5. Chemical industries
  6. Construction
  7. Transport
  8. Mining/mineral production
  9. Metal production
  10. Fugitive emissions from fuels (solid, oil and gas)
  11. Fugitive emissions from production and consumption of halocarbons and sulphur hexafluoride
  12. Solvent use
  13. Waste handling and disposal
  14. Afforestation and reforestation
  15. Agriculture

Calculation - Sector Agriculture

Number of Credits = #hectares * #days * #tCO2e/ha/day 

| Input Field | Data Type | Mandatory/Optional | Default Value | Possible values if any | Validations | | --- | --- | --- | --- | --- | --- | | landArea | Float | Mandatory | | | Area>0Format – Non-zero, Can't be negative Invalid area Format – Not a number Empty area Format - Empty field | | landAreaUnit | String | Mandatory | | ha | Invalid unit Format – Invalid field Empty unit Format – Empty field | | duration | Integer | Mandatory | | | Days > 0 Format – Non-zero, Can't be negative Invalid input field Format – Not a number Format – Empty field | | durationUnit | String | Mandatory | | Days | Invalid unit Format – Invalid field Empty unit Format – Empty field |

System Configurations

Constants

| Constant Name | Value | Unit | Unit of Measurement | | ----------------- | --------- | ------------------ | ----------------------- | | emissionFactor | 0.046 | emissionFactorUnit | tCO2e/ha/day |

Constant values can parse externally. If not use above default constants.

Example Calculation:

Hectares - 16ha 
Days – 120 
Constant – 0.046 
 #hectares * #days * #tCO2e/ha/day = 16*120*0.046 = 88.32 

Calculation - Sector Energy

Sub Sector: Solar

Approved Methodology: Solar Photovoltaic (PV)

Parameters: 
 
X – Enegy generation value (kWh/year/unit) 
Y – Threshold value (kWh/year/unit) 
A – High emission factor (tCO2/ MWh) 
B – Low emission factor (tCO2/ MWh) 
If X < Y ; X*A 
If X >= Y ; Y*A + (X-Y)*B 

| Input Field | Data Type | Mandatory/ Optional | Default Value | Possible values if any | Validations | | --- | --- | --- | --- | --- | --- | | energyGeneration | Float | Mandatory | || Energy > 0 Format – Non-zero, Can't be negativeInvalid input field Format – Not a numberFormat - Empty input field| | energyGenerationUnit | String | Mandatory | | kWh/year | Invalid unit Format – Invalid fieldEmpty unit Format – Empty field | | buildingType | String | Mandatory | | HouseholdHealth CenterDispensarySchoolPrimary SchoolSecondary SchoolPublic AdministrationTrading PlaceBus Stop| Invalid input field Format – Invalid fieldEmpty input fieldFormat – Empty field |

System Configurations

Constants

| Constant Name | Value | Unit of Measurement | | --- | --- | --- | | High Emission Factor (A) | 6.8(at or below threshold) | High emission factor (tCO2/ MWh) | | Low Emission Factor (B) | 1.3(above throshold) | Low emission factor (tCO2/ MWh) | | Building Type || Household, Health Center, Dispensary, School, Primary School, Secondary School, Public Administration, Trading Place, Bus Stop|

Threshold

| Building Type | Threshold Value | Unit of Measurement | | --- | --- | --- | | Household | 55 | kWh/y | | Health Center | 825 | kWh/y | | Dispensary | 825 | kWh/y | | School | 275 | kWh/y | | Primary School | 275 | kWh/y | | Secondary School | 275 | kWh/y | | Public Administration | 55 | kWh/y | | Trading Place | 825 | kWh/y | | Bus Stop | 200 | kWh/y |

Example Calculation:

  1. A - High emission factor (tCO2/ MWh) = 6.8
  2. B - Low emission factor (tCO2/ MWh) = 1.3
  3. Bulding Type – Household
    • Y Threshold value (kWh/year/unit) = 55
  4. X - Measured value (kWh/year/unit) = 20
    X < Y ; X*A = (20/1000)*6.8 = 0.136
  5. X - Measured value (kWh/year/unit) = 105
    X >= Y ; Y*A + (X-Y)*B = (55/1000)*6.8 + {(105-55)/1000}*1.3 = 0.439

Usage

Generate Credit based on the Sector

import { AgricultureConstants, AgricultureCreationRequest, calculateCredit, SolarConstants, SolarCreationRequest } from '@undp/carbon-credit-calculator';

// Create creditCreationRequest based on the sector
// AgricultureCreationRequest if it is Agriculture sector
// SolarCreationRequest if it is a Solar sub sector.
let creditCreationRequest: CreditCreationRequest = <Sub sector specific create req>;
const credit = await calculateCredit()