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

User-defined constraints #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

User-defined constraints #75

wants to merge 2 commits into from

Conversation

abhishek0208
Copy link
Contributor

This functionality allows for flexible user-defined constraints to be added. It allows for creation of relationships between the capacities and activities of specific technologies. For instance, the total new capacity of all renewable powerplants can be set using such a relationship. It is an expansion of the OEP presented here. The formulation of the constraints is as follows:

s.t. UDC0_UserDefinedConstraintEquality{r in REGION, u in UDC, y in YEAR: UDCTag[r,u] = 0}: 
sum{t in TECHNOLOGY}UDCMultiplierTotalCapacity[r,t,u,y]*TotalCapacityAnnual[r,t,y] + 
sum{t in TECHNOLOGY}UDCMultiplierNewCapacity[r,t,u,y]*NewCapacity[r,t,y] +
sum{t in TECHNOLOGY}UDCMultiplierActivity[r,t,u,y]*TotalTechnologyAnnualActivity[r,t,y] = UDCConstant[r,u,y];

s.t. UDC1_UserDefinedConstraintInequality{r in REGION, u in UDC, y in YEAR: UDCTag[r,u] = 1}: 
sum{t in TECHNOLOGY}UDCMultiplierTotalCapacity[r,t,u,y]*TotalCapacityAnnual[r,t,y] + 
sum{t in TECHNOLOGY}UDCMultiplierNewCapacity[r,t,u,y]*NewCapacity[r,t,y] +
sum{t in TECHNOLOGY}UDCMultiplierActivity[r,t,u,y]*TotalTechnologyAnnualActivity[r,t,y] >= UDCConstant[r,u,y];

s.t. UDC2_UserDefinedConstraintInequality{r in REGION, u in UDC, y in YEAR: UDCTag[r,u] = 2}: 
sum{t in TECHNOLOGY}UDCMultiplierTotalCapacity[r,t,u,y]*TotalCapacityAnnual[r,t,y] + 
sum{t in TECHNOLOGY}UDCMultiplierNewCapacity[r,t,u,y]*NewCapacity[r,t,y] +
sum{t in TECHNOLOGY}UDCMultiplierActivity[r,t,u,y]*TotalTechnologyAnnualActivity[r,t,y] <= UDCConstant[r,u,y];

where UDCTag specifies whether a user-defined constraint is an equality [0], LHS>=RHS [1], or LHS<=RHS [2]; UDCConstant is the RHS of the UDC; three multipliers - UDCMultiplier* - are used as co-efficients for TotalCapacityAnnual, NewCapacity, TotalTechnologyAnnualActivity.

Below is a summary of additions:
1 new set:
set UDC

5 new parameters:
param UDCMultiplierTotalCapacity
param UDCMultiplierNewCapacity
param UDCMultiplierActivity
param UDCConstant
param UDCTag

and 3 new constraints:
s.t. UDC0_UserDefinedConstraintEquality
s.t. UDC1_UserDefinedConstraintInequality
s.t. UDC2_UserDefinedConstraintInequality

A simple test case 'simplicity_udc.txt' has been used to test these constraints for all three versions of the OSeMOSYS_GNU_MathProg code. In this example, three user-defined constraints are created:

  1. TotalCapacityAnnual of GAS_EXTRACTION and GAS_IMPORT must together equal 10.
  2. TotalTechnologyAnnualActivity of SOLPV1, SOLPV2, and WINDPOWER must be >= 50% of SpecifiedAnnualDemand of FEL1
  3. NewCapacity of SOLPV1 and SOLPV2 together must be <= 0

@abhishek0208 abhishek0208 added the enhancement New feature or request label Nov 15, 2021
@tniet
Copy link
Contributor

tniet commented Nov 15, 2021

@abhishek0208 - looks like a good enhancement and I think the formulation looks good as well. Does this allow us to require a given land area for an installed capacity of solar in CLEWs? I think it does but wanted to get your thoughts on that.

I think we should consider the data for the constraints you've added and decide if these are reasonable for Simplicity and then make the TravisCI checks work for the added constraints. Maybe @willu47 can provide some assistance with updating the checks/constraints to work?

@abhishek0208
Copy link
Contributor Author

Thanks @tniet. My understanding is that this formulation will allow a user to set the total or minimum land area for a given capacity of a technology (e.g. solar). I don't think it'll quite work to set land area per unit capacity of a technology (we can use other parameters for that: InputToTotalCapacityRatio and InputToNewCapacityRatio). Happy to be corrected on this.

@tniet
Copy link
Contributor

tniet commented Nov 15, 2021

@abhishek0208 It seems to me that these can allow you to link installed capacity, new capacity and activity for any user defined group of techs and commodities, so I think you should be able to do what you've described. Might be easier and clearer to have separate constraints, but nominally I think it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants