Skip to content

Commit 1be1b63

Browse files
committed
easier access to powerhouse minimum mol
1 parent 4596c41 commit 1be1b63

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/examples/bed_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# elec_load = mlt.GetElectricLoad(r'..\testbed_load.txt')
1414
# print(elec_load.data)
1515

16-
testload = [randrange(120, 1100) for x in range(0, 40)]
16+
testload = [randrange(120, 1000) for x in range(0, 40)]
1717
testresource = [randrange(200, 300) if x < 4000 else 0 for x in range(0, 40)]
1818
#
1919
#

src/migrids_lite/Powerhouse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(self, gensets: tuple):
2020
self.gendict_mol = {item.ident:item.mol for item in gensets}
2121
self.gencombos = powerset(self.gendict_mol)
2222
self.gendict_cap = {item.ident:item.capacity for item in gensets}
23+
self.min_mol = min(self.gendict_mol.values())
2324

2425
# finding all the possible combinations of the minimum operating load
2526
self.combo_mol_caps = {}

src/migrids_lite/SrcLimits.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ def src_diesel_out(self):
5656
calculates the actual diesel output based on minimum operating load of the diesel
5757
:param min_operating_load: minimum operating load of the diesel in kW
5858
"""
59-
min_mol = min(self.powerhouse.combo_mol_caps, key=self.powerhouse.combo_mol_caps.get)
60-
if self.powerhouse.combo_mol_caps[min_mol] > self.elec_load['electric_load'].min():
59+
if self.powerhouse.min_mol > self.elec_load['electric_load'].min():
6160
warnings.warn('Electric load below powerhouse minimum operating load: the electric load has 1 or more '
6261
'instances where its value is below the minimum output of the powerhouse. '
6362
'Energy balance calculations may be invalid', stacklevel=4)
6463

65-
self.calc_frame['src_diesel_output'] = self.calc_frame['dummy_diesel'].clip(self.powerhouse.combo_mol_caps[min_mol], None)
64+
self.calc_frame['src_diesel_output'] = self.calc_frame['dummy_diesel'].clip(self.powerhouse.min_mol, None)
6665

6766
def dsrc_resource_out(self):
6867
"""

0 commit comments

Comments
 (0)