Skip to content

DCPower DC Voltage Source and Measure#42

Open
ankitan-ni wants to merge 9 commits into
mainfrom
users/ankit/dc_voltage_source_and_measure
Open

DCPower DC Voltage Source and Measure#42
ankitan-ni wants to merge 9 commits into
mainfrom
users/ankit/dc_voltage_source_and_measure

Conversation

@ankitan-ni
Copy link
Copy Markdown
Contributor

PR for DCPower DC Voltage Source and Measure

@ankitan-ni ankitan-ni changed the title added first version of dc vg src & meas. DCPower DC Voltage Source and Measure Apr 28, 2026
self._session.channels[self._channel_name].source_trigger_type = nidcpower.TriggerType.DIGITAL_EDGE
self._session.channels[self._channel_name].digital_edge_source_trigger_input_terminal = trigger_parameters.start_source_name

if trigger_parameters.export_event.value == "Route_Event":
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do something like this.. instead of long cases?

EVENT_ROUTING_MAP = {
EventSignalToExport.Source_Complete_Event: "source_complete_event_output_terminal",
EventSignalToExport.Measure_Complete_Event: "measure_complete_event_output_terminal",
# add more mappings here
}

attr = EVENT_ROUTING_MAP.get(trigger_parameters.event_signal_to_export)
if not attr:
raise ValueError(f"Unsupported event: {trigger_parameters.event_signal_to_export}")

setattr(ch, attr, signal)

Copy link
Copy Markdown
Contributor Author

@ankitan-ni ankitan-ni Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this looks a better way to reduce the code for performing the same functionality. I've updated the code with the suggested way, but I've made a little change - instead of creating EVENT_ROUTING_MAP I've used event_signal_to_export.value directly from the EventSignalToExport enum class:

if trigger_parameters.export_event == ExportEvent.Route_Event:
setattr(
self._session.channels[self._channel_name],
trigger_parameters.event_signal_to_export.value,
trigger_parameters.output_event_signal_terminal,
)

timing_parameters: TimingParameters,
) -> None:
match self._session.instrument_model:
case "NI PXIe-4112" | "NI PXIe-4113":
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we handle model specific configurations? would driver not take care of it..
we can discuss on this.

Copy link
Copy Markdown
Contributor Author

@ankitan-ni ankitan-ni Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it is done in the LabVIEW POC code, we can discuss about it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets rename the library to "dcpower"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets review the library names and function names with Emmanuel once

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed the library to "dcpower" for now, we can discuss with Emmanuel and finalize.

@@ -0,0 +1,2 @@
"""Provides DC voltage source and measure functionality using SMU."""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets make comments generic to SMU and PPS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, updated it to "SMU and PPS".

SJayaraman-NI
SJayaraman-NI previously approved these changes May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants