Skip to content

PyomoException: Cannot convert non-constant Pyomo expression (0 <= re[1,1]) to bool. #1

Description

@Yuroujiang

Thanks for the dedication that rpglab made to SCUC coding. it gave me a lot of help.

I tried to run the code of "T_OPF_SCUC.py" in anaconda Jupyter notebook.
When it run to instance = model.create_instance('./dataFile24BusAllinertia41sen_T.dat'), it warned:
PyomoException: Cannot convert non-constant Pyomo expression (0 <= re[1,1]) to bool.

To address this problem, if we recode the Generator reserve limits to the code belows,
it will run smoothly:

## Generator reserve limits ##
def reserve_limit_lower(model, j, t):
return model.re[j, t] >= 0
model.reserve_limit_lower = Constraint(model.GEND, model.PERIOD, rule=reserve_limit_lower)
def reserve_limit_upper(model, j, t):
return model.re[j, t] <= model.HRamp[j] / BaseMVA
model.reserve_limit_upper = Constraint(model.GEND, model.PERIOD, rule=reserve_limit_upper)

Since I am a freshman of coding, if there exist any problem, please leave a comment here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions