예제 #1
0
        public static double Roughness(this Material material)
        {
            IEnvironmentMaterial materialProperties = material.Properties.Where(x => x is IEnvironmentMaterial).FirstOrDefault() as IEnvironmentMaterial;

            if (materialProperties == null)
            {
                return(0.0);
            }

            switch (materialProperties.Roughness)
            {
            case oM.Environment.MaterialFragments.Roughness.VerySmooth:
                return(0.0);

            case oM.Environment.MaterialFragments.Roughness.MediumSmooth:
                return(0.04);

            case oM.Environment.MaterialFragments.Roughness.Smooth:
                return(0.08);

            case oM.Environment.MaterialFragments.Roughness.Rough:
                return(0.12);

            case oM.Environment.MaterialFragments.Roughness.MediumRough:
                return(0.16);

            case oM.Environment.MaterialFragments.Roughness.VeryRough:
                return(0.2);

            default:
                return(0.0);
            }
        }
예제 #2
0
        public static double RValue(this Layer layer)
        {
            //rValue is calculated as being the thickness of the layer dividied by the materials conductivity

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

            if (envMaterial == null)
            {
                return(0.0);
            }
            return(layer.Thickness / envMaterial.Conductivity);
        }
예제 #3
0
        public static double RValue(this Layer layer)
        {
            if (layer == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Cannot query the RValue of a null layer.");
                return(-1);
            }

            //rValue is calculated as being the thickness of the layer dividied by the materials conductivity

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

            if (envMaterial == null)
            {
                return(0.0);
            }

            return(layer.Thickness / envMaterial.Conductivity);
        }
예제 #4
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);
        }