Esempio n. 1
0
        public static global::OpenStudio.Model CreateModel(List <List <BHE.Panel> > panelsAsSpaces, global::OpenStudio.Model modelReference)
        {
            List <BHC.Construction> uniqueConstructions = panelsAsSpaces.UniqueConstructions();

            //Create a curtain wall construction
            BHC.Construction curtainWallConstruction = new BHC.Construction();
            curtainWallConstruction.Name = "Curtain Wall Construction Replacement";

            BHC.Layer curtainWallLayer = new BHC.Layer();
            curtainWallLayer.Thickness = 0.1;

            BHM.Material curtainWallMaterial = new BHM.Material();
            curtainWallMaterial.Name = "Curtain Wall Construction Replacement";

            BHEM.SolidMaterial curtainWallMaterialProperties = new BHEM.SolidMaterial();
            curtainWallMaterialProperties.Roughness                = BHEM.Roughness.VerySmooth;
            curtainWallMaterialProperties.SpecificHeat             = 101;
            curtainWallMaterialProperties.Conductivity             = 0.1;
            curtainWallMaterialProperties.EmissivityExternal       = 0.1;
            curtainWallMaterialProperties.SolarReflectanceExternal = 0.1;
            curtainWallMaterialProperties.LightReflectanceExternal = 0.1;
            curtainWallMaterialProperties.Density = 0.1;

            curtainWallMaterial.Properties.Add(curtainWallMaterialProperties);
            curtainWallLayer.Material = curtainWallMaterial;
            curtainWallConstruction.Layers.Add(curtainWallLayer);

            Dictionary <string, Construction> osmConstructions = new Dictionary <string, Construction>();

            foreach (BHC.Construction c in uniqueConstructions)
            {
                osmConstructions.Add(c.UniqueConstructionName(), c.ToOSM(modelReference));
            }

            osmConstructions.Add("CurtainWallReplacementConstruction", curtainWallConstruction.ToOSM(modelReference));

            foreach (List <BHE.Panel> space in panelsAsSpaces)
            {
                ThermalZone osmZone  = new ThermalZone(modelReference);
                Space       osmSpace = new Space(modelReference);
                osmSpace.setThermalZone(osmZone);

                foreach (BHE.Panel be in space)
                {
                    string conName = be.Construction.UniqueConstructionName();

                    //be.ToOSM(modelReference, osmSpace, (conName == "" ? null : osmConstructions[conName]));
                    Surface host = be.ToOSM(modelReference, osmSpace, osmConstructions, be.OutsideBoundaryCondition(be.AdjacentSpaces(panelsAsSpaces)));

                    foreach (BHE.Opening o in be.Openings)
                    {
                        conName = o.OpeningConstruction.UniqueConstructionName();

                        o.ToOSM(host, (conName == "" ? null : osmConstructions[conName]), modelReference);
                    }
                }
            }

            return(modelReference);
        }
Esempio n. 2
0
        public static BHX.Glaze ToGBXGlazed(this BHC.Layer layer)
        {
            if (layer == null || layer.Material == null)
            {
                return(null);
            }
            SolidMaterial transparentProperties = layer.FindMaterial <SolidMaterial>(typeof(SolidMaterial));

            if (transparentProperties == null)
            {
                return(null);
            }

            BHX.Glaze glaze = new BHX.Glaze();

            glaze.ID                 = "glaze-" + layer.Material.Name.Replace(" ", "-").Replace(",", "") + layer.Material.BHoM_Guid.ToString().Substring(0, 5);
            glaze.Name               = layer.Material.Name;
            glaze.Thickness.Value    = Math.Round(layer.Thickness, 4).ToString();
            glaze.Conductivity.Value = transparentProperties.Conductivity.ToString();

            glaze.SolarTransmittance = new BHX.Transmittance {
                Value = Math.Round(transparentProperties.SolarTransmittance, 3).ToString(), Type = "Solar"
            };

            List <BHX.Reflectance> solarReflectance = new List <BHX.Reflectance>();

            solarReflectance.Add(new BHX.Reflectance {
                Value = Math.Round(transparentProperties.SolarReflectanceExternal, 3).ToString(), Type = "ExtSolar"
            });
            solarReflectance.Add(new BHX.Reflectance {
                Value = Math.Round(transparentProperties.SolarReflectanceInternal, 3).ToString(), Type = "IntSolar"
            });
            glaze.SolarReflectance = solarReflectance.ToArray();

            glaze.LightTransmittance = new BHX.Transmittance {
                Value = Math.Round(transparentProperties.LightTransmittance, 3).ToString(), Type = "Visible"
            };

            List <BHX.Reflectance> lightReflectance = new List <BHX.Reflectance>();

            lightReflectance.Add(new BHX.Reflectance {
                Value = Math.Round(transparentProperties.LightReflectanceExternal, 3).ToString(), Type = "ExtVisible"
            });
            lightReflectance.Add(new BHX.Reflectance {
                Value = Math.Round(transparentProperties.LightReflectanceInternal, 3).ToString(), Type = "IntVisible"
            });
            glaze.LightReflectance = lightReflectance.ToArray();

            List <BHX.Emittance> emittance = new List <BHX.Emittance>();

            emittance.Add(new BHX.Emittance {
                Value = Math.Round(transparentProperties.EmissivityExternal, 3).ToString(), Type = "ExtIR"
            });
            emittance.Add(new BHX.Emittance {
                Value = Math.Round(transparentProperties.EmissivityInternal, 3).ToString(), Type = "IntIR"
            });
            glaze.Emittance = emittance.ToArray();

            return(glaze);
        }
