/// <summary>
        /// Initializes a new instance of the <see cref="FaceSubSet" /> class.
        /// </summary>
        /// <param name="interiorConstruction">An OpaqueConstruction for walls with a Surface or Adiabatic boundary condition..</param>
        /// <param name="exteriorConstruction">An OpaqueConstruction for walls with an Outdoors boundary condition..</param>
        /// <param name="groundConstruction">An OpaqueConstruction for walls with a Ground boundary condition..</param>
        public FaceSubSet
        (
            // Required parameters
            OpaqueConstruction interiorConstruction = default, OpaqueConstruction exteriorConstruction = default, OpaqueConstruction groundConstruction = default // Optional parameters
        ) : base()                                                                                                                                                // BaseClass
        {
            this.InteriorConstruction = interiorConstruction;
            this.ExteriorConstruction = exteriorConstruction;
            this.GroundConstruction   = groundConstruction;

            // Set non-required readonly properties with defaultValue
            this.Type = "_FaceSubSet";
        }
Esempio n. 2
0
        private static List <OpaqueConstruction> readOpaqueConstructionsCSV(string fp, List <OpaqueMaterial> mat)
        {
            var records = new List <OpaqueConstruction>();

            using (var sr = new StreamReader(fp))
            {
                var csv = new CsvReader(sr);
                while (csv.Read())
                {
                    try
                    {
                        bool foundAllMaterials    = true;
                        OpaqueConstruction record = csv.GetRecord <OpaqueConstruction>();
                        int layerCnt     = csv.GetField <int>("LayerCount");
                        int layerStartAt = csv.GetFieldIndex("LayerCount") + 1;
                        for (int i = layerStartAt; i < layerStartAt + layerCnt; i++)
                        {
                            var thick = csv.GetField <double>(i);
                            var name  = csv.GetField <string>(i + layerCnt);
                            if (mat.Any(x => x.Name == name))
                            {
                                var m = mat.First(x => x.Name == name);
                                record.Layers.Add(new Layer <OpaqueMaterial>(thick, m));
                            }
                            else
                            {
                                foundAllMaterials = false;
                            }
                        }
                        if (foundAllMaterials)
                        {
                            records.Add(record);
                        }
                        else
                        {
                            System.Windows.MessageBox.Show(record.Name + " contains materials not found in library");
                        }
                    }
                    catch (Exception ex) { Debug.WriteLine(ex.Message); }
                }
            }
            return(records);
        }