Skip to content

len(env.state_series()) different than env.observation_space.high.shape[0] #109

@Alfonso00MA

Description

@Alfonso00MA

Issue Type

Select one:

[] Bug report
[X] Question
[] Feature Request
[] Other

Fill these out:

  • python version: Python 3.10.13
  • python-microgrid version: python-microgrid==1.4.1

Question

  • Question:

I have been following the "Quick Start" section in the docs:

small_battery = BatteryModule(min_capacity=10,
                              max_capacity=100,
                              max_charge=50,
                              max_discharge=50,
                              efficiency=0.9,
                              init_soc=0.2)

large_battery = BatteryModule(min_capacity=10,
                              max_capacity=1000,
                              max_charge=10,
                              max_discharge=10,
                              efficiency=0.7,
                              init_soc=0.2)
                              
                              
load_ts = 100+100*np.random.rand(24*90) # random load data in the range [100, 200].
pv_ts = 200*np.random.rand(24*90) # random pv data in the range [0, 200].

load = LoadModule(time_series=load_ts)

pv = RenewableModule(time_series=pv_ts)


grid_ts = [0.2, 0.1, 0.5] * np.ones((24*90, 3))

grid = GridModule(max_import=100,
                  max_export=100,
                  time_series=grid_ts)
                  
                  
modules = [
    small_battery,
    large_battery,
    ('pv', pv),
    load,
    grid]

microgrid = Microgrid(modules)

Finally I created a discrete env with the following command:

env = DiscreteMicrogridEnv.from_microgrid(microgrid)

But I noticed the following assertion is not being satisfied. Contrary to what I expected:

assert(len(env.state_series()) == env.observation_space.high.shape[0])

However, the same assertion is satisfied in all the benchmark microgrids:

for i in range(25):
	env = DiscreteMicrogridEnv.from_scenario(microgrid_number=i)
	assert(len(env.state_series()) == env.observation_space.high.shape[0])

Is that the expected behauviour?
I am not sure if it should be reported as a bug or not.
Any clarification will be appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions