Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assigning Attributes to a Waveform doesn't work - PXI5670 #903

Open
RT-Tap opened this issue Apr 4, 2023 · 4 comments
Open

Assigning Attributes to a Waveform doesn't work - PXI5670 #903

RT-Tap opened this issue Apr 4, 2023 · 4 comments

Comments

@RT-Tap
Copy link

RT-Tap commented Apr 4, 2023

Hi,
I've been trying to run a script that would require different waveforms to have different carrier frequencies or output powers. This would require me to add properties/attributes to arbitrary waveforms referenced in the script by following this process. It's a little confusing because it states

Use the ... channelName parameter of the niRFSG_GetAttributeViReal64 function to name a waveform 
and associate the ... NIRFSG_ATTR_IQ_RATE, NIRFSG_ATTR_PEAK_POWER_ADJUSTMENT, and NIRFSG_ATTR_ARB_CARRIER_FREQUENCY 
attributes with the named waveform. 

But I couldnt find anything on associating a waveform with an attribute other than to pass the waveform name in to the channel_name parameter of the GetAttributeViReal64 function. This however does not work, I tried both get GetAttributeViReal64 and set GetAttributeViReal64 functions as well as different waveform name formats suggested in both documentation for SetAttributeViReal64 and documentation for GetAttributeViReal64 such as testwaveform , waveform::testwaveform or waveform::testwaveform\marker0 but none accept this and throw an error.

The error I get is as follows:

Attribute: NIRFSG_ATTR_FREQUENCY, Channel: waveform::testwavform"
        debug_error_string = "UNKNOWN:Error received from peer ipv4:192.168.XX.XX:31763 {created_time:"2023-04-04T18:45:09.862103914+00:00", grpc_status:2, grpc_message:"IVI: The channel or repeated capability name is not allowed.\n\nAttribute: NIRFSG_ATTR_FREQUENCY, Channel: waveform::testwavform"}"

Am I doing something wrong here? Is documentation wrong? Can someone help clear this up for me?
Thank you.

EDIT: I even see that apparently I was doing this correctly according to this line in this example so not sure what's going on, there was no mention of this capability not working on the PXI5670.

AB#2356013

@reckenro
Copy link
Collaborator

reckenro commented Apr 4, 2023

Just at a glance, in the error you're getting towards the end it says Channel: waveform::testwavform"}"

Is it a typo that you're passing "waveform::testwavform" without the e in waveform?

@RT-Tap
Copy link
Author

RT-Tap commented Apr 4, 2023

Yea that's correct it was not a typo its just how I named it- I'm actually sending in channel_name = f"waveform::{name}"

@RT-Tap
Copy link
Author

RT-Tap commented Apr 5, 2023

OK so I altered a CVI script example to see if it's a grpc error and it turns out it may not be.

I altered the finiteGeneration-Re-Triggered NI_CVI example to have a test button that calls this function.

void testFunction()
{
   ViReal64 frequency;
   ViInt32  numberOfSamples = 25;
   ViInt32  waveformItr;
   double*  i_Data = VI_NULL;
   double*  q_Data = VI_NULL;
   double*  blank_Data = VI_NULL;
   ViStatus error = VI_SUCCESS;
   
   GetCtrlVal (gui, GUI_IN_RESOURCE_NAME, resourceName);
   
   checkWarn(
      niRFSG_init (resourceName, VI_TRUE, VI_FALSE, &vi));
   
   checkAlloc (i_Data = malloc (numberOfSamples * sizeof(double)));
   checkAlloc (q_Data = malloc (numberOfSamples * sizeof(double)));
   checkAlloc (blank_Data = malloc (12 * sizeof(double)));
   for (waveformItr = 0; waveformItr < numberOfSamples; waveformItr++)
   {
     i_Data[waveformItr] = 1.0;
     q_Data[waveformItr] = 0.0;
   }
   for (waveformItr = 0; waveformItr < 12; waveformItr++)
   {
     blank_Data[waveformItr] = 0.0;
   }
   checkWarn(
      niRFSG_WriteArbWaveform (vi, "triggeredWaveform", numberOfSamples,
                               i_Data, q_Data, VI_FALSE));

   checkWarn(niRFSG_WriteArbWaveform (vi, "allZeroes", 12, blank_Data, blank_Data, VI_FALSE));

   /*- Configure the frequency of each waveform -----------------------------*/
   checkWarn(
      niRFSG_SetAttributeViReal64 (vi, "waveform::triggeredWaveform", NIRFSG_ATTR_FREQUENCY, 2E9));
   checkWarn(
      niRFSG_SetAttributeViReal64 (vi, "waveform::allZeroes", NIRFSG_ATTR_FREQUENCY, 1.5E9));
   
Error:
   if (i_Data != VI_NULL) free (i_Data);
   if (q_Data != VI_NULL) free (q_Data);
   if (blank_Data != VI_NULL) free (blank_Data);

   showError ("startGeneration()", error);
}

And this is the error:
error

So does this mean it's not supported on PXI 5670? There's no note of that, also is there another way to accomplish scripts but have different waveforms have different attributes?

@RT-Tap
Copy link
Author

RT-Tap commented Apr 6, 2023

Ok so from what I'm seeing the only attributes that allow you to specify a waveform appear to be
NIRFSG_ATTRIBUTE_WAVEFORM_SIGNAL_BANDWIDTH, NIRFSG_ATTRIBUTE_WAVEFORM_RUNTIME_SCALING, NIRFSG_ATTRIBUTE_WAVEFORM_PAPR is that correct? This isn't mentioned anywhere in the documentation, the documentation makes it seem we can set NIRFSG_ATTRIBUTE_FREQUENCY, NIRFSG_ATTRIBUTE_ARB_POWER etc for each waveform independently by setting channelname to the waveform name.

This begs the question how would one change the frequency of waveforms referenced in a script? Do all waveforms in a script need to be the same frequency and output level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants