Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cb7cf0d
moved dc_current_measurements in daq folder
JRMTheSecond Jan 7, 2026
7fc8745
moved daq functions inside daq folder
JRMTheSecond Jan 8, 2026
5aef089
added init file to daq folder
JRMTheSecond Jan 8, 2026
88d1718
Created remaining folders and various init files
JRMTheSecond Jan 8, 2026
fafe8e4
1) Implemented folder structure
JRMTheSecond Jan 14, 2026
8dffce0
Fixed folders through pcbatt_automation
JRMTheSecond Jan 14, 2026
94671a0
Fixed remaining borken imports across src/nipcbatt directory
JRMTheSecond Jan 15, 2026
ebec363
Fixed callers inside pcbatt_ft_demo_test_sequence library
JRMTheSecond Jan 20, 2026
9fb310f
Minor cosmetic changes
JRMTheSecond Jan 23, 2026
e49a560
Fixed missing .daq imports
JRMTheSecond Jan 24, 2026
ce2ef6e
Refacted these test files to run and confirm they work after the re-s…
JRMTheSecond Jan 24, 2026
5b73ded
Fixed unit tests -- IMPORTANT: In this commit I changed dynamic_digit…
JRMTheSecond Jan 30, 2026
02c3a26
!00% coverage on pcbatt_library_tests
JRMTheSecond Jan 31, 2026
626b41b
Fixed nicpbatt references in save_traces.py
JRMTheSecond Jan 31, 2026
69b3367
Switch functionality done. Going to add unit testing next.
JRMTheSecond Feb 9, 2026
3ba0b87
Added .daq reference
JRMTheSecond Feb 9, 2026
6d5da5f
Added test comment to init file
JRMTheSecond Feb 9, 2026
ebec8ef
Undoing test comment
JRMTheSecond Feb 10, 2026
2b84248
Completed unit tests on switch data types (static_digital_path)
JRMTheSecond Feb 10, 2026
9daba45
Adding integration test directory and script for static digital path
JRMTheSecond Feb 11, 2026
548f38c
Completed integration tests for switch
JRMTheSecond Feb 12, 2026
f9fd5a7
Added ignore warning for linter and description for data types
JRMTheSecond Feb 17, 2026
7f3b851
Merge pull request #18 from ni/users/John/fix_callers
JRMTheSecond Feb 17, 2026
b20aef0
Fixed remaining daq references pointed out by Ankit in the PR doc
JRMTheSecond Feb 17, 2026
63e62c1
Finished re-factoring first half of integration tests
JRMTheSecond Feb 18, 2026
8f5f1eb
Fixed remaining integration tests for daq import
JRMTheSecond Feb 18, 2026
de447ce
Updated asserts and tests to ensure the exact error code received mat…
JRMTheSecond Feb 19, 2026
4363355
Merge pull request #19 from ni/users/John/switch
JRMTheSecond Feb 20, 2026
992ee92
Fixed CI.yml file to avoid bug during build
JRMTheSecond Feb 23, 2026
10fe037
Added no build failure on linter errors
JRMTheSecond Feb 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ jobs:

- name: Check Windows architecture
shell: pwsh
run: wmic os get osarchitecture
- name: Check Python architecture
run: python -c "import platform; print('Platform architecture:', platform.architecture())"
run: |
Write-Host "OS Architecture: $((Get-CimInstance Win32_OperatingSystem).OSArchitecture)"

- uses: Gr1N/setup-poetry@v9
with:
Expand All @@ -45,6 +44,7 @@ jobs:
run: poetry --version

- name: Lint the Code
continue-on-error: true
run: poetry run ni-python-styleguide lint

- name: Run tests
Expand Down
340 changes: 8 additions & 332 deletions src/nipcbatt/__init__.py

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions src/nipcbatt/pcbatt_automation/LED_Tests/analog_pwm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import nidaqmx.constants

import nipcbatt
from nipcbatt import daq
from nipcbatt.pcbatt_utilities.pcbatt_logger import PcbattLogger

