def ziegler_nichols_bang_bang_response(amplitude, period, max_current, mode
    ='PID'):
    """
    amplitude : float
        center-to-peak amplitude (in K) of bang-bang oscillation
    period : float
        period (in seconds) of the critical oscillation
    max_current : float
        "bang" current (in amps)
    """
    proportional = float(max_current) / amplitude
    period = float(period)
    if mode == 'P':
        return proportional / 2, float('inf'), 0
    elif mode == 'PI':
        return proportional / 3, 2 * period, 0
    elif mode == 'PID':
        return proportional / 2, period, period / 4
    raise ValueError(mode)
