@Test public void testCase() { WashoutControlBlock block = new WashoutControlBlock(1.0, 0.1); assertTrue(block.initStateY0(0.0)); assertTrue(Math.abs(block.getStateX() + 0.0) < 0.0001); assertTrue(Math.abs(block.getU0() - 0.0) < 0.0001); double u = 0.0, dt = 0.01; block.eulerStep1(u, dt); block.eulerStep2(u, dt); block.eulerStep1(u, dt); block.eulerStep2(u, dt); block.eulerStep1(u, dt); block.eulerStep2(u, dt); assertTrue(Math.abs(block.getStateX() + 0.0) < 0.0001); assertTrue(Math.abs(block.getY()) < 0.0001); u = 2.0; for (int i = 0; i < 1000; i++) { block.eulerStep1(u, dt); block.eulerStep2(u, dt); } assertTrue(Math.abs(block.getStateX() - 2.0) < 0.0001); assertTrue(Math.abs(block.getY()) < 0.0001); }
@Test(expected = InterpssRuntimeException.class) public void testException() { WashoutControlBlock block = new WashoutControlBlock(1.0, 0.1); assertTrue(block.initStateY0(1.0)); }