{type:"func", params:[{name:"ahu"}, {name:"dates"}, {name:"oatThld", def:{type:"literal", val:22°C}}, {name:"timeLimit", def:{type:"literal", val:30min}}, {name:"pressureThreshold", def:{type:"literal", val:90Pa}}, {name:"vsdSpeedThreshold", def:{type:"literal", val:5%}}, {name:"enthalpyDifference", def:{type:"literal", val:5kJ/kg}}], body:{type:"block", exprs:[{type:"def", name:"bldgRuleTuning", val:{type:"call", target:{type:"var", name:"read"}, args:[{type:"and", lhs:{type:"var", name:"equip"}, rhs:{type:"and", lhs:{type:"var", name:"ruleParameter"}, rhs:{type:"eq", lhs:{type:"var", name:"siteRef"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"siteRef"}]}}}}, {type:"literal", val:false}]}}, {type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"bldgRuleTuning"}, rhs:{type:"literal", val:null}}, rhs:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_oatThld"}]}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"assign", lhs:{type:"var", name:"oatThld"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_oatThld"}]}}}, {type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"bldgRuleTuning"}, rhs:{type:"literal", val:null}}, rhs:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_timeLimit"}]}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"assign", lhs:{type:"var", name:"timeLimit"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_timeLimit"}]}}}, {type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"bldgRuleTuning"}, rhs:{type:"literal", val:null}}, rhs:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_pressureThreshold"}]}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"assign", lhs:{type:"var", name:"pressureThreshold"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_pressureThreshold"}]}}}, {type:"if", cond:{type:"and", lhs:{type:"ne", lhs:{type:"var", name:"bldgRuleTuning"}, rhs:{type:"literal", val:null}}, rhs:{type:"ne", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_vsdSpeedThreshold"}]}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"assign", lhs:{type:"var", name:"vsdSpeedThreshold"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"bldgRuleTuning"}, {type:"literal", val:"ahu_missedEconomyOpportunity_vsdSpeedThreshold"}]}}}, {type:"if", cond:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_oatThld"}]}, ifExpr:{type:"assign", lhs:{type:"var", name:"oatThld"}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_oatThld"}]}}}, {type:"if", cond:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_timeLimit"}]}, ifExpr:{type:"assign", lhs:{type:"var", name:"timeLimit"}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_timeLimit"}]}}}, {type:"if", cond:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_pressureThreshold"}]}, ifExpr:{type:"assign", lhs:{type:"var", name:"pressureThreshold"}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_pressureThreshold"}]}}}, {type:"if", cond:{type:"dotCall", target:{type:"var", name:"has"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_vsdSpeedThreshold"}]}, ifExpr:{type:"assign", lhs:{type:"var", name:"vsdSpeedThreshold"}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"ahu_missedEconomyOpportunity_vsdSpeedThreshold"}]}}}, {type:"def", name:"rat", val:{type:"call", target:{type:"var", name:"ahu_toReturnTemp"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:false}]}}, {type:"def", name:"crat", val:{type:"call", target:{type:"var", name:"ahu_toCommonReturnTemp_p"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:false}]}}, {type:"def", name:"rah", val:{type:"call", target:{type:"var", name:"ahu_toReturnAirHumidity"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:false}]}}, {type:"def", name:"crah", val:{type:"call", target:{type:"var", name:"ahu_toCommonRAH"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:false}]}}, {type:"def", name:"satSp", val:{type:"call", target:{type:"var", name:"ahu_toDischargeTempSp_p"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:false}]}}, {type:"if", cond:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"rat"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"var", name:"crat"}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"throw", expr:{type:"call", target:{type:"var", name:"gegRuleErrMissingPoint"}, args:[{type:"literal", val:"RAT or CRAT"}, {type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"id"}]}]}}}, {type:"if", cond:{type:"and", lhs:{type:"eq", lhs:{type:"var", name:"rah"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"var", name:"crah"}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"throw", expr:{type:"call", target:{type:"var", name:"gegRuleErrMissingPoint"}, args:[{type:"literal", val:"RAH or CRAH"}, {type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"id"}]}]}}}, {type:"def", name:"temp", val:{type:"var", name:"rat"}}, {type:"if", cond:{type:"eq", lhs:{type:"var", name:"rat"}, rhs:{type:"literal", val:null}}, ifExpr:{type:"assign", lhs:{type:"var", name:"temp"}, rhs:{type:"var", name:"crat"}}}, {type:"def", name:"humidity", val:{type:"var", name:"rah"}}, {type:"if", cond:{type:"eq", lhs:{type:"var", name:"rah"}, rhs:{type:"literal", val:null}}, ifExpr:{type:"assign", lhs:{type:"var", name:"humidity"}, rhs:{type:"var", name:"crah"}}}, {type:"def", name:"oatEnthalpy", val:{type:"call", target:{type:"var", name:"equip_oatEnthalpy"}, args:[{type:"var", name:"ahu"}, {type:"var", name:"dates"}]}}, {type:"def", name:"ratEnthalpy", val:{type:"call", target:{type:"var", name:"equip_EnthalpyCalculator"}, args:[{type:"var", name:"temp"}, {type:"var", name:"humidity"}, {type:"var", name:"dates"}]}}, {type:"if", cond:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oatEnthalpy"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"var", name:"ratEnthalpy"}, rhs:{type:"literal", val:null}}}, ifExpr:{type:"return", expr:{type:"literal", val:null}}}, {type:"def", name:"highRatE", val:{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"hisInterpolate"}, args:[{type:"call", target:{type:"var", name:"hisJoin"}, args:[{type:"list", vals:[{type:"var", name:"oatEnthalpy"}, {type:"var", name:"ratEnthalpy"}]}]}]}, {type:"func", params:[{name:"r"}], body:{type:"dict", names:["ts", "val"], vals:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"r"}, {type:"literal", val:"ts"}]}, {type:"sub", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"r"}, {type:"literal", val:"v0"}]}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"r"}, {type:"literal", val:"v1"}]}}]}}]}, {type:"func", params:[{name:"x"}], body:{type:"and", lhs:{type:"lt", lhs:{type:"var", name:"x"}, rhs:{type:"literal", val:0}}, rhs:{type:"gt", lhs:{type:"call", target:{type:"var", name:"abs"}, args:[{type:"var", name:"x"}]}, rhs:{type:"var", name:"enthalpyDifference"}}}}]}}, {type:"def", name:"oatPoints", val:{type:"call", target:{type:"var", name:"readAll"}, args:[{type:"and", lhs:{type:"var", name:"outside"}, rhs:{type:"and", lhs:{type:"var", name:"air"}, rhs:{type:"and", lhs:{type:"var", name:"temp"}, rhs:{type:"and", lhs:{type:"var", name:"sensor"}, rhs:{type:"and", lhs:{type:"not", operand:{type:"var", name:"dewpoint"}}, rhs:{type:"and", lhs:{type:"not", operand:{type:"var", name:"wetBulb"}}, rhs:{type:"eq", lhs:{type:"var", name:"siteRef"}, rhs:{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"ahu"}, {type:"literal", val:"siteRef"}]}, {type:"literal", val:"id"}]}}}}}}}}]}}, {type:"def", name:"avgOatHis", val:{type:"dotCall", target:{type:"var", name:"hisFoldCols"}, args:[{type:"dotCall", target:{type:"var", name:"hisRollup"}, args:[{type:"dotCall", target:{type:"var", name:"hisInterpolate"}, args:[{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"oatPoints"}, {type:"var", name:"dates"}]}]}]}, {type:"var", name:"avg"}, {type:"literal", val:15min}]}, {type:"var", name:"avg"}, {type:"literal", val:15min}]}}, {type:"def", name:"satSpHis", val:{type:"dotCall", target:{type:"var", name:"hisRollup"}, args:[{type:"dotCall", target:{type:"var", name:"hisInterpolate"}, args:[{type:"dotCall", target:{type:"var", name:"hisClip"}, args:[{type:"dotCall", target:{type:"var", name:"hisRead"}, args:[{type:"var", name:"satSp"}, {type:"var", name:"dates"}]}]}]}, {type:"var", name:"avg"}, {type:"literal", val:15min}]}}, {type:"def", name:"acceptableOAT", val:{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"dotCall", target:{type:"var", name:"map"}, args:[{type:"dotCall", target:{type:"var", name:"hisInterpolate"}, args:[{type:"call", target:{type:"var", name:"hisJoin"}, args:[{type:"list", vals:[{type:"var", name:"avgOatHis"}, {type:"var", name:"satSpHis"}]}]}]}, {type:"func", params:[{name:"r"}], body:{type:"dict", names:["ts", "val"], vals:[{type:"trapCall", target:{type:"var", name:"trap"}, args:[{type:"var", name:"r"}, {type:"literal", val:"ts"}]}, {type:"sub", lhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"r"}, {type:"literal", val:"v0"}]}, rhs:{type:"dotCall", target:{type:"var", name:"get"}, args:[{type:"var", name:"r"}, {type:"literal", val:"v1"}]}}]}}]}, {type:"func", params:[{name:"x"}], body:{type:"gt", lhs:{type:"var", name:"x"}, rhs:{type:"literal", val:1.5}}}]}}, {type:"if", cond:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"acceptableOAT"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"acceptableOAT"}]}, rhs:{type:"literal", val:0}}}, ifExpr:{type:"return", expr:{type:"literal", val:null}}}, {type:"def", name:"oatTempAcceptablePeriods", val:{type:"dotCall", target:{type:"var", name:"hisFindPeriods"}, args:[{type:"var", name:"avgOatHis"}, {type:"func", params:[{name:"x"}], body:{type:"lt", lhs:{type:"var", name:"x"}, rhs:{type:"var", name:"oatThld"}}}]}}, {type:"if", cond:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"oatTempAcceptablePeriods"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"oatTempAcceptablePeriods"}]}, rhs:{type:"literal", val:0}}}, ifExpr:{type:"return", expr:{type:"literal", val:null}}}, {type:"def", name:"ahuRunningPeriods", val:{type:"call", target:{type:"var", name:"ahu_getFanRunningPeriods_p"}, args:[{type:"var", name:"ahu"}, {type:"var", name:"dates"}, {type:"var", name:"pressureThreshold"}, {type:"var", name:"vsdSpeedThreshold"}]}}, {type:"if", cond:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"ahuRunningPeriods"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"ahuRunningPeriods"}]}, rhs:{type:"literal", val:0}}}, ifExpr:{type:"return", expr:{type:"literal", val:null}}}, {type:"def", name:"economyPeriods", val:{type:"call", target:{type:"var", name:"ahu_getEconPeriods_p"}, args:[{type:"var", name:"ahu"}, {type:"var", name:"dates"}, {type:"def", name:"damperPos", val:{type:"literal", val:false}}, {type:"def", name:"checked", val:{type:"literal", val:true}}, {type:"def", name:"minDamperThld", val:{type:"literal", val:10%}}]}}, {type:"if", cond:{type:"or", lhs:{type:"eq", lhs:{type:"var", name:"economyPeriods"}, rhs:{type:"literal", val:null}}, rhs:{type:"eq", lhs:{type:"dotCall", target:{type:"var", name:"size"}, args:[{type:"var", name:"economyPeriods"}]}, rhs:{type:"literal", val:0}}}, ifExpr:{type:"return", expr:{type:"literal", val:null}}}, {type:"dotCall", target:{type:"var", name:"hisFindAll"}, args:[{type:"call", target:{type:"var", name:"hisPeriodIntersection"}, args:[{type:"list", vals:[{type:"var", name:"acceptableOAT"}, {type:"var", name:"economyPeriods"}, {type:"var", name:"highRatE"}, {type:"var", name:"ahuRunningPeriods"}, {type:"var", name:"oatTempAcceptablePeriods"}]}]}, {type:"func", params:[{name:"p"}], body:{type:"ge", lhs:{type:"var", name:"p"}, rhs:{type:"var", name:"timeLimit"}}}]}]}}