def build_device_status(device):
    """
    Builds an integer representation of the device status bit-field.
    :param device: the lewis device
    :return: int representation of the bit field
    """
    status_bits = [
        device.is_controller_ok(),
        device.is_up_to_speed(),
        device.is_able_to_run(),
        device.is_shutting_down(),
        device.is_levitation_complete(),
        device.is_phase_locked(),
        device.get_motor_direction() > 0,
        device.is_avc_on()
    ]

    bit = 1
    result = 0
    for stat in status_bits:
        result += bit if stat else 0
        bit *= 2
    return result