Пример #1
0
        public static TBD.BuildingElementType ToTAS(this BHE.PanelType bHoMBuildingElementType)
        {
            switch (bHoMBuildingElementType) // This is just a test, it does not match. We have more BETypes in TAS than in BHoM
            {
            // here we will need to have two levels or recognision ASHRAEBuilidingElementType as per new idraw graph
            //Agreed - but we also need to implement our extended building element types in core BHoM so this might solve that?

            case BHE.PanelType.Ceiling:
                return(TBD.BuildingElementType.CEILING);

            case BHE.PanelType.UndergroundCeiling:
                return(TBD.BuildingElementType.UNDERGROUNDCEILING);

            case BHE.PanelType.Roof:
                return(TBD.BuildingElementType.ROOFELEMENT);

            case BHE.PanelType.CurtainWall:
                return(TBD.BuildingElementType.CURTAINWALL);

            case BHE.PanelType.WallInternal:
                return(TBD.BuildingElementType.INTERNALWALL);

            case BHE.PanelType.WallExternal:
                return(TBD.BuildingElementType.EXTERNALWALL);

            case BHE.PanelType.UndergroundWall:
                return(TBD.BuildingElementType.UNDERGROUNDWALL);

            case BHE.PanelType.Wall:
                return(TBD.BuildingElementType.EXTERNALWALL);

            case BHE.PanelType.FloorExposed:
                return(TBD.BuildingElementType.EXPOSEDFLOOR);

            case BHE.PanelType.FloorInternal:
                return(TBD.BuildingElementType.INTERNALFLOOR);

            case BHE.PanelType.FloorRaised:
                return(TBD.BuildingElementType.RAISEDFLOOR);

            case BHE.PanelType.SlabOnGrade:
                return(TBD.BuildingElementType.INTERNALFLOOR);

            case BHE.PanelType.Floor:
                return(TBD.BuildingElementType.INTERNALFLOOR);

            case BHE.PanelType.UndergroundSlab:
                return(TBD.BuildingElementType.UNDERGROUNDSLAB);

            case BHE.PanelType.Shade:
                return(TBD.BuildingElementType.SHADEELEMENT);

            case BHE.PanelType.SolarPanel:
                return(TBD.BuildingElementType.SOLARPANEL);

            case BHE.PanelType.Air:
            default:
                return(TBD.BuildingElementType.NULLELEMENT);
            }
        }
Пример #2
0
        public static BuildingSurfaceType ToEnergyPlus(this BHE.PanelType type)
        {
            switch (type)
            {
            case BHE.PanelType.Ceiling:
                return(BuildingSurfaceType.Ceiling);

            case BHE.PanelType.Floor:
                return(BuildingSurfaceType.Floor);

            case BHE.PanelType.Wall:
                return(BuildingSurfaceType.Wall);

            case BHE.PanelType.WallInternal:
                return(BuildingSurfaceType.Wall);

            case BHE.PanelType.CurtainWall:
                return(BuildingSurfaceType.Wall);

            case BHE.PanelType.Roof:
                return(BuildingSurfaceType.Roof);

            case BHE.PanelType.Undefined:
                return(BuildingSurfaceType.Wall);

            default:
                return(BuildingSurfaceType.Wall);
            }
        }
Пример #3
0
        public static string ToGBXML(this BHE.PanelType type)
        {
            switch (type)
            {
            case BHE.PanelType.Ceiling:
                return("Ceiling");

            case BHE.PanelType.Floor:
            case BHE.PanelType.FloorExposed:
                return("ExposedFloor");

            case BHE.PanelType.FloorInternal:
                return("InteriorFloor");

            case BHE.PanelType.FloorRaised:
                return("RaisedFloor");

            case BHE.PanelType.Roof:
                return("Roof");

            case BHE.PanelType.Shade:
                return("Shade");

            case BHE.PanelType.SlabOnGrade:
                return("SlabOnGrade");

            case BHE.PanelType.SolarPanel:
                return("SolarPanel");

            case BHE.PanelType.UndergroundCeiling:
                return("UndergroundCeiling");

            case BHE.PanelType.UndergroundSlab:
                return("UndergroundSlab");

            case BHE.PanelType.UndergroundWall:
                return("UndergroundWall");

            case BHE.PanelType.Wall:
            case BHE.PanelType.WallExternal:
                return("ExteriorWall");

            case BHE.PanelType.WallInternal:
                return("InteriorWall");

            default:
                return("Air");    //Adiabatic
            }
        }
