def create_demand_curve0(x, tIn, tout, tSup, mDot): # print 'vav-'+str(x) info = json.load(open('vav-' + str(x))) zone = FirstOrderZone() zone.x0 = info['properties']['x0'] zone.x1 = info['properties']['x1'] zone.x2 = info['properties']['x2'] zone.x3 = info['properties']['x3'] zone.x4 = info['properties']['x4'] zone.mDotMin = info['properties']['mDotMin'] zone.mDotMax = info['properties']['mDotMax'] zone.tMinAdj = info['properties']['tMin'] zone.tMaxAdj = info['properties']['tMax'] zone.tIn = tIn zone.tout = tout zone.mDot = mDot zone.qHvacSens = round(zone.mDot, 2) * 1006. * (tSup - zone.tIn) zone.qMin = min(0, zone.mDotMin * 1006. * (tSup - zone.tIn)) zone.qMax = min(0, zone.mDotMax * 1006. * (tSup - zone.tIn)) t = clamp(zone.tIn + zone.tDel, zone.tMinAdj, zone.tMaxAdj) qlow = clamp(zone.getQ(t), zone.qMax, zone.qMin) t = clamp(zone.tIn - zone.tDel, zone.tMinAdj, zone.tMaxAdj) qhig = clamp(zone.getQ(t), zone.qMax, zone.qMin) curve = PolyLine() curve.add(Point(qlow, 100)) curve.add(Point(qhig, 10)) return curve
def display_graphic(self, scale: int): point_list = self.cursor.get_points() for i in range(len(point_list) - 1): ln = Line( Point(point_list[i].x * scale, point_list[i].y * scale), Point(point_list[i + 1].x * scale, point_list[i + 1].y * scale)) ln.setWidth(4) ln.draw(self.win)
def create_demand_curve(x, tIn, tout, tSup, mDot, idex): # print 'vav-'+str(x) info = json.load(open('vav-' + str(x))) zone = FirstOrderZone() zone.x0 = info['properties']['x0'] zone.x1 = info['properties']['x1'] zone.x2 = info['properties']['x2'] zone.x3 = info['properties']['x3'] zone.x4 = info['properties']['x4'] zone.mDotMin = info['properties']['mDotMin'] zone.mDotMax = info['properties']['mDotMax'] zone.tMinAdj = info['properties']['tMin'] zone.tMaxAdj = info['properties']['tMax'] zone.k = info['properties']['k'] zone.tIn = tIn zone.tout = tout zone.mDot = mDot zone.qHvacSens = round(zone.mDot, 2) * 1006. * (tSup - zone.tIn) zone.qMin = min(0, zone.mDotMin * 1006. * (tSup - zone.tMinAdj)) zone.qMax = min(0, zone.mDotMax * 1006. * (tSup - zone.tMaxAdj)) curve = PolyLine() tHig = zone.tMaxAdj tLow = zone.tMinAdj phig = 0.15 + zone.k * 0.01 plow = 0.15 - zone.k * 0.01 price = [] quantity = [] p = 0.0 price.append(0.0) q = clamp(zone.getQ(tLow), zone.qMax, zone.qMin) quantity.append(q) curve.add(Point(q, p)) for i in range(101): p = (phig - plow) / 100 * float(i) + plow price.append(p) t = (tHig - tLow) / 100 * float(i) + tLow q = clamp(zone.getQ(t), zone.qMax, zone.qMin) quantity.append(q) curve.add(Point(q, p)) p = 1.0 price.append(1.0) q = clamp(zone.getQ(tHig), zone.qMax, zone.qMin) quantity.append(q) curve.add(Point(q, p)) tab = pd.DataFrame() tab['price'] = price tab['quantity'] = quantity tab.to_csv('dc_zone/' + str(x) + '_' + str(idex) + '.csv') return curve
def create_demand_curve(x,tIn,tout,tSup,mDot): # print 'vav-'+str(x) info = json.load(open('vav-'+str(x))) zone=FirstOrderZone() zone.x0=info['properties']['x0'] zone.x1=info['properties']['x1'] zone.x2=info['properties']['x2'] zone.x3=info['properties']['x3'] zone.x4=info['properties']['x4'] zone.mDotMin=info['properties']['mDotMin'] zone.mDotMax=info['properties']['mDotMax'] zone.tMinAdj=info['properties']['tMin'] zone.tMaxAdj=info['properties']['tMax'] zone.tIn=tIn zone.tout=tout zone.mDot=mDot zone.qHvacSens = round(zone.mDot,2)*1006.*(tSup-zone.tIn) zone.qMin = min(0, zone.mDotMin*1006.*(tSup-zone.tIn)) zone.qMax = min(0, zone.mDotMax*1006.*(tSup-zone.tIn)) curve = PolyLine() for i in range(10,110,5): tHig=zone.tIn+0.5 tLow=zone.tIn-0.5 t=(tHig-tLow)/90*(float(i-10))+tLow q=clamp(zone.getQ(t), zone.qMax, zone.qMin) curve.add(Point(q, float(i))) return curve
def display_eligible_points(self, scale: int): for x in range(self.x_size): for y in range(self.y_size): cir = Circle(Point(x * scale, y * scale), 2) cir.setOutline('green') cir.setFill('green') cir.draw(self.win)
def create_demand_curve3(x, tIn, tout, tSup, mDot, idex): # print 'vav-'+str(x) info = json.load(open('vav-' + str(x))) curve = PolyLine() tab = pd.read_csv('dc_zone/' + str(x) + '_' + str(idex) + '.csv') for i in range(len(tab)): price = tab['price'].iloc[i] quantity = tab['quantity'].iloc[i] curve.add(Point(quantity, price)) return curve
def convert_demand_curve(x,tret,tsup,tmix,demandCurve): info = json.load(open('AHU-00'+str(x))) ahu=AhuChiller() ahu.tAirReturn = tret ahu.tAirSupply = tsup ahu.tAirMixed = tmix ahu.c0=info['properties']['c0'] ahu.c1=info['properties']['c1'] ahu.c2=info['properties']['c2'] ahu.c3=info['properties']['c3'] ahu.COP=info['properties']['COP'] curve = PolyLine() for point in demandCurve.points: curve.add(Point(ahu.calcTotalLoad(point.x), point.y)) # print ahu.calcTotalLoad(point.x) return curve
def create_demand_curve5(x, tIn, tout, tSup, mDot, idex): # print 'vav-'+str(x) info = json.load(open('vav-' + str(x))) curve = PolyLine() min = 100 min_index = 0 for i in range(190, 235, 5): if abs(i / 10.0 - tIn) < min: min_index = i min = abs(i / 10.0 - tIn) print min_index tab = pd.read_csv('dz_zone/' + str(x) + '_' + str(idex) + '_' + str(min_index) + '.csv') for i in range(len(tab)): price = tab['price'].iloc[i] quantity = tab['quantity'].iloc[i] curve.add(Point(quantity, price)) return curve
def process_data(index): index = index / 5 VAV_index1 = [ '102', '118', '119', '120', '123a', '123b', '127a', 'corridor', '127b', '129', '131', '136', '133', '142', '143', '150', 'restroom' ] for st in range(len(VAV_index1)): x = VAV_index1[st].upper() info = json.load(open('vav-' + str(x))) k = info['properties']['k'] phig = 0.15 + k * 0.01 plow = 0.15 - k * 0.01 price = [] quantity = [] s = 0 curve = PolyLine() tab2 = pd.read_csv('temp/eplusout_' + str(index) + '_' + str(-5) + '.csv') tin = 'ZONE-VAV-' + str(x) + ':Zone Mean Air Temperature [C](TimeStep)' tout = 'Environment:Site Outdoor Air Drybulb Temperature [C](TimeStep)' mdot = 'ZONE-VAV-' + str( x ) + ' VAV BOX OUTLET NODE:System Node Mass Flow Rate [kg/s](TimeStep)' tsup = 'ZONE-VAV-' + str( x) + ' VAV BOX OUTLET NODE:System Node Temperature [C](TimeStep)' tab2['qHvacSens'] = 1006 * tab2[mdot] * (tab2[tsup] - tab2[tin]) q = 0 for i in range(index * 5 + 1, (index + 1) * 5 + 1): q = q + tab2['qHvacSens'].iloc[i] quantity.append(q / 5) price.append(0) curve.add(Point(q / 5, 0)) for i in range(0, 10, 5): tab2 = pd.read_csv('temp/eplusout_' + str(index) + '_' + str(i) + '.csv') tin = 'ZONE-VAV-' + str( x) + ':Zone Mean Air Temperature [C](TimeStep)' tout = 'Environment:Site Outdoor Air Drybulb Temperature [C](TimeStep)' mdot = 'ZONE-VAV-' + str( x ) + ' VAV BOX OUTLET NODE:System Node Mass Flow Rate [kg/s](TimeStep)' tsup = 'ZONE-VAV-' + str( x ) + ' VAV BOX OUTLET NODE:System Node Temperature [C](TimeStep)' tab2['qHvacSens'] = 1006 * tab2[mdot] * (tab2[tsup] - tab2[tin]) q = 0 for k in range(index * 5 + 1, (index + 1) * 5 + 1): q = q + tab2['qHvacSens'].iloc[k] quantity.append(q / 5) p = (phig - plow) / 2 * float(s) + plow price.append(p) s = s + 1 curve.add(Point(q / 5, p)) p = 1.0 price.append(1.0) quantity.append(q / 5) curve.add(Point(q / 5, p)) tab = pd.DataFrame() tab['price'] = price tab['quantity'] = quantity tab.to_csv('dc_zone/' + str(x) + '_' + str(index) + '.csv')
def create_demand_curve2(x, tIn, tout, tSup, mDot, idex): # print 'vav-'+str(x) info = json.load(open('vav-' + str(x))) k = info['properties']['k'] phig = 0.15 + k * 0.01 plow = 0.15 - k * 0.01 price = [] quantity = [] s = 0 curve = PolyLine() tab2 = pd.read_csv('result_1min/eplusout_' + str(idex) + '_' + str(190) + '.csv') tin = 'ZONE-VAV-' + str(x) + ':Zone Mean Air Temperature [C](TimeStep)' tout = 'Environment:Site Outdoor Air Drybulb Temperature [C](TimeStep)' mdot = 'ZONE-VAV-' + str( x) + ' VAV BOX OUTLET NODE:System Node Mass Flow Rate [kg/s](TimeStep)' tsup = 'ZONE-VAV-' + str( x) + ' VAV BOX OUTLET NODE:System Node Temperature [C](TimeStep)' tab2['qHvacSens'] = 1006 * tab2[mdot] * (tab2[tsup] - tab2[tin]) q = 0 for i in range(idex * 5 + 1, (idex + 1) * 5 + 1): q = q + tab2['qHvacSens'].iloc[i] quantity.append(q / 5) price.append(0) curve.add(Point(q / 5, 0)) for i in range(190, 235, 5): tab2 = pd.read_csv('result_1min/eplusout_' + str(idex) + '_' + str(i) + '.csv') tin = 'ZONE-VAV-' + str(x) + ':Zone Mean Air Temperature [C](TimeStep)' tout = 'Environment:Site Outdoor Air Drybulb Temperature [C](TimeStep)' mdot = 'ZONE-VAV-' + str( x ) + ' VAV BOX OUTLET NODE:System Node Mass Flow Rate [kg/s](TimeStep)' tsup = 'ZONE-VAV-' + str( x) + ' VAV BOX OUTLET NODE:System Node Temperature [C](TimeStep)' tab2['qHvacSens'] = 1006 * tab2[mdot] * (tab2[tsup] - tab2[tin]) q = 0 for k in range(idex * 5 + 1, (idex + 1) * 5 + 1): q = q + tab2['qHvacSens'].iloc[k] quantity.append(q / 5) p = (phig - plow) / 8 * float(s) + plow price.append(p) s = s + 1 curve.add(Point(q / 5, p)) p = 1.0 price.append(1.0) quantity.append(q / 5) curve.add(Point(q / 5, p)) tab = pd.DataFrame() tab['price'] = price tab['quantity'] = quantity tab.to_csv('dc_zone/' + str(x) + '_' + str(idex) + '.csv') return curve
def display_ineligible_points(self, scale: int): for point in self.ineligible_points: cir = Circle(Point(point.x * scale, point.y * scale), 8) cir.setOutline('red') cir.setFill('red') cir.draw(self.win)
def add_ineligible_point(self, x: int, y: int): self.ineligible_points.append(Point(x, y))