from agentlib_mpc.modules import mpc_full, minlp_mpc
[docs]
class FlexibilityBaselineMPC(mpc_full.MPC):
config: mpc_full.MPCConfig
[docs]
def pre_computation_hook(self):
if self.get("in_provision").value:
timestep = (self.get("_P_external").value.index[1] -
self.get("_P_external").value.index[0])
self.set("rel_start", self.get("_P_external").value.index[0] -
self.env.time)
# the provision profile gives a value for the start of a time step.
# For the end of the flex interval add time step!
self.set("rel_end", self.get("_P_external").value.index[-1] -
self.env.time + timestep)
[docs]
class FlexibilityBaselineMINLPMPC(minlp_mpc.MINLPMPC):
config: minlp_mpc.MINLPMPCConfig
[docs]
def pre_computation_hook(self):
if self.get("in_provision").value:
timestep = (self.get("_P_external").value.index[1] -
self.get("_P_external").value.index[0])
self.set("rel_start", self.get("_P_external").value.index[0] -
self.env.time)
# the provision profile gives a value for the start of a time step.
# For the end of the flex interval add time step!
self.set("rel_end", self.get("_P_external").value.index[-1] -
self.env.time + timestep)