DCPower DC Voltage Source and Measure#42
Conversation
| 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": |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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": |
There was a problem hiding this comment.
should we handle model specific configurations? would driver not take care of it..
we can discuss on this.
There was a problem hiding this comment.
This is how it is done in the LabVIEW POC code, we can discuss about it.
There was a problem hiding this comment.
lets rename the library to "dcpower"
There was a problem hiding this comment.
lets review the library names and function names with Emmanuel once
There was a problem hiding this comment.
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.""" | |||
There was a problem hiding this comment.
lets make comments generic to SMU and PPS
There was a problem hiding this comment.
Done, updated it to "SMU and PPS".
PR for DCPower DC Voltage Source and Measure