rtc-tools 2.7.0a3__py3-none-any.whl → 2.7.0.dev2__py3-none-any.whl

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.

Potentially problematic release.


This version of rtc-tools might be problematic. Click here for more details.

@@ -1,12 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: rtc-tools
3
- Version: 2.7.0a3
3
+ Version: 2.7.0.dev2
4
4
  Summary: Toolbox for control and optimization of water systems.
5
5
  Home-page: https://oss.deltares.nl/web/rtc-tools/home
6
+ Download-URL: http://gitlab.com/deltares/rtc-tools/
6
7
  Author: Deltares
7
8
  Maintainer: Deltares
8
- License: UNKNOWN
9
- Download-URL: http://gitlab.com/deltares/rtc-tools/
10
9
  Platform: Windows
11
10
  Platform: Linux
12
11
  Platform: Mac OS-X
@@ -24,20 +23,29 @@ Classifier: Operating System :: Microsoft :: Windows
24
23
  Classifier: Operating System :: POSIX
25
24
  Classifier: Operating System :: Unix
26
25
  Classifier: Operating System :: MacOS
27
- Requires-Python: >=3.8
26
+ Requires-Python: >=3.9
28
27
  License-File: COPYING.LESSER
29
- Requires-Dist: casadi ==3.6.*,>=3.6.3
30
- Requires-Dist: numpy <1.26,>=1.16.0
31
- Requires-Dist: scipy <1.11,>=1.0.0
32
- Requires-Dist: pymoca ==0.9.*,>=0.9.1
33
- Requires-Dist: rtc-tools-channel-flow >=1.2.0
34
- Requires-Dist: defusedxml >=0.7.0
35
- Provides-Extra: all
36
- Requires-Dist: netCDF4 ; extra == 'all'
28
+ Requires-Dist: casadi!=3.6.6,==3.6.*,>=3.6.3
29
+ Requires-Dist: numpy>=1.16.0
30
+ Requires-Dist: scipy>=1.0.0
31
+ Requires-Dist: pymoca==0.9.*,>=0.9.1
32
+ Requires-Dist: rtc-tools-channel-flow>=1.2.0
33
+ Requires-Dist: defusedxml>=0.7.0
37
34
  Provides-Extra: netcdf
38
- Requires-Dist: netCDF4 ; extra == 'netcdf'
35
+ Requires-Dist: netCDF4; extra == "netcdf"
36
+ Provides-Extra: all
37
+ Requires-Dist: netCDF4; extra == "all"
38
+ Dynamic: author
39
+ Dynamic: classifier
40
+ Dynamic: description
41
+ Dynamic: download-url
42
+ Dynamic: home-page
43
+ Dynamic: maintainer
44
+ Dynamic: platform
45
+ Dynamic: provides-extra
46
+ Dynamic: requires-dist
47
+ Dynamic: requires-python
48
+ Dynamic: summary
39
49
 
40
50
  RTC-Tools is the Deltares toolbox for control and optimization of water systems.
41
51
 
42
-
43
-
@@ -1,5 +1,5 @@
1
1
  rtctools/__init__.py,sha256=91hvS2-ryd2Pvw0COpsUzTwJwSnTZ035REiej-1hNI4,107
2
- rtctools/_version.py,sha256=NDNDfYdfbfnXYIbOXMs5aKbrACG7Okc9i2sbnNx2dZU,499
2
+ rtctools/_version.py,sha256=MKiTFKmzZzk3ruW9CeIqZv3Ttm1g0-MB9CDCLpfrPnw,502
3
3
  rtctools/rtctoolsapp.py,sha256=UnkuiJhv0crEEVs8H6PYvMuc2y_q6V_xLuyKEgXj9GM,4200
4
4
  rtctools/util.py,sha256=PaeKfDUA174ODZbY5fZjCTf-F-TdhW7yEuP189Ro190,9075
5
5
  rtctools/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,29 +8,29 @@ rtctools/_internal/caching.py,sha256=p4gqSL7kCI7Hff-KjMEP7mhJCQSiU_lYm2MR7E18gBM
