From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate device

Hallo,
 
is it possible to simulate devices with LabWin/CVI for my application (without hardware) on my PC?
LabWindows /CVI Ver 7.1.1
Unfortunately sometimes the hardware is outside at the customer and he wants to have some changes.
 
thanks.
 
franky71
0 Kudos
Message 1 of 6
(3,549 Views)
With NI-DAQmx you can define simulated devices in MAX. If your programs built in LabWindows /CVI uses DAQmx calls, the simulated devices can be used just as if they are hardware (with funky timing and no hardware outputs, of course).
John Weeks

WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
www.wavemetrics.com
Message 2 of 6
(3,541 Views)
Sorry, I don't understand it clearly in MAX
 
For example,  what I have to do, to simulate a PCI-6221.
 
thank you
 
franky
 
 
0 Kudos
Message 3 of 6
(3,508 Views)

now I found some to simulate PCI6221

But there are still errors in LabWin/CVI :

 NON-FATAL RUN-TIME ERROR:   "mess.c", line 86, col 23, thread id 0x00000708:   Function DAQmxReadAnalogF64: (return value == -89120 [0xfffea3e0]). Source terminal to be routed could not be found on the device.  Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names. Property: DAQmx_SampClk_Src Property: DAQmx_SampClk_ActiveEdge Source Device: Dev1 Source Terminal: Dev1/ai0 Channel Name: Dev1/ai0  Task Name: Dickemessung 1  Status Code: -89120

It happens, when Read or when starttasked.

I created and configerd my task on this way.

 

  strcpy (chan,"Dev1/ai0");
  /*********************************************/
  /*/ DAQmx Configure Code
  /*********************************************/
  DAQmxErrChk (DAQmxCreateTask("Dickemessung 1",&taskHandleA1));
  DAQmxErrChk (DAQmxCreateAICurrentChan (taskHandleA1, chan, "", DAQmx_Val_Cfg_Default, 0.004,0.020, DAQmx_Val_Amps, DAQmx_Val_External, 499.0, ""));
  DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleA1,chan,1000.0,DAQmx_Val_Falling,DAQmx_Val_FiniteSamps,1000));        
  /*********************************************/
  /*/ DAQmx Start Code
  /* Start über digitales Signal aus der SPS, sobald Kachel unter Sensor
  /* (Analoger Trigger gibt Fehlermeldung)
  /*********************************************/
  //DAQmxErrChk ( DAQmxCfgDigEdgeStartTrig (taskHandleA1, "Startsignal",DAQmx_Val_Rising));

  DAQmxErrChk (DAQmxStartTask (taskHandleA1));

May be I made something wrong, or is it specially a problem of the simulation ?

Greets from good old germany

 

franky71

 

0 Kudos
Message 4 of 6
(3,499 Views)
Hi Franky71,

i tested your code and recieved the same error. I have created a new c file with a simulated 6221. It is based on the DAQAssisstant and it works fine.
I have made some screenshots while i created the simulated device. I hope that will answer your question.

Regards,

Carsten Sprung
NI Germany

#include <utility.h>
#include <dataacq.h>
#include <ansi_c.h>
#include <NIDAQmx.h>

#define DAQmxErrChk(functionCall) {DAQmxError = (functionCall);  {if (DAQmxError < 0){goto Error;}}}

int main (int argc, char *argv[])
{
    TaskHandle task0 = 0;
    int32 DAQmxError = DAQmxSuccess;
    TaskHandle taskOut;
   
    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;    /* out of memory */

        DAQmxErrChk(DAQmxCreateTask("DAQTaskInProject", &taskOut));

        DAQmxErrChk(DAQmxCreateAICurrentChan(taskOut, "Dev2/ai0","Strom", DAQmx_Val_RSE, 0.004, 0.02,DAQmx_Val_Amps, DAQmx_Val_External, 499, ""));   

        DAQmxErrChk(DAQmxCfgSampClkTiming(taskOut, "",1000, DAQmx_Val_Rising,DAQmx_Val_FiniteSamps, 1000));

        DAQmxErrChk(DAQmxCfgDigEdgeStartTrig(taskOut, "PFI0", DAQmx_Val_Rising));

  

        Error:
        return DAQmxError;
            
        DAQmxStartTask (task0);
         
        /* Place here the code to acquire the data */
       
        DAQmxStopTask (task0);
           
        DAQmxClearTask(task0);
           
        return 0;
}


Download All
0 Kudos
Message 5 of 6
(3,492 Views)

Hi Carsten,

thank you very much for your help, especially the screenshots.

The lines above I got from an NI-Example, little bit modifying. As I see, this function helps too:

DAQmxSetTimingAttribute (taskHandleA1, DAQmx_SampClk_Rate, 1000.0)

bye

 

 

0 Kudos
Message 6 of 6
(3,482 Views)