Class: Honeybee::EnergyWindowMaterialShade

Inherits:
ModelObject
  • Object
show all
Defined in:
lib/honeybee/material/window_shade.rb,
lib/to_openstudio/material/window_shade.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, #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/material/window_shade.rb', line 37

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

#find_existing_openstudio_object(openstudio_model) ⇒ Object



39
40
41
42
43
# File 'lib/to_openstudio/material/window_shade.rb', line 39

def find_existing_openstudio_object(openstudio_model)
  object = openstudio_model.getShadeByName(@hash[:identifier])
  return object.get if object.is_initialized
  nil
end

#to_openstudio(openstudio_model) ⇒ Object



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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/to_openstudio/material/window_shade.rb', line 45

def to_openstudio(openstudio_model)
  # create openstudio shade object
  os_shade_mat = OpenStudio::Model::Shade.new(openstudio_model)
  os_shade_mat.setName(@hash[:identifier])
  unless @hash[:display_name].nil?
    os_shade_mat.setDisplayName(@hash[:display_name])
  end
  # assign solar transmittance
  if @hash[:solar_transmittance]
    os_shade_mat.setSolarTransmittance(@hash[:solar_transmittance])
  else
    os_shade_mat.setSolarTransmittance(defaults[:solar_transmittance][:default])
  end

  # assign solar reflectance
  if @hash[:solar_reflectance]
    os_shade_mat.setSolarReflectance(@hash[:solar_reflectance])
  else
    os_shade_mat.setSolarReflectance(defaults[:solar_reflectance][:default])
  end

  # assign visible transmittance
  if @hash[:visible_transmittance]
    os_shade_mat.setVisibleTransmittance(@hash[:visible_transmittance])
  else
    os_shade_mat.setVisibleTransmittance(defaults[:visible_transmittance][:default])
  end

  # assign visible reflectance
  if @hash[:visible_reflectance]
    os_shade_mat.setVisibleReflectance(@hash[:visible_reflectance])
  else
    os_shade_mat.setVisibleReflectance(defaults[:visible_reflectance][:default])
  end

  # assign emissivity
  if @hash[:emissivity]
    os_shade_mat.setThermalHemisphericalEmissivity(@hash[:emissivity])
  else
    os_shade_mat.setThermalHemisphericalEmissivity(defaults[:emissivity][:default])
  end

  # assign infrared transmittance
  if @hash[:infrared_transmittance]
    os_shade_mat.setThermalTransmittance(@hash[:infrared_transmittance])
  else
    os_shade_mat.setThermalTransmittance(defaults[:infrared_transmittance][:default])
  end

  # assign thickness
  if @hash[:thickness]
    os_shade_mat.setThickness(@hash[:thickness])
  else
    os_shade_mat.setThickness(defaults[:thickness][:default])
  end

  # assign conductivity
  if @hash[:conductivity]
    os_shade_mat.setConductivity(@hash[:conductivity])
  else
    os_shade_mat.setConductivity(defaults[:conductivity][:default])
  end

  # assign distance to glass
  if @hash[:distance_to_glass]
    os_shade_mat.setShadetoGlassDistance(@hash[:distance_to_glass])
  else
    os_shade_mat.setShadetoGlassDistance(defaults[:distance_to_glass][:default])
  end

  # assign top opening multiplier
  if @hash[:top_opening_multiplier]
    os_shade_mat.setTopOpeningMultiplier(@hash[:top_opening_multiplier])
  else
    os_shade_mat.setTopOpeningMultiplier(defaults[:top_opening_multiplier][:default])
  end

  # assign bottom opening multiplier
  if @hash[:bottom_opening_multiplier]
    os_shade_mat.setBottomOpeningMultiplier(@hash[:bottom_opening_multiplier])
  else
    os_shade_mat.setBottomOpeningMultiplier(defaults[:bottom_opening_multiplier][:default])
  end

  # assign left opening multiplier
  if @hash[:left_opening_multiplier]
    os_shade_mat.setLeftSideOpeningMultiplier(@hash[:left_opening_multiplier])
  else
    os_shade_mat.setLeftSideOpeningMultiplier(defaults[:left_opening_multiplier][:default])
  end

  # assign right opening muliplier
  if @hash[:right_opening_multiplier]
    os_shade_mat.setRightSideOpeningMultiplier(@hash[:right_opening_multiplier])
  else
    os_shade_mat.setRightSideOpeningMultiplier(defaults[:right_opening_multiplier][:default])
  end

  # assign airflow permeability
  if @hash[:airflow_permeability]
    os_shade_mat.setAirflowPermeability(@hash[:airflow_permeability])
  else
    os_shade_mat.setAirflowPermeability(defaults[:airflow_permeability][:default])
  end

  os_shade_mat
end