8
8
  rtctools/_internal/casadi_helpers.py,sha256=oAf5zyFkZbaMhvhgMnQkOi2A6dBOzj-VAUkYwBf-Jxk,1410
9
9
  rtctools/_internal/debug_check_helpers.py,sha256=UgQTEPw4PyR7MbYLewSSWQqTwQj7xr5yUBk820O9Kk4,1084
10
10
  rtctools/data/__init__.py,sha256=EllgSmCdrlvQZSd1VilvjPaeYJGhY9ErPiQtedmuFoA,157
11
- rtctools/data/csv.py,sha256=iYOEED3AaNxt4ews_aAkHfl9Tq9a-9vjxvYwjVR_lQE,5231
11
+ rtctools/data/csv.py,sha256=hEpoTH3nhZaAvRN4r-9-nYeAjaFiNDRoiZWg8GxM3yo,5539
12
12
  rtctools/data/netcdf.py,sha256=xpk4Ggl7gItNG6lO7p3OJPR-elK8_CiCtxUI7cX0gwk,19109
13
- rtctools/data/pi.py,sha256=VZNLtaYTdyXFVbM6rLM8BKMnyRs-H3NwKz955Mp-KTc,46988
13
+ rtctools/data/pi.py,sha256=5w50zWgI79Vu5EMMz-MKoManXYqsjxfFgcZN6Z3eeiQ,46638
14
14
  rtctools/data/rtc.py,sha256=1yGJZGq2Z36MYLiLuZaHnxupL4mgw-Wuu54PAG05kcM,9077
15
15
  rtctools/data/storage.py,sha256=67J4BRTl0AMEzlKNZ8Xdpy_4cGtwx8Lo_tL2n0G4S9w,13206
16
16
  rtctools/data/interpolation/__init__.py,sha256=GBubCIT5mFoSTV-lOk7cpwvZekNMEe5bvqSQJ9HE34M,73
17
17
  rtctools/data/interpolation/bspline.py,sha256=qevB842XWCH3fWlWMBqKMy1mw37ust-0YtSnb9PKCEc,948
18
- rtctools/data/interpolation/bspline1d.py,sha256=hQrok4rrBcJV_HciuFjZYSwrSP8w_VufQRP6JLZhA7U,6106
18
+ rtctools/data/interpolation/bspline1d.py,sha256=HAh7m5xLBuiFKzMzuYEqZX_GmCPChKjV7ynTS6iRZOc,6166
19
19
  rtctools/data/interpolation/bspline2d.py,sha256=ScmX0fPDxbUVtj3pbUE0L7UJocqroD_6fUT-4cvdRMc,1693
20
20
  rtctools/optimization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  rtctools/optimization/collocated_integrated_optimization_problem.py,sha256=Bv1a1O4QTAdIpe9SOA9_oEDDph-oj-9q5yfN4SFMdW8,131343
22
22
  rtctools/optimization/control_tree_mixin.py,sha256=CC6TWp3kFQgMokx6213pRLx9iY17Fd0VcwG4Wpwa0Uo,8974
23
23
  rtctools/optimization/csv_lookup_table_mixin.py,sha256=h4WKuPR1BJbYuJfQ9lx4rXalB6yYK-zajINabRL7BrA,17298
24
24
  rtctools/optimization/csv_mixin.py,sha256=sRp5paHWfCw2bz-23Nw-HdFLS3CZTpVwaBdFo98DbvE,12252
25
- rtctools/optimization/goal_programming_mixin.py,sha256=GK25DrbAY_rMsra080pSCDZwzLQNN2Ppd-2d0_FEllg,32999
26
- rtctools/optimization/goal_programming_mixin_base.py,sha256=oh9CsEiyYTmthcfvRbX-9Z9bIo6SHv_DCiVt9kx0sjI,43781
25
+ rtctools/optimization/goal_programming_mixin.py,sha256=r2pPzcqi-VlstPx4CdtUT0JeemduiYBV5zeH4kA9QGs,33301
26
+ rtctools/optimization/goal_programming_mixin_base.py,sha256=IvA3cfJmUW9SaDGATD7r4Rrjku9T4oI2H68imPTlq2A,43816
27
27
  rtctools/optimization/homotopy_mixin.py,sha256=Kh0kMfxB-Fo1FBGW5tPOQk24Xx_Mmw_p0YuSQotdkMU,6905
