Rail¶
- class brainstem.entity.Rail(module, index)[source]¶
Provides power rail functionality on certain modules.
This entity is only available on certain modules. The RailClass can be used to control power to downstream devices, I has the ability to take current and voltage measurements, and depending on hardware, may have additional modes and capabilities.
- Useful Constants:
KELVIN_SENSING_OFF (0)
KELVIN_SENSING_ON (1)
OPERATIONAL_MODE_AUTO (0)
OPERATIONAL_MODE_LINEAR (1)
OPERATIONAL_MODE_SWITCHER (2)
OPERATIONAL_MODE_SWITCHER_LINEAR (3)
DEFAULT_OPERATIONAL_MODE (OPERATIONAL_MODE_AUTO)
OPERATIONAL_STATE_INITIALIZING (0)
OPERATIONAL_STATE_ENABLED (1)
OPERATIONAL_STATE_FAULT (2)
OPERATIONAL_STATE_HARDWARE_CONFIG (8)
OPERATIONAL_STATE_LINEAR (0)
OPERATIONAL_STATE_SWITCHER (1)
OPERATIONAL_STATE_LINEAR_SWITCHER (2)
OPERATIONAL_STATE_OVER_VOLTAGE_FAULT (16)
OPERATIONAL_STATE_UNDER_VOLTAGE_FAULT (17)
OPERATIONAL_STATE_OVER_CURRENT_FAULT (18)
OPERATIONAL_STATE_OVER_POWER_FAULT (19)
OPERATIONAL_STATE_REVERSE_POLARITY_FAULT (20)
OPERATIONAL_STATE_OVER_TEMPERATURE_FAULT (21)
OPERATIONAL_STATE_OPERATING_MODE (24)
OPERATIONAL_STATE_CONSTANT_CURRENT (0)
OPERATIONAL_STATE_CONSTANT_VOLTAGE (1)
OPERATIONAL_STATE_CONSTANT_POWER (2)
OPERATIONAL_STATE_CONSTANT_RESISTANCE (3)
- clearFaults()[source]¶
Clears the current fault state of the rail.
Refer to the module datasheet for definition of the rail faults.
- Returns:
Return result object with NO_ERROR set or an Error.
- Return type:
- getCurrent()[source]¶
Get the rail current.
- Returns:
- Result object, containing NO_ERROR and the current in microamps
or a non zero Error code.
- Return type:
- getCurrentLimit()[source]¶
Get the rail current limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microamps (int) – The current in micro-amps (1 == 1e-6A).
- Returns:
- Return result object with NO_ERROR set and the current
limit setting in the Result.value or an Error condition.
- Return type:
- getCurrentSetpoint()[source]¶
Get the rail setpoint current.
Rail current control capabilities vary between modules. Refer to the module datasheet for definition of the rail current capabilities.
- Returns:
Return result object with NO_ERROR set and the current rail current setting in the Result.value or an Error.
- Return type:
- getEnable()[source]¶
Get the state of the rail switch.
Not all rails can be switched on and off. Refer to the module datasheet for capability specification of the rails.
- Returns:
Return result object with NO_ERROR set and the current rail enable state in the Result.value or an Error condition.
- Return type:
- getKelvinSensingEnable()[source]¶
Determine whether kelvin sensing is enabled or disabled.
Refer to the module datasheet for definition of the rail kelvin sensing capabilities.
- Parameters:
bEnable (bool) – Kelvin sensing is enabled or disabled.
- Returns:
Return result object with NO_ERROR set and the current rail kelvin sensing mode setting in the Result.value or an Error.
- Return type:
- getKelvinSensingState()[source]¶
Determine whether kelvin sensing has been disabled by the system.
Refer to the module datasheet for definition of the rail kelvin sensing capabilities.
- Returns:
Return result object with NO_ERROR set and the current rail kelvin sensing state setting in the Result.value or an Error.
- Return type:
- getOperationalMode()[source]¶
Determine the current operational mode of the system.
Refer to the module datasheet for definition of the rail operational mode capabilities.
- Returns:
Return result object with NO_ERROR set and the current rail operational mode setting in the Result.value or an Error.
- Return type:
- getOperationalState()[source]¶
Determine the current operational state of the system.
Refer to the module datasheet for definition of the rail operational states.
- Returns:
Return result object with NO_ERROR set and the current rail operational state in the Result.value or an Error.
- Return type:
- getPower()[source]¶
Get the rail power.
- Returns:
- Result object, containing NO_ERROR and the power in milliwatts
or a non zero Error code.
- Return type:
- getPowerLimit()[source]¶
Get the rail power limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
milliwatts (int) – The power in milli-watts (1 == 1e-3W).
- Returns:
- Return result object with NO_ERROR set and the power
limit setting in the Result.value or an Error condition.
- Return type:
- getPowerSetpoint()[source]¶
Get the rail setpoint power.
Rail power control capabilities vary between modules. Refer to the module datasheet for definition of the rail power capabilities.
- Returns:
Return result object with NO_ERROR set and the power rail power setting in the Result.value or an Error.
- Return type:
- getResistance()[source]¶
Get the rail resistance.
- Returns:
- Result object, containing NO_ERROR and the resistance in milliohms
or a non zero Error code.
- Return type:
- getResistanceSetpoint()[source]¶
Get the rail setpoint resistance.
Rail resistance control capabilities vary between modules. Refer to the module datasheet for definition of the rail resistance capabilities.
- Returns:
Return result object with NO_ERROR set and the resistance rail resistance setting in the Result.value or an Error.
- Return type:
- getTemperature()[source]¶
Get the rail temperature.
- Returns:
Return result object with NO_ERROR set and the rail temperature in the Result.value or an Error condition.
- Return type:
- getVoltage()[source]¶
Get the rail supply voltage.
Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.
On some modules this is a measured value so may not exactly match what was previously set via the setVoltage interface. Refer to the module datasheet to to determine if this is a measured or stored value.
- Returns:
Return result object with NO_ERROR set and the current rail voltage setting in the Result.value or an Error.
- Return type:
- getVoltageMaxLimit()[source]¶
Get the rail voltage maximum limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microvolts (int) – The voltage maximum in micro-volts (1 == 1e-6V).
- Returns:
- Return result object with NO_ERROR set and the voltage minimum
limit setting in the Result.value or an Error condition.
- Return type:
- getVoltageMinLimit()[source]¶
Get the rail voltage minimum limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microvolts (int) – The voltage minimum in micro-volts (1 == 1e-6V).
- Returns:
- Return result object with NO_ERROR set and the voltage minimum
limit setting in the Result.value or an Error condition.
- Return type:
- getVoltageSetpoint()[source]¶
Get the rail setpoint voltage.
Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.
- Returns:
Return result object with NO_ERROR set and the current rail voltage setting in the Result.value or an Error.
- Return type:
- setCurrentLimit(microamps)[source]¶
Set the rail current limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microamps (int) – The current in micro-amps (1 == 1e-6A).
- Returns:
Return NO_ERROR on success, or one of the common sets of return error codes on failure.
- Return type:
Result.error
- setCurrentSetpoint(microamps)[source]¶
Set the rail supply current.
Rail current control capabilities vary between modules. Refer to the module datasheet for definition of the rail current capabilities.
- Parameters:
microamps (int) – The current in micro-amps (1 == 1e-6A) to be supply by the rail.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setEnable(bEnable)[source]¶
Set the state of the rail switch.
Not all rails can be switched on and off. Refer to the module datasheet for capability specification of the rails.
- Parameters:
bEnable (bool) – true: enable and connect to the supply rail voltage; false: disable and disconnect from the supply rail voltage
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setKelvinSensingEnable(bEnable)[source]¶
Enable or Disable kelvin sensing on the module.
Refer to the module datasheet for definition of the rail kelvin sensing capabilities.
- Parameters:
bEnable (bool) – enable or disable kelvin sensing.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setOperationalMode(mode)[source]¶
Set the operational mode of the rail.
Refer to the module datasheet for definition of the rail operational capabilities.
- Parameters:
mode (int) – The operational mode to employ.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setPowerLimit(milliwatts)[source]¶
Set the rail power limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
milliwatts (int) – The power in milli-watts (1 == 1e-3W).
- Returns:
Return NO_ERROR on success, or one of the common sets of return error codes on failure.
- Return type:
Result.error
- setPowerSetpoint(milliwatts)[source]¶
Set the rail supply power.
Rail power control capabilities vary between modules. Refer to the module datasheet for definition of the rail power capabilities.
- Parameters:
milliwatts (int) – The power in milli-watts (1 == 1e-3W) to be supply by the rail.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setResistanceSetpoint(milliohms)[source]¶
Set the rail load resistance.
Rail resistance control capabilities vary between modules. Refer to the module datasheet for definition of the rail resistance capabilities.
- Parameters:
milliohms (int) – The resistance in milli-ohms (1 == 1e-3Ohms) to be applied to the rail.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error
- setVoltageMaxLimit(microvolts)[source]¶
Set the rail voltage maximum limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microvolts (int) – The voltage maximum in micro-volts (1 == 1e-6V).
- Returns:
Return NO_ERROR on success, or one of the common sets of return error codes on failure.
- Return type:
Result.error
- setVoltageMinLimit(microvolts)[source]¶
Set the rail voltage minimum limit setting.
Check product datasheet to see if this feature is available.
- Parameters:
microvolts (int) – The voltage minimum in micro-volts (1 == 1e-6V).
- Returns:
Return NO_ERROR on success, or one of the common sets of return error codes on failure.
- Return type:
Result.error
- setVoltageSetpoint(microvolts)[source]¶
Set the rail supply voltage.
Rail voltage control capabilities vary between modules. Refer to the module datasheet for definition of the rail voltage capabilities.
- Parameters:
microvolts (int) – The voltage in micro-volts (1 == 1e-6V) to be supply by the rail.
- Returns:
- Return NO_ERROR on success, or one of the common
sets of return error codes on failure.
- Return type:
Result.error