Measures/m_5_example_5_computed_schedule/resources/util.rb
# Returns a boolean denoting whether the execution was successful
Returns a boolean denoting whether the execution was successful
Returns a boolean denoting whether the execution was successful
def create_and_assign_construction(surface, materials, runner, model, name)
            if materials.size == 0 and @remove_materials.size == 0
                return true
            end
            if (not surface.construction.is_initialized or not surface.construction.get.to_LayeredConstruction.is_initialized) or materials[0].is_a? GlazingMaterial
                constr = OpenStudio::Model::Construction.new(model)
            else
                constr = surface.construction.get.clone(model).to_LayeredConstruction.get
            end
            is_modified = false
            if not name.nil?
                constr.setName(name)
            end
            remove_non_std_layers = true
            materials.each do |material|
                if assign_material(constr, material, surface, remove_non_std_layers, runner)
                    is_modified = true
                end
                remove_non_std_layers = false
            end
            @remove_materials.each do |material_name|
                if remove_material(constr, material_name, runner)
                    is_modified = true
                end
            end
            if is_modified
                surface.setConstruction(constr) 
            else
                constr.remove 
            end
            return true
        end
def create_and_assign_construction ( surface , materials , runner , model , name ) if materials . size == 0 and @remove_materials . size == 0 return true end if ( not surface . construction . is_initialized or not surface . construction . get . to_LayeredConstruction . is_initialized ) or materials [ 0 ] . is_a? GlazingMaterial constr = OpenStudio :: Model :: Construction . new ( model ) else constr = surface . construction . get . clone ( model ) . to_LayeredConstruction . get end is_modified = false if not name . nil? constr . setName ( name ) end remove_non_std_layers = true materials . each do | material | if assign_material ( constr , material , surface , remove_non_std_layers , runner ) is_modified = true end remove_non_std_layers = false end @remove_materials . each do | material_name | if remove_material ( constr , material_name , runner ) is_modified = true end end if is_modified surface . setConstruction ( constr ) else constr . remove end return true end
Returns a boolean denoting whether the execution was successful
Returns a boolean denoting whether the execution was successful
# Create new construction # Otherwise, clone construction # Assign material layers as appropriate # If multiple non standard layers being assigned, ensure we only remove # the existing non standard layers the first time. # Remove material layers as appropriate # use the constr # constr not used, remove
surface
<not_specific>
materials
<not_specific>
runner
<not_specific>
model
<not_specific>
name
<not_specific>