iesopt 2.0.0__tar.gz → 2.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iesopt
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: IESopt -- an Integrated Energy System Optimization framework.
5
5
  Home-page: https://github.com/ait-energy/iesopt
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "iesopt"
7
- version = "2.0.0"
7
+ version = "2.0.2"
8
8
  description = "IESopt -- an Integrated Energy System Optimization framework."
9
9
  keywords = ["integrated energy systems", "optimization", "energy model", "modelling"]
10
10
  authors = [
@@ -13,7 +13,7 @@ def _strtobool(val: str):
13
13
  class Config:
14
14
  DEFAULTS = {
15
15
  "IESOPT_JULIA": "1.11.1",
16
- "IESOPT_CORE": "2.0.0",
16
+ "IESOPT_CORE": "2.0.2",
17
17
  "IESOPT_JUMP": "1.23.5",
18
18
  "IESOPT_SOLVER_HIGHS": "1.12.1",
19
19
  "IESOPT_MULTITHREADED": "no", # yes, no
@@ -11,8 +11,8 @@ def initialize():
11
11
  return
12
12
 
13
13
  logger.info("Integrated Energy System Optimization (IESopt)")
14
- logger.info("© 2021 - now: AIT Austrian Institute of Technology GmbH")
15
- logger.info("Documentation: https://ait-energy.github.io/iesopt")
14
+ logger.info(" © 2021 - now: AIT Austrian Institute of Technology GmbH")
15
+ logger.info(" Documentation: https://ait-energy.github.io/iesopt")
16
16
 
17
17
  juliacall = setup_julia()
18
18
  julia = juliacall.Main
@@ -20,7 +20,9 @@ def initialize():
20
20
  set_iesopt_module_attr("juliacall", juliacall)
21
21
 
22
22
  import_modules()
23
- logger.info("Versions: py=%s, jl=%s" % (importlib.metadata.version("iesopt"), str(julia.pkgversion(julia.IESopt))))
23
+ logger.info(
24
+ "Loaded versions: py=%s, jl=%s" % (importlib.metadata.version("iesopt"), str(julia.pkgversion(julia.IESopt)))
25
+ )
24
26
 
25
27
  set_iesopt_module_attr("IESopt", julia.IESopt)
26
28
  set_iesopt_module_attr("JuMP", julia.JuMP)
@@ -35,6 +35,9 @@ def add_package(f_add, name: str, config: str, target: str):
35
35
 
36
36
 
37
37
  def setup_julia():
38
+ target = str((Path(__file__).parent / "..").resolve())
39
+ logger.info(f" Target for juliapkg: '{target}'")
40
+
38
41
  logger.info("Checking Julia environment")
39
42
 
40
43
  if "juliacall" in sys.modules:
@@ -60,9 +63,6 @@ def setup_julia():
60
63
  # Setup Julia (checking if it "looks" valid).
61
64
  import juliapkg
62
65
 
63
- target = str((Path(__file__).parent / "..").resolve())
64
- logger.info(f"Using temporary target for juliapkg: '{target}'")
65
-
66
66
  # Set Julia version.
67
67
  juliapkg.require_julia(f"={Config.get('julia')}", target=target)
68
68
 
@@ -114,6 +114,8 @@ def setup_julia():
114
114
  import juliacall
115
115
 
116
116
  logger.info("Julia setup complete")
117
+ logger.info(" Executable: %s" % juliapkg.executable())
118
+ logger.info(" Project: %s" % juliapkg.project())
117
119
 
118
120
  custom_packages = list(Config.find("pkg_"))
119
121
  if len(custom_packages) > 0:
@@ -132,5 +134,6 @@ def setup_julia():
132
134
 
133
135
 
134
136
  def import_modules():
137
+ logger.info("Importing Julia modules:")
135
138
  jl_import("IESopt")
136
139
  jl_import("JuMP")
@@ -14,7 +14,7 @@ def jl_safe_seval(code: str):
14
14
 
15
15
  def jl_import(module: str):
16
16
  """Import a Julia module."""
17
- logger.info("Importing Julia module `%s`" % module)
17
+ logger.info(" %s" % module)
18
18
  jl_safe_seval(f"import {module}")
19
19
 
20
20
 
@@ -61,11 +61,11 @@ def jl_docs(obj: str, module: str = "IESopt"):
61
61
 
62
62
 
63
63
  def recursive_convert_py2jl(item):
64
- juliacall = get_iesopt_module_attr("juliacall")
65
-
66
64
  if isinstance(item, dict):
65
+ juliacall = get_iesopt_module_attr("juliacall")
67
66
  return juliacall.Main.Dict({k: recursive_convert_py2jl(v) for (k, v) in item.items()})
68
67
  if isinstance(item, list):
68
+ juliacall = get_iesopt_module_attr("juliacall")
69
69
  return juliacall.convert(juliacall.Main.Vector, [recursive_convert_py2jl(v) for v in item])
70
70
 
71
71
  return item
@@ -182,6 +182,18 @@ class Model:
182
182
  except Exception:
183
183
  raise Exception(f"Error while retrieving component `{component}` from model")
184
184
 
185
+ def get_components(self, tagged=None):
186
+ """
187
+ Get all components of the model, possibly filtered by (a) tag(s).
188
+
189
+ Arguments:
190
+ tagged (str or list of str): The tag(s) to filter the components by, can be `None` (default) to get all components.
191
+ """
192
+ if tagged is None:
193
+ return self._IESopt.get_components(self.core)
194
+
195
+ return self._IESopt.get_components(self.core, recursive_convert_py2jl(tagged))
196
+
185
197
  def get_variable(self, component: str, variable: str):
186
198
  """Get a specific variable from a core component."""
187
199
  raise DeprecationWarning(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes