Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

IVI Simulation Driver

Hello everybody,

 

I try to make a simulation driver for a DC power so I look at the exemple from CVI called "ividcpwr" which worked well. 

But now, what I want to do is trying to generate simulated return data with "simulation drive software module" that I could find in NI MAX. There is a way to display a sort of plug-in to decide which data return during a measurement according to this :

 

forum.png

 

Did I have to just call the measurement function from IviDCPwr and enable simulation to display this window ? I try to add this function in the example:

 

"IviDCPwr_Measure (instrumentHandle, chanName, IVIDCPWR_VAL_MEASURE_VOLTAGE, &testvolt);"

 

The measure works but I don't decide which data return.

Moreover, when I choose "specific driver" in MAX for drive session, I have no problem, but when I try with "nisDCPwr", i have a new error in Labwindows :

 

"Function IviDCPwr_InitWithOptions: (return value == -1074130544 [0xbffa1190]). (0xbffa1190) The session handle is not valid."

 

I don't really know the reason why I have this error because I just change "Simulate with nisDCPwr" in MAX.

So, how to display the measurement panel and generate the desire measurement base is not clear in my mind so if you could help me it would be nice 😉

 

Thanks.

0 Kudos
Message 1 of 12
(5,762 Views)


Hello Bouyakaz,


Sorry for the late response.


First the error -1074130544 you mentionned in the use of Instruments Drivers is often caused by bad Initialization and Closure of your VISA Session that is used by your driver. Make sure that you handle the VIs responsable for these actions properly. It will allow a clean communication and that no session stay open between two executions.

For your global needs, I advice you to watch these 2 videos:
- https://www.youtube.com/watch?v=4eOJ1A-hvxY
- https://www.youtube.com/watch?v=hQ7dRhjhYKI

Please keep us inform if I misunderstood your needs.


Thanks in advance. Bye!

0 Kudos
Message 2 of 12
(5,679 Views)

Thanks for your answer !

I'm gonna look at your videos the next hours, thanks for the links. I just try to clarify my problem : I try to use the exemple in CVI "iviDCPwr" with a driver for n67xx DC supply. I configure it in MAX to have a "logical name" to put in my "IviDCPwr_InitWithOptions" function. To configure it in MAX :

 

  • I create a logical name linked to  "AgN67xx" (Driver Session)
  • In this driver session, I put "Simulate With n67xx or nisDCPwr" (simulation driver session) and choose agn67xx Software Module in Software option.
  • In both simulation driver session, I choose "nisDCPwr" for Simulation Driver Software Module and put in initial settings "INTERACTIVE_SIMULATION=TRUE on channel 1", having for hope to display the data generation window.

After that, I just replace in the exemple the "IviDCPwr_init" function by the "IviDCPwr_InitWithOptions" one with "Simulate=1".

 

With these configuration, I have the error that you mentionned (-1074130544) which be caused by VISA like you said. But when I change in my driver session in MAX, "Simulate With => Specific Driver", this error disappear.

 

My aim is to display the interactive window data generation in simulation mode.

 

I will post an other answer after looking at your videos.

 

Thanks ! Bye !

0 Kudos
Message 3 of 12
(5,675 Views)

Hello,

 

I look your video but didn't find how to resolve my problem. You said that the error could come from VISA and after reading this post : http://forums.ni.com/t5/LabWindows-CVI/Creating-a-quot-ViSession-quot-data-input-in-a-function-panel...

I was wondering if the problem could not come from the function (I just try to find some explanations Smiley Frustrated):

 

ViStatus IviDCPwr_InitWithOptions (ViRsrc Logical_Name, ViBoolean ID_Query,ViBoolean Reset_Device,ViChar_VI_FAROption_String[], ViPSession Instrument_Handle);

 

However, with "Specific Driver" in max, I don't have any problem so I show you how I configure it :

 

First, I created a logical name with agn67xx for driver session to call it in the function above:

