rtc-tools-interface 0.10.1__tar.gz → 0.10.2a2__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.
- {rtc-tools-interface-0.10.1/rtc_tools_interface.egg-info → rtc_tools_interface-0.10.2a2}/PKG-INFO +2 -2
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/README.md +17 -15
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2/rtc_tools_interface.egg-info}/PKG-INFO +1 -1
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/_version.py +3 -3
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/plotting/subplot_classes.py +70 -9
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/results_collection.py +5 -1
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/setup.py +1 -1
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/COPYING.LESSER +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtc_tools_interface.egg-info/SOURCES.txt +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtc_tools_interface.egg-info/dependency_links.txt +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtc_tools_interface.egg-info/requires.txt +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtc_tools_interface.egg-info/top_level.txt +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/config.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/optimization_ranges.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/results_construction.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/runner.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/time_series_handler.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/base_goal.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/base_optimization_problem.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/goal_generator_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/goal_performance_metrics.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/goal_table_schema.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/helpers/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/helpers/statistics_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/plot_goals_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/plot_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/optimization/read_goals.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/plotting/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/plotting/plot_tools.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/simulation/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/simulation/base_simulation_problem.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/simulation/plot_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/plot_table_schema.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/read_goals_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/read_plot_table.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/serialization.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/type_definitions.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/setup.cfg +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/closed_loop/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/closed_loop/test_optimization_ranges.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/closed_loop/test_read_xml.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/closed_loop/test_run_optization_problem_closed_loop.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/test_base_optimization_problem.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/test_passing_goals_directly.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/test_plot_goals_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/test_read_goals.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/simulation/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/simulation/test_base_simulation_problem.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/simulation/test_plot_mixin.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/utils/__init__.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/utils/get_test.py +0 -0
- {rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/versioneer.py +0 -0
|
@@ -70,28 +70,30 @@ where $w$ is equal to the `weight` (default is 1), $r$ is equal to the `order` (
|
|
|
70
70
|
For the range goal, rtc-tools adds the following equation to the objective function of the specified priority
|
|
71
71
|
$$w\sum_t \epsilon_t^r $$
|
|
72
72
|
and the following constraints
|
|
73
|
-
|
|
74
|
-
\
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
$$
|
|
73
|
+
|
|
74
|
+
$$g_{low}(\epsilon_t) \leq x_t \leq g_{up}(\epsilon_t) \quad \forall t $$
|
|
75
|
+
|
|
76
|
+
$$0 \leq \epsilon_t \leq 1 \quad \forall t $$
|
|
77
|
+
|
|
79
78
|
where
|
|
80
|
-
|
|
81
|
-
\
|
|
82
|
-
|
|
83
|
-
g_{up}(\epsilon_t)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
|
|
80
|
+
$$g_{low}(\epsilon_t) = (1-\epsilon_t) m_{t,target} + \epsilon_t m $$
|
|
81
|
+
|
|
82
|
+
$$g_{up}(\epsilon_t) = (1-\epsilon_t) M_{t,target} + \epsilon_t M $$
|
|
83
|
+
|
|
84
|
+
and $w$ is equal to the `weight` (default is 1), $r$ is equal to the `order` (default is 2), $t$ the timestep, $x$ the selected `state`, $m_{target}$ and $M_{target}$ the lower and upper targets (`target_min` and `target_max`), $m$ and $M$ the actual bounds of $x$ (`function_min` and `function_max`). The auxiliary variable $\epsilon$ is automatically created by rtc-tools.
|
|
85
|
+
|
|
86
|
+
In loose terms, the range goal tries to archieve
|
|
87
|
+
|
|
88
|
+
$$m_{t,target} \leq x_t \leq M_{t,target} \quad \forall t$$
|
|
89
|
+
|
|
88
90
|
by minimizing, if any, the sum of exceedances for the timesteps. For more details on the range goal, see [Read the Docs](https://rtc-tools.readthedocs.io/en/latest/optimization/goal_programming/goals.html) of rtc-tools.
|
|
89
91
|
|
|
90
92
|
|
|
91
93
|
#### range_rate_of_change
|
|
92
94
|
The range_rate_of_change goal can be used to set a target range on ramp rate. Like the range goal, one needs to set the `target_min` and `target_max` for that. **Importantly** for the range_rate_of_change goal, the supplied values are relative to the nominal of the function. So supplying a `target_max` of `10` corresponds to the aim of having a maximum increase per timestep of 10% * `nominal`, where the nominal automatically set to `maximum rate of change`/2 or specified manually. To formulate the target of having a maximum increase and decrease by of 10% per timestep, one would set the `target_min` to `-10` and the `target_max` to `10`.
|
|
93
95
|
|
|
94
|
-
The equations for the range_rate_of_change goal are almost the same as for the range goal, which can be found above. The only difference is that $x_t$ is replaced by $
|
|
96
|
+
The equations for the range_rate_of_change goal are almost the same as for the range goal, which can be found above. The only difference is that $x_t$ is replaced by the derivative of $x$ with respect to $t$, calculated as $\frac{x_t - x_{t-1}}{\Delta t}$.
|
|
95
97
|
|
|
96
98
|
### Example goal table
|
|
97
99
|
See the table below for an example content of the `goal_table.csv`.
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-
|
|
11
|
+
"date": "2025-10-30T09:45:54+0100",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.10.
|
|
14
|
+
"full-revisionid": "dcc43a518f9d2672d43280e14083500fb85225cb",
|
|
15
|
+
"version": "0.10.2a2"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -200,10 +200,35 @@ class SubplotMatplotlib(SubplotBase):
|
|
|
200
200
|
|
|
201
201
|
def plot_dashed_line(self, xarray, yarray, label, color="red"):
|
|
202
202
|
"""Given the input and output array, add dashed line plot to the subplot."""
|
|
203
|
-
|
|
203
|
+
# Create step data for implicit timesteps:
|
|
204
|
+
step_x = []
|
|
205
|
+
step_y = []
|
|
206
|
+
for i in range(len(xarray)):
|
|
207
|
+
if i == 0:
|
|
208
|
+
step_x.append(xarray[i])
|
|
209
|
+
step_y.append(yarray[i])
|
|
210
|
+
else:
|
|
211
|
+
step_x.append(xarray[i-1])
|
|
212
|
+
step_y.append(yarray[i])
|
|
213
|
+
step_x.append(xarray[i])
|
|
214
|
+
step_y.append(yarray[i])
|
|
215
|
+
self.axis.plot(step_x, step_y, "--", label=label, color=color)
|
|
204
216
|
|
|
205
217
|
def plot_line(self, xarray, yarray, label, color=None, linewidth=None, linestyle=None):
|
|
206
|
-
|
|
218
|
+
"""Plot step line for implicit timesteps."""
|
|
219
|
+
# Create step data for implicit timesteps:
|
|
220
|
+
step_x = []
|
|
221
|
+
step_y = []
|
|
222
|
+
for i in range(len(xarray)):
|
|
223
|
+
if i == 0:
|
|
224
|
+
step_x.append(xarray[i])
|
|
225
|
+
step_y.append(yarray[i])
|
|
226
|
+
else:
|
|
227
|
+
step_x.append(xarray[i-1])
|
|
228
|
+
step_y.append(yarray[i])
|
|
229
|
+
step_x.append(xarray[i])
|
|
230
|
+
step_y.append(yarray[i])
|
|
231
|
+
self.axis.plot(step_x, step_y, label=label, color=color, linewidth=linewidth, linestyle=linestyle)
|
|
207
232
|
|
|
208
233
|
def format_subplot(self):
|
|
209
234
|
"""Format the current axis and set legend and title."""
|
|
@@ -258,30 +283,66 @@ class SubplotPlotly(SubplotBase):
|
|
|
258
283
|
return color_mapping.get(color, color)
|
|
259
284
|
|
|
260
285
|
def plot_dashed_line(self, xarray, yarray, label, color="red"):
|
|
261
|
-
"""Given the input and output array, add dashed line plot to the subplot."""
|
|
286
|
+
"""Given the input and output array, add dashed step line plot to the subplot."""
|
|
287
|
+
# Create step data for plotly by duplicating points
|
|
288
|
+
step_x = []
|
|
289
|
+
step_y = []
|
|
290
|
+
|
|
291
|
+
for i in range(len(xarray)):
|
|
292
|
+
if i == 0:
|
|
293
|
+
# First point - just add as is
|
|
294
|
+
step_x.append(xarray[i])
|
|
295
|
+
step_y.append(yarray[i])
|
|
296
|
+
else:
|
|
297
|
+
# Add horizontal line from previous time to current time at previous value
|
|
298
|
+
step_x.append(xarray[i-1])
|
|
299
|
+
step_y.append(yarray[i])
|
|
300
|
+
# Add vertical line at current time from previous to current value
|
|
301
|
+
step_x.append(xarray[i])
|
|
302
|
+
step_y.append(yarray[i])
|
|
303
|
+
|
|
262
304
|
self.figure.add_trace(
|
|
263
305
|
go.Scatter(
|
|
264
306
|
legendgroup=self.i_plot,
|
|
265
|
-
x=
|
|
266
|
-
y=
|
|
307
|
+
x=step_x,
|
|
308
|
+
y=step_y,
|
|
267
309
|
name=label,
|
|
268
|
-
line={"color": self.map_color_code(color), "dash": "dot"},
|
|
310
|
+
line={"color": self.map_color_code(color), "dash": "dot", "shape": "hv"},
|
|
269
311
|
),
|
|
270
312
|
row=self.row_num,
|
|
271
313
|
col=self.col_num,
|
|
272
314
|
)
|
|
273
315
|
|
|
274
316
|
def plot_line(self, xarray, yarray, label, color=None, linewidth=None, linestyle=None):
|
|
317
|
+
"""Plot step line for implicit timesteps."""
|
|
275
318
|
linewidth = float(linewidth) * 1.3 if linewidth else linewidth
|
|
276
319
|
linestyle = "dot" if linestyle == "dotted" else linestyle
|
|
320
|
+
|
|
321
|
+
# Create step data for plotly by duplicating points
|
|
322
|
+
step_x = []
|
|
323
|
+
step_y = []
|
|
324
|
+
|
|
325
|
+
for i in range(len(xarray)):
|
|
326
|
+
if i == 0:
|
|
327
|
+
# First point - just add as is
|
|
328
|
+
step_x.append(xarray[i])
|
|
329
|
+
step_y.append(yarray[i])
|
|
330
|
+
else:
|
|
331
|
+
# Add horizontal line from previous time to current time at previous value
|
|
332
|
+
step_x.append(xarray[i-1])
|
|
333
|
+
step_y.append(yarray[i])
|
|
334
|
+
# Add vertical line at current time from previous to current value
|
|
335
|
+
step_x.append(xarray[i])
|
|
336
|
+
step_y.append(yarray[i])
|
|
337
|
+
|
|
277
338
|
self.figure.add_trace(
|
|
278
339
|
go.Scatter(
|
|
279
340
|
legendgroup=self.i_plot,
|
|
280
341
|
legendgrouptitle_text=self.subplot_title,
|
|
281
|
-
x=
|
|
282
|
-
y=
|
|
342
|
+
x=step_x,
|
|
343
|
+
y=step_y,
|
|
283
344
|
name=label,
|
|
284
|
-
line={"width": linewidth, "dash": linestyle, "color": color},
|
|
345
|
+
line={"width": linewidth, "dash": linestyle, "color": color, "shape": "hv"},
|
|
285
346
|
),
|
|
286
347
|
row=self.row_num,
|
|
287
348
|
col=self.col_num,
|
|
@@ -160,7 +160,11 @@ class PlottingBaseMixin(ReadGoalsMixin):
|
|
|
160
160
|
def create_plot_data_and_config(self, base_goals: list) -> PlotDataAndConfig:
|
|
161
161
|
"""Create the PlotDataAndConfig dict."""
|
|
162
162
|
prio_independent_data: PrioIndependentData = {
|
|
163
|
-
"io_datetimes":
|
|
163
|
+
"io_datetimes": [
|
|
164
|
+
dt
|
|
165
|
+
for idx, dt in enumerate(self.io.datetimes)
|
|
166
|
+
if self.io.times_sec[idx] in self.times()
|
|
167
|
+
],
|
|
164
168
|
"times": self.times(),
|
|
165
169
|
"base_goals": base_goals,
|
|
166
170
|
}
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtc_tools_interface.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/closed_loop/runner.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/plotting/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/rtctools_interface/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/closed_loop/test_read_xml.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/optimization/test_read_goals.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rtc-tools-interface-0.10.1 → rtc_tools_interface-0.10.2a2}/tests/simulation/test_plot_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|