Class: ElectricityMix

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
Earth::Model
Defined in:
lib/earth/locality/electricity_mix.rb

Constant Summary collapse

TABLE_STRUCTURE =
<<-EOS

CREATE TABLE electricity_mixes
  (
     name                               CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     egrid_subregion_abbreviation       CHARACTER VARYING(255),
     state_postal_abbreviation          CHARACTER VARYING(255),
     country_iso_3166_code              CHARACTER VARYING(255),
     co2_emission_factor                FLOAT,
     co2_emission_factor_units          CHARACTER VARYING(255),
     co2_biogenic_emission_factor       FLOAT,
     co2_biogenic_emission_factor_units CHARACTER VARYING(255),
     ch4_emission_factor                FLOAT,
     ch4_emission_factor_units          CHARACTER VARYING(255),
     n2o_emission_factor                FLOAT,
     n2o_emission_factor_units          CHARACTER VARYING(255),
     loss_factor                        FLOAT
  );

EOS

Instance Method Summary collapse

Methods included from Earth::Model

extend_mining, extended, registry

Instance Method Details

#energy_contentObject



30
31
32
# File 'lib/earth/locality/electricity_mix.rb', line 30

def energy_content
  1.kilowatt_hours.to(:megajoules)
end

#energy_content_unitsObject



34
35
36
# File 'lib/earth/locality/electricity_mix.rb', line 34

def energy_content_units
  'megajoules_per_kilowatt_hour'
end