Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for patch release #53

Merged
merged 24 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Format obj e_str
  • Loading branch information
jinningwang committed Feb 29, 2024
commit ba912641ed8780e4cb01203de6765d70d023dd77
6 changes: 2 additions & 4 deletions ams/routines/ed.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ def __init__(self, system, config):
type='uq',)

# --- objective ---
cost = 'sum(c2 @ (t dot pg)**2 + c1 @ (t dot pg))'
# constant cost
cost = 'sum(t**2 dot c2 @ pg**2)'
cost += '+ t dot sum(c1 @ pg + csr @ prs)'
cost += '+ sum(mul(ugt, mul(c0, tlv)))'
# spinning reserve cost
cost += ' + sum(csr@(t dot prs))'
self.obj.e_str = cost

def _post_solve(self):
Expand Down
21 changes: 9 additions & 12 deletions ams/routines/rted.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def __init__(self, system, config):
self.config.add_extra("_help",
t="time interval in hours",
)
self.config.add_extra("_tex",
t='T_{cfg}',
)

self.info = 'Real-time economic dispatch'
self.type = 'DCED'
Expand Down Expand Up @@ -172,12 +175,10 @@ def __init__(self, system, config):

# --- objective ---
self.obj.info = 'total generation and reserve cost'
# NOTE: the product of dt and pg is processed using ``dot``,
# because dt is a numnber
cost = 'sum(mul(c2, power(t dot pg, 2)))'
cost += '+ sum(c1 @ (t dot pg))'
cost += '+ ug * c0' # constant cost
cost += '+ sum(cru * pru + crd * prd)' # reserve cost
# NOTE: the product involved t should use ``dot``
cost = 't**2 dot sum(mul(c2, pg**2)) + sum(ug * c0)'
_to_sum = 'c1 @ pg + cru * pru + crd * prd'
cost += f'+ t dot sum({_to_sum})'
self.obj.e_str = cost

def dc2ac(self, **kwargs):
Expand Down Expand Up @@ -542,12 +543,8 @@ def __init__(self, system, config):

# --- objective ---
self.obj.info = 'total generation and reserve cost'
gcost = 'sum(mul(c2, power(pg, 2)))'
gcost += '+ sum(c1 @ (t dot pg))'
gcost += '+ ug * c0 ' # constant cost
rcost = '+ sum(cru * (t dot pru) + crd * (t dot prd)) ' # reserve cost
vsgcost = '+ sum(cm * M + cd * D)'
self.obj.e_str = gcost + rcost + vsgcost
vsgcost = '+ t dot sum(cm * M + cd * D)'
self.obj.e_str += vsgcost

self.map2.update({
'M': ('RenGen', 'M'),
Expand Down
15 changes: 8 additions & 7 deletions ams/routines/uc.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def __init__(self, system, config):
self.config.add_extra("_help",
t="time interval in hours",
)
self.config.add_extra("_tex",
t='T_{cfg}',
)

self.info = 'unit commitment'
self.type = 'DCUC'
Expand Down Expand Up @@ -258,13 +261,11 @@ def __init__(self, system, config):
self.pb.e_str = pb

# --- objective ---
gcost = 'sum(c2 @ (t dot zug)**2 + c1 @ (t dot zug))'
gcost += '+ sum(mul(mul(ug, c0), tlv))'
acost = ' + sum(csu * vgd + csd * wgd)' # action
srcost = ' + sum(csr @ prs)' # spinning reserve
nsrcost = ' + sum(cnsr @ prns)' # non-spinning reserve
dcost = ' + sum(cdp @ pdu)' # unserved load
self.obj.e_str = gcost + acost + srcost + nsrcost + dcost
cost = 't**2 dot sum(c2 @ zug**2 + t dot c1 @ zug)'
cost += '+ sum(mul(ug, c0) @ tlv)'
_to_sum = 'csu * vgd + csd * wgd + csr @ prs + cnsr @ prns + cdp @ pdu'
cost += f' + t dot sum({_to_sum})'
self.obj.e_str = cost

def _initial_guess(self):
"""
Expand Down