<commit_before>require_relative '../belgium_2050_model'

class Belgium2050ModelResult < Belgium2050ModelUtilities  
  attr_accessor :excel, :pathway
  
  def initialize
    @excel = Belgium2050ModelShim.new
  end
  
  def self.calculate_pathway(code)
    new.calculate_pathway(code)
  end
  
  def calculate_pathway(code)
    Thread.exclusive do 
      reset
      @pathway = { _id: code, choices: set_choices(code) }
      # One method per view
      all_energy_tables
      electricity_tables
      energy_security_tables
      energy_flow_tables
      area_tables
      story_tables
      air_quality_tables # Not implemented
      costs_tables
    end
    return pathway
  end
      
  def all_energy_tables
    # Each number is a row on the CONTROL worksheet
    pathway[:ghg] = table 399, 400, 401, 402, 403, 404, 405, 406, 407, 409, 411, 412 
    pathway[:final_energy_demand, ] = table 12, 16, 19, 21
    pathway[:primary_energy_supply] = table 27, 28, 29, 30, 31, 32, 33, 34, 36, 41, 44, 48, 51, 52
  end

  def electricity_tables
    e = {}
    # Each number is a row on the CONTROL worksheet
    e[:emissions] = table 441, 442, 443, 444
    e[:demand] = table 94, 97, 110, 120
    e[:supply] = table 130, 131, 135, 136, 137, 138, 139, 141, 142, 143, 146, 149, 151
    pathway[:electricity] = e
  end

  def energy_security_tables
  end

  def energy_flow_tables
    # Not implemented
  end

  def area_tables
  end

  def story_tables
    #pathway[:ghg][:percent_reduction_from_1990] = (r("control_ae44") * 100).round
  end

  def air_quality_tables
    # Not implemented
  end

  def costs_tables
  end
  
  # Helper methods
 <commit_msg>Added simple cost tables<commit_after>require_relative '../belgium_2050_model'

class Belgium2050ModelResult < Belgium2050ModelUtilities  
  attr_accessor :excel, :pathway
  
  def initialize
    @excel = Belgium2050ModelShim.new
  end
  
  def self.calculate_pathway(code)
    new.calculate_pathway(code)
  end
  
  def calculate_pathway(code)
    Thread.exclusive do 
      reset
      @pathway = { _id: code, choices: set_choices(code) }
      # One method per view
      all_energy_tables
      electricity_tables
      energy_security_tables
      energy_flow_tables
      area_tables
      story_tables
      air_quality_tables # Not implemented
      costs_tables
    end
    return pathway
  end
      
  def all_energy_tables
    # Each number is a row on the CONTROL worksheet
    pathway[:ghg] = table 399, 400, 401, 402, 403, 404, 405, 406, 407, 409, 411, 412 
    pathway[:final_energy_demand, ] = table 12, 16, 19, 21
    pathway[:primary_energy_supply] = table 27, 28, 29, 30, 31, 32, 33, 34, 36, 41, 44, 48, 51, 52
  end

  def electricity_tables
    e = {}
    # Each number is a row on the CONTROL worksheet
    e[:emissions] = table 441, 442, 443, 444
    e[:demand] = table 94, 97, 110, 120
    e[:supply] = table 130, 131, 135, 136, 137, 138, 139, 141, 142, 143, 146, 149, 151
    pathway[:electricity] = e
  end

  def energy_security_tables
  end

  def energy_flow_tables
    # Not implemented
  end

  def area_tables
  end

  def story_tables
    #pathway[:ghg][:percent_reduction_from_1990] = (r("control_ae44") * 100).round
  end

  def air_quality_tables
    # Not implemented
  end

  def costs_tables
    c = {}
    c[:sector] = table 492, 497, 502, 507
    c[:type] = table 509, 510, 511
    pathway[:simple_costs] = c
  end
  
  # Helper methods
 
{'fraction_non_alphanumeric': 0.08338192419825073, 'fraction_numerical': 0.09825072886297376, 'mean_word_length': 2.9756662804171494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5445541', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1150, 'n_words': 341}