28
28
  rtctools/optimization/initial_state_estimation_mixin.py,sha256=74QYfG-VYYTNVg-kAnCG6QoY3_sUmaID0ideF7bPkkY,3116
29
29
  rtctools/optimization/io_mixin.py,sha256=AsZQ7YOUcUbWoczmjTXaSje5MUEsPNbQyZBJ6qzSjzU,11821
30
30
  rtctools/optimization/linearization_mixin.py,sha256=mG5S7uwvwDydw-eBPyQKnLyKoy08EBjQh25vu97afhY,1049
31
31
  rtctools/optimization/linearized_order_goal_programming_mixin.py,sha256=LQ2qpYt0YGLpEoerif4FJ5wwzq16q--27bsRjcqIU5A,9087
32
32
  rtctools/optimization/min_abs_goal_programming_mixin.py,sha256=WMOv9EF8cfDJgTunzXfI_cUmBSQK26u1HJB_9EAarfM,14031
33
- rtctools/optimization/modelica_mixin.py,sha256=6rotTEge4l2oDib4tnG2ccXqG1ryEzNxbRkk_StFAHg,17769
33
+ rtctools/optimization/modelica_mixin.py,sha256=9MnZ2tz9WWMeUg7UuS7TNOuqvfZhuTDvZsDfS6HcBIo,17796
34
34
  rtctools/optimization/netcdf_mixin.py,sha256=-zkXh3sMYE50c3kHsrmUVGWMSFm-0cXQpGrCm0yn-Tc,7563
35
35
  rtctools/optimization/optimization_problem.py,sha256=qzpc81NaZMeoXKuayFmBF15iXYuNAk5yxmaER_Gcz_A,44131
36
36
  rtctools/optimization/pi_mixin.py,sha256=n_ZyifuNPxcRoJXKR6Ks7DgK_b7-EToYJ23_khOwpzo,11786
@@ -42,9 +42,9 @@ rtctools/simulation/csv_mixin.py,sha256=rGDUFPsqGHmF0_dWdXeWzWzMpkPmwCNweTBVrwSh
42
42
  rtctools/simulation/io_mixin.py,sha256=SJasNGI--OQ9Y-Z61oeeaGCxSrNddYz4AOVfJYbmf74,6209
43
43
  rtctools/simulation/pi_mixin.py,sha256=vcizArZsOn7tGlSFCsUmkjmRFA1A1kMNqUllLlkVc9Y,9831
44
44
  rtctools/simulation/simulation_problem.py,sha256=8k3MjznzvFIut04NAiu7UAhfndAvNTkQFsO9vbmNd-0,49567
45
- rtc_tools-2.7.0a3.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
46
- rtc_tools-2.7.0a3.dist-info/METADATA,sha256=o9lVOLg5xdv9pe2GRSjdPr0_6ubcI7SvqPc6jOU9gRc,1494
47
- rtc_tools-2.7.0a3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
48
- rtc_tools-2.7.0a3.dist-info/entry_points.txt,sha256=-x622IB_l1duw2M6t6syfQ4yzOiQTp0IZxKGcYRgWgk,151
49
- rtc_tools-2.7.0a3.dist-info/top_level.txt,sha256=pnBrb58PFPd1kp1dqa-JHU7R55h3alDNJIJnF3Jf9Dw,9
50
- rtc_tools-2.7.0a3.dist-info/RECORD,,
45
+ rtc_tools-2.7.0.dev2.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
46
+ rtc_tools-2.7.0.dev2.dist-info/METADATA,sha256=MKSiD7EB2VvL5lozEHyI4TSLh5tvIVAhgxr-6_QQkAw,1691
47
+ rtc_tools-2.7.0.dev2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
48
+ rtc_tools-2.7.0.dev2.dist-info/entry_points.txt,sha256=DVS8sWf3b9ph9h8srEr6zmQ7ZKGwblwgZgGPZg-jRNQ,150
49
+ rtc_tools-2.7.0.dev2.dist-info/top_level.txt,sha256=pnBrb58PFPd1kp1dqa-JHU7R55h3alDNJIJnF3Jf9Dw,9
50
+ rtc_tools-2.7.0.dev2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,4 +1,3 @@
1
1
  [console_scripts]
