SIMulation Workbench Documentation SIMulation Workbench Documentation

Signal Generator API
[SimWB RT functions]

Collaboration diagram for Signal Generator API:

Functions

int ccurGen_addGenerator (const char *pointName, int endConditionType, int sigtype, float freq, float amplitude, float phase, float offset, float duty, float noise, double duration, void *userArg)
int ccurGen_addGeneratorP (const RTDBItem *pItem, int endConditionType, int sigtype, float freq, float amplitude, float phase, float offset, float duty, float noise, double duration, void *userArg)
int ccurGen_addAsamGenerator (const char *pointName, const char *asamFile)
int ccurGen_addSegmentGenerator (const char *pointName, const char *sigName, int repeat)
int ccurGen_addAsamGeneratorP (const RTDBItem *pItem, const char *asamFile)
int ccurGen_addSegmentGeneratorP (const RTDBItem *pItem, const char *sigName, int repeat)
int ccurGen_startGenerator (int genNumber)
int ccurGen_startAllGenerators ()
int ccurGen_stopGenerator (int genNumber)
int ccurGen_removeGenerator (int genNumber)
int ccurGen_stopAllGenerators ()
int ccurGen_removeAllGenerators ()
int ccurGen_appendGenerator (int first, int second)
int ccurGen_rampToValue (const char *pointName, double endValue, double rate, int initCondition, double initialValue)
int ccurGen_rampToValueP (const RTDBItem *pItem, double endValue, double rate, int initCondition, double initialValue)
int ccurGen_rampRate (const char *pointName, double duration, double rate, int initCondition, double initialValue)
int ccurGen_rampRateP (const RTDBItem *pItem, double duration, double rate, int initCondition, double initialValue)
int ccurGen_getGeneratorInfo (int genNumber, GeneratorInfo *info)

Detailed Description

This API is used by program running on the Real-Time host to access and configure signal generators.
Typically, those programs are script program that initialize signal generator at start-up time and attach an RTDB item value to it.


Function Documentation

int ccurGen_addGenerator ( const char *  pointName,
int  endConditionType,
int  sigtype,
float  freq,
float  amplitude,
float  phase,
float  offset,
float  duty,
float  noise,
double  duration,
void *  userArg 
)

Attach a wave form generator to a RTDB point value for a specified duration or terminate with a user specified callback.
A test must be running before you can create and start a signal generator.

Warning:
This function require long execution time as it generates an internal buffer of a one cycle wave used for DDS wave generation.
Parameters:
pointName The name of the RTDB item to assign value to.
endConditionType One of TDL_SiggenEndCondition. Either terminate when user specified time has expired or when the user supplied callback routine returns true;
sigtype One of SigType i.e. SIG_TYPE_SINE, SIG_TYPE_SQUARE, SIG_TYPE_TRIANGLE, SIG_TYPE_SAWTOOTH, SIG_TYPE_NOISE but NOT SIG_TYPE_RAMP reserved for ramp only.
freq The frequency in Hz for the signal generator.
amplitude The amplitude in Engineering for the generator.
phase The phase in degree for the generator.
offset The offset in engineering units for the generator.
duty The duty cycle in % (0 to 100 %) for the generator.
noise Additional white component to add to the signal generator.
duration The duration in seconds . Use -1 to run forever until the test is stopped.
userArg Pointer to pass to the user callback routine at each call. Callback is not supported at this time.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_addGeneratorP ( const RTDBItem pItem,
int  endConditionType,
int  sigtype,
float  freq,
float  amplitude,
float  phase,
float  offset,
float  duty,
float  noise,
double  duration,
void *  userArg 
)

Attach a wave form generator to a RTDB point value for a specified duration or terminate with a user specified callback.
A test must be running before you can create and start a signal generator.

Warning:
This function require long execution time as it generates an internal buffer of a one cycle wave used for DDS wave generation.
Parameters:
pItem Pointer to the RTDB item.
endConditionType One of TDL_SiggenEndCondition. Either terminate when user specified time has expired or when the user supplied callback routine returns true;
sigtype One of SigType i.e. SIG_TYPE_SINE, SIG_TYPE_SQUARE, SIG_TYPE_TRIANGLE, SIG_TYPE_SAWTOOTH, SIG_TYPE_NOISE but NOT SIG_TYPE_RAMP reserved for ramp only.
freq The frequency in Hz for the signal generator.
amplitude The amplitude in Engineering for the generator.
phase The phase in degree for the generator.
offset The offset in engineering units for the generator.
duty The duty cycle in % (0 to 100 %) for the generator.
noise Additional white component to add to the signal generator.
duration The duration in seconds . Use -1 to run forever until the test is stopped.
userArg Pointer to pass to the user callback routine at each call. Callback is not supported at this time.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_addAsamGenerator ( const char *  pointName,
const char *  asamFile 
)

Attach an ASAM wave form generator to an RTDB point value.
A test must be running before you can create and start a signal generator.

Parameters:
pointName The name of the RTDB item to be driven.
asamFile The name of the ASAM signal definition file.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_addSegmentGenerator ( const char *  pointName,
const char *  sigName,
int  repeat 
)

Attach an segemented wave form generator to an RTDB point value.
This is similar to a ASAM generator but the signal generator file is In the SigGenerators directory.
A test must be running before you can create and start a signal generator.

Parameters:
pointName The name of the RTDB item to be driven.
sigName The name of the generator ; i.e. 'sig1', 'mysig', etc..
repeat The number of time to repeat the segment when generating data.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_addAsamGeneratorP ( const RTDBItem pItem,
const char *  asamFile 
)

