Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I automate creating a simulated device?

Solved!
Go to solution

I see that I can create simulated devices in NI MAX. Is it possible to automatically create simulated devices? I want to unit test software as part of an automated deployment process

0 Kudos
Message 1 of 12
(4,425 Views)

Hi Chris_c++,

 

You can export a .INI file from MAX that describes the simulated devices and import it: Import and Export a MAX Configuration Through LabVIEW.

 

I bet your next question is "how can I do that from C++"? It is possible to use the NI System Configuration API from C or C++, but you have to explicitly select CVI support during installation, even if you're not using CVI. The header file and a MSVC-compatible CVI import library should get installed somewhere under %ProgramFiles%\National Instruments\Shared\CVI.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 12
(4,409 Views)

Let us know how that go.

steve.bm
AE | NI
0 Kudos
Message 3 of 12
(4,405 Views)

I am having trouble finding a header with system configuration functions. Can you be more specific?

 

Thanks,

Chris

0 Kudos
Message 4 of 12
(4,380 Views)
Solution
Accepted by topic author Chris_c++

Hi Chris,

 

Sorry, I thought the NI System Configuration >> LabWindows/CVI feature showed up when you install NI-DAQmx (after you select "Custom"), but it doesn't.

Here's what you need to do:

  • Download NI System Configuration: http://joule.ni.com/nidu/cds/view/p/id/2613/lang/en (or select it from the NI Driver DVD)
  • Select LabWindows/CVI:
    NISysCfg_CVI.png
  • nisyscfg.h should be installed in %ProgramFiles%\National Instruments\Shared\CVI\include .
  • nisyscfg.lib should be installed in %ProgramFiles%\National Instruments\Shared\CVI\ExtLib\msvc . Note that it requires linking against user32.lib as well.

Brad

 

---
Brad Keryan
NI R&D
Message 5 of 12
(4,368 Views)

This seems to be a good solution.

 

Thank you. 

0 Kudos
Message 6 of 12
(4,349 Views)

i would like to create a simulated device using c++. i found the cvi api and its documentation, but cannot find a function to create a (simulated) device.

could you point me in the right direction?

thanx!

0 Kudos
Message 7 of 12
(4,098 Views)

Hi mael15,

 

You can export a .INI file from MAX that describes the simulated devices and import it using NISysCfgImportConfiguration().

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 8 of 12
(4,020 Views)

thanx, but it just does not work:

NISysCfgEnumExpertHandle expertEnumHandle;

NISysCfgSessionHandle sessionHandle; NISysCfgInitializeSession(NULLNULLNULLNISysCfgLocaleGermanNISysCfgBoolFalse, 0, &expertEnumHandle, &sessionHandle); const char path2[100] = "C:/existing/path/configData.nce";

NISysCfgStatus stat = NISysCfgImportConfiguration(&sessionHandle, path2, NULLNISysCfgImportMergeItemsNULL);

 

this gets me a NISysCfg_InvalidArg (-2147024809)

 

i thought this can only be about the path?

const char path2[100] = "C:\\existing\\path\\configData.nce";

does not work either.

what am i missing?!?

 

the nce file is working.

0 Kudos
Message 9 of 12
(4,002 Views)

Hi mael15,

 

NISysCfgInitializeSession() takes a NISysCfgSessionHandle* and NISysCfgImportConfiguration() takes a NISysCfgSessionHandle, but you're passing &sessionHandle to both. Since NISysCfgSessionHandle is a typedef for void*, using the wrong level of indirection doesn't produce a compiler warning/error. Try passing sessionHandle to NISysCfgImportConfiguration().

 

Brad

---
Brad Keryan
NI R&D
Message 10 of 12
(3,998 Views)