def _kW(model, ID, item, line, shape): key = 'kW' mid = float(item[key]) if not mid: return None units = item.units size = item.S mid = mid / size distribution = shape(mid) units = (bst._Q(1, 'kW') / bst._Q(1, units)).units name = 'electricity rate' if ID != line: ID = ID + ' ' + name else: ID = name @model.parameter(element=line, units=units, distribution=distribution, name=ID) def set_cost_option(value): item[key] = value * size
def factor(base_units, new_units): if base_units == new_units: return 1 else: return bst._Q(1, base_units).to(new_units).magnitude