2
2
  rtc-tools-copy-libraries = rtctools.rtctoolsapp:copy_libraries
3
3
  rtc-tools-download-examples = rtctools.rtctoolsapp:download_examples
4
-
rtctools/_version.py CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # This file was generated by 'versioneer.py' (0.18) from
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
3
  # revision-control system data, or from the parent directory name of an
4
4
  # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
5
  # of this file.
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-07-23T15:26:53+0200",
11
+ "date": "2025-02-04T13:27:11+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "4657ff3b5634df60af117b022fca4e968b88feb7",
15
- "version": "2.7.0a3"
14
+ "full-revisionid": "3bdb1fdfd01f5ae5e4dff117abe8862d9316352a",
15
+ "version": "2.7.0.dev2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
rtctools/data/csv.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
  import sys
3
3
  from datetime import datetime
4
+ from typing import Union
4
5
 
5
6
  import numpy as np
6
7
 
@@ -41,6 +42,21 @@ def _boolean_to_nan(data, fname):
41
42
  return data
42
43
 
43
44
 
45
+ def _string_to_datetime(string: Union[str, bytes]) -> datetime:
46
+ """Convert a string to a datetime object."""
47
+ if isinstance(string, bytes):
48
+ string = string.decode("utf-8")
49
+ return datetime.strptime(string, "%Y-%m-%d %H:%M:%S")
50
+
51
+
52
+ def _string_to_float(string: Union[str, bytes]) -> float:
53
+ """Convert a string to a float."""
54
+ if isinstance(string, bytes):
55
+ string = string.decode("utf-8")
56
+ string = string.replace(",", ".")
57
+ return float(string)
58
+
59
+
44
60
  def load(fname, delimiter=",", with_time=False):
45
61
  """
46
62
  Check delimiter of csv and read contents to an array. Assumes no date-time conversion needed.
@@ -53,7 +69,7 @@ def load(fname, delimiter=",", with_time=False):
53
69
  """
54
70
  c = {}
55
71
  if with_time:
56
- c.update({0: lambda str: datetime.strptime(str.decode("utf-8"), "%Y-%m-%d %H:%M:%S")})
72
+ c.update({0: _string_to_datetime})
57
73
 
58
74
  # Check delimiter of csv file. If semicolon, check if decimal separator is
59
75
  # a comma.
@@ -73,12 +89,7 @@ def load(fname, delimiter=",", with_time=False):
73
89
  # If commas are used as decimal separator, we need additional
74
90
  # converters.
75
91
  if n_comma_decimal:
76
- c.update(
77
- {
78
- i + len(c): lambda str: float(str.decode("utf-8").replace(",", "."))
79
- for i in range(1 + n_semicolon - len(c))
80
- }
81
- )
92
+ c.update({i + len(c): _string_to_float for i in range(1 + n_semicolon - len(c))})
82
93
 
83
94
  # Read the csv file and convert to array
84
95
  try:
@@ -55,6 +55,7 @@ class BSpline1D(BSpline):
55
55
  epsilon=1e-7,
56
56
  delta=1e-4,
57
57
  interior_pts=None,
58
+ ipopt_options=None,
58
59
  ):
