public static CSYearSchedule QuickSchedule(string Name, double[] dayArray, double[] weArray, ScheduleType type, string category, string dataSource, ref CSLibrary Library) { //int[] MonthFrom = { 1 }; //int[] DayFrom = { 1 }; //int[] MonthTo = { 12 }; //int[] DayTo = { 31 }; CSDaySchedule someDaySchedule = new CSDaySchedule(Name, type, dayArray.ToList()); someDaySchedule.DataSource = dataSource; someDaySchedule.Category = category; someDaySchedule = Library.Add(someDaySchedule); CSDaySchedule weSchedule = new CSDaySchedule(Name + "WeekEnd", type, weArray.ToList()); weSchedule.DataSource = dataSource; weSchedule.Category = category; weSchedule = Library.Add(weSchedule); CSDaySchedule[] daySchedulesArray = { someDaySchedule, someDaySchedule, someDaySchedule, someDaySchedule, someDaySchedule, weSchedule, weSchedule }; WeekSchedule someWeekSchedule = new WeekSchedule(daySchedulesArray, new DateTime(2006, 1, 1), new DateTime(2006, 12, 31)); //someWeekSchedule.DataSource = dataSource; //someWeekSchedule.Category = category; //someWeekSchedule = Library.Add(someWeekSchedule); WeekSchedule[] weekSchedulesArray = { someWeekSchedule }; CSYearSchedule someYearSchedule = new CSYearSchedule(Name, type, weekSchedulesArray.ToList()); //, MonthFrom.ToList(), DayFrom.ToList(), MonthTo.ToList(), DayTo.ToList() someYearSchedule.DataSource = dataSource; someYearSchedule.Category = category; Library.Add(someYearSchedule); return(someYearSchedule); }
public CSLibrary getAllLibraryReferences(CSLibrary library) { var newLib = new CSLibrary(); if (library.GlazingConstructions.Any(o => o.Name == this.Construction)) { var ys = library.GlazingConstructions.First(o => o.Name == this.Construction); newLib.Add(ys); } else if (library.GlazingConstructionsSimple.Any(o => o.Name == this.Construction)) { newLib.Add(library.GlazingConstructionsSimple.First(o => o.Name == this.Construction)); } HashSet<string> List_usedYearSchedules = new HashSet<string>(); // add zone schedules List_usedYearSchedules.Add(this.ShadingSystemAvailibilitySchedule); List_usedYearSchedules.Add(this.ZoneMixingAvailibilitySchedule); List_usedYearSchedules.Add(this.AFN_WIN_AVAIL); foreach (string s in List_usedYearSchedules.ToList()) { if (string.IsNullOrWhiteSpace(s)) { continue; } // check if year schedule is not array schedule if (library.YearSchedules.Any(o => o.Name == s)) { var ys = library.YearSchedules.First(o => o.Name == s); newLib.Add(ys); } else if (library.ArraySchedules.Any(o => o.Name == s)) { newLib.Add(library.ArraySchedules.First(o => o.Name == s)); } } return newLib; }
public CSLibrary getAllLibraryReferences(CSLibrary library) { var newLib = new CSLibrary(); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.RoofConstruction)); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.FacadeConstruction)); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.SlabConstruction)); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.PartitionConstruction)); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.GroundConstruction)); newLib.Add(library.getElementByName <CSOpaqueConstruction>(this.Materials.InternalMassConstruction)); HashSet <string> List_usedYearSchedules = new HashSet <string>(); // add zone schedules List_usedYearSchedules.Add(this.Loads.OccupancySchedule); List_usedYearSchedules.Add(this.Loads.AirspeedSchedule); List_usedYearSchedules.Add(this.Conditioning.MechVentSchedule); List_usedYearSchedules.Add(this.Ventilation.ScheduledVentilationSchedule); List_usedYearSchedules.Add(this.DomHotWater.WaterSchedule); List_usedYearSchedules.Add(this.Loads.LightsAvailibilitySchedule); List_usedYearSchedules.Add(this.Loads.EquipmentAvailibilitySchedule); List_usedYearSchedules.Add(this.Ventilation.NatVentSchedule); List_usedYearSchedules.Add(this.Conditioning.HeatingSchedule); List_usedYearSchedules.Add(this.Conditioning.CoolingSchedule); List_usedYearSchedules.Add(this.Conditioning.HeatingSetpointSchedule); List_usedYearSchedules.Add(this.Conditioning.CoolingSetpointSchedule); foreach (string s in List_usedYearSchedules.ToList()) { if (string.IsNullOrWhiteSpace(s)) { continue; } // check if year schedule is not array schedule if (library.YearSchedules.Any(o => o.Name == s)) { var ys = library.YearSchedules.First(o => o.Name == s); newLib.Add(ys); } else if (library.ArraySchedules.Any(o => o.Name == s)) { newLib.Add(library.ArraySchedules.First(o => o.Name == s)); } } return(newLib); }
public static CSOpaqueConstruction QuickConstruction(string name, ConstructionCategory type, string[] layers, double[] thickness, string category, string source, ref CSLibrary Library) { CSOpaqueConstruction oc = new CSOpaqueConstruction(); for (int i = 0; i < layers.Length; i++) { try { if (thickness.Length != layers.Length) { continue; } if (!(thickness[i] > 0)) { continue; } if (Library.OpaqueMaterials.Any(x => x.Name == layers[i])) { var mat = Library.OpaqueMaterials.First(o => o.Name == layers[i]); Layer <CSOpaqueMaterial> layer = new Layer <CSOpaqueMaterial>(thickness[i], mat); oc.Layers.Add(layer); } else { Debug.WriteLine("ERROR: " + "Could not find " + layers[i]); Logger.WriteLine("ERROR: " + "Could not find " + layers[i]); return(null); } } catch (Exception e) { Debug.WriteLine(e.Message); } } oc.Name = name; oc.Type = type; oc.Category = category; oc.DataSource = source; Library.Add(oc); return(oc); }