Ejemplo n.º 1
0
class SetCRModeTransientResistanceAndTiming(Message):
    """Set CR mode transient resistance and timing"""
    ID = 0x38

    MODE_TYPE = 'CR'

    # 3 to 6 Value A of resistance in units of 1 m. Little-endian 4 byte number.
    resistance_a = ScalarFloatField('resistance_a', 3, length=4,
                                    scalar=1000)  # 1 m Ohm
    value_a = resistance_a  # Alias so Message(value_a=1) can be used

    # 7 to 8 Time for A resistance in units of 0.1 ms. Little-endian 2 byte number.
    time_a = ScalarFloatField('time_a', 7, length=2, scalar=10000)  # 0.1 ms

    # 9 to 12 Value B of resistance in units of 1 m. Little-endian 4 byte number.
    resistance_b = ScalarFloatField('resistance_b', 9, length=4,
                                    scalar=1000)  # 1 m Ohm
    value_b = resistance_b  # Alias so Message(value_b=1) can be used

    # 13 to 14 Time for B resistance in units of 0.1 ms. Little-endian 2 byte number.
    time_b = ScalarFloatField('time_b', 13, length=2, scalar=10000)  # 0.1 ms

    # 15 Transient operation: 0 is CONTINUOUS, 1 is PULSE, 2 is TOGGLED
    OPERATION_NAMES = {'CONTINUOUS': 0, 'PULSE': 1, 'TOGGLED': 2}
    operation = Int8Field('operation', 15, d_names=OPERATION_NAMES)
Ejemplo n.º 2
0
class SetCCModeTransientCurrentAndTiming(Message):
    """Set CC mode transient current and timing

    Kwargs:
        current_a (float)[0]: Current as 0.1 mA
        time_a (float)[0]: Time as 0.1 ms
        current_b (float)[0]: Current as 0.1 mA
        time_b (float)[0]: Time as 0.1 ms
        operation (int/str)[0]: {'CONTINUOUS': 0, 'PULSE': 1, 'TOGGLED': 2}
    """
    ID = 0x32

    MODE_TYPE = 'CC'

    # 3 to 6 Value A of current in units of 0.1 mA. Little-endian 4 byte number.
    current_a = ScalarFloatField('current_a', 3, length=4,
                                 scalar=10000)  # 0.1 mA
    value_a = current_a  # Alias so Message(value_a=1) can be used

    # 7 to 8 Time for A current in units of 0.1 ms. Little-endian 2 byte number.
    time_a = ScalarFloatField('time_a', 7, length=2, scalar=10000)  # 0.1 ms

    # 9 to 12 Value B of current in units of 0.1 mA. Little-endian 4 byte number.
    current_b = ScalarFloatField('current_b', 9, length=4,
                                 scalar=10000)  # 0.1 mA
    value_b = current_b  # Alias so Message(value_b=1) can be used

    # 13 to 14 Time for B current in units of 0.1 ms. Little-endian 2 byte number.
    time_b = ScalarFloatField('time_b', 13, length=2, scalar=10000)  # 0.1 ms

    # 15 Transient operation: 0 is CONTINUOUS, 1 is PULSE, 2 is TOGGLED
    OPERATION_NAMES = {'CONTINUOUS': 0, 'PULSE': 1, 'TOGGLED': 2}
    operation = Int8Field('operation', 15, d_names=OPERATION_NAMES)
