|
1 | 1 | from abc import ABC, abstractmethod |
2 | | - |
| 2 | +import warnings |
3 | 3 | import numpy as np |
4 | 4 |
|
5 | 5 |
|
@@ -86,8 +86,8 @@ def _update_iir_coefficients(self): |
86 | 86 | self.actuator_time_constant + demand_period |
87 | 87 | ) |
88 | 88 | else: |
89 | | - print( |
90 | | - f"Warning: Actuator time constant currently only implemented on discrete controllers. '{self.name}' dynamics not applied." |
| 89 | + warnings.warn( |
| 90 | + f"Actuator time constant currently only implemented on discrete controllers. '{self.name}' dynamics not applied." |
91 | 91 | ) |
92 | 92 | self._alpha = 1.0 # No filtering, direct pass-through |
93 | 93 | else: |
@@ -120,21 +120,21 @@ def actuator_output(self, value): |
120 | 120 | change = value - self._actuator_output |
121 | 121 | if abs(change) > max_change: |
122 | 122 | value = self._actuator_output + np.sign(change) * max_change |
123 | | - print( |
124 | | - f"Warning: Actuator '{self.name}' output change {change:.3f} exceeds rate limit of {max_change:.3f} per time step." |
| 123 | + warnings.warn( |
| 124 | + f"Actuator '{self.name}' output change {change:.3f} exceeds rate limit of {max_change:.3f} per time step." |
125 | 125 | ) |
126 | 126 | else: |
127 | | - print( |
128 | | - f"Warning: Actuator rate limit currently only implemented for discrete controllers. '{self.name}' rate limit not applied." |
| 127 | + warnings.warn( |
| 128 | + f"Actuator rate limit currently only implemented for discrete controllers. '{self.name}' rate limit not applied." |
129 | 129 | ) |
130 | 130 |
|
131 | 131 | # Apply range limits if specified |
132 | 132 | if self.clamp: |
133 | 133 | value = np.clip(value, self.actuator_range[0], self.actuator_range[1]) |
134 | 134 | else: |
135 | 135 | if value < self.actuator_range[0] or value > self.actuator_range[1]: |
136 | | - print( |
137 | | - f"Warning: Actuator '{self.name}' output {value:.3f} exceeds range limits {self.actuator_range}." |
| 136 | + warnings.warn( |
| 137 | + f"Actuator '{self.name}' output {value:.3f} exceeds range limits {self.actuator_range}." |
138 | 138 | ) |
139 | 139 |
|
140 | 140 | self._actuator_output = value |
|
0 commit comments