def offers_to_pwl(self, offers):
        assert not self.is_load
        g_offers = [offer for offer in offers if offer.generator == self]
        gt_zero = [offr for offr in g_offers if round(offr.quantity, 4) > 0.0]
        valid = [offer for offer in gt_zero if not offer.withheld]
        p_offers = [v for v in valid if not v.reactive]
        q_offers = [v for v in valid if v.reactive]
        if p_offers:
            self.p_cost = self._offbids_to_points(p_offers)
            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
            if q_offers:
                self.p_min = 0.0
                self.p_max = 0.0
                self.online = True
            else:
                self.online = False
        if q_offers:
            self.q_cost = self._offbids_to_points(q_offers)
            self.qcost_model = PW_LINEAR
        else:
            self.q_cost = None
            self.qcost_model = PW_LINEAR
        if not len(p_offers) and not len(q_offers):
            logger.info("No valid offers for generator [%s], shutting down." %
                        self.name)
            self.online = False
        self._adjust_limits()