src.utils.interface package

Submodules

src.utils.interface.conversion_functions module

src.utils.interface.conversion_functions.convert_exponential(voltage: float, ch_data: ChannelData) float

Converts voltage to temperature using an exponential formula.

src.utils.interface.conversion_functions.convert_linear(voltage: float, ch_data: ChannelData) float

Converts voltage using a linear formula.

src.utils.interface.conversion_functions.convert_quadratic(voltage: float, ch_data: ChannelData) float

Converts voltage using a quadratic formula.

src.utils.interface.conversion_functions.convert_value_to_voltage_exponential(value: float, ch_data: ChannelData) float

Converts an analog value to voltage using the reverse of the exponential formula.

src.utils.interface.conversion_functions.convert_value_to_voltage_linear(value: float, ch_data: ChannelData) float

Converts an analog value to voltage using the reverse of the linear formula.

src.utils.interface.conversion_functions.convert_value_to_voltage_quadratic(value: float, ch_data: ChannelData) float

Converts an analog value to voltage using the reverse of the quadratic formula. Solves B * voltage^2 + k * voltage + C - value = 0 for voltage.

src.utils.interface.mcp1_create_chip_settings module

src.utils.interface.mcp1_create_chip_settings.create_dig_out_channels(num_channels: int) List[ChannelData]

Creates a list of ChannelData instances for channels of type DIG_OUT.

Parameters:

num_channels (int) – The number of DIG_OUT channels to create.

Returns:

A list of ChannelData instances.

Return type:

List[ChannelData]

src.utils.interface.name_to_id module

src.utils.interface.name_to_id.get_name_from_true_value(structured_data: InterfaceSchema | STMInterfaceSchema, true_value: str)

Get the name of a ChannelData instance from the structured data.

Parameters:
  • structured_data (InterfaceSchema) – Structured data from the Excel file.

  • true_value (str) – True value of the ChannelData instance.

Returns:

Name of the ChannelData instance.

Return type:

str

src.utils.interface.name_to_id.get_true_value_from_name(structured_data: InterfaceSchema | STMInterfaceSchema, name: str)

Get the true value of a ChannelData instance from the structured data.

Parameters:
  • structured_data (InterfaceSchema) – Structured data from the Excel file.

  • name (str) – Name of the ChannelData instance.

Returns:

True value of the ChannelData instance.

Return type:

float

src.utils.interface.voltage_value_calculation module

src.utils.interface.voltage_value_calculation.get_analog_value_from_voltage(voltage: float | int, ch_data: ChannelData) float

Converts an input voltage to an analog value based on the channel’s conversion parameters.

src.utils.interface.voltage_value_calculation.get_digital_value_from_voltage(voltage: float | int, ch_data: ChannelData) int

Converts an input voltage to a digital boolean value based on the channel’s conversion parameters.

src.utils.interface.voltage_value_calculation.get_voltage_from_value(value: float | int, ch_data: ChannelData) float

Converts an analog value to voltage based on the channel’s conversion parameters.

Module contents