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

demo custom variables on solution #540

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion solution/altcement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from model import vma
from model import tam
from solution import rrs
import dataclasses

DATADIR = Path(__file__).parents[2]/'data'
THISDIR = Path(__file__).parent
Expand All @@ -37,7 +38,15 @@
name = 'Alternative Cements'
solution_category = ac.SOLUTION_CATEGORY.REDUCTION

scenarios = ac.load_scenarios_from_json(directory=THISDIR/'ac', vmas=VMAs)
# CUSTOMIZE SECTION
# BE SURE TO IMPORT DATACLASSES ABOVE
@dataclasses.dataclass(eq=True, frozen=True)
class CementAC(ac.AdvancedControls):
clinker_to_cement_ratio : float = dataclasses.field(default=0.1, metadata={
'vma_titles': ['Clinker to Cement Ratio in Year 2']})

scenarios = ac.load_scenarios_from_json(directory=THISDIR/'ac', vmas=VMAs, cls=CementAC)
# END CUSTOMIZE SECTION

# These are the "default" scenarios to use for each of the drawdown categories.
# They should be set to the most recent "official" set"
Expand All @@ -57,6 +66,17 @@ def __init__(self, scen=None):
# AC
self.initialize_ac(scen, scenarios, PDS2)

# CUSTOMIZE SECTION
# Somehow use ac.clinker_to_cement_ratio in the code. Let's assume, for sake of example, that the clinker ratio
# affects the emissions of the cement. You would update the AC to have the correct value for emissions like this
# (obviously I'm just making up the equation):

self.ac = self.ac.with_modifications(
soln_emissions_per_funit=(self.ac.conv_emissions_per_funit * self.ac.clinker_to_cement_ratio))

# You could use also ac.clinker_to_cement_ratio anywhere in the code below as well, for example to customize adoption.
# END CUSTOMIZE SECTION

# TAM

# Instructions: Set TAM override parameters appropriately if any of these vary from the standard (then delete these comments):
Expand Down
1 change: 1 addition & 0 deletions solution/altcement/ac/PDS1-100p2050-Oct2021-popadjus.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"description": "Updated using updated population data",
"report_start_year": 2020,
"report_end_year": 2050,
"clinker_to_cement_ratio": 0.5,
"conv_2014_cost": 74790999.4544158,
"conv_first_cost_efficiency_rate": 0.0,
"conv_lifetime_capacity": 30.0,
Expand Down
1 change: 1 addition & 0 deletions solution/altcement/ac/PDS2-100p2050-Oct2021-popadjust.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"description": "Updated using updated population data",
"report_start_year": 2020,
"report_end_year": 2050,
"clinker_to_cement_ratio": 0.9,
"conv_2014_cost": 74790999.4544158,
"conv_first_cost_efficiency_rate": 0.0,
"conv_lifetime_capacity": 30.0,
Expand Down