59
60
  """
60
61
  fit() returns a tck tuple like scipy.interpolate.splrep, but adjusts
@@ -153,7 +154,10 @@ class BSpline1D(BSpline):
153
154
  nlp = {"x": c, "f": f, "g": g}
154
155
  my_solver = "ipopt"
155
156
  solver = nlpsol(
156
- "solver", my_solver, nlp, {"print_time": 0, "expand": True, "ipopt": {"print_level": 0}}
157
+ "solver",
158
+ my_solver,
159
+ nlp,
160
+ {"print_time": 0, "expand": True, "ipopt": ipopt_options},
157
161
  )
158
162
  sol = solver(lbg=lbg, ubg=ubg)
159
163
  stats = solver.stats()
rtctools/data/pi.py CHANGED
@@ -881,29 +881,26 @@ class Timeseries:
881
881
  events = series.findall("pi:event", ns)
882
882
 
883
883
  t = self.__start_datetime
884
- for i in range(min(len(events), len(values))):
884
+ for i, value in enumerate(values):
885
885
  if self.dt is None:
886
886
  t = self.times[i]
887
- # Set the date/time, so that any date/time steps that
888
- # are wrong in the placeholder file are corrected.
889
- events[i].set("date", t.strftime("%Y-%m-%d"))
890
- events[i].set("time", t.strftime("%H:%M:%S"))
891
887
 
892
- # Set the value
893
- events[i].set("value", str(values[i]))
894
- if self.dt:
895
- t += self.dt
896
- for i in range(len(events), len(values)):
897
- if self.dt is None:
898
- t = self.times[i]
899
- event = ET.Element("pi:event")
888
+ if i < len(events):
889
+ event = events[i]
890
+ else:
891
+ event = ET.Element("pi:event")
892
+ series.append(event)
893
+
894
+ # Always set the date/time, so that any date/time steps
895
+ # that are wrong in the placeholder file are corrected.
900
896
  event.set("date", t.strftime("%Y-%m-%d"))
901
897
  event.set("time", t.strftime("%H:%M:%S"))
898
+
902
899
  if nans[i]:
903
900
  event.set("value", miss_val)
904
901
  else:
905
- event.set("value", str(values[i]))
906
- series.append(event)
902
+ event.set("value", str(value))
903
+
907
904
  if self.dt:
908
905
  t += self.dt
909
906
 
@@ -667,6 +667,7 @@ class GoalProgrammingMixin(_GoalProgrammingMixinBase):
667
667
  logger.info("Starting goal programming")
668
668
 
669
669
  success = False
670
+ self.skip_priority = False
670
671
 
671
672
  self.__constraint_store = [OrderedDict() for ensemble_member in range(self.ensemble_size)]
672
673
  self.__path_constraint_store = [
@@ -691,6 +692,13 @@ class GoalProgrammingMixin(_GoalProgrammingMixinBase):
691
692
  # Call the pre priority hook
692
693
  self.priority_started(priority)
693
694
 
695
+ if self.skip_priority:
696
+ logger.info(
697
+ "priority {} was removed in priority_started. No optimization problem "
698
+ "is solved at this priority.".format(priority)
699
+ )
700
+ continue
701
+
694
702
  (
695
703
  self.__subproblem_epsilons,
696
704
  self.__subproblem_objectives,
@@ -1081,6 +1081,7 @@ class _GoalProgrammingMixinBase(OptimizationProblem, metaclass=ABCMeta):
1081
1081
 
1082
1082
  :param priority: The priority level that was started.
1083
1083
  """
1084
+ self.skip_priority = False
1084
1085
  pass
1085
1086
 
1086
1087
  def priority_completed(self, priority: int) -> None:
@@ -54,8 +54,8 @@ class ModelicaMixin(OptimizationProblem):
54
54
  self.__pymoca_model = pymoca.backends.casadi.api.transfer_model(
55
55
  kwargs["model_folder"], model_name, compiler_options
56
56
  )
57
- except RuntimeError as error:
58
- if compiler_options.get("cache", False):
57
+ except (RuntimeError, ModuleNotFoundError) as error:
58
+ if not compiler_options.get("cache", False):
59
59
  raise error
60
60
  compiler_options["cache"] = False
61
61
  logger.warning(f"Loading model {model_name} using a cache file failed: {error}.")