Esempio n. 3
0
        public static TBD.material ToTAS(this BHPMC.Layer layer, TBD.material tbdMaterial)
        {
            if (layer == null)
            {
                return(tbdMaterial);
            }
            if (layer.Material != null)
            {
                tbdMaterial.name = layer.Material.Name;
            }
            tbdMaterial.width = (float)layer.Thickness;

            tbdMaterial.type = (int)layer.Material.ToTASType();

            BHM.IEnvironmentMaterial envMat = layer.Material.Properties.Where(x => x.GetType() == typeof(BHM.IEnvironmentMaterial)).FirstOrDefault() as BHM.IEnvironmentMaterial;

            if (envMat != null)
            {
                switch ((TBD.MaterialTypes)tbdMaterial.type)
                {
                case TBD.MaterialTypes.tcdGasLayer:
                    tbdMaterial.convectionCoefficient = (float)((BHM.GasMaterial)envMat).ConvectionCoefficient;
                    tbdMaterial.vapourDiffusionFactor = (float)(((BHM.GasMaterial)envMat).VapourResistivity / 5 / layer.Thickness);     //Vapour Resistivity / 5GN·s/kg·m / material thickness
                    tbdMaterial.description           = ((BHM.GasMaterial)envMat).Description;

                    break;

                case TBD.MaterialTypes.tcdOpaqueLayer:     //Thickness not showing
                    tbdMaterial.conductivity             = (float)((BHM.SolidMaterial)envMat).Conductivity;
                    tbdMaterial.specificHeat             = (float)((BHM.SolidMaterial)envMat).SpecificHeat;
                    tbdMaterial.density                  = (float)((BHM.SolidMaterial)envMat).Density;
                    tbdMaterial.vapourDiffusionFactor    = (float)(((BHM.SolidMaterial)envMat).VapourResistivity / 5 / layer.Thickness);  //Vapour Resistivity / 5GN·s/kg·m / material thickness
                    tbdMaterial.externalSolarReflectance = (float)((BHM.SolidMaterial)envMat).SolarReflectanceExternal;
                    tbdMaterial.internalSolarReflectance = (float)((BHM.SolidMaterial)envMat).SolarReflectanceInternal;
                    tbdMaterial.externalLightReflectance = (float)((BHM.SolidMaterial)envMat).LightReflectanceExternal;
                    tbdMaterial.internalLightReflectance = (float)((BHM.SolidMaterial)envMat).LightReflectanceInternal;
                    tbdMaterial.externalEmissivity       = (float)((BHM.SolidMaterial)envMat).EmissivityExternal;
                    tbdMaterial.internalEmissivity       = (float)((BHM.SolidMaterial)envMat).EmissivityInternal;
                    tbdMaterial.description              = ((BHM.SolidMaterial)envMat).Description;

                    break;

                case TBD.MaterialTypes.tcdTransparentLayer:
                    tbdMaterial.conductivity             = (float)((BHM.SolidMaterial)envMat).Conductivity;
                    tbdMaterial.vapourDiffusionFactor    = (float)(((BHM.SolidMaterial)envMat).VapourResistivity / 5 / layer.Thickness);  //Vapour Resistivity / 5GN·s/kg·m / material thickness
                    tbdMaterial.solarTransmittance       = (float)((BHM.SolidMaterial)envMat).SolarTransmittance;
                    tbdMaterial.externalSolarReflectance = (float)((BHM.SolidMaterial)envMat).SolarReflectanceExternal;
                    tbdMaterial.internalSolarReflectance = (float)((BHM.SolidMaterial)envMat).SolarReflectanceInternal;
                    tbdMaterial.lightTransmittance       = (float)((BHM.SolidMaterial)envMat).LightTransmittance;
                    tbdMaterial.externalLightReflectance = (float)((BHM.SolidMaterial)envMat).LightReflectanceExternal;
                    tbdMaterial.internalLightReflectance = (float)((BHM.SolidMaterial)envMat).LightReflectanceInternal;
                    tbdMaterial.externalEmissivity       = (float)((BHM.SolidMaterial)envMat).EmissivityExternal;
                    tbdMaterial.internalEmissivity       = (float)((BHM.SolidMaterial)envMat).EmissivityInternal;
                    tbdMaterial.description = ((BHM.SolidMaterial)envMat).Description;
                    break;
                }
            }
            return(tbdMaterial);
        }
