コード例 #1
0
 def convert(self):
     """
     convert raw_values to model currency and capacity (energy_unit/time_step)
     """
     model_energy_unit = cfg.calculation_energy_unit
     self.values = UnitConverter.unit_convert(self.raw_values, unit_from_den=self.energy_unit,unit_to_den=model_energy_unit)
     if self.definition == 'absolute':
         self.values = UnitConverter.currency_convert(self.values, self.currency, self.currency_year)
         self.absolute = True
     else:
         self.absolute = False
コード例 #2
0
    def convert_cost(self):
        """
        convert raw_values to model currency and energy
        """

        self.values = UnitConverter.unit_convert(
            self.raw_values,
            unit_from_den=self.cost_denominator_unit,
            unit_to_den=self.unit_to)
        self.values = UnitConverter.currency_convert(self.values,
                                                     self.currency,
                                                     self.currency_year)
コード例 #3
0
 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.getParam('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 = UnitConverter.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 ()
         unit_from_den = self.capacity_or_energy_unit + "_" + model_time_step
         self.values = UnitConverter.unit_convert(self.raw_values, unit_from_den=unit_from_den, unit_from_num=model_time_step, unit_to_den=model_energy_unit, unit_to_num=model_time_step)
     if self.definition == 'absolute':
         self.values = UnitConverter.currency_convert(self.values, self.currency, self.currency_year)
         self.absolute = True
     else:
         self.absolute = False
コード例 #4
0
 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 = UnitConverter.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 = UnitConverter.currency_convert(
             self.values, self.currency, self.currency_year)
         self.absolute = True
     else:
         self.absolute = False
コード例 #5
0
 def convert(self):
     """
     convert raw_values to model currency and capacity (energy_unit/time_step)
     """
     self.values = UnitConverter.currency_convert(self.values,
                                                  self.currency,
                                                  self.currency_year)
     model_energy_unit = cfg.calculation_energy_unit
     model_time_step = cfg.getParam('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 = UnitConverter.unit_convert(
             self.values,
             unit_from_den=self.self.capacity_or_energy_unit,
             unit_from_num=self.time_unit,
             unit_to_den=model_energy_unit,
             unit_to_num=model_time_step)
     else:
         self.values = UnitConverter.unit_convert(
             self.values,
             unit_from_den=self.capacity_or_energy_unit + "_" +
             model_time_step,
             unit_to_den=model_energy_unit)