mirror of
https://github.com/WallabyLester/RBF-aPID-Controller.git
synced 2026-05-10 04:58:14 +08:00
Added test for update function.
This commit is contained in:
@@ -15,5 +15,20 @@ class TestAdaptivePIDNP(unittest.TestCase):
|
||||
self.rbf = RBFNetwork(self.input_dim, self.n_centers)
|
||||
self.apid = AdaptivePIDNP(Kp, Ki, Kd, self.rbf)
|
||||
|
||||
def test_update(self):
|
||||
"""Test the update method."""
|
||||
target = 10.0
|
||||
measured_value = 8.0
|
||||
dt = 0.1
|
||||
|
||||
control_signal = self.apid.update(target, measured_value, dt)
|
||||
|
||||
self.assertIsInstance(control_signal, float)
|
||||
self.assertGreater(control_signal, 0)
|
||||
|
||||
measured_value = 9.0
|
||||
control_signal_2 = self.apid.update(target, measured_value, dt)
|
||||
self.assertNotEqual(control_signal, control_signal_2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user