Esempio n. 4
0
        public static BHC.Layer ToBHoM(this BHX.Layer gbLayer, BHM.Material material, double thickness)
        {
            BHC.Layer layer = new BHC.Layer();
            layer.Name      = gbLayer.Name;
            layer.Thickness = thickness;
            layer.Material  = material;

            return(layer);
        }
Esempio n. 5
0
        public static BHPMC.Layer FromTAS(this TBD.material tbdMaterial, TBD.Construction tbdConstruction)
        {
            if (tbdMaterial == null)
            {
                return(null);
            }

            BHPMC.Layer layer = new BHPMC.Layer();
            layer.Thickness = tbdMaterial.width;

            BHPM.Material material = new BHPM.Material();
            material.Name = tbdMaterial.name;
            material.Properties.Add(tbdMaterial.FromTASProperties(tbdConstruction));

            layer.Material = material;

            return(layer);
        }
Esempio n. 6
0
        public static BHX.Gap ToGBXGap(this BHC.Layer layer)
        {
            if (layer == null || layer.Material == null)
            {
                return(null);
            }
            GasMaterial gasProperties = layer.FindMaterial <GasMaterial>(typeof(GasMaterial));

            if (gasProperties == null)
            {
                return(null);
            }

            BHX.Gap gap = new BHX.Gap();

            gap.ID                 = "gap-" + layer.Material.Name.Replace(" ", "-").Replace(",", "") + layer.Material.BHoM_Guid.ToString().Substring(0, 5);
            gap.Name               = layer.Material.Name;
            gap.Thickness.Value    = Math.Round(layer.Thickness, 4).ToString();
            gap.Conductivity.Value = Math.Round(gasProperties.Conductivity, 3).ToString();

            switch (gasProperties.Gas)
            {
            case Gas.Air:
                gap.Gas = "Air";
                break;

            case Gas.Argon:
                gap.Gas = "Argon";
                break;

            case Gas.Krypton:
                gap.Gas = "Krypton";
                break;

            default:
                gap.Gas = "Custom";
                break;
            }

            return(gap);
        }
Esempio n. 7
0
        public static BHC.Layer ToBHoM(this BHX.Material gbMaterial)
        {
            BHC.Layer     layer = new BHC.Layer();
            SolidMaterial materialProperties = new SolidMaterial();

            try
            {
                layer.Thickness = System.Convert.ToDouble(gbMaterial.Thickness.Value);
                materialProperties.Conductivity = System.Convert.ToDouble(gbMaterial.Conductivity.Value);
                materialProperties.SpecificHeat = System.Convert.ToDouble(gbMaterial.SpecificHeat.Value);
                materialProperties.Density      = System.Convert.ToDouble(gbMaterial.Density.Value);
            }
            catch { }

            BHM.Material material = new BHM.Material();
            material.Name = gbMaterial.Name;

            material.Properties.Add(materialProperties);
            layer.Material = material;

            return(layer);
        }
Esempio n. 8
0
        public static BHX.Material ToGBXML(this BHC.Layer layer)
        {
            BHX.Material gbMaterial = new BHX.Material();

            //double rValue = Math.Round(layer.RValue(), 3);
            //if (double.IsInfinity(rValue) || double.IsNaN(rValue)) rValue = -1; //Error

            gbMaterial.ID   = "material-" + layer.Material.Name.CleanName();
            gbMaterial.Name = layer.Material.Name;
            //gbMaterial.RValue.Value = rValue.ToString();
            gbMaterial.Thickness.Value = Math.Round(layer.Thickness, 3).ToString();

            IEnvironmentMaterial envMaterial = layer.Material.Properties.Where(x => x is IEnvironmentMaterial).FirstOrDefault() as IEnvironmentMaterial;

            if (envMaterial != null)
            {
                gbMaterial.Density.Value      = Math.Round(envMaterial.Density, 3).ToString();
                gbMaterial.Conductivity.Value = Math.Round(envMaterial.Conductivity, 3).ToString();
                gbMaterial.SpecificHeat.Value = envMaterial.SpecificHeat.ToString();
            }

            return(gbMaterial);
        }
Esempio n. 9
0
 public static IEnergyPlusClass ToEnergyPlus(this BHP.Layer layer)
 {
     return(layer.Material.ToEnergyPlus(layer.Thickness));
 }