Skip to content

Commit

Permalink
Update openTEPES_ModelFormulation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arght committed Jan 8, 2025
1 parent a3c72be commit 2c62777
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions openTEPES/openTEPES_ModelFormulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ def eRampDwCharge(OptModel,n,eh):
else:
pEpsilon = 1e-4

def eRampUpState(OptModel, n, nr):
def eRampUpState(OptModel,n,nr):
if mTEPES.pStableTime[nr] and mTEPES.pMaxPower2ndBlock[p,sc,n,nr] and (p,nr) in mTEPES.pnr and mTEPES.pDuration[p,sc,n]():
if pIndStableTimeDeadBand:
if mTEPES.pRampUp[nr]:
Expand Down Expand Up @@ -1110,7 +1110,7 @@ def eRampUpState(OptModel, n, nr):
if pIndLogConsole == 1:
print('eRampUpState ... ', len(getattr(OptModel, f'eRampUpState_{p}_{sc}_{st}')), ' rows')

def eRampDwState(OptModel, n, nr):
def eRampDwState(OptModel,n,nr):
if mTEPES.pStableTime[nr] and mTEPES.pMaxPower2ndBlock[p,sc,n,nr] and (p,nr) in mTEPES.pnr and mTEPES.pDuration[p,sc,n]():
if pIndStableTimeDeadBand:
if mTEPES.pRampDw[nr]:
Expand Down Expand Up @@ -1168,7 +1168,7 @@ def eMinDownTime(OptModel,n,t):
print('eMinDownTime ... ', len(getattr(OptModel, f'eMinDownTime_{p}_{sc}_{st}')), ' rows')

if pIndSimplexFormulation:
def eMinStableTime(OptModel, n, nr):
def eMinStableTime(OptModel,n,nr):
if (mTEPES.pStableTime[nr] and mTEPES.pMaxPower2ndBlock[p,sc,n,nr] and mTEPES.n.ord(n) >= mTEPES.pStableTime[nr] + 2):
return OptModel.vRampUpState[p,sc,n,nr] + sum(OptModel.vRampDwState[p,sc,n2,nr] for n2 in list(mTEPES.n2)[mTEPES.n.ord(n)-mTEPES.pStableTime[nr]-1:mTEPES.n.ord(n)-1]) <= 1
else:
Expand All @@ -1181,9 +1181,9 @@ def eMinStableTime(OptModel, n, nr):
for nr in mTEPES.nr:
if (mTEPES.pStableTime[nr] and mTEPES.pMaxPower2ndBlock[p,sc,n,nr] and mTEPES.n.ord(n) >= mTEPES.pStableTime[nr] + 2):
for n2 in list(mTEPES.n2)[mTEPES.n.ord(n)-mTEPES.pStableTime[nr]-1:mTEPES.n.ord(n)-1]:
MinStableTimeLoadLevels.append((n, n2, nr))
MinStableTimeLoadLevels.append((n,n2,nr))

def eMinStableTime(OptModel, n, n2, nr):
def eMinStableTime(OptModel,n,n2,nr):
return OptModel.vRampUpState[p,sc,n,nr] + OptModel.vRampDwState[p,sc,n2,nr] <= 1
setattr(OptModel, f'eMinStableTime_{p}_{sc}_{st}', Constraint(MinStableTimeLoadLevels, rule=eMinStableTime, doc='minimum stable time [p.u.]'))

Expand Down

0 comments on commit 2c62777

Please sign in to comment.