Class: Honeybee::PVProperties

Inherits:
ModelObject show all
Defined in:
lib/honeybee/generator/pv.rb,
lib/to_openstudio/generator/pv.rb

Instance Attribute Summary

Attributes inherited from ModelObject

#errors, #openstudio_object, #warnings

Instance Method Summary collapse

Methods inherited from ModelObject

#allowable_types, clean_identifier, clean_name, #find_existing_openstudio_object, #initialize, #method_missing, read_from_disk, truncate

Constructor Details

This class inherits a constructor from Honeybee::ModelObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Honeybee::ModelObject

Instance Method Details

#defaultsObject



37
38
39
# File 'lib/honeybee/generator/pv.rb', line 37

def defaults
  @@schema[:components][:schemas][:PVProperties][:properties]
end

#to_openstudio(openstudio_model, parent) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/to_openstudio/generator/pv.rb', line 39

def to_openstudio(openstudio_model, parent)
  # calculate the DC system size from the efficiency and the parent area
  rated_watts = defaults[:rated_efficiency][:default] * 1000
  if @hash[:rated_efficiency]
    rated_watts = @hash[:rated_efficiency]  * 1000
  end
  active_fraction = defaults[:active_area_fraction][:default]
  if @hash[:active_area_fraction]
    active_fraction = @hash[:active_area_fraction]
  end
  sys_cap = parent.netArea * active_fraction * rated_watts
  sys_cap = sys_cap.round

  # create the PVWatts generator and set identifier
  os_gen = OpenStudio::Model::GeneratorPVWatts.new(openstudio_model, parent, sys_cap)
  os_gen.setName(@hash[:identifier] + '..' + parent.name.get)

  # assign the module type
  if @hash[:module_type]
    os_gen.setModuleType(@hash[:module_type])
  else
    os_gen.setModuleType(defaults[:module_type][:default])
  end

  # assign the mounting type
  if @hash[:mounting_type]
    os_gen.setArrayType(@hash[:mounting_type])
  else
    os_gen.setArrayType(defaults[:mounting_type][:default])
  end

  # assign the system loss fraction
  if @hash[:system_loss_fraction]
    os_gen.setSystemLosses(@hash[:system_loss_fraction])
  else
    os_gen.setSystemLosses(defaults[:system_loss_fraction][:default])
  end

  # assign the tracking ground coverage ratio
  if @hash[:tracking_ground_coverage_ratio]
    os_gen.setGroundCoverageRatio(@hash[:tracking_ground_coverage_ratio])
  end

  os_gen
end