Class: BTAPAnalysis

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/standards/necb/common/btap_analysis.rb

Overview

Abstract class, only instantiate BTAPNoSimAnalysis or BTAPDatapointAnalysis.

Direct Known Subclasses

BTAPDatapointAnalysis, BTAPNoSimAnalysis

Instance Method Summary collapse

Constructor Details

#initialize(output_folder:, template:) ⇒ BTAPAnalysis

Returns a new instance of BTAPAnalysis.



11
12
13
14
15
# File 'lib/openstudio-standards/standards/necb/common/btap_analysis.rb', line 11

def initialize(output_folder:, template:)
  @output_folder = output_folder
  @template      = template
  @cp            = CommonPaths.instance
end

Instance Method Details

#run_carbonObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/openstudio-standards/standards/necb/common/btap_analysis.rb', line 39

def run_carbon
  carbon = BTAPCarbon.new(attributes: @attributes, standards_data: @standard.standards_data)
  carbon_result = carbon.audit_embodied_carbon

  if not @qaqc.nil?
    @qaqc[:carbon_information] = carbon_result
  end

  File.open(File.join(@output_folder, 'carbon_results.json'), 'w') do |f|
    f.write(JSON.pretty_generate(carbon_result, allow_nan: true))
  end
  puts "Wrote File carbon_results.json in #{@output_folder} "

  return carbon_result
end

#run_costing(costs_csv: @cp.costs_path, factors_csv: @cp.costs_local_factors_path) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/openstudio-standards/standards/necb/common/btap_analysis.rb', line 17

def run_costing(costs_csv: @cp.costs_path, factors_csv: @cp.costs_local_factors_path)
  costing = BTAPCosting.new(costs_csv: costs_csv, factors_csv: factors_csv, attributes: @attributes)

  cost_result, btap_items = costing.cost_audit_all(
    model: @model,
    prototype_creator: @standard,
    template_type: @template)

  if not @qaqc.nil?
    @qaqc[:costing_information] = cost_result
  end

  # disable openstudio-version; for debugging only
  # cost_result["openstudio-version"] = OpenstudioStandards::VERSION
  File.open(File.join(@output_folder, 'cost_results.json'), 'w') do |f|
    f.write(JSON.pretty_generate(cost_result, allow_nan: true))
  end
  puts "Wrote File cost_results.json in #{@output_folder} "

  return cost_result
end