Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DesignDay" /> class.
        /// </summary>
        /// <param name="name">Text string for a unique design day name. This name remains constant as the object is mutated, copied, and serialized to different formats (eg. dict, idf, osm). It is also used to reference the object within SimulationParameters. It must be &lt; 100 characters, use only ASCII characters and exclude (, ; ! \\n \\t). (required).</param>
        /// <param name="dayType">dayType (required).</param>
        /// <param name="dryBulbCondition">A DryBulbCondition describing temperature conditions on the design day. (required).</param>
        /// <param name="humidityCondition">A HumidityCondition describing humidity and precipitation conditions on the design day. (required).</param>
        /// <param name="windCondition">A WindCondition describing wind conditions on the design day. (required).</param>
        /// <param name="skyCondition">skyCondition (required).</param>
        public DesignDay
        (
            string name, DesignDayTypes dayType, DryBulbCondition dryBulbCondition, HumidityCondition humidityCondition, WindCondition windCondition, AnyOf <ASHRAEClearSky, ASHRAETau> skyCondition // Required parameters
            // Optional parameters
        ) : base()                                                                                                                                                                                   // BaseClass
        {
            // to ensure "name" is required (not null)
            this.Name    = name ?? throw new ArgumentNullException("name is a required property for DesignDay and cannot be null");
            this.DayType = dayType;
            // to ensure "dryBulbCondition" is required (not null)
            this.DryBulbCondition = dryBulbCondition ?? throw new ArgumentNullException("dryBulbCondition is a required property for DesignDay and cannot be null");
            // to ensure "humidityCondition" is required (not null)
            this.HumidityCondition = humidityCondition ?? throw new ArgumentNullException("humidityCondition is a required property for DesignDay and cannot be null");
            // to ensure "windCondition" is required (not null)
            this.WindCondition = windCondition ?? throw new ArgumentNullException("windCondition is a required property for DesignDay and cannot be null");
            // to ensure "skyCondition" is required (not null)
            this.SkyCondition = skyCondition ?? throw new ArgumentNullException("skyCondition is a required property for DesignDay and cannot be null");

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

            // check if object is valid, only check for inherited class
            if (this.GetType() == typeof(DesignDay))
            {
                this.IsValid(throwException: true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DesignDay" /> class.
        /// </summary>
        /// <param name="name">Name of the object. Must use only ASCII characters and exclude (, ; ! \\n \\t). It cannot be longer than 100 characters. (required).</param>
        /// <param name="dayType">dayType (required).</param>
        /// <param name="dryBulbCondition">A DryBulbCondition describing temperature conditions on the design day. (required).</param>
        /// <param name="humidityCondition">A HumidityCondition describing humidity and precipitation conditions on the design day. (required).</param>
        /// <param name="windCondition">A WindCondition describing wind conditions on the design day. (required).</param>
        /// <param name="skyCondition">skyCondition (required).</param>
        /// <param name="type">type (default to &quot;DesignDay&quot;).</param>
        public DesignDay(string name, DayTypeEnum dayType, DryBulbCondition dryBulbCondition, HumidityCondition humidityCondition, WindCondition windCondition, AnyOf <ASHRAEClearSky, ASHRAETau> skyCondition, string type = "DesignDay")
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for DesignDay and cannot be null");
            }
            else
            {
                this.Name = name;
            }

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

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

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

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

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

            // use default value if no "type" provided
            if (type == null)
            {
                this.Type = "DesignDay";
            }
            else
            {
                this.Type = type;
            }
        }