public static bool RemoveIZAMs(this TBD.Building building) { if (building == null) { return(false); } TBD.IZAM iZAM = building.GetIZAM(0); while (iZAM != null) { building.RemoveIZAM(0); iZAM = building.GetIZAM(0); } return(true); }
public static List <TBD.IZAM> IZAMs(this TBD.Building building, IEnumerable <Space> spaces) { if (building == null || spaces == null) { return(null); } List <TBD.zone> zones = building.Zones(); List <TBD.dayType> dayTypes = building.DayTypes(); dayTypes.RemoveAll(x => x.name.Equals("CDD") || x.name.Equals("HDD")); List <TBD.IZAM> result = new List <TBD.IZAM>(); foreach (Space space in spaces) { string name = space.Name; //if (string.IsNullOrWhiteSpace(name)) // space.TryGetValue(Analytical.Query.ParameterName_SpaceName(), out name, true); if (string.IsNullOrWhiteSpace(name)) { continue; } name = name.Trim(); TBD.IZAM iZAM_From = IZAM(building, space, name, true, zones, dayTypes); TBD.IZAM iZAM_To = IZAM(building, space, name, false, zones, dayTypes); if (iZAM_From != null) { result.Add(iZAM_From); } if (iZAM_To != null) { result.Add(iZAM_To); } } return(result); }
public static TBD.IZAM IZAM(this TBD.Building building, Space space, string name, bool from, IEnumerable <TBD.zone> zones, IEnumerable <TBD.dayType> dayTypes) { string directionText = "To"; if (from) { directionText = "From"; } string name_Direction = null; if (!space.TryGetValue(string.Format("SAM_IZAM_{0}_Source", directionText), out name_Direction, true)) { return(null); } if (string.IsNullOrWhiteSpace(name_Direction)) { return(null); } TBD.IZAM iZAM = building.AddIZAM(null); foreach (TBD.dayType aDayType in dayTypes) { iZAM.SetDayType(aDayType, true); } TBD.zone zone_Source = null; TBD.zone zone_Assign = null; TBD.zone zone = zones.Zone(name_Direction); if (zone != null) { if (from) { iZAM.name = string.Format("IZAM_{0}_FROM_{1}", name, name_Direction); zone_Source = zone; zone_Assign = zones.Zone(name); } else { iZAM.name = string.Format("IZAM_{0}_FROM_{1}", name_Direction, name); zone_Source = zones.Zone(name); zone_Assign = zone; } } else { iZAM.name = string.Format("IZAM_{0}_{1} OUTSIDE", name, directionText.ToUpper()); zone_Assign = zones.Zone(name); if (from) { iZAM.fromOutside = 1; } else { iZAM.fromOutside = 0; } } if (zone_Source != null) { iZAM.SetSourceZone(zone_Source); } if (zone_Assign != null) { zone_Assign.AssignIZAM(iZAM, true); } TBD.profile profile = iZAM.GetProfile(); profile.type = TBD.ProfileTypes.ticValueProfile; double value; if (space.TryGetValue(string.Format("SAM_IZAM_{0}_Value", directionText), out value, true)) { profile.value = (float)value; } double factor; if (space.TryGetValue(string.Format("SAM_IZAM_{0}_ValueFactor", directionText), out factor, true)) { profile.factor = (float)factor; } double setbackValue; if (space.TryGetValue(string.Format("SAM_IZAM_{0}_ValueSetBack", directionText), out setbackValue, true)) { profile.setbackValue = (float)setbackValue; } string scheduleValues = null; if (space.TryGetValue(string.Format("SAM_IZAM_{0}_Schedule", directionText), out scheduleValues, true)) { string name_Schedule = string.Format("SAM_IZAM_{0}_Schedule_{1}", directionText, "IZAMSCHED"); List <int> values = scheduleValues.Ints(); TBD.schedule schedule = Schedule(building, name_Schedule, values); if (schedule != null) { profile.schedule = schedule; } } return(iZAM); }
internal IZAM(TBD.IZAM IZAM) { pIZAM = IZAM; }