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

Reducing complexity of check that all thermal generators are assigned… #250

Merged
merged 2 commits into from
Nov 12, 2021
Merged
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
17 changes: 9 additions & 8 deletions egret/model_library/unit_commitment/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,15 @@ def get_interface_line_pairs(m):

model.ThermalGeneratorType = Param(model.ThermalGenerators, within=Any, default='C', initialize=thermal_gen_attrs.get('fuel', dict()))

def verify_thermal_generator_buses_rule(m, g):
for b in m.Buses:
if g in m.ThermalGeneratorsAtBus[b]:
return
print("DATA ERROR: No bus assigned for thermal generator=%s" % g)
assert(False)

model.VerifyThermalGeneratorBuses = BuildAction(model.ThermalGenerators, rule=verify_thermal_generator_buses_rule)
def verify_thermal_generators_assigned_to_buses_rule(m):
generators_at_buses = set(g for b in m.Buses for g in m.ThermalGeneratorsAtBus[b])
all_generators = set(m.ThermalGenerators)
unassigned_generators = all_generators.difference(generators_at_buses)
if len(unassigned_generators) > 0:
print("Encountered thermal generators unassigned to a bus: "+str(unassigned_generators))
assert(len(unassigned_generators)==0)

model.VerifyThermalGeneratorsAssignedToBuses = BuildAction(rule=verify_thermal_generators_assigned_to_buses_rule)

model.QuickStart = Param(model.ThermalGenerators, within=Boolean, default=False, initialize=thermal_gen_attrs.get('fast_start', dict()))

Expand Down