Ejemplo n.º 3
0
class ReadInput(Message):
    """Read input voltage, current, power and relative state"""
    ID = 0x5F

    REPR_EXCLUDE = ['operation_register', 'demand_register']

    # 3 to 6 4 byte little-endian integer for terminal voltage in units of 1 mV
    voltage = ScalarFloatField('voltage', 3, length=4, scalar=1000)  # 1 mV

    # 7 to 10 4 byte little-endian integer for terminal current in units of 0.1 mA
    current = ScalarFloatField('current', 7, length=4, scalar=10000)  # 0.1 mA

    # 11 to 14 4 byte little-endian integer for terminal power in units of 1 mW
    power = ScalarFloatField('power', 11, length=4, scalar=1000)  # 1 mV

    # 15 Operation state register (see bit list below)
    operation_register = BitFlagField(
        'operation_register',
        15,
        flags={
            'calc_new_demarcation_coeff':
            0,  # 0 Calculate the new demarcation coefficient
            'waiting': 1,  # 1 Waiting for a trigger signal
            'remote_control_state':
            2,  # 2 Remote control state (1 means enabled)
            'output_state': 3,  # 3 Output state (1 means ON)
            'local_key_state':
            4,  # 4 Local key state (0 means not enabled, 1 means enabled)
            'remote_sensing_mode':
            5,  # 5 Remote sensing mode (1 means enabled)
            'load_on_timer': 6,  # 6 LOAD ON timer is enabled
            'reserved': 7,  # 7 Reserved
        })

    # 16 to 17 2 byte little-endian integer for demand state register (see bit list below)
    demand_register = BitFlagField(
        'demand_register',
        16,
        length=2,
        flags={
            'reversed_voltage':
            0,  # 0 Reversed voltage is at instrument's terminals (1 means yes)
            'over_voltage': 1,  # 1 Over voltage (1 means yes)
            'over_current': 2,  # 2 Over current (1 means yes)
            'over_power': 3,  # 3 Over power (1 means yes)
            'over_temperature': 4,  # 4 Over temperature (1 means yes)
            'connect_remote_terminal': 5,  # 5 Not connect remote terminal
            'constant_current': 6,  # 6 Constant current
            'constant_voltage': 7,  # 7 Constant voltage
            'constant_power': 8,  # 8 Constant power
            'constant_resistance': 9,  # 9 Constant resistance
        })
Ejemplo n.º 4
0
class SetOneStepPowerAndTime(Message):
    """Set one of the step's power and time values"""
    ID = 0x44

    MODE_TYPE = 'CW'

    # 3 to 4 2 byte little-endian integer specifying which step number in the list
    step = Int16Field('step', 3)

    # 5 to 8 4 byte little-endian integer specifying the power in units of 1 mW
    power = ScalarFloatField('power', 5, length=4, scalar=1000)  # 1 mV
    value = power  # Alias so Message(value=1) can be used

    # 9 to 10 2 byte little-endian integer specifying the step timing in units of 0.1 ms
    time = ScalarFloatField('time', 9, length=2, scalar=10000)  # 0.1 ms
Ejemplo n.º 5
0
class SetOneStepCurrentAndTime(Message):
    """Set one of the step's current and time values"""
    ID = 0x40

    MODE_TYPE = 'CC'

    # 3 to 4 2 byte little-endian integer specifying which step number in the list
    step = Int16Field('step', 3)

    # 5 to 8 4 byte little-endian integer specifying the current in units of 0.1 mA
    current = ScalarFloatField('current', 5, length=4, scalar=10000)  # 0.1 mA
    value = current  # Alias so Message(value=1) can be used

    # 9 to 10 2 byte little-endian integer specifying the step timing in units of 0.1 ms
    time = ScalarFloatField('time', 9, length=2, scalar=10000)  # 0.1 ms
Ejemplo n.º 6
0
class SetMinimumVoltage(Message):
    """Set minimum voltage in battery testing"""
    ID = 0x4E

    # 3 to 6 4 byte little-endian integer specifying the minimum voltage in units of 1 mV
    voltage = ScalarFloatField('voltage', 3, length=4, scalar=1000)  # 1 mV
    value = voltage  # Alias so Message(value=1) can be used