Attach an ASAM wave form generator to an RTDB point value.
A test must be running before you can create and start a signal generator.

Parameters:
pItem Pointer to the RTDB item to be driven.
asamFile The name of the ASAM signal definition file.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_addSegmentGeneratorP ( const RTDBItem pItem,
const char *  sigName,
int  repeat 
)

Attach an segemented wave form generator to an RTDB point value.
This is similar to a ASAM generator but the signal generator file is In the SigGenerators directory.
A test must be running before you can create and start a signal generator.

Parameters:
pItem Pointer to the RTDB item to be driven.
sigName The name of the generator ; i.e. 'sig1', 'mysig', etc..
repeat The number of time to repeat the segment when generating data.
Returns:
> 0 The generator number on Sucess.
< 0 On Failure. Error can be any of the RTDB or GEN_xx failure code.
See also:
simerrors.h
int ccurGen_startGenerator ( int  genNumber  ) 

Start the generator number genNum.

Parameters:
genNumber A valid generator number returned by a call to ccurTDL_addGenerator.
Returns:
0 On success. < 0 Any of TDL_xx error codes
See also:
simerrors.h
int ccurGen_startAllGenerators (  ) 

Start all the generators that have been defined.
This does not start generators that are appended.

int ccurGen_stopGenerator ( int  genNumber  ) 

Stop the generator genNum.

Parameters:
genNumber The number of the generator to stop.
Returns:
0 On success.
< 0 TDL_GENERATORNOTFOUND if the generator cannot be found.
int ccurGen_removeGenerator ( int  genNumber  ) 

Stop the generator genNum and remove it from the list of existing generators.

Parameters:
genNumber The number of the generator to stop.
Returns:
0 On success.
< 0 TDL_GENERATORNOTFOUND if the generator cannot be found.
int ccurGen_stopAllGenerators (  ) 

Stop all the generators that have been defined.

int ccurGen_removeAllGenerators (  ) 

Stop all the generators that have been defined and remove them from the list of existing generators.

int ccurGen_appendGenerator ( int  first,
int  second 
)

Append a second generator that starts running when the first has finished executing.
Both generators must have been created by a call to _addGenerator or _rampToValue or _rampRate.

Parameters:
first The number of the first generator.
second The number of the generator that will start when first finished.
Returns:
0 On success. < 0 If either generator cannot be found.
int ccurGen_rampToValue ( const char *  pointName,
double  endValue,
double  rate,
int  initCondition,
double  initialValue 
)

Ramp up/down a RTDB point value to a specified value.
The function will keep running until the end value is attained.
A test must be running before you can create and start a ram signal.

Parameters:
pointName The name of the RTDB item to assign value to.
endValue The target end value.
rate The rate in Units/Seconds at which to ramp the value of the item up or down.
initCondition The initial value type for the ramp.
See also:
GEN_SiggenInitValue .
Parameters:
initialValue This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.
Returns:
> 0 The generator number on success.
< 0 On Failure. Error can be any of the RTDB or TDL failure code.
See also:
simerrors.h
int ccurGen_rampToValueP ( const RTDBItem pItem,
double  endValue,
double  rate,
int  initCondition,
double  initialValue 
)

Ramp up/down a RTDB point value to a specified value.
The function will keep running until the end value is attained.
A test must be running before you can create and start a ram signal.

Parameters:
pItem Pointer to the RTDB item.
endValue The target end value.
rate The rate in Units/Seconds at which to ramp the value of the item up or down.
initCondition The initial value type for the ramp.
See also:
GEN_SiggenInitValue .
Parameters:
initialValue This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.
Returns:
> 0 The generator number on success.
< 0 On Failure. Error can be any of the RTDB or TDL failure code.
See also:
simerrors.h
int ccurGen_rampRate ( const char *  pointName,
double  duration,
double  rate,
int  initCondition,
double  initialValue 
)

Ramp up/down a RTDB point value for a specified duration.
The function will keep running for the duration specified by the call.

Parameters:
pointName The name of the RTDB item to assign value to.
duration The duration in seconds. Must be > 0.
rate The rate in Units/Seconds at which to ram the value of the item up or down.
initCondition The initial value type for the ramp.
See also:
GEN_SiggenInitValue .
Parameters:
initialValue This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.
Returns:
> 0 The generator number on success.
< 0 On Failure. Error can be any of the RTDB or TDL failure code.
See also:
simerrors.h
int ccurGen_rampRateP ( const RTDBItem pItem,
double  duration,
double  rate,
int  initCondition,
double  initialValue 
)

Ramp up/down a RTDB point value for a specified duration.
The function will keep running for the duration specified by the call.

Parameters:
pItem Pointer to the RTDB item.
duration The duration in seconds. Must be > 0.
rate The rate in Units/Seconds at which to ram the value of the item up or down.
initCondition The initial value type for the ramp.
See also:
GEN_SiggenInitValue .
Parameters:
initialValue This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.
Returns:
> 0 The generator number on success.
< 0 On Failure. Error can be any of the RTDB or TDL failure code.
See also:
simerrors.h
int ccurGen_getGeneratorInfo ( int  genNumber,
GeneratorInfo *  info 
)

Get the running status of the generator genNum .

Parameters:
genNumber The number of the generator to stop.
info A pointer to a GeneratorStatus structure where the information is returned.
Returns:
0 On success.
< 0 GEN_GENERATORNOTFOUND if the generator cannot be found, RTDB_POINTNOTFOUND if the RTDB attached to the generator cannot be found.