Hi Philipp,
exactly, use a "meta variable" that it's set on every variable changes.
Sending the meta variable ( dictionary) with each change could be a problem if 
there are a large number of parameters to be transferred; in that case it might 
be useful to ‘split’ the parameter set into ‘changed often’ and ‘changes 
sometimes’.
Actually, one could also use a ‘list’ and then derive the individual variables 
via the list index... I used a dictionary because they seems a little more 
descriptive to me.

In my application there are about ten of them and I have never encountered any 
problems: my ‘Control Unit’ and the ‘RF head’ are connected via a VPN and 
physically about 40 km apart.
Attached is a small demonstration flow ;-)

Enjoy!

Viitorio, I3VFJ

fingerprint: fb5f492a54e016c632c933d3ee4b7e38203c79ca

Inviato con l'email sicura [Proton Mail](https://proton.me/mail/home).

lunedì 27 gennaio 2025 18:58, Philipp Niedermayer <p.niederma...@gsi.de> ha 
scritto:

> Hi Vittorio,
>
> not sure I get it, according to [1], [2] and [3] linked below it is clear, 
> that the variable name configured as parameter is used, and the actual <name> 
> of the message pair is ignored.
>
> Are you suggesting to to put all my variables in a single "meta variable" of 
> dict type? I.e. something like `meta_var = {"freq": 1e6, "gain": 5}` and then 
> access it like `meta_var["freq"]` instead of just `freq`? That's an 
> interesting approach, but it would require to change all variables in the 
> flowgraph, and to always send all variables even if you only want to change a 
> single one, right?
>
> Best
> Philipp
>
> [1] https://wiki.gnuradio.org/index.php/Message_Pair_to_Var
> [2] https://github.com/gnuradio/gnuradio/issues/6574
> [3] 
> https://github.com/gnuradio/gnuradio/blob/8cbd8526b50a96188119d11bf69b2fc701edb38a/gr-blocks/python/blocks/msg_pair_to_var.py
>
> Am 27.1.25 um 17:33 schrieb vitt...@pm.me:
>
>> Good evening everybody!
>>
>> Regarding this:
>> "...PS: I found that the "Message Pair to Var" block is not very flexible, 
>> since it only allows to set one specific variable...."
>>
>> Actually a variable can also be a dictionary: simply creates a dictionary in 
>> which tag/value pairs refer to other variables.
>> In a mine (never finished) project I'm using this to transfer several 
>> settings (TX_freq, RX_freq, various gains, PTT) between a remote RF head 
>> (Pluto+ and amplifiers) and a local CONTROL unit, over ZMQ sockets with very 
>> good results
>>
>> I hope it can be helpful...
>>
>> Vittorio, I3VFJ
>>
>> fingerprint: fb5f492a54e016c632c933d3ee4b7e38203c79ca
>>
>> Inviato con l'email sicura [Proton Mail](https://proton.me/mail/home).
>>
>> lunedì 27 gennaio 2025 09:16, Philipp Niedermayer 
>> [<p.niederma...@gsi.de>](mailto:p.niederma...@gsi.de) ha scritto:
>>
>>> Dear Muhammad,
>>>
>>> you can use ZMQ blocks to send messages to your GR program. Either directly 
>>> to the message port of USRP sink, or use a "Message Pair to Var" block to 
>>> update a flowgraph variable. You can read more about these blocks here:
>>>
>>> - https://wiki.gnuradio.org/index.php/Understanding_ZMQ_Blocks
>>> - https://wiki.gnuradio.org/index.php/Message_Pair_to_Var
>>>
>>> PS: I found that the "Message Pair to Var" block is not very flexible, 
>>> since it only allows to set one specific variable. I am currently working 
>>> on a similar block that allows me to change multiple variables based on the 
>>> message car, so that I can control my flowgraph by sending (variable_name, 
>>> value) message pairs. Once I got it to work, and if there is interest, I 
>>> could open a PR.
>>>
>>> Best
>>> Philipp
>>>
>>> Am 25.1.25 um 8:08 schrieb Muhammad Anas:
>>>
>>>> Dear GNU Radio Community,
>>>>
>>>> I'm working on a project to control a USRP channel frequency from QT 
>>>> creater GUI application, is it possible to implement a communication 
>>>> between QT and GRC using xmlrpm or tcp block etc to control the GRC 
>>>> parameters in real-time on the same computer in window.
>>>>
>>>> Kindly help me to achieve this communication.
>>>>
>>>> Regards
>>>> Muhammad Anas

Attachment: dict_ZMQ.grc
Description: Binary data

Attachment: dict_ZMQ.pdf
Description: Adobe PDF document

Reply via email to