Skip to content

Commit

Permalink
Add various primary demand specs
Browse files Browse the repository at this point in the history
Closes #148, #150, #151
  • Loading branch information
michieldenhaan committed Aug 24, 2021
1 parent 01ec5db commit 5f66665
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 112 deletions.
9 changes: 4 additions & 5 deletions lib/preset_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ class PresetCollection
attr_reader :presets

PRESET_SCENARIOS = {
nvdt: [112_999_0, 112_999_0],
basic: [472_389, 428_904, 929_277],
high_hydrogen: [123_456, 243_568],
regional: [345_689, 801_831]
}.freeze
nvdt: [1329317, 1329318, 1329319, 1329320],
ii3050: [1370826, 1370828, 1370830, 1370832],
high_hydrogen: [123_456, 243_568]
}

def initialize(presets)
@presets = presets
Expand Down
107 changes: 0 additions & 107 deletions spec/demand/biomass_multi_scenario_spec.rb

This file was deleted.

22 changes: 22 additions & 0 deletions spec/demand/primary_demand_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'spec_helper'

describe 'Primary Demand' do
let(:default_margin) { 1.0E-12 }

Turk::PresetCollection.from_key(:ii3050).each do |scenario|
# Test whether application group covers all final demand and exports
it 'primary demand of the application group nodes should always equal primary demand of the nodes in the final_demand_group and energy_export group' do
expect(scenario.primary_demand_of_application_group.value)
.to be_within(default_margin * scenario.primary_demand_of_final_demand_and_export.value)
.of(scenario.primary_demand_of_final_demand_and_export.value)
end

# Test whether total primary demand is accounted for by final demand, exports and curtailment. Refinery gas is also added to this list due to this issue: https://github.com/quintel/etsource/issues/1156.
it 'total primary demand in the graph should always equal primary demand of the nodes in the final_demand_group, energy_export group and curtailment.' do
puts scenario.id
expect(scenario.total_primary_demand.value)
.to be_within(default_margin * scenario.primary_demand_of_final_demand_export_curtailment_and_refinery_gas.value)
.of(scenario.primary_demand_of_final_demand_export_curtailment_and_refinery_gas.value)
end
end
end

0 comments on commit 5f66665

Please sign in to comment.