| Algorithm 1 Pseudo code governing the control loop. | |||
| Data: particles, watching_window, detected_movement, not_move_count system initialization; | |||
| 1 | whilenot_move_count < threshold do | ||
| 2 | Detect particles in the current frame; | ||
| 3 | Append detection results to the watching_window; | ||
| 4 | Analyze the direction of particle movement and save result to detected_movement; | ||
| 5 | if |detected_movement| < threshold then | ||
| 6 | STATE <= NOT_MOVE; | ||
| 7 | not_move_count += 1; | ||
| 8 | else if detected_movement > 0 then | ||
| 9 | STATE <= POSITIVE_DEP; | ||
| 10 | function_generator.decrease(); | ||
| 11 | else | ||
| 12 | STATE <= NEGATIVE_DEP; | ||
| 13 | function_generator.increase(); | ||
| 14 | end | ||
| 15 | end | ||