def _add_gml_opaque_material(gml_layer, teaser_layer):
    """Adds gml opaque material to the given layer

    Adds a material to given layer and fills information with teaser
    information

    Parameters
    ----------

    gml_layer : energy.LayerComponentType()
        A Layer object with basic data
    teaser_layer : TEASER Layer
        Instance of Layer
    """
    gml_layer.material = energy.AbstractMaterialPropertyType()
    gml_layer.material.AbstractMaterial = energy.SolidMaterial()

    _current_material = gml_layer.material.AbstractMaterial
    _current_material.name = [og.gml.CodeType(teaser_layer.material.name)]
    _current_material.conductivity = gml.MeasureType(
        teaser_layer.material.thermal_conduc)
    _current_material.conductivity.uom = bd.datatypes.anyURI('W/mK')
    _current_material.density = gml.MeasureType(teaser_layer.material.density)
    _current_material.density.uom = bd.datatypes.anyURI('kg/m^3')
    _current_material.specificHeat = gml.MeasureType(
        teaser_layer.material.heat_capac)
    _current_material.specificHeat.uom = bd.datatypes.anyURI('kJ/kg')
def _set_gml_thermal_zone(thermal_zone):
    """creates a citygml.energy instance of a thermal zone

    EnergyADE includes information of a thermal zone, these values are set in
    this class.

    Parameters
    ----------

    thermal_zone : ThermalZone() object
        A ThermalZone object, from TEASER

    Returns
    -------

    gml_zone : energy.thermalZones() object
        A thermalZone object, where energy is a reference to
        `pyxb.bundles.opengis.citygml.energy`.
    """
    gml_zone = energy.thermalZone()
    gml_zone.ThermalZone = energy.ThermalZoneType()
    gml_zone.ThermalZone.id = thermal_zone.name
    gml_zone.ThermalZone.isCooled = bd.datatypes.boolean(True)
    gml_zone.ThermalZone.isHeated = bd.datatypes.boolean(True)
    # gml_zone.ThermalZone.heatedFloorArea = gml.AreaType(thermal_zone.area)
    # gml_zone.ThermalZone.heatedFloorArea.uom = bd.datatypes.anyURI('m^2')
    gml_zone.ThermalZone.infiltrationRate = gml.MeasureType(
        thermal_zone.infiltration_rate)
    gml_zone.ThermalZone.infiltrationRate.uom = bd.datatypes.anyURI('1/h')

    return gml_zone
def _add_gml_layer(gml_surf_comp, element):
    """Adds gml layer to a surface component

    Adds all layer of the element to the gml surface component

    Parameters
    ----------

    gml_surf_comp : energy.SurfaceComponent()
        A SurfaceComponent object with basic data
    element : TEASER BuildingElement
        Instance of BuildingElement or inherited classes
    """

    cons = energy.AbstractConstructionPropertyType()
    cons.AbstractConstruction = energy.Construction()
    cons.AbstractConstruction.name = [og.gml.CodeType(element.name)]
    cons.AbstractConstruction.uValue = gml.MeasureType(element.ua_value /
                                                       element.area)
    cons.AbstractConstruction.uValue.uom = bd.datatypes.anyURI('W/(m^2*K)')

    if type(element).__name__ == "Window":
        cons.AbstractConstruction.opticalProperties = \
            energy.OpticalPropertiesPropertyType()
        cons.AbstractConstruction.opticalProperties.append(
            energy.OpticalPropertiesType())
        cons.AbstractConstruction.opticalProperties.OpticalProperties \
            .transmittance.append(energy.TransmittancePropertyType())
        cons.AbstractConstruction.opticalProperties.OpticalProperties \
            .transmittance[-1].Transmittance = energy.TransmittanceType()
        cons.AbstractConstruction.opticalProperties.OpticalProperties \
            .transmittance[-1].Transmittance.fraction = element.g_value
        cons.AbstractConstruction.opticalProperties.OpticalProperties \
            .transmittance[-1].Transmittance.fraction.uom = \
            bd.datatypes.anyURI('g value')
        cons.AbstractConstruction.opticalProperties.OpticalProperties \
            .transmittance[-1].Transmittance.wavelengthRange = \
            energy.WavelengthRangeType("Solar")

    for lay_count in element.layer:
        layer = energy.LayerPropertyType()
        layer.Layer = energy.LayerType()
        layer.Layer.layerComponent.append(energy.LayerComponentPropertyType())
        layer.Layer.layerComponent[-1].LayerComponent = \
            energy.LayerComponentType()

        _current_layer = layer.Layer.layerComponent[-1].LayerComponent

        _current_layer.thickness = gml.LengthType(lay_count.thickness)
        _current_layer.thickness.uom = bd.datatypes.anyURI('m')
        _add_gml_opaque_material(_current_layer, lay_count)

        cons.AbstractConstruction.layer.append(layer)

    gml_surf_comp.ThermalComponent.construction = cons