Skip to content

[BUG] DCPowerSessionsBundle ExportSignal extension method is not channel aware. #295

@ktvanzwol

Description

@ktvanzwol

Describe the bug
When trying to export an Event on a session with multiple channels ExportSignal will generate an exception on commit.

For example, consider this line: powerBundle.FilterByPin("VDD25R").ExportSignal(DCPowerSignalSource.SourceCompleteEvent, "/SMU_P142_CH0-3/PXI_Trig1");

powerBundle contains a single session with multiple channels and the pin map only has 1 site. The expectation was that because of FilterByPin only the SourceCompleteEvent will be exported to PXI_Trig1 for pin "VDD25R" but when committing it resulted in the following exception:

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
   at NationalInstruments.SemiconductorTestLibrary.Common.ParallelExecution.Do[TSessionInformation](ISessionsBundle`1 sessionsBundle, Action`1 action)
   at XFDefaultTemplate.TestSteps.UTCPowerUp(ISemiconductorModuleContext tsmContext, String[] dcPins, String digitalPins, String triggerTerminal, String eventCode) in C:\Users\Public\Documents\National Instruments\TestStand 2023 (64-bit)\Components\Tools\STS Project Creation Tool\Templates\X-FAB UTC v4.0 Template\Code Modules\TestSteps\TemplateTestStep.cs:line 79

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
IviCDriverException: ModularInstruments.NIDCPower: Specified route cannot be satisfied, because it requires resources that are currently in use by another route.

Source Device: SMU_P142_CH0-3
Source Terminal: Engine0/SourceCompleteEvent
Destination Device: SMU_P142_CH0-3
Destination Terminal: PXI_Trig1

Required Resources in Use by
Source Device: SMU_P142_CH0-3
Source Terminal: Engine2/SourceCompleteEvent
Destination Device: SMU_P142_CH0-3
Destination Terminal: PXI_Trig1

   Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Error code: -1074107506

Because ExportSignal is not channel aware the FilterByPin does not have effect, and it sets the same destination for each channel in the session resulting in the above resource in use exception.

To Reproduce
Call 'ExportSignal' on a DCPowerSessionsBundle that contains a session with multiple channels grouped together.

Expected behavior
The above example line should only export the signal for pin "VDD25R".
The same behavior as when you configure source settings like this:

powerBundle.FilterByPin("VDD25R").ConfigureSourceSettings(new DCPowerSourceSettings
{
    Level = 2.5,
    SourceDelayInSeconds = 0.00000
});

Screenshots
N/A

System Setup(please complete the following information):

  • STS Software Version: 24.5
  • Hardware: STS M2 T1
  • Instrumentation: PXIe-4147

NI Support Status
N/A

Additional context
Root cause ExportSignal uses ExportSignal(DCPowerSignalSource, string) which is not channel aware. NI-DCPower does offer a channel aware version e.g. ExportSignal(string, DCPowerSignalSource, string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions