Skip to content

Commit d99bb23

Browse files
Simplify LTI integration test to speed up tests (#45)
* Simplify test LTI model * Update test LTI controller params for new test model * Reduce sim steps in LTI integration test to speed up tests
1 parent a180585 commit d99bb23

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
test_lti_dd_mpc_params:
3-
n: 4
4-
N: 400
5-
L: 30
6-
Q_weights: 3
7-
R_weights: 1.0e-4
3+
n: 1
4+
N: 12
5+
L: 2
6+
Q_weights: 1
7+
R_weights: 1
88
epsilon_bar: 0.002
99
lambda_sigma: 1000
1010
lambda_alpha_epsilon_bar: 0.1
@@ -16,6 +16,6 @@ test_lti_dd_mpc_params:
1616
- [-1, 1]
1717
slack_var_constraint_type: 0
1818
controller_type: 1
19-
u_s: [1, 1]
20-
y_s: [0.65, 0.77]
19+
u_s: [1, 1.5]
20+
y_s: [1, 1]
2121
n_n_mpc_step: true

tests/config/models/test_lti_model.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
---
22
test_lti_model:
33
A:
4-
- [0.921, 0, 0.041, 0]
5-
- [0, 0.918, 0, 0.033]
6-
- [0, 0, 0.924, 0]
7-
- [0, 0, 0, 0.937]
4+
- [0.9, 0]
5+
- [0, 0.85]
86
B:
9-
- [0.017, 0.001]
10-
- [0.001, 0.023]
11-
- [0, 0.061]
12-
- [0.072, 0]
7+
- [0.1, 0]
8+
- [0, 0.1]
139
C:
14-
- [1, 0, 0, 0]
15-
- [0, 1, 0, 0]
10+
- [1, 0]
11+
- [0, 1]
1612
D:
1713
- [0, 0]
1814
- [0, 0]

tests/test_lti_dd_mpc_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_lti_dd_mpc_integration(
7272
"""
7373
# Define test parameters
7474
np_random = np.random.default_rng(0)
75-
n_steps = 50
75+
n_steps = 30
7676
verbose = 0
7777

7878
# Define system model
@@ -163,7 +163,7 @@ def test_lti_dd_mpc_integration(
163163
np.testing.assert_equal(dd_mpc_controller.y_s, new_y_s)
164164

165165
# Simulate data-driven MPC control system for the new setpoint
166-
n_steps_setpoint_change = 30
166+
n_steps_setpoint_change = 25
167167
u_change, y_change = simulate_lti_data_driven_mpc_control_loop(
168168
system_model=system_model,
169169
data_driven_mpc_controller=dd_mpc_controller,

0 commit comments

Comments
 (0)