updating basic exmaple code, coming all example

This commit is contained in:
Sadam93 2024-05-31 11:07:51 -04:00
parent abd1f96a2d
commit 7545aad0fe

View File

@ -17,9 +17,23 @@ model.dt = Param(initialize=1, doc='time duration ')
model.pl = Var(model.t,bounds=(0, None)) #todo example: 2 model.pl = Var(model.t,bounds=(0, None)) #todo example: 2
# model.pl = Var(RangeSet(1, 4),bounds=(0, 3)) #todo example: 3 # model.pl = Var(RangeSet(1, 4),bounds=(0, 3)) #todo example: 3
# model.pl = Var(RangeSet(1, 4),bounds=(0, 3)) #todo example: 4 # model.pl = Var(RangeSet(1, 4),bounds=(0, 3)) #todo example: 4
# model.pl = Var(RangeSet(1, 4),bounds=(0, 5)) #todo example: 5
# model.pmax = py.Param(initialize=5, doc='Maximum Power ')#todo example: 5
# model.emax = py.Param(initialize=8, doc='Maximum Controllable Energy ')#todo example: 5
# model.plmax = py.Param(initialize=6, doc='Maximum Controllable power')#todo example: 5
#
# Constraints # Constraints
model.c1 = Constraint(expr=sum([model.pl[i] for i in model.t]) * model.dt == 8) model.c1 = Constraint(expr=sum([model.pl[i] for i in model.t]) * model.dt == 8)
# todo this is for the example 5
# def total_power(model, i):
# return (model.pb[i] + model.pl[i]) <= model.pmax
# model.c2 = py.Constraint(model.t, rule=total_power, doc='Total power')
# Objective # Objective
model.obj = Objective(expr=sum([(model.pb[i] + model.pl[i]) * model.c[i] for i in model.t]) * model.dt) model.obj = Objective(expr=sum([(model.pb[i] + model.pl[i]) * model.c[i] for i in model.t]) * model.dt)