# Desktop Python teaching example. Numerical inputs are illustrative.
reference = 0.12
speed = 0.0
for step in range(40):
    disturbance = 0.7 if step >= 20 else 1.0
    error = reference - speed
    command = max(0.0, min(1.0, 0.4 + 2.0 * error))
    speed += 0.2 * (0.3 * command * disturbance - speed)
    print(step, round(speed, 4), round(error, 4), round(command, 4))
