I am using a PXI-4110 supply to power my DUT. I am trying to simply read back the current being supplied by the PXI-4110 module. I start a session, issue the read command and close the session. When I run the vi I get the error "Requested operation cannot be performed unless session is running.". A jpg of the code and error is attached. Any suggestions on what is wrong?
Among other things, you're missing the "niDCPower Initiate" VI. That VI is needed to start generation and acquisition. It sets the session into the Running state. Without it, your session will remain in either the Uncommitted or Committed state, which explains the error you're receiving.
You may also want to refer to some examples to see how this VI is used and where it is placed. In LabVIEW, go to Help -> Find Examples. Then select the "Hardware Input and Output" folder, then "Modular Instruments", and
"NI-DCPOWER (DC Power Supplies)". You will find a bunch of examples here that will be very similar to what you're trying to do.
Hope this helps!
Thanks for the suggestion, Will.
Sorry, but I didn't give enough background. I have previously opened a session, configured the supply and set it to the Running state. I then closed the session. This is working fine. All I want to do now is read the current being supplied. If I run init, the supply is turned off. I am using a producer/consumer loop so I would rather not leave the session open. Leaving a session open to each of the instruments in the rack breaks the goal of modular code and makes managing a producer/consumer loop more complicated.
Is there a way to read the power supply current without resetting the supply?
As an alternative, is there a way to at least query the supply to see if an output is enabled? This would be helpful.
I looked at the examples and didn't see anything that applied to what I want to do. I'll check again.
What does the previous session you were referring to do? Perhaps you could do the measurement on this session as well, then you wouldn't have to reset the supply before the current measurement.
I am developing a characterization program where I will need to measure the supply currents at any arbitrary point in time. For instance, when the DUT operating mode is changed through the control registers, the supply current needs to be updated in the front panel.
As far as I can tell from the documentation, you can't start a session and read the supply currents. The instrument must be set to run mode in that session before reads can be taken. (Hey NI, how about allowing queries to the instrument without resetting it? This would be very helpful.)
I have already implemented a work-around. When I power on the supply, I do not close the session and pass the reference to other events in the producer/consumer loop as needed through local variables (ugly but workable).
Thanks for your suggestions.