def performAction(self, action):
        """ Perform an action on the world that changes it's internal state.
        """
        gs = [g for g in self.case.online_generators if g.bus.type !=REFERENCE]

        assert len(action) == len(gs)

        logger.info("Action: %s" % list(action))

        # Set the output of each (non-reference) generator.
        for i, g in enumerate(gs):
            g.p = action[i]

        # Compute power flows and slack generator set-point.
        NewtonPF(self.case, verbose=False).solve()
        #FastDecoupledPF(self.case, verbose=False).solve()

        # Store all generator set-points (only used for plotting).
        self._Pg[:, self._step] = [g.p for g in self.case.online_generators]

        # Apply the next load profile value to the original demand at each bus.
        if self._step != len(self.profile) - 1:
            pq_buses = [b for b in self.case.buses if b.type == PQ]
            for i, b in enumerate(pq_buses):
                b.p_demand = self._Pd0[i] * self.profile[self._step + 1]

        self._step += 1

        logger.info("Entering step %d." % self._step)
def performAction ( self , action ) : gs = [ g for g in self . case . online_generators if g . bus . type != REFERENCE ] assert len ( action ) == len ( gs ) logger . info ( "Action: %s" % list ( action ) ) for i , g in enumerate ( gs ) : g . p = action [ i ] NewtonPF ( self . case , verbose = False ) . solve ( ) self . _Pg [ : , self . _step ] = [ g . p for g in self . case . online_generators ] if self . _step != len ( self . profile ) - 1 : pq_buses = [ b for b in self . case . buses if b . type == PQ ] for i , b in enumerate ( pq_buses ) : b . p_demand = self . _Pd0 [ i ] * self . profile [ self . _step + 1 ] self . _step += 1 logger . info ( "Entering step %d." % self . _step )
Perform an action on the world that changes it's internal state.