def convert(self): """ convert raw_values to model currency and capacity (energy_unit/time_step) """ model_energy_unit = cfg.calculation_energy_unit model_time_step = cfg.cfgfile.get('case', 'time_step') if self.time_unit is not None: # if a cost has a time_unit, then the unit is energy and must be converted to capacity self.values = util.unit_convert( self.raw_values, unit_from_num=self.capacity_or_energy_unit, unit_from_den=self.time_unit, unit_to_num=model_energy_unit, unit_to_den=model_time_step) else: # if a cost is a capacity unit, the model must convert the unit type to an energy unit for conversion () self.values = util.unit_convert( self.raw_values, unit_from_den=cfg.ureg.Quantity(self.capacity_or_energy_unit) * cfg.ureg.Quantity(model_time_step), unit_from_num=model_time_step, unit_to_den=model_energy_unit, unit_to_num=model_time_step) if self.definition == 'absolute': self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id) self.absolute = True else: self.absolute = False
def convert_cost(self): """ convert raw_values to model currency and energy """ self.values = util.unit_convert(self.raw_values, unit_from_den=self.cost_denominator_unit, unit_to_den=self.unit_to) self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id)
def convert_cost(self): """ convert raw_values to model currency and energy """ self.values = util.unit_convert( self.raw_values, unit_from_den=self.cost_denominator_unit, unit_to_den=self.unit_to) self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id)
def convert(self): """ convert raw_values to model currency and capacity (energy_unit/time_step) """ model_energy_unit = cfg.cfgfile.get('case', 'energy_unit') self.values = util.unit_convert(self.raw_values, unit_from_den=self.energy_unit,unit_to_den=model_energy_unit) if self.definition == 'absolute': self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id) self.absolute = True else: self.absolute = False
def convert_cost(self): """ convert raw_values to model currency and capacity (energy_unit/time_step) """ if self.demand_tech_unit_type == 'service demand': if self.tech_time_unit is None: self.time_unit = 'year' self.values = util.unit_convert(self.raw_values, unit_from_num=self.tech_time_unit, unit_from_den=self.unit, unit_to_num=self.stock_time_unit, unit_to_den=self.service_demand_unit) else: self.values = copy.deepcopy(self.raw_values) if self.definition == 'absolute': self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id) self.absolute = True else: self.absolute = False
def convert(self): """ convert raw_values to model currency and capacity (energy_unit/time_step) """ model_energy_unit = cfg.cfgfile.get('case', 'energy_unit') model_time_step = cfg.cfgfile.get('case', 'time_step') if hasattr(self,'time_unit') and self.time_unit is not None: # if a cost has a time_unit, then the unit is energy and must be converted to capacity self.values = util.unit_convert(self.raw_values, unit_from_den=self.capacity_or_energy_unit, unit_from_num=self.time_unit, unit_to_den=model_energy_unit, unit_to_num=model_time_step) else: # if a cost is a capacity unit, the model must convert the unit type to an energy unit for conversion () self.values = util.unit_convert(self.raw_values, unit_from_den =cfg.ureg.Quantity(self.capacity_or_energy_unit)* cfg.ureg.Quantity(model_time_step), unit_from_num=model_time_step, unit_to_den=model_energy_unit, unit_to_num=model_time_step) if self.definition == 'absolute': self.values = util.currency_convert(self.values, self.currency_id, self.currency_year_id) self.absolute = True else: self.absolute = False