Пример #4
0
        public static string ToOSMSurfaceType(this BHE.PanelType type)
        {
            switch (type)
            {
            case BHE.PanelType.Ceiling:
                return("Ceiling");

            case BHE.PanelType.Floor:
                return("Floor");

            case BHE.PanelType.Wall:
            case BHE.PanelType.CurtainWall:
                return("Wall");

            case BHE.PanelType.Roof:
                return("Roof");

            default:
                return("Wall");
            }
        }
Пример #5
0
        public static BHE.Panel FromTAS(this TBD.buildingElement tbdElement, TBD.zoneSurface tbdSurface, TASSettings tasSettings)
        {
            BHE.Panel element = new BHE.Panel();

            TBD.BuildingElementType tbdElementType = ((TBD.BuildingElementType)tbdElement.BEType);
            TASPanelData            tasData        = new TASPanelData();

            tasData.PanelIsOpening = tbdElementType.ElementIsOpening();

            //Add a flag on the element for the final read
            if (tbdElementType.ElementIsOpening())
            {
                //Find out what the fix was - frame or pane?
                BHE.OpeningType fixedOpeningType = tbdElementType.FromTASOpeningType().FixBuildingElementType(tbdElement, tbdSurface);
                tasData.OpeningIsFrame = fixedOpeningType.OpeningIsFrame();
            }

            BHE.PanelType     elementType         = ((TBD.BuildingElementType)tbdElement.BEType).FromTAS();
            BHPC.Construction elementConstruction = tbdElement.GetConstruction().FromTAS();

            element.Name         = tbdElement.name;
            element.Type         = elementType;
            element.Construction = elementConstruction;

            element.Fragments.Add(tasData);

            //EnvironmentContextProperties
            BHP.OriginContextFragment environmentContextProperties = new BHP.OriginContextFragment();
            environmentContextProperties.ElementID   = tbdSurface.GUID.RemoveBrackets();
            environmentContextProperties.Description = tbdElement.description;
            environmentContextProperties.TypeName    = tbdSurface.buildingElement.name;
            element.Fragments.Add(environmentContextProperties);

            //BuildingElementContextProperties
            BHP.PanelContextFragment buildingElementContextProperties = new BHP.PanelContextFragment();
            element.ConnectedSpaces.Add(tbdSurface.zone.name);
            if ((int)tbdSurface.type == 3)
            {
                element.ConnectedSpaces.Add(tbdSurface.linkSurface.zone.name);
            }
            else
            {
                element.ConnectedSpaces.Add("-1");
            }

            buildingElementContextProperties.IsAir    = tbdElement.ghost != 0;
            buildingElementContextProperties.IsGround = tbdElement.ground != 0;
            buildingElementContextProperties.Colour   = BH.Engine.Adapters.TAS.Query.GetRGB(tbdElement.colour).ToString();
            buildingElementContextProperties.Reversed = tbdSurface.reversed != 0;
            element.Fragments.Add(buildingElementContextProperties);

            //BuildingElementAnalyticalProperties
            BHP.PanelAnalyticalFragment buildingElementAnalyticalProperties = new BHP.PanelAnalyticalFragment();
            buildingElementAnalyticalProperties.Altitude      = tbdSurface.altitude.Round();
            buildingElementAnalyticalProperties.AltitudeRange = tbdSurface.altitudeRange.Round();
            buildingElementAnalyticalProperties.Inclination   = tbdSurface.inclination.Round();
            buildingElementAnalyticalProperties.Orientation   = tbdSurface.orientation.Round();
            buildingElementAnalyticalProperties.GValue        = tbdElement.GValue().Round();
            buildingElementAnalyticalProperties.LTValue       = tbdElement.LTValue().Round();
            buildingElementAnalyticalProperties.UValue        = tbdElement.UValue().Round();
            element.Fragments.Add(buildingElementAnalyticalProperties);

            List <BHG.Polyline> panelCurve = new List <BHG.Polyline>();
            int surfaceIndex = 0;

            TBD.RoomSurface roomSurface = null;

            while ((roomSurface = tbdSurface.GetRoomSurface(surfaceIndex)) != null)
            {
                TBD.Perimeter tbdPerimeter = roomSurface.GetPerimeter();
                if (tbdPerimeter != null)
                {
                    panelCurve.Add(tbdPerimeter.FromTAS());

                    //Add openings
                    int         openingIndex   = 0;
                    TBD.Polygon openingPolygon = null;
                    while ((openingPolygon = tbdPerimeter.GetHole(openingIndex)) != null)
                    {
                        element.Openings.Add(openingPolygon.FromTASOpening(roomSurface, tasSettings));
                        openingIndex++;
                    }
                }

                surfaceIndex++;
            }

            if (panelCurve.Count == 1)
            {
                element.ExternalEdges = panelCurve.First().CleanPolyline(tasSettings.AngleTolerance, tasSettings.MinimumSegmentLength).ToEdges();
            }
            else
            {
                try
                {
                    List <BHG.Polyline> polylines = Geometry.Compute.BooleanUnion(panelCurve, 1e-3);
                    if (polylines.Count == 1)
                    {
                        element.ExternalEdges = polylines.First().CleanPolyline(tasSettings.AngleTolerance, tasSettings.MinimumSegmentLength).ToEdges();
                    }
                    else
                    {
                        element.ExternalEdges = Geometry.Create.PolyCurve(polylines).ICollapseToPolyline(BH.oM.Geometry.Tolerance.Angle).CleanPolyline(tasSettings.AngleTolerance, tasSettings.MinimumSegmentLength).ToEdges();
                    }
                }
                catch (Exception e)
                {
                    BH.Engine.Base.Compute.RecordWarning("An error occurred in building buildingElement ID - " + element.BHoM_Guid + " - error was: " + e.ToString());
                    element.ExternalEdges = Geometry.Create.PolyCurve(panelCurve).ICollapseToPolyline(BH.oM.Geometry.Tolerance.Angle).CleanPolyline(tasSettings.AngleTolerance, tasSettings.MinimumSegmentLength).ToEdges();
                }
            }

            tasData.TASID                   = tbdSurface.GUID.RemoveBrackets();
            tasData.TASName                 = "Z_" + tbdSurface.zone.number + "_" + tbdSurface.number + "_" + tbdSurface.zone.name;
            tasData.Type                    = System.Convert.ToString(tbdSurface.type);
            tasData.Area                    = tbdSurface.area.Round();
            tasData.InternalArea            = tbdSurface.internalArea.Round();
            tasData.Width                   = tbdElement.width.Round();
            tasData.MaterialLayersThickness = tbdElement.GetConstruction().ConstructionThickness().Round();

            element.Fragments.Add(tasData);

            //AddingExtended Properties for a frame
            BHE.OpeningType elementOpeningType = tbdElementType.FromTASOpeningType().FixBuildingElementType(tbdElement, tbdSurface);
            if (elementOpeningType == BHE.OpeningType.RooflightWithFrame || elementOpeningType == BHE.OpeningType.WindowWithFrame)
            {
                if (element.Openings.FirstOrDefault() != null)
                {
                    element.Openings[0].FrameConstruction = elementConstruction;
                }
            }

            return(element);
        }