05-12-2009 02:28 PM
Does anybody knows if Properties for Controlling IviScope Simulation for TDS2000 series works. I've tried to set it through MAX properties like WAVEFORM, FREQUENCY so I can set different simulation from the deafualt one with no success. It did not affect the soft panel in TS 4 IviScope step.
Thank you.
Elik
Solved! Go to Solution.
05-13-2009 11:53 AM - edited 05-13-2009 11:54 AM
Hello Elik,
I tested this on my system and it works fine. Please make sure that you save the configurable initial settings in MAX to apply them to the IVI Configuration File. Also confirm that the Specific Driver Session is configured to use the Class Simulation Driver. You can see from my screenshots that the frequency and amplitude that I configure in MAX are being applied to the Simulation driver.
Cheers,
NathanT
05-13-2009 12:16 PM
Thanks Nathan,
I'm trying to do the same with TDS driver tktds1k2k witn no success. The niScope works fine. As you can see from the attached file the I define waveform as 2 for square wave and frequency. It also define the configurable setting for the driver at the driver session.
What am I doing wrong?
05-13-2009 12:18 PM
Here is the additional file.
05-13-2009 01:50 PM
Hello Elik,
Thank you for the clarification. The configurable initial settings are not going to apply to IVI Specific Driver simulation for most IVI Specific Drivers. For advanced simulation, you should use the Class Simulation Drivers. You can look at the source code for the tktds1k2k and see that the tktds1k2k_FetchSimData( ) function does not give much control over the data returned. The great thing is that you can edit the instrument driver to return different simulated data.
Cheers,
NathanT
05-13-2009 02:23 PM
Hi Nathan,
I look for the function tktds1k2k_FetchSimData( ) in the driver file and could not find one. The fetch functions are all related to the waveform. Where is this function located?
Elik
05-14-2009 09:15 AM
Hello Elik,
The FetchSimData() function is in the tktds1k2k.c file, which is probably located at "C:\Program Files\IVI Foundation\IVI\Drivers\tktds1k2k"
Cheers,
NathanT
05-14-2009 10:11 AM
Hi Nathan,
I did look at the suggested directory in both tktds1k2k and niScope driver and could not find the function. Under Aquisition Fuction I've found all kind of Fetch functions but there is no simulation functions. I guess I have to dig in. Is there any documentation that describe the part of simulation function. I also could not find it NI IVI Driver help. Any suggestions?
Thanks.
Elik
05-15-2009 10:23 AM
Hello Elik,
The full name of the function is "tktds1k2k_FetchSimData", try searching for that. I will attach the tktds1k2k.c file just in case. IVI simulation is defined by the IVI foundation specifications. They are available at ivifoundation.org
and I recommend looking at "IVI-3.1: Driver Architecture Specification" first. As long as a developer follows the specifications, they have some latitude in choosing how to implement simulation.
Cheers,
NathanT
p.s. Here is part of the code for "tktds1k2k_FetchSimData" :
/*****************************************************************************
* Function: tktds1k2k_FetchSimData
* Purpose: This function fetches and returns a simulated acquisition.
******************************************************************************/
.....
<section removed>
......
checkErr( Ivi_GetAttributeViReal64 (vi, channel,
TKTDS1K2K_ATTR_VERTICAL_RANGE,
0, &yRange));
checkErr( Ivi_GetAttributeViReal64 (vi, channel,
TKTDS1K2K_ATTR_VERTICAL_OFFSET,
0, &offset));
checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL,
TKTDS1K2K_ATTR_TRIGGER_SLOPE,
0, &triggerSlope));
checkErr( Ivi_GetAttributeViInt32 (vi, channel,
TKTDS1K2K_ATTR_VERTICAL_COUPLING,
0, &vCoup));
checkErr( Ivi_GetAttributeViReal64 (vi, VI_NULL,
TKTDS1K2K_ATTR_TRIGGER_LEVEL,
0, &level));
checkErr( Ivi_GetAttributeViReal64 (vi, VI_NULL,
TKTDS1K2K_ATTR_HORZ_TIME_PER_RECORD,
0, xIncrement));
theta = asin (2*level/yRange);
if (triggerSlope == TKTDS1K2K_VAL_POSITIVE)
k = 1.0;
else
k = -1.0;
*initialX = 0.0;
if( *actualPoints>waveformSize )
*actualPoints = waveformSize; /* Checking number of points to write */
*xIncrement /= *actualPoints;
if (vCoup == TKTDS1K2K_VAL_DC)
simOffset = 0.5;
if (vCoup == TKTDS1K2K_VAL_GND)
k = 0.0;
for (x = 0; x < *actualPoints; x++)
{
ViReal64 y = simOffset + k * 2.5 * sin (*xIncrement * 12560 * x + k * theta) + // ~2 periods of 1kHz sinewave
(!(x%20)) * (16384 - rand())/150000.0;
waveform[x] = (offset + yRange/2) > y ? ((offset - yRange/2) < y ? y : (offset - yRange/2)) : (offset + yRange/2);
}
Error:
return error;
}
05-15-2009 01:45 PM
Hello Nathan,
Thanks for the code. I've found the function in the file. My mistake was looking at the driver functions.
Thanks again
Elik