CityLearn 2.3.0__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/PKG-INFO +1 -1
  2. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/SOURCES.txt +8 -1
  3. {CityLearn-2.3.0 → CityLearn-2.4.0}/PKG-INFO +1 -1
  4. CityLearn-2.4.0/citylearn/__init__.py +1 -0
  5. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/base.py +1 -0
  6. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/rbc.py +98 -2
  7. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/base.py +19 -2
  8. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/building.py +447 -77
  9. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/citylearn.py +608 -158
  10. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/data.py +252 -53
  11. CityLearn-2.4.0/citylearn/electric_vehicle.py +162 -0
  12. CityLearn-2.4.0/citylearn/electric_vehicle_charger.py +465 -0
  13. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/energy_model.py +255 -40
  14. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/reward_function.py +145 -285
  15. CityLearn-2.4.0/citylearn/tests/test_battery.py +324 -0
  16. CityLearn-2.4.0/citylearn/tests/test_electric_vehicle.py +104 -0
  17. CityLearn-2.4.0/citylearn/tests/test_electric_vehicle_charger.py +430 -0
  18. CityLearn-2.4.0/citylearn/tests/test_pv.py +136 -0
  19. CityLearn-2.4.0/citylearn/tests/test_washing_machine.py +113 -0
  20. CityLearn-2.4.0/citylearn/tests/test_weather.py +57 -0
  21. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/utilities.py +0 -1
  22. CityLearn-2.3.0/citylearn/electric_vehicle.py +0 -437
  23. CityLearn-2.3.0/citylearn/electric_vehicle_charger.py +0 -352
  24. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/dependency_links.txt +0 -0
  25. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/entry_points.txt +0 -0
  26. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/requires.txt +0 -0
  27. {CityLearn-2.3.0 → CityLearn-2.4.0}/CityLearn.egg-info/top_level.txt +0 -0
  28. {CityLearn-2.3.0 → CityLearn-2.4.0}/LICENSE +0 -0
  29. {CityLearn-2.3.0 → CityLearn-2.4.0}/MANIFEST.in +0 -0
  30. {CityLearn-2.3.0 → CityLearn-2.4.0}/README.md +0 -0
  31. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/__main__.py +0 -0
  32. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/__init__.py +0 -0
  33. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/marlisa.py +0 -0
  34. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/q_learning.py +0 -0
  35. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/rlc.py +0 -0
  36. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/agents/sac.py +0 -0
  37. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-0-charge-0.png +0 -0
  38. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-0-charge-1.png +0 -0
  39. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-0-charge-2.png +0 -0
  40. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-0-charge-3.png +0 -0
  41. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-1-charge-0.png +0 -0
  42. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-1-charge-1.png +0 -0
  43. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-1-charge-2.png +0 -0
  44. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/building-1-charge-3.png +0 -0
  45. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/glow.png +0 -0
  46. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/assets/grid.png +0 -0
  47. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/cost_function.py +0 -0
  48. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/dynamics.py +0 -0
  49. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/__init__.py +0 -0
  50. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/clustering.py +0 -0
  51. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/lstm_model/__init__.py +0 -0
  52. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/lstm_model/model.py +0 -0
  53. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/lstm_model/model_generation.py +0 -0
  54. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/lstm_model/model_generation_wrapper.py +0 -0
  55. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/lstm_model/preprocessing.py +0 -0
  56. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/neighborhood.py +0 -0
  57. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/end_use_load_profiles/simulate.py +0 -0
  58. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/create_zone_metadata.sql +0 -0
  59. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/select_citylearn_energy_simulation.sql +0 -0
  60. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/select_citylearn_weather.sql +0 -0
  61. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/select_ideal_loads.sql +0 -0
  62. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/select_lstm_training_data.sql +0 -0
  63. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/queries/select_zone_conditioning_metadata.sql +0 -0
  64. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/misc/settings.yaml +0 -0
  65. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/occupant.py +0 -0
  66. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/power_outage.py +0 -0
  67. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/preprocessing.py +0 -0
  68. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/rl.py +0 -0
  69. {CityLearn-2.3.0/citylearn → CityLearn-2.4.0/citylearn/tests}/__init__.py +0 -0
  70. {CityLearn-2.3.0 → CityLearn-2.4.0}/citylearn/wrappers.py +0 -0
  71. {CityLearn-2.3.0 → CityLearn-2.4.0}/setup.cfg +0 -0
  72. {CityLearn-2.3.0 → CityLearn-2.4.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CityLearn
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: An open source Farama Foundation Gymnasium environment for benchmarking distributed energy resource control algorithms to provide energy flexibility in a district of buildings.
5
5
  Home-page: https://github.com/intelligent-environments-lab/CityLearn
6
6
  Author: Jose Ramon Vazquez-Canteli, Kingsley Nweye, Zoltan Nagy
@@ -58,4 +58,11 @@ citylearn/misc/queries/select_citylearn_energy_simulation.sql
58
58
  citylearn/misc/queries/select_citylearn_weather.sql
59
59
  citylearn/misc/queries/select_ideal_loads.sql
60
60
  citylearn/misc/queries/select_lstm_training_data.sql
61
- citylearn/misc/queries/select_zone_conditioning_metadata.sql
61
+ citylearn/misc/queries/select_zone_conditioning_metadata.sql
62
+ citylearn/tests/__init__.py
63
+ citylearn/tests/test_battery.py
64
+ citylearn/tests/test_electric_vehicle.py
65
+ citylearn/tests/test_electric_vehicle_charger.py
66
+ citylearn/tests/test_pv.py
67
+ citylearn/tests/test_washing_machine.py
68
+ citylearn/tests/test_weather.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CityLearn
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: An open source Farama Foundation Gymnasium environment for benchmarking distributed energy resource control algorithms to provide energy flexibility in a district of buildings.
5
5
  Home-page: https://github.com/intelligent-environments-lab/CityLearn
6
6
  Author: Jose Ramon Vazquez-Canteli, Kingsley Nweye, Zoltan Nagy
@@ -0,0 +1 @@
1
+ __version__ = '2.4.0'
@@ -33,6 +33,7 @@ class Agent(Environment):
33
33
  seconds_per_time_step=self.env.unwrapped.seconds_per_time_step,
34
34
  random_seed=self.env.unwrapped.random_seed,
35
35
  episode_tracker=self.env.unwrapped.episode_tracker,
36
+ time_step_ratio=self.env.unwrapped.time_step_ratio
36
37
  )
