Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Story" /> 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="room2ds">An array of dragonfly Room2D objects that together form an entire story of a building. (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;Story&quot;).</param>
        /// <param name="floorToFloorHeight">A number for the distance from the floor plate of this story to the floor of the story above this one (if it exists). If None, this value will be the maximum floor_to_ceiling_height of the input room_2ds..</param>
        /// <param name="multiplier">An integer that denotes the number of times that this Story is repeated over the height of the building. (default to 1).</param>
        public Story(string name, List <Room2D> room2ds, StoryPropertiesAbridged properties, string displayName = default, string type = "Story", double floorToFloorHeight = default, int multiplier = 1)
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for Story and cannot be null");
            }
            else
            {
                this.Name = name;
            }

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

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

            this.DisplayName = displayName;
            // use default value if no "type" provided
            if (type == null)
            {
                this.Type = "Story";
            }
            else
            {
                this.Type = type;
            }
            this.FloorToFloorHeight = floorToFloorHeight;
            // use default value if no "multiplier" provided
            if (multiplier == null)
            {
                this.Multiplier = 1;
            }
            else
            {
                this.Multiplier = multiplier;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Story" /> class.
        /// </summary>
        /// <param name="room2ds">An array of dragonfly Room2D objects that together form an entire story of a building. (required).</param>
        /// <param name="properties">Extension properties for particular simulation engines (Radiance, EnergyPlus). (required).</param>
        /// <param name="floorToFloorHeight">A number for the distance from the floor plate of this story to the floor of the story above this one (if it exists). If None, this value will be the maximum floor_to_ceiling_height of the input room_2ds..</param>
        /// <param name="floorHeight">A number to indicate the height of the floor plane in the Z axis.If None, this will be the minimum floor height of all the room_2ds, which is suitable for cases where there are no floor plenums..</param>
        /// <param name="multiplier">An integer that denotes the number of times that this Story is repeated over the height of the building. (default to 1).</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 Story
        (
            string identifier, List <Room2D> room2ds, StoryPropertiesAbridged properties,                                                                  // Required parameters
            string displayName = default, Object userData = default, double floorToFloorHeight = default, double floorHeight = default, int multiplier = 1 // Optional parameters
        ) : base(identifier: identifier, displayName: displayName, userData: userData)                                                                     // BaseClass
        {
            // to ensure "room2ds" is required (not null)
            this.Room2ds = room2ds ?? throw new ArgumentNullException("room2ds is a required property for Story and cannot be null");
            // to ensure "properties" is required (not null)
            this.Properties         = properties ?? throw new ArgumentNullException("properties is a required property for Story and cannot be null");
            this.FloorToFloorHeight = floorToFloorHeight;
            this.FloorHeight        = floorHeight;
            this.Multiplier         = multiplier;

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