예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Room2D" /> class.
        /// </summary>
        /// <param name="floorBoundary">A list of 2D points representing the outer boundary vertices of the Room2D. The list should include at least 3 points and each point should be a list of 2 (x, y) values. (required).</param>
        /// <param name="floorHeight">A number to indicate the height of the floor plane in the Z axis. (required).</param>
        /// <param name="floorToCeilingHeight">A number for the distance between the floor and the ceiling. (required).</param>
        /// <param name="properties">Extension properties for particular simulation engines (Radiance, EnergyPlus). (required).</param>
        /// <param name="floorHoles">Optional list of lists with one list for each hole in the floor plate. Each hole should be a list of at least 2 points and each point a list of 2 (x, y) values. If None, it will be assumed that there are no holes in the floor plate..</param>
        /// <param name="isGroundContact">A boolean noting whether this Room2D has its floor in contact with the ground. (default to false).</param>
        /// <param name="isTopExposed">A boolean noting whether this Room2D has its ceiling exposed to the outdoors. (default to false).</param>
        /// <param name="boundaryConditions">A list of boundary conditions that match the number of segments in the input floor_geometry + floor_holes. These will be used to assign boundary conditions to each of the walls of the Room in the resulting model. Their order should align with the order of segments in the floor_boundary and then with each hole segment. If None, all boundary conditions will be Outdoors or Ground depending on whether ceiling height of the room is at or below 0 (the assumed ground plane)..</param>
        /// <param name="windowParameters">A list of WindowParameter objects that dictate how the window geometries will be generated for each of the walls. If None, no windows will exist over the entire Room2D..</param>
        /// <param name="shadingParameters">A list of ShadingParameter objects that dictate how the shade geometries will be generated for each of the walls. If None, no shades will exist over the entire Room2D..</param>
        /// <param name="airBoundaries">A list of booleans for whether each wall has an air boundary type. False values indicate a standard opaque type while True values indicate an AirBoundary type. All walls will be False by default. Note that any walls with a True air boundary must have a Surface boundary condition without any windows..</param>
        /// <param name="identifier">Text string for a unique object ID. This identifier remains constant as the object is mutated, copied, and serialized to different formats (eg. dict, idf, rad). This identifier is also used to reference the object across a Model. It must be &lt; 100 characters and not contain any spaces or special characters. (required).</param>
        /// <param name="displayName">Display name of the object with no character restrictions..</param>
        /// <param name="userData">Optional dictionary of user data associated with the object.All keys and values of this dictionary should be of a standard data type to ensure correct serialization of the object (eg. str, float, int, list)..</param>
        public Room2D
        (
            string identifier, List <List <double> > floorBoundary, double floorHeight, double floorToCeilingHeight, Room2DPropertiesAbridged properties,                                                                                                                                                                                                                                                                                                                                                                                                // Required parameters
            string displayName = default, Object userData = default, List <List <List <double> > > floorHoles = default, bool isGroundContact = false, bool isTopExposed = false, List <AnyOf <Ground, Outdoors, Adiabatic, Surface> > boundaryConditions = default, List <AnyOf <SingleWindow, SimpleWindowRatio, RepeatingWindowRatio, RectangularWindows, DetailedWindows> > windowParameters = default, List <AnyOf <ExtrudedBorder, Overhang, LouversByDistance, LouversByCount> > shadingParameters = default, List <bool> airBoundaries = default // Optional parameters
        ) : base(identifier: identifier, displayName: displayName, userData: userData)                                                                                                                                                                                                                                                                                                                                                                                                                                                                   // BaseClass
        {
            // to ensure "floorBoundary" is required (not null)
            this.FloorBoundary        = floorBoundary ?? throw new ArgumentNullException("floorBoundary is a required property for Room2D and cannot be null");
            this.FloorHeight          = floorHeight;
            this.FloorToCeilingHeight = floorToCeilingHeight;
            // to ensure "properties" is required (not null)
            this.Properties         = properties ?? throw new ArgumentNullException("properties is a required property for Room2D and cannot be null");
            this.FloorHoles         = floorHoles;
            this.IsGroundContact    = isGroundContact;
            this.IsTopExposed       = isTopExposed;
            this.BoundaryConditions = boundaryConditions;
            this.WindowParameters   = windowParameters;
            this.ShadingParameters  = shadingParameters;
            this.AirBoundaries      = airBoundaries;

            // Set non-required readonly properties with defaultValue
            this.Type = "Room2D";

            // check if object is valid
            if (this.GetType() == typeof(Room2D))
            {
                this.IsValid(throwException: true);
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Room2D" /> class.
        /// </summary>
        /// <param name="name">Name of the object used in all simulation engines. Must not contain spaces and use only letters, digits and underscores/dashes. It cannot be longer than 100 characters. (required).</param>
        /// <param name="floorBoundary">A list of 2D points representing the outer boundary vertices of the Room2D. The list should include at least 3 points and each point should be a list of 2 (x, y) values. (required).</param>
        /// <param name="floorHeight">A number to indicate the height of the floor plane in the Z axis. (required).</param>
        /// <param name="floorToCeilingHeight">A number for the distance between the floor and the ceiling. (required).</param>
        /// <param name="properties">Extension properties for particular simulation engines (Radiance, EnergyPlus). (required).</param>
        /// <param name="displayName">Display name of the object with no restrictions..</param>
        /// <param name="type">type (default to &quot;Room2D&quot;).</param>
        /// <param name="floorHoles">Optional list of lists with one list for each hole in the floor plate.Each hole should be a list of at least 2 points and each point a list of 2 (x, y) values. If None, it will be assumed that there are no holes in the floor plate..</param>
        /// <param name="isGroundContact">A boolean noting whether this Room2D has its floor in contact with the ground. (default to false).</param>
        /// <param name="isTopExposed">A boolean noting whether this Room2D has its ceiling exposed to the outdoors. (default to false).</param>
        /// <param name="boundaryConditions">A list of boundary conditions that match the number of segments in the input floor_geometry + floor_holes. These will be used to assign boundary conditions to each of the walls of the Room in the resulting model. Their order should align with the order of segments in the floor_boundary and then with each hole segment. If None, all boundary conditions will be Outdoors or Ground depending on whether ceiling height of the room is at or below 0 (the assumed ground plane)..</param>
        /// <param name="windowParameters">A list of WindowParameter objects that dictate how the window geometries will be generated for each of the walls. If None, no windows will exist over the entire Room2D..</param>
        /// <param name="shadingParameters">A list of ShadingParameter objects that dictate how the shade geometries will be generated for each of the walls. If None, no shades will exist over the entire Room2D..</param>
        public Room2D(string name, List <List <double> > floorBoundary, double floorHeight, double floorToCeilingHeight, Room2DPropertiesAbridged properties, string displayName = default, string type = "Room2D", List <List <List <double> > > floorHoles = default, bool isGroundContact = false, bool isTopExposed = false, List <AnyOf <Ground, Outdoors, Adiabatic, Surface> > boundaryConditions = default, List <AnyOf <SingleWindow, SimpleWindowRatio, RepeatingWindowRatio, RectangularWindows, DetailedWindows> > windowParameters = default, List <AnyOf <ExtrudedBorder, Overhang, LouversByDistance, LouversByCount> > shadingParameters = default)
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for Room2D and cannot be null");
            }
            else
            {
                this.Name = name;
            }

            // to ensure "floorBoundary" is required (not null)
            if (floorBoundary == null)
            {
                throw new InvalidDataException("floorBoundary is a required property for Room2D and cannot be null");
            }
            else
            {
                this.FloorBoundary = floorBoundary;
            }

            // to ensure "floorHeight" is required (not null)
            if (floorHeight == null)
            {
                throw new InvalidDataException("floorHeight is a required property for Room2D and cannot be null");
            }
            else
            {
                this.FloorHeight = floorHeight;
            }

            // to ensure "floorToCeilingHeight" is required (not null)
            if (floorToCeilingHeight == null)
            {
                throw new InvalidDataException("floorToCeilingHeight is a required property for Room2D and cannot be null");
            }
            else
            {
                this.FloorToCeilingHeight = floorToCeilingHeight;
            }

            // to ensure "properties" is required (not null)
            if (properties == null)
            {
                throw new InvalidDataException("properties is a required property for Room2D and cannot be null");
            }
            else
            {
                this.Properties = properties;
            }

            this.DisplayName = displayName;
            // use default value if no "type" provided
            if (type == null)
            {
                this.Type = "Room2D";
            }
            else
            {
                this.Type = type;
            }
            this.FloorHoles = floorHoles;
            // use default value if no "isGroundContact" provided
            if (isGroundContact == null)
            {
                this.IsGroundContact = false;
            }
            else
            {
                this.IsGroundContact = isGroundContact;
            }
            // use default value if no "isTopExposed" provided
            if (isTopExposed == null)
            {
                this.IsTopExposed = false;
            }
            else
            {
                this.IsTopExposed = isTopExposed;
            }
            this.BoundaryConditions = boundaryConditions;
            this.WindowParameters   = windowParameters;
            this.ShadingParameters  = shadingParameters;
        }