pypsa-usa icon indicating copy to clipboard operation
pypsa-usa copied to clipboard

EqC Constraint Error

Open ktehranchi opened this issue 1 year ago • 1 comments

Checklist

  • [X] I am using the current master branch
  • [X] I am running on an up-to-date pypsa-usa environment. Update via conda env update -f envs/environment.yaml

The Issue

Error thrown when using the Eq0.2c constraint that requires 0.2 % of generation to be produced within a given country/region.

Steps To Reproduce

No response

Expected Behavior

No response

Error Message

scripts/tmp_5aijmfg.solve_network.py", line 598, in extra_functionality
    add_EQ_constraints(n, o)
  File "/home/groups/iazevedo/kamran/pypsa-usa/workflow/.snakemake/shadow/tmpp_za9rkr/.snakemake/scripts/tmp_5aijmfg.solve_network.py", line 322, in add_EQ_constraints
    n.model.add_constraints(lhs >= rhs, name="equity_min")
                            ^^^^^^^^^^
  File "/home/groups/iazevedo/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/linopy/expressions.py", line 483, in __ge__
    return self.to_constraint(GREATER_EQUAL, rhs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/groups/iazevedo/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/linopy/expressions.py", line 846, in to_constraint
    all_to_lhs = (self - rhs).data
                  ~~~~~^~~~~
  File "/home/groups/iazevedo/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/linopy/expressions.py", line 414, in __sub__
    other = as_expression(
            ^^^^^^^^^^^^^^
  File "/home/groups/iazevedo/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/linopy/expressions.py", line 1367, in as_expression
    raise ValueError("Cannot convert to LinearExpression") from e
ValueError: Cannot convert to LinearExpression

Anything else?

No response

ktehranchi avatar Feb 28 '24 07:02 ktehranchi

To be honest I might remove this opt. This is a hold-over from EUR.... I'm not sure if we'll ever want to use it?

ktehranchi avatar Jul 22 '24 23:07 ktehranchi