code: def bids_to_pwl(self, bids):
          assert self.is_load
          vl_bids = [bid for bid in bids if bid.vLoad == self]
          gt_zero = [bid for bid in vl_bids if round(bid.quantity, 4) > 0.0]
          valid_bids = [bid for bid in gt_zero if not bid.withheld]
          p_bids = [v for v in valid_bids if not v.reactive]
          q_bids = [v for v in valid_bids if v.reactive]
          if p_bids:
              self.p_cost = self._offbids_to_points(p_bids, True)
              self.pcost_model = PW_LINEAR
              self.online = True
          else:
              self.p_cost = [(0.0, 0.0), (self.p_max, 0.0)]
              self.pcost_model = PW_LINEAR
              logger.info("No valid active power bids for dispatchable load "
                          "[%s], shutting down." % self.name)
              self.online = False
          if q_bids:
              self.q_cost = self._offbids_to_points(q_bids, True)
              self.qcost_model = PW_LINEAR
              self.online = True
          else:
              self.q_cost = [(self.q_min, 0.0), (0.0, 0.0), (self.q_max, 0.0)]
              self.qcost_model = PW_LINEAR
          self._adjust_limits()