37
38
  self.reset()
38
39
 
@@ -343,7 +343,7 @@ class BasicBatteryRBC(BasicRBC):
343
343
 
344
344
  for n in action_names:
345
345
  action_map[n] = {}
346
-
346
+
347
347
  if 'storage' in n:
348
348
  for hour in Building.get_periodic_observation_metadata()['hour']:
349
349
  if 6 <= hour <= 14:
@@ -387,4 +387,100 @@ class BasicBatteryRBC(BasicRBC):
387
387
  else:
388
388
  raise ValueError(f'Unknown action name: {n}')
389
389
 
390
- HourRBC.action_map.fset(self, action_map)
390
+ HourRBC.action_map.fset(self, action_map)
391
+
392
+ class BasicElectricVehicleRBC_ReferenceController(BasicRBC): #change the name
393
+ r"""A rule-based controller that charges EVs to the maximum of the chargers and to the maximum of the battery upon connection.
394
+
395
+ The EV battery is charged at the maximum available charging power whenever it is connected.
396
+
397
+ Parameters
398
+ ----------
399
+ env: CityLearnEnv
400
+ CityLearn environment.
401
+
402
+ Other Parameters
403
+ ----------------
404
+ **kwargs: Any
405
+ Other keyword arguments used to initialize super class.
406
+ """
407
+
408
+ def __init__(self, env: CityLearnEnv, **kwargs: Any):
409
+ super().__init__(env, **kwargs)
410
+
411
+ @HourRBC.action_map.setter
412
+ def action_map(self, action_map: Union[
413
+ List[Mapping[str, Mapping[int, float]]], Mapping[str, Mapping[int, float]], Mapping[int, float]]):
414
+ if action_map is None:
415
+ action_map = {}
416
+ action_names = [a_ for a in self.action_names for a_ in a]
417
+ action_names = list(set(action_names))
418
+
419
+ for n in action_names:
420
+ action_map[n] = {}
421
+
422
+ if n == "electrical_storage":
423
+ for hour in Building.get_periodic_observation_metadata()['hour']:
424
+ if 9 <= hour <= 21:
425
+ value = -0.08
426
+ elif (1 <= hour <= 8) or (22 <= hour <= 24):
427
+ value = 0.091
428
+ else:
429
+ value = 0.0
430
+
431
+ action_map[n][hour] = value
432
+
433
+ elif n == 'cooling_device':
434
+ for hour in Building.get_periodic_observation_metadata()['hour']:
435
+ if 9 <= hour <= 21:
436
+ value = 0.8
437
+ elif (1 <= hour <= 8) or (22 <= hour <= 24):
438
+ value = 0.4
439
+ else:
440
+ value = 0.0
441
+
442
+ action_map[n][hour] = value
443
+
444
+ elif n == 'heating_device':
445
+ for hour in Building.get_periodic_observation_metadata()['hour']:
446
+ if 9 <= hour <= 21:
447
+ value = 0.4
448
+ elif (1 <= hour <= 8) or (22 <= hour <= 24):
449
+ value = 0.8
450
+ else:
451
+ value = 0.0
452
+
453
+ action_map[n][hour] = value
454
+
455
+ elif n == 'cooling_or_heating_device':
456
+ for hour in Building.get_periodic_observation_metadata()['hour']:
457
+ if hour < 7:
458
+ value = 0.4
459
+
460
+ elif hour < 21:
461
+ value = -0.4
462
+
463
+ else:
464
+ value = 0.8
465
+
466
+ action_map[n][hour] = value
467
+
468
+ elif "electric_vehicle" in n:
469
+ for hour in Building.get_periodic_observation_metadata()['hour']:
470
+ value = 1
471
+ action_map[n][hour] = value
472
+
473
+ elif "dhw_storage" in n:
474
+ for hour in Building.get_periodic_observation_metadata()['hour']:
475
+ value = 1
476
+ action_map[n][hour] = value
477
+
478
+ elif "washing_machine" in n:
479
+ for hour in Building.get_periodic_observation_metadata()['hour']:
480
+ value = 1
481
+ action_map[n][hour] = value
482
+
483
+ else:
484
+ raise ValueError(f'Unknown action name: {n}')
485
+
486
+ HourRBC.action_map.fset(self, action_map)
@@ -153,12 +153,13 @@ class Environment:
153
153
  DEFAULT_SECONDS_PER_TIME_STEP = 3600.0
