1

I am trying to automatically update a variable "phase_shift" using GNU Radio.

I have 2 receivers and I am trying to find the optimal phase shift between them. Once this value has been calculated, I want it to be plugged into the phase shift block so that the phase of one of the receivers is actually shifted. However, the calculated phase shift value is constantly changing over time and hence, I would like to save it into a variable that will then be plugged into the actual phase shift block in GNU Radio to find the desired output.

So, as of now, the program is automatically calculating the desired phase shift. I would like to save this value and plug it into the "phase shift" block so it is automatically updated. Is there a way of doing so?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Roby
  • 25
  • 5
  • Does this answer your question? [Qt - easiest and fastest way to save (or load) qt variables in (from) file](https://stackoverflow.com/questions/43191314/qt-easiest-and-fastest-way-to-save-or-load-qt-variables-in-from-file) – mkrieger1 May 22 '23 at 14:13
  • No, that's not what I am looking for. I am trying to find a way to save a variable in GNU Radio, without using python. For instance, I would like to have a block which can save and store a variable, in this case "phase_shift", so then I can use this to update the phase shift in the "phase shift" block. – Roby May 22 '23 at 14:54
  • Where do you want to store the variable? Do you not mean that it is saved when you close the program, in order to load the same value again when you start the program the next time? – mkrieger1 May 22 '23 at 15:01
  • I will try to explain better what I am doing. So I have 2 receivers and I am trying to find the optimal phase shift between them. Once this value has been calculated, I want it to be plugged into the phase shift block so that the phase of one of the receivers is actually shifted. However, the calculated phase shift value is constantly changing over time and hence, I would like to save it into a variable that will then be plugged into the actual phase shift block in GNU Radio to find the desired output. So as of now I am using a slider and manually looking for the desired output. – Roby May 22 '23 at 15:39

1 Answers1

-1

I have 2 receivers and I am trying to find the optimal phase shift between them. Once this value has been calculated, I want it to be plugged into the phase shift block so that the phase of one of the receivers is actually shifted. However, the calculated phase shift value is constantly changing over time and hence, I would like to save it into a variable that will then be plugged into the actual phase shift block in GNU Radio to find the desired output.

A variable is the wrong approach, then. What you'd want is probably to let the block that calculates the phase shift to emit the correction, which is then used in the other branch.

  • If you get a phase error estimate every N samples, then the right solution is to generate a stream of samples that are that shift, and (conjugate) multiply with that
  • If you get a phase error estimate sporadically, but based on the received signal, then it's likely the best option to add a stream tag at the position that your new estimate becomes "valid", and use that tag further down the processing
  • If you get a phase error estimate sporadically, externally, and asynchronously to the samples, then you would want to send a message to a block that does the correction.

But the variables you refer to only exist within the Python flow graphs, they are not what you need here.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94