1 logical name.png

 

In this driver session, I choose to simulate with NisDCPwr :

2 driver session.png

 

Virtual Names options :

2.5 driver session n67xx.png

 

Software options :

4 software1.png

 

I activate the interactive simulation :

nisDCPwr interactive simu.png

 

Choose "nisDCPwr" to Simulation Drivers Software Module :

5.5 nisDCPwr simu session.png

 

6 nisDCPwr simu driver software module .png

 

Maybe my configuration comport some mistakes.

 

Thanks for your help !

 

Bye

0 Kudos
Message 4 of 12
(5,641 Views)

Hey CivoDK, 

 

Something isn't right about the way your driver is named. When I go to IDNet and download the Keysight Agn6700 driver, I get different entries on MAX. Did you create the DLL yourself or get it from a different download location? 

 

ivi C agn6700 driver.png

 

When I configure this driver in the same manner that you described, I am able to use the example. This makes me think that you have a different driver or a modified version of the driver. 

 

Could you attach attach the IVIConifgurationStore.xml file located in C:\ProgramData\IVI Foundation\IVI\ and attach a screenshot of the Agn67xx Instrument Driver Software Module under the Advanced tree as it appears in MAX? I suspect that whatever driver you have might be an IVI-COM Driver. Notice how the types above are IVI-C. The specific drivers need to be IVI-C in order to be compatibile with NI's simulation drivers. If the driver is IVI-Com or IVI-.NET, then it will not work with these simulation drivers. 

 

Thank you,

 

KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 5 of 12
(5,602 Views)

Hello Kurt-P,

 

Thanks for your answer, you have right, my driver come from Keysight Website. I will retry with your's if I have better result and give you some news. You can find here some screen of Max configuration and the IVIConifgurationStore.xml. It seems to be IVI C compatible.

 

Thanks,

CK

0 Kudos
Message 6 of 12
(5,594 Views)

Hello,

 

So I try with your driver, and now have another erreur : 0xbffa0045 "The Channel or repeated capability name is not allowed" like in this post : http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Unknown-channel-or-repeated-capability-name-M...

It should be a channel configuration hmmmm ...

 

CK

 

 

Download All
0 Kudos
Message 7 of 12
(5,565 Views)

Ok now it works, I have my window to configured output data. Thanks for your advice.

 

This windows always pops when I'm doing a measure like I expected. But, I have a question : for exemple, if I want to take a measure of voltage level, and put in my window 10V for voltage level, did the value gonna be well returned to my variable (testmeasure)?

IviDCPwr_Measure (instrumentHandle, chanName, IVIDCPWR_VAL_MEASURE_VOLTAGE, &testmeasure);

 

Thanks.

0 Kudos
Message 8 of 12
(5,559 Views)

Each time I put the Output state to true in the exemple, I have this error :

FATAL RUN-TIME ERROR:   "ividcpwu.c", line 144, col 17, thread id 0x00002338:   The program has caused a 'General Protection' fault at 0x02774636.

This error comes from the agn6700_32.dll, is there a sort of protection when I put this Output to 1 if I take measurement even in simulation or could it be a more complex error ? (Driver is supported on both 32 and 64-bit platforms).

 

Thanks,

 

CK

0 Kudos
Message 9 of 12
(5,549 Views)

CivoDK,

 

To answer your first question about IviDCPwr_Measure (instrumentHandle, chanName, IVIDCPWR_VAL_MEASURE_VOLTAGE, &testmeasure);, yes, the testmeasurement will contain the measured value. Refer the http://zone.ni.com/reference/en-XX/help/370430H-01/ivi-cvi/ividcpwr_measure/ 

 

As for the second behavior, I am not sure why that is happening and am currently investigating the behavior. I will let you know when I have an update. In the mean time, can you tell me which function you get the General Protection Fault? 

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 10 of 12
(5,460 Views)