本文整理汇总了Python中volttron.platform.agent.base_market_agent.poly_line.PolyLine类的典型用法代码示例。如果您正苦于以下问题:Python PolyLine类的具体用法?Python PolyLine怎么用?Python PolyLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PolyLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_electric_demand_curve
def create_electric_demand_curve(self, aggregate_air_demand):
curve = PolyLine()
for point in aggregate_air_demand.points:
curve.add(Point(price=point.y, quantity=self.calcTotalLoad(point.x)))
self.buyBidCurve = curve
_log.debug("Report aggregated curve : {}".format(curve.points))
return curve
示例2: create_demand_curve
def create_demand_curve():
demand_curve = PolyLine()
price = 0
quantity = 1000
demand_curve.add(Point(price,quantity))
price = 1000
quantity = 0
demand_curve.add(Point(price,quantity))
return demand_curve
示例3: create_supply_curve
def create_supply_curve(self):
supply_curve = PolyLine()
price = self.price
quantity = self.infinity
supply_curve.add(Point(price=price, quantity=quantity))
price = self.price
quantity = 0
supply_curve.add(Point(price=price, quantity=quantity))
return supply_curve
示例4: create_supply_curve
def create_supply_curve():
supply_curve = PolyLine()
price = 0
quantity = 0
supply_curve.add(Point(price,quantity))
price = 1000
quantity = 1000
supply_curve.add(Point(price,quantity))
return supply_curve
示例5: create_air_supply_curve
def create_air_supply_curve(self, electric_price, electric_quantity):
supply_curve = PolyLine()
price = 65
quantity = 100000
supply_curve.add(Point(price=price,quantity=quantity))
price = 65
quantity = 0 # negative quantities are not real -1*10000
supply_curve.add(Point(price=price,quantity=quantity))
return supply_curve
示例6: create_demand_curve
def create_demand_curve(self):
self.demand_curve = PolyLine()
pMin = 10
pMax = 100
if (self.hvacAvail > 0):
self.demand_curve.add(Point(price=min(pMin, pMax),quantity=max(self.qMin, self.qMax)*self.Pabsnom))
self.demand_curve.add(Point(price=max(pMin, pMax),quantity=min(self.qMin, self.qMax)*self.Pabsnom))
else:
self.demand_curve.add(Point(price=max(pMin, pMax), quantity=0))
self.demand_curve.add(Point(price=min(pMin, pMax),quantity=0))
return self.demand_curve
示例7: settle
def settle(self):
enough_buys = len(self._buy_offers) > 0
enough_sells = len(self._sell_offers) > 0
if enough_buys:
demand_curve = self._aggregate(self._buy_offers)
else:
_log.debug("There are no buy offers.")
if enough_sells:
supply_curve = self._aggregate(self._sell_offers)
else:
_log.debug("There are no sell offers.")
if enough_buys and enough_sells:
intersection = PolyLine.intersection(demand_curve, supply_curve)
else:
intersection = None, None, {}
quantity = intersection[0]
price = intersection[1]
aux = PolyLine.compare(demand_curve, supply_curve)
return quantity, price, aux
示例8: test_poly_line_sum_first_none
def test_poly_line_sum_first_none():
sum = PolyLine.sum(None,2)
assert sum == 2
示例9: test_poly_line_max_second_none
def test_poly_line_max_second_none():
max = PolyLine.max(1,None)
assert max == 1
示例10: test_poly_line_sum
def test_poly_line_sum():
sum = PolyLine.sum(1,2)
assert sum == 3
示例11: test_poly_line_max
def test_poly_line_max():
max = PolyLine.max(1,2)
assert max == 2
示例12: test_poly_line_max_first_none
def test_poly_line_max_first_none():
max = PolyLine.max(None,2)
assert max == 2
示例13: fromTupples
def fromTupples(points):
polyLine = PolyLine()
for p in points:
if p is not None and len(p) == 2:
polyLine.add(Point(p[0], p[1]))
return polyLine
示例14: test_poly_line_min_second_none
def test_poly_line_min_second_none():
min = PolyLine.min(1,None)
assert min == 1
示例15: test_poly_line_sum_second_none
def test_poly_line_sum_second_none():
sum = PolyLine.sum(1,None)
assert sum == 1