Skip to content

Commit

Permalink
Quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed Jul 28, 2022
1 parent 577ac65 commit adf3ee7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions archetypal/template/ventilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def from_zone(cls, zone, zone_ep, **kwargs):
IsScheduledVentilationOn,
ScheduledVentilationAch,
ScheduledVentilationSetpoint,
) = do_scheduled_ventilation(index, sched_df, zone)
) = do_scheduled_ventilation(index, sched_df, zone, zone_ep)

z_vent = cls(
Name=name,
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def do_natural_ventilation(index, nat_df, zone, zone_ep):
)


def do_scheduled_ventilation(index, scd_df, zone):
def do_scheduled_ventilation(index, scd_df, zone, zone_ep):
"""Get schedule ventilation information of the zone.
Args:
Expand All @@ -1052,12 +1052,12 @@ def do_scheduled_ventilation(index, scd_df, zone):
try:
IsScheduledVentilationOn = any(scd_df.loc[index, "Name"])
schedule_name_ = scd_df.loc[index, "Schedule Name"]
epbunch = zone.idf.schedules_dict[schedule_name_.upper()]
epbunch = zone_ep.theidf.schedules_dict[schedule_name_.upper()]
ScheduledVentilationSchedule = UmiSchedule.from_epbunch(epbunch)
ScheduledVentilationAch = scd_df.loc[index, "ACH - Air Changes per Hour"]
ScheduledVentilationSetpoint = resolve_temp(
scd_df.loc[index, "Minimum Indoor Temperature{C}/Schedule"],
zone.idf,
zone_ep.theidf,
)
except Exception:
ScheduledVentilationSchedule = UmiSchedule.constant_schedule(
Expand Down Expand Up @@ -1184,7 +1184,10 @@ def nominal_ventilation(df):
)
tbpiv = (
tbpiv.reset_index()
.groupby(["Archetype", "Zone Name", "Fan Type {Exhaust;Intake;Natural}"])
.groupby(
["Archetype", "Zone Name", "Fan Type {Exhaust;Intake;Natural}"],
as_index=False,
)
.apply(nominal_ventilation_aggregation)
)
return tbpiv
Expand All @@ -1206,8 +1209,13 @@ def nominal_ventilation_aggregation(x):
aggregated accordingly.
"""
how_dict = {
"Archetype": x["Archetype"][0],
"Zone Name": x["Zone Name"][0],
"Name": top(x["Name"], x, "Zone Floor Area {m2}"),
"Schedule Name": top(x["Schedule Name"], x, "Zone Floor Area {m2}"),
"Fan Type {Exhaust;Intake;Natural}": top(
x["Fan Type {Exhaust;Intake;Natural}"], x, "Zone Floor Area {m2}"
),
"Zone Floor Area {m2}": top(
x["Zone Floor Area {m2}"], x, "Zone Floor Area {m2}"
),
Expand All @@ -1223,7 +1231,7 @@ def nominal_ventilation_aggregation(x):
"Volume Flow Rate/person Area {m3/s/person}": weighted_mean(
x.filter(like="Volume Flow Rate/person Area").squeeze(axis=1),
x,
"Zone Floor " "Area {m2}",
"Zone Floor Area {m2}",
),
"ACH - Air Changes per Hour": weighted_mean(
x["ACH - Air Changes per Hour"], x, "Zone Floor Area {m2}"
Expand Down

0 comments on commit adf3ee7

Please sign in to comment.