Esempio n. 1
0
    def __init__(
            self,
            power_rating=2.0,      # MW
            capacity=4.0,          # MWh
            round_trip_eff=0.9,    # %
            initial_charge=0.5,    # %
            **kwargs
    ):

        self.power_rating = float(power_rating)
        self.capacity = float(capacity)
        self.round_trip_eff = float(round_trip_eff)
        self.initial_charge = initial_charge   # can be 'random' or float
        super().__init__(**kwargs)

        """
        action space has a single dimension, ranging from max charge
        to max discharge

        for a 2 MW battery, a range of -2 to 2 MW
        """
        self.action_space = GlobalSpace('action').from_spaces(
            ContinuousSpace(-self.power_rating, self.power_rating),
            'Rate [MW]'
        )
        self.action_space.no_op = np.array([0]).reshape(1, 1)

        self.state_space.extend(ContinuousSpace(0, self.capacity),
                                'C_charge_level [MWh]')

        self.observation_space.extend(ContinuousSpace(0, self.capacity),
                                      'C_charge_level [MWh]')
Esempio n. 2
0
    def __init__(self):
        env = gym.make('MountainCar-v0')
        super(MountainCarEnv, self).__init__(env)

        self.observation_space = self.env.observation_space

        self.action_space = GlobalSpace('action').from_spaces(
            DiscreteSpace(2), 'push_l_or_r')
Esempio n. 3
0
    def __init__(self):
        env = gym.make('Pendulum-v0')
        super(PendulumEnv, self).__init__(env)

        self.observation_space = self.env.observation_space

        self.action_space = GlobalSpace('action').from_spaces(
            ContinuousSpace(low=-env.env.max_torque, high=env.env.max_torque),
            'applied_torque')
Esempio n. 4
0
    def __init__(
            self,
            capacity=4.0,  # MWh
            supply_capacity=0.5,  # MWh
            release_time=12,  # num 5 mins
            supply_power=0.05,  # MW
            **kwargs):

        self.capacity = float(capacity)

        #  this should look at the max of the data - TODO
        self.supply_capacity = float(supply_capacity)

        self.release_time = int(release_time)

        super().__init__(**kwargs)
        """
        action space has a single discrete dimension
        0 = no op
        1 = increase setpoint
        2 = decrease setpoint
        """
        self.action_space = GlobalSpace('action').from_spaces(
            DiscreteSpace(3), 'setpoint')

        self.action_space.no_op = np.array([0]).reshape(1, 1)

        self.state_space.extend(
            [
                ContinuousSpace(0, self.episode_length),
                ContinuousSpace(0, self.capacity),
                ContinuousSpace(0, self.supply_capacity)
            ],
            ['Step', 'C_stored_demand [MWh]', 'C_stored_supply[MWh]'],
        )

        #  let our agent see the stored demand
        #  let our agent see the stored supply
        #  see precool power?

        #  obs space is created during env init
        self.observation_space.extend(
            [
                ContinuousSpace(0, self.capacity),
                ContinuousSpace(0, self.supply_capacity)
            ],
            ['C_stored_demand [MWh]', 'C_stored_supply[MWh]'],
        )

        #  supply = precooling
        #  i.e how much power we consume during precooling
        self.supply_power = float(
            max(float(supply_power),
                self.state_space.data.loc[:, 'C_demand [MW]'].max()))