ugr-sail / sinergym

Gym environment for building simulation and control using reinforcement learning
https://ugr-sail.github.io/sinergym/
MIT License
129 stars 35 forks source link

[BUG]: Unregistered error for data center and IWM environments. #163

Closed tummalapallimurali closed 2 years ago

tummalapallimurali commented 2 years ago

Bug 🐛

Unregistered error for data center environments.

To Reproduce

gym.error.UnregisteredEnv: No registered env with id: Eplus-datacenter-discrete-v, Eplus-datacenter-continuous-v1 , Eplus-datacenter-discrete-stochastic-v1 , Eplus-datacenter-continuous-stochastic-v1. This is also happening for IWMullion environments. Other environments work fine. I already included "Import sinergym" in the code.

Steps to reproduce the behavior.

**

**root@58f4215b445a:/workspaces/sinergym# /usr/bin/python /workspaces/sinergym/DRL_battery.py --environment Eplus-IWMullion-discrete-v1 --episodes 1 --algorithm PPO --logger --tensorboard /Users/Murali/sinergym/tensor Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/gym/envs/registration.py", line 150, in spec return self.env_specs[id] KeyError: 'Eplus-IWMullion-discrete-v1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/workspaces/sinergym/DRL_battery.py", line 204, in env = gym.make(args.environment, reward=LinearReward()) File "/usr/local/lib/python3.9/dist-packages/gym/envs/registration.py", line 184, in make return registry.make(id, kwargs) File "/usr/local/lib/python3.9/dist-packages/gym/envs/registration.py", line 105, in make spec = self.spec(path) File "/usr/local/lib/python3.9/dist-packages/gym/envs/registration.py", line 167, in spec raise error.UnregisteredEnv("No registered env with id: {}".format(id)) gym.error.UnregisteredEnv: No registered env with id: Eplus-IWMullion-discrete-v1

**

from sinergym import ...
Traceback (most recent call last): File ...

Expected behavior

I am expecting simulation files to be created with monitor.csv and progress.csv.

System Info

Describe the characteristic of your environment:

Additional context

Add any other context about the problem here.

Checklist

:pencil: Please, don't forget to include more labels besides bug if it is necessary.

AlejandroCN7 commented 2 years ago

Hi @tummalapallimurali! I think you are using names of environments that do not exist. For example, try the following code for a datacenter simulation (it works):

import gym
import numpy as np
import sinergym

env = gym.make('Eplus-datacenter-hot-discrete-stochastic-v1')
for i in range(1):
    obs = env.reset()
    rewards = []
    done = False
    current_month = 0
    while not done:
        a = env.action_space.sample()
        obs, reward, done, info = env.step(a)
        rewards.append(reward)
        if info['month'] != current_month:  # display results every month
            current_month = info['month']
            print('Reward: ', sum(rewards), info)
    print(
        'Episode ',
        i,
        'Mean reward: ',
        np.mean(rewards),
        'Cumulative reward: ',
        sum(rewards))
env.close()

Edit: I just checked that the list of environment names provided in the documentation is out of date. I apologize for this. Please see the list of names here while it is being fixed (id parameter it is environment name).