154
154
  DEFAULT_RANDOM_SEED_RANGE = (0, 100_000_000)
155
155
 
156
- def __init__(self, seconds_per_time_step: float = None, random_seed: int = None, episode_tracker: EpisodeTracker = None):
156
+ def __init__(self, seconds_per_time_step: float = None, random_seed: int = None, episode_tracker: EpisodeTracker = None, time_step_ratio: int = None):
157
157
  self.seconds_per_time_step = seconds_per_time_step
158
158
  self.__uid = uuid.uuid4().hex
159
159
  self.random_seed = random_seed
160
160
  self.__time_step = None
161
161
  self.episode_tracker = episode_tracker
162
+ self.time_step_ratio = time_step_ratio
162
163
 
163
164
  @property
164
165
  def uid(self) -> str:
@@ -178,6 +179,13 @@ class Environment:
178
179
  current episode time steps for reading observations from data files."""
179
180
 
180
181
  return self.__episode_tracker
182
+
183
+ @property
184
+ def time_step_ratio(self) -> int:
185
+ """:py:class:`citylearn.base.EpisodeTracker` object used to keep track of
186
+ current episode time steps for reading observations from data files."""
187
+
188
+ return self.__time_step_ratio
181
189
 
182
190
  @property
183
191
  def time_step(self) -> int:
@@ -213,6 +221,14 @@ class Environment:
213
221
  @episode_tracker.setter
214
222
  def episode_tracker(self, episode_tracker: EpisodeTracker):
215
223
  self.__episode_tracker = episode_tracker
224
+
225
+ @time_step_ratio.setter
226
+ def time_step_ratio(self, time_step_ratio: int):
227
+ self.__time_step_ratio = time_step_ratio
228
+
229
+ @time_step.setter
230
+ def time_step(self, time_step: int):
231
+ self.__time_step = time_step
216
232
 
217
233
  def get_metadata(self) -> Mapping[str, Any]:
218
234
  """Returns general static information."""
@@ -221,7 +237,8 @@ class Environment:
221
237
  'uid': self.uid,
222
238
  'random_seed': self.random_seed,
223
239
  'simulation_time_steps': self.episode_tracker.simulation_time_steps,
224
- 'seconds_per_time_step': self.seconds_per_time_step
240
+ 'seconds_per_time_step': self.seconds_per_time_step,
241
+ 'time_step_ratio': self.time_step_ratio,
225
242
  }
226
243
 
227
244
  def next_time_step(self):