Showing results for 
Search instead for 
Did you mean: 

CVI SMU 4140 iviDCPwr set output measuring can't be called in different instrument session?

Go to solution



I have to use the PXIe4140 as SMU for my test function. I would like tu use it as an DC power to supply voltage or current depending my purpose. As I used for other power supplies in my test bench, I want to develop basic function surch

CONFIGURE_VOLTAGE_DC => set the parameter  V level and Current Limit

CONFIGURE_CURRENT_DC => set the parameter  I level and VOLTAGE Limit

OUTPUT_ON => Switch ON the output

OUTPUT_OFF => Switch OFF the output

MEASURE_V => get the supply voltage

MEASURE_I => get the supply current


All these function shall be called depending my sequencer. They open an instrument session, do the thing then close the session

I use the IVI DCPwr class instrument.

My problem is

I can configure the output to the desired level but as soon as I call my function MEASURExx or OUTPUTxx the output is switch OFF or the instrument is reset.

It seems that it is only working if everybody uses the same instrument session. WHY?

0 Kudos
Message 1 of 5

The IVI programming paradigm is session-based. If you close a session to an NI-DCPower device, the most recent output configuration will remain valid until you open a new session to the device. When you open a new session (if the Reset parameter is true), it will disable the output. Otherwise, the old output value will be disabled when the new session's Commit() is called.

Generally, you should keep a single session open to a device for the entire time you are using it. The usual design with a sequencer I've seen opens the session at the beginning of the run and stores the session handle through the entire program.


NI-DCPower Programming States explains this a bit more.

Also refer to ClassPrefix_Init

Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 2 of 5

Thank you

You said

"When you open a new session (if the Reset parameter is true), it will disable the output. Otherwise, the old output value will be disabled when the new session's Commit() is called."


So in both case, whatever I do not reset my ni device using IVI during the open session query, my output will be resetted as soon as I do a commit()... Maybe it what I observed :  My output is still ON after a session open, and switch OFF at the moment I use IviDCPwr_Measure()?! It means that I should use ni_configure() ni_commit()  ni_initiate() in the same session => not IVI programming paradigm


However, I need to configure teh power supply in Current Level and IVI driver do not let it I think. So i will have to use ni_DCP functions





0 Kudos
Message 3 of 5
Accepted by eDFT

I believe you are describing the following behavior (specific values for example purposes):

Open Session. Set Voltage Level to 5V and enable output. Initiate. You see 5V on the output. Close Session.

Open Session (reset false). Initiate(). IviDCPwr_Measure(). At Initiate, you start seeing 0V/output disabled.

This is intentional behavior. Initiate() applies its session's existing configuration to hardware. Since the second session was never configured to anything, it uses the default values (which are 0V and output disabled).


The usual code flow keeps a session open. Closing a session and relying on the previous session's output is very tricky to get working correctly and is not recommended. Once a session is closed, all configuration information (e.g. Voltage Level, Current Limit) is lost, so the new session has to start from zero assumptions as to the previous state. If I'm understanding you correctly, you can fix your existing design by keeping a single session open for your entire design.


That said, if you need NI-specific functionality, you will need to switch over to using the NI-DCPower functions. They have the same behavior in this regard.

Principal Software Engineer
Driver Software
National Instruments
Message 4 of 5

Thank you Tobias for the details and your recommandation





0 Kudos
Message 5 of 5