Ejemplo n.º 7
0
class SetOneStepResistanceAndTime(Message):
    """Set one of the step's resistance and time values"""
    ID = 0x46

    MODE_TYPE = 'CR'

    # 3 to 4 2 byte little-endian integer specifying which step number in the list
    step = Int16Field('step', 3)

    # 5 to 8 4 byte little-endian integer specifying the resistance in units of 1 m Ohm
    resistance = ScalarFloatField('resistance', 5, length=4,
                                  scalar=1000)  # 1 mV
    value = resistance  # Alias so Message(value=1) can be used

    # 9 to 10 2 byte little-endian integer specifying the step timing in units of 0.1 ms
    time = ScalarFloatField('time', 9, length=2, scalar=10000)  # 0.1 ms
Ejemplo n.º 8
0
class SetCWModePower(Message):
    """Set CW mode power"""
    ID = 0x2E

    MODE_TYPE = 'CW'

    power = ScalarFloatField('power', 3, length=4, scalar=1000)
    value = power  # Alias so Message(value=1) can be used
Ejemplo n.º 9
0
class SetCRModeResistance(Message):
    """Set CR mode resistance"""
    ID = 0x30

    MODE_TYPE = 'CR'

    resistance = ScalarFloatField('resistance', 3, length=4, scalar=1000)
    value = resistance  # Alias so Message(value=1) can be used
Ejemplo n.º 10
0
class SetCVModeVoltage(Message):
    """Set CV mode voltage"""
    ID = 0x2C

    MODE_TYPE = 'CV'

    voltage = ScalarFloatField('voltage', 3, length=4, scalar=1000)
    value = voltage  # Alias so Message(value=1) can be used
Ejemplo n.º 11
0
class SetCCModeCurrent(Message):
    """Set CC mode current"""
    ID = 0x2A

    MODE_TYPE = 'CC'

    current = ScalarFloatField('current', 3, length=4, scalar=10000)
    value = current  # Alias so Message(value=1) can be used
Ejemplo n.º 12
0
class SetCWModeTransientPowerAndTiming(Message):
    """Set CW mode transient power and timing"""
    ID = 0x36

    MODE_TYPE = 'CW'

    # 3 to 6 Value A of power in units of 1 mW. Little-endian 4 byte number.
    power_a = ScalarFloatField('power_a', 3, length=4, scalar=1000)  # 1 mW
    value_a = power_a  # Alias so Message(value_a=1) can be used

    # 7 to 8 Time for A power in units of 0.1 ms. Little-endian 2 byte number.
    time_a = ScalarFloatField('time_a', 7, length=2, scalar=10000)  # 0.1 ms

    # 9 to 12 Value B of power in units of 1 mW. Little-endian 4 byte number.
    power_b = ScalarFloatField('power_b', 9, length=4, scalar=1000)  # 1 mW
    value_b = power_b  # Alias so Message(value_b=1) can be used

    # 13 to 14 Time for B power in units of 0.1 ms. Little-endian 2 byte number.
    time_b = ScalarFloatField('time_b', 13, length=2, scalar=10000)  # 0.1 ms

    # 15 Transient operation: 0 is CONTINUOUS, 1 is PULSE, 2 is TOGGLED
    OPERATION_NAMES = {'CONTINUOUS': 0, 'PULSE': 1, 'TOGGLED': 2}
    operation = Int8Field('operation', 15, d_names=OPERATION_NAMES)
Ejemplo n.º 13
0
class SetMaxPower(Message):
    """Set the maximum power allowed"""
    ID = 0x26

    power = ScalarFloatField('power', 3, length=4, scalar=1000)  # 1 mW
    value = power  # Alias so Message(value=1) can be used
Ejemplo n.º 14
0
class SetMaxCurrent(Message):
    """Set the maximum current allowed"""
    ID = 0x24

    current = ScalarFloatField('current', 3, length=4, scalar=10000)  # 0.1 mA
    value = current  # Alias so Message(value=1) can be used
Ejemplo n.º 15
0
class SetMaxVoltage(Message):
    """Set the maximum voltage allowed"""
    ID = 0x22

    voltage = ScalarFloatField('voltage', 3, length=4, scalar=1000)  # 1mV
    value = voltage  # Alias so Message(value=1) can be used