# To use save_traces and plotter from utils folder
Expand Down Expand Up @@ -40,11 +41,11 @@ def setup(
"""Creates necessary objects for the generation of Analog PWM siganl and
Time Domain Measurement"""
# Creates instance of the generation class required for the test
svg = nipcbatt.SignalVoltageGeneration()
svg = daq.SignalVoltageGeneration()
"""Initializes the channels for signal volatge generaion"""
svg.initialize(channel_expression=output_terminal)
# Creates instance for the measurement class required for the test
tdvm = nipcbatt.TimeDomainMeasurement()
tdvm = daq.TimeDomainMeasurement()
"""Initializes the channels for tdvm module to prepare for measurement"""
tdvm.initialize(analog_input_channel_expression=input_terminal)

Expand All @@ -63,8 +64,8 @@ def setup(
# Region to configure and Generate/Measure
################### MAIN TEST FUNCTION : CONFIGURE AND GENERATE/MEASURE ###########################
def main(
svg: nipcbatt.SignalVoltageGeneration,
tdvm: nipcbatt.TimeDomainMeasurement,
svg: daq.SignalVoltageGeneration,
tdvm: daq.TimeDomainMeasurement,
digital_trigger_source=DIGITAL_TRIGGER_SOURCE,
):
results_map = {} # this structure will hold results in key-value pairs
Expand Down Expand Up @@ -97,7 +98,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

tdvm_config = nipcbatt.TimeDomainMeasurementConfiguration(
tdvm_config = daq.TimeDomainMeasurementConfiguration(
global_channel_parameters=global_channel_parameters,
specific_channels_parameters=specific_channels_parameters,
measurement_options=meas_config_configure_only,
Expand All @@ -115,7 +116,7 @@ def main(
range_min_volts=-10, range_max_volts=10
)
# Set the Sampling rate hertz and the generated siganl duration
gen_timing_parameters = nipcbatt.SignalVoltageGenerationTimingParameters(
gen_timing_parameters = daq.SignalVoltageGenerationTimingParameters(
sample_clock_source="OnboardClock",
sampling_rate_hertz=100000,
generated_signal_duration_seconds=0.1,
Expand All @@ -128,15 +129,15 @@ def main(
)

# Set the PWM signal parameters
waveform_parameters = nipcbatt.SignalVoltageGenerationSquareWaveParameters(
waveform_parameters = daq.SignalVoltageGenerationSquareWaveParameters(
generated_signal_amplitude_volts=0.5,
generated_signal_duty_cycle_percent=80.00,
generated_signal_frequency_hertz=100,
generated_signal_phase_radians=0,
generated_signal_offset_volts=0.5,
)

svg_config = nipcbatt.SignalVoltageGenerationSquareWaveConfiguration(
svg_config = daq.SignalVoltageGenerationSquareWaveConfiguration(
voltage_generation_range_parameters=voltage_generation_range_parameters,
waveform_parameters=waveform_parameters,
timing_parameters=gen_timing_parameters,
Expand All @@ -158,7 +159,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

tdvm_config = nipcbatt.TimeDomainMeasurementConfiguration(
tdvm_config = daq.TimeDomainMeasurementConfiguration(
global_channel_parameters=global_channel_parameters,
specific_channels_parameters=specific_channels_parameters,
measurement_options=meas_options_measure_only,
Expand Down Expand Up @@ -186,8 +187,8 @@ def main(
############################# CLEAN UP FUNCTION: CLOSE ALL TASKS ###################################
# Close all tasks
def cleanup(
svg: nipcbatt.SignalVoltageGeneration,
tdvm: nipcbatt.TimeDomainMeasurement,
svg: daq.SignalVoltageGeneration,
tdvm: daq.TimeDomainMeasurement,
):
svg.close()
tdvm.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import nidaqmx.constants

import nipcbatt
from nipcbatt import daq
from nipcbatt.pcbatt_utilities.pcbatt_logger import PcbattLogger

# To use save_traces and plotter from utils folder
Expand All @@ -30,7 +31,7 @@ def setup(input_terminal=INPUT_TERMINAL, file_path=DEFAULT_FILEPATH):
"""Creates the necessary objects for measurement of Voltage"""

# Creates the instance of measurement class required for the test
drvm = nipcbatt.DcRmsVoltageMeasurement()
drvm = daq.DcRmsVoltageMeasurement()
"""Initializes the channels for drvm module to prepare for measurement"""
drvm.initialize(analog_input_channel_expression=input_terminal)

Expand All @@ -49,7 +50,7 @@ def setup(input_terminal=INPUT_TERMINAL, file_path=DEFAULT_FILEPATH):
# Region to configure and Measure
################### MAIN TEST FUNCTION : CONFIGURE AND MEASURE ###########################
def main(
drvm: nipcbatt.DcRmsVoltageMeasurement,
drvm: daq.DcRmsVoltageMeasurement,
):
results_map = {} # this structure will hold results in key-value pairs

Expand Down Expand Up @@ -82,7 +83,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

drvm_config = nipcbatt.DcRmsVoltageMeasurementConfiguration(
drvm_config = daq.DcRmsVoltageMeasurementConfiguration(
global_channel_parameters=global_channel_parameters,
specific_channels_parameters=specific_channels_parameters,
measurement_options=measurement_options,
Expand All @@ -108,7 +109,7 @@ def main(
############################# CLEAN UP FUNCTION: CLOSE ALL TASKS ###################################
# Close all tasks
def cleanup(
drvm: nipcbatt.DcRmsVoltageMeasurement,
drvm: daq.DcRmsVoltageMeasurement,
):
drvm.close()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Main sequence for Analog PWM test"""

# Import Functions
from analog_pwm_test import analog_pwm_test
from analog_voltage_measurement_test import analog_voltage_measurement
from turn_off_all_ao_channels import power_down_all_ao_channels
from .analog_pwm_test import analog_pwm_test
from .analog_voltage_measurement_test import analog_voltage_measurement
from .turn_off_all_ao_channels import power_down_all_ao_channels

############# SETUP ###################
# Import the simulated hardware to NI Max for running the example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This example resets all configured Analog output channels to 0 volts"""

import nipcbatt
from nipcbatt import daq

# Note to run with hardware: update virtual/physical channels info based
# on NI MAX in the below Initialize Steps
Expand All @@ -9,7 +9,7 @@
ANALOG_OUT_CHANNELS = "Sim_PC_basedDAQ/ao0"

# Assign the Range Parameters for all configured AO Channels
RANGE_PARAMETERS = nipcbatt.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS
RANGE_PARAMETERS = daq.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS


def power_down_all_ao_channels(
Expand All @@ -22,11 +22,11 @@ def power_down_all_ao_channels(
off_voltages = [0.0]

# DC Voltage Generation - Initialize AO Channels
generation = nipcbatt.DcVoltageGeneration()
generation = daq.DcVoltageGeneration()
generation.initialize(analog_output_channel_expression=channel_names)

# Create configuration for analog output
output_configuration = nipcbatt.DcVoltageGenerationConfiguration(
output_configuration = daq.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=parameters, output_voltages=off_voltages
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Example demonstrates DC-RMS Voltage Measurements by performing button actions
(generating DC Voltages) on specific test points"""

import nipcbatt
from nipcbatt import daq
from nipcbatt.pcbatt_utilities.pcbatt_logger import PcbattLogger

## Setup: Get the physical channels required for the test.
Expand All @@ -28,8 +28,8 @@ def setup(
"""Creates the necessary objects for the simulation and measurement of the action button"""

# Create the instances of generation and measurement classes required for the test.
button_instance = nipcbatt.DcVoltageGeneration()
dc_rms_voltage_test_point = nipcbatt.DcRmsVoltageMeasurement()
button_instance = daq.DcVoltageGeneration()
dc_rms_voltage_test_point = daq.DcRmsVoltageMeasurement()

# Initialize Action Button
"""Initializes the configured channels of AO module to perform action button functionality"""
Expand All @@ -49,8 +49,8 @@ def setup(
# region configure_and_generate
################### MAIN TEST FUNCTION : CONFIGURE AND GENERATE/MEASURE ###########################
def main(
button_instance: nipcbatt.DcVoltageGeneration,
dc_rms_voltage_test_point: nipcbatt.DcRmsVoltageMeasurement,
button_instance: daq.DcVoltageGeneration,
dc_rms_voltage_test_point: daq.DcRmsVoltageMeasurement,
write_to_file=True,
filepath=DEFAULT_FILEPATH,
):
Expand All @@ -66,8 +66,8 @@ def main(
"""Button ON Action"""

# create a configuration that will generate 3.3V to simulate a button press
button_configuration = nipcbatt.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=nipcbatt.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS,
button_configuration = daq.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=daq.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS,
output_voltages=[3.3], # ON voltage = 3.3V
)

Expand All @@ -86,7 +86,7 @@ def main(

# Acquire the data from the test points using CONFIGURE_AND_MEASURE (button should be on)
test_point_result_data_after_button_on = dc_rms_voltage_test_point.configure_and_measure(
configuration=nipcbatt.DEFAULT_DC_RMS_VOLTAGE_MEASUREMENT_CONFIGURATION,
configuration=daq.DEFAULT_DC_RMS_VOLTAGE_MEASUREMENT_CONFIGURATION,
)

"""Storing results -- create both a Python dictionary (hashmap)
Expand All @@ -101,8 +101,8 @@ def main(
This step can be replaced with actual button action"""

# Reconfigure the button object with 0V to prepare it to turn off in next step
button_configuration = nipcbatt.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=nipcbatt.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS,
button_configuration = daq.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=daq.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS,
output_voltages=[0.0], # OFF voltage = 0V
)

Expand All @@ -111,7 +111,7 @@ def main(

# Acquire the data from the test points again using CONFIGURE_AND_MEASURE (button should be off)
test_point_result_data_after_button_off = dc_rms_voltage_test_point.configure_and_measure(
configuration=nipcbatt.DEFAULT_DC_RMS_VOLTAGE_MEASUREMENT_CONFIGURATION,
configuration=daq.DEFAULT_DC_RMS_VOLTAGE_MEASUREMENT_CONFIGURATION,
)

# record intermediate result
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""This example resets all configured Analog output channels to 0 volts""" # noqa: D415, W505 - First line should end with a period, question mark, or exclamation point (auto-generated noqa), doc line too long (185 > 100 characters) (auto-generated noqa)

import nipcbatt
from nipcbatt import daq

# Note to run with hardware: update virtual/physical channels info based
# on NI MAX in the below Initialize Steps

# Local constant for channel name
ANALOG_OUT_CHANNELS = "Sim_PC_basedDAQ/ao0:3"
ANALOG_OUT_CHANNELS = "Simulated_DAQ/ao0:3"

# Assign the Range Parameters for all configured AO Channels
RANGE_PARAMETERS = nipcbatt.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS
RANGE_PARAMETERS = daq.DEFAULT_VOLTAGE_GENERATION_CHANNEL_PARAMETERS


def power_down_all_ao_channels(
Expand All @@ -22,11 +22,11 @@ def power_down_all_ao_channels(
off_voltages = [0.0, 0.0, 0.0, 0.0]

# DC Voltage Generation - Initialize AO Channels
generation = nipcbatt.DcVoltageGeneration()
generation = daq.DcVoltageGeneration()
generation.initialize(analog_output_channel_expression=channel_names)

# Create configuration for analog output
output_configuration = nipcbatt.DcVoltageGenerationConfiguration(
output_configuration = daq.DcVoltageGenerationConfiguration(
voltage_generation_range_parameters=parameters, output_voltages=off_voltages
)

Expand Down
27 changes: 14 additions & 13 deletions src/nipcbatt/pcbatt_automation/audio_tests/audio_filter_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import nidaqmx.constants

import nipcbatt
from nipcbatt import daq
from nipcbatt.pcbatt_utilities.pcbatt_logger import PcbattLogger

# Default channels
Expand All @@ -30,8 +31,8 @@ def setup():
"""Creates the necessary objects for signal generation and measurement"""

# Create the instances of generation and measurement classes required for the test
generation_instance = nipcbatt.SignalVoltageGeneration()
measurement_instance = nipcbatt.FrequencyDomainMeasurement()
generation_instance = daq.SignalVoltageGeneration()
measurement_instance = daq.FrequencyDomainMeasurement()

# Initialize generation
generation_instance.initialize(channel_expression=GEN_CHANNEL)
Expand All @@ -55,8 +56,8 @@ def setup():


def main(
generation_instance: nipcbatt.SignalVoltageGeneration,
measurement_instance: nipcbatt.FrequencyDomainMeasurement,
generation_instance: daq.SignalVoltageGeneration,
measurement_instance: daq.FrequencyDomainMeasurement,
write_to_file=True,
filepath=DEFAULT_FILEPATH,
):
Expand Down Expand Up @@ -98,7 +99,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

meas_config_configure_only = nipcbatt.FrequencyDomainMeasurementConfiguration(
meas_config_configure_only = daq.FrequencyDomainMeasurementConfiguration(
global_channel_parameters=glob_chan_params,
specific_channels_parameters=spec_chan_params,
measurement_options=meas_options,
Expand All @@ -114,29 +115,29 @@ def main(
range_min_volts=-10.0, range_max_volts=10.0
)

tone_params0 = nipcbatt.ToneParameters(
tone_params0 = daq.ToneParameters(
tone_frequency_hertz=10.0, tone_amplitude_volts=1.0, tone_phase_radians=0.0
)

tone_params1 = nipcbatt.ToneParameters(
tone_params1 = daq.ToneParameters(
tone_frequency_hertz=100.0, tone_amplitude_volts=1.0, tone_phase_radians=0.0
)

tone_params2 = nipcbatt.ToneParameters(
tone_params2 = daq.ToneParameters(
tone_frequency_hertz=1000.0, tone_amplitude_volts=1.0, tone_phase_radians=0.0
)

tone_params3 = nipcbatt.ToneParameters(
tone_params3 = daq.ToneParameters(
tone_frequency_hertz=10000.0, tone_amplitude_volts=1.0, tone_phase_radians=0.0
)

multi_tone_params = nipcbatt.SignalVoltageGenerationMultipleTonesWaveParameters(
multi_tone_params = daq.SignalVoltageGenerationMultipleTonesWaveParameters(
generated_signal_offset_volts=0.0,
generated_signal_amplitude_volts=1.0,
multiple_tones_parameters=[tone_params0, tone_params1, tone_params2, tone_params3],
)

gen_timing_params = nipcbatt.SignalVoltageGenerationTimingParameters(
gen_timing_params = daq.SignalVoltageGenerationTimingParameters(
sample_clock_source="OnboardClock",
sampling_rate_hertz=100000,
generated_signal_duration_seconds=0.1,
Expand All @@ -148,7 +149,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

gen_config = nipcbatt.SignalVoltageGenerationMultipleTonesConfiguration(
gen_config = daq.SignalVoltageGenerationMultipleTonesConfiguration(
voltage_generation_range_parameters=vol_gen_range_params,
waveform_parameters=multi_tone_params,
timing_parameters=gen_timing_params,
Expand All @@ -172,7 +173,7 @@ def main(
digital_start_trigger_edge=nidaqmx.constants.Edge.RISING,
)

meas_config_postgen = nipcbatt.FrequencyDomainMeasurementConfiguration(
meas_config_postgen = daq.FrequencyDomainMeasurementConfiguration(
global_channel_parameters=glob_chan_params,
specific_channels_parameters=spec_chan_params,
measurement_options=meas_options_measure_only,
Expand Down
Loading
Loading