キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Dynamic shared variable node

Hello, i'd like something like a Shared Variable Node, but with ability to choose at runtime which variable to read/write, for example passing a variable name. Is it possible?
I have the DSC module and it supports "Shared Variable Costant", which can be passed to a Property Node and allows to dinamically access a SV's properties, but apparently not its value and error status.
I tried to retrieve the DataSocketURL property and pass it to "Datasocket Read"; it kinda works, but i'm not sure if it's equivalent to a SV Node... it's slower and error status is not easily detected. May it be the right way?
0 件の賞賛
メッセージ1/8
5,638件の閲覧回数

Greetings and Merry Christmas,

 

I guess I’m a little confused about your application. An idea for choosing a variable to read/write from your front panel would be with a state diagram. This could be placed in a stacked sequence to occur first. Is that what you are trying to accomplish? Would you please elaborate on your application as well as what you mean about “choosing a variable”

 

For the Shared Variable Constant, I’m not sure why you would want to pass the value or error status when you could just deploy the shared variable?

 

Let me know of any head way and good luck!
Jordan Randall
National Instruments Italy
0 件の賞賛
メッセージ2/8
5,593件の閲覧回数

Sorry for late reply, i've been on holiday.

My current apllication is a typical DSC with data binding and Fieldpoint. There isn't a particular problem i need to solve, but a "dynamic SV" would be generally useful and make some code more clean.

By "choose" i mean select, wiith an input wire in the block diagram, which variable a r/w node refers to. It's got nothing to do with front panel and user's choices.

For example, suppose i wish to  turn on 30 boolean variables. Normally i need to place 30 variable nodes!! A For loop with a dynamic node and an array of variable names would be much better.

Other example: i have a complex r/w operation which may be done on SV a, or SV b, or SV c... depending on a Case. Normally i need to duplicate the whole operation for each case; or to put in a Case every variable.node. It would be much better to pass just the name of the variable as an input!

Note: i can't use arrays because binding a SV of type "array" to multiple Fielpoint channels isn't possible.

0 件の賞賛
メッセージ3/8
5,506件の閲覧回数
I think a solution is (was) accessing variables with Datasocket blocks and a psp:\\... url. The url is a string and can be easily changed at runtime. Right?
0 件の賞賛
メッセージ4/8
4,550件の閲覧回数

Right. Below there is an excerpt from https://www.ni.com/en/support/documentation/supplemental/06/using-the-labview-shared-variable.html.
Buon lavoro!


Use the Datasocket API in applications where you need change dynamically the shared variable that a VI reads and writes. You can change a shared variable dynamically by building the URL of the Datasocket connection programmatically. You also can control other shared variable features, such as buffer size, programmatically. Additionally, the Datasocket API has a blocking read that returns only when the shared variable updates.

Figure 14. Using the DataSocket API to Programmatically Read and Write Shared Variables



 
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 件の賞賛
メッセージ5/8
4,547件の閲覧回数
Grazie (ormai avevo risolto piazzando miliardi di nodi SV, ma sarà utile la prossima volta スマイリー ハッピー)
0 件の賞賛
メッセージ6/8
4,542件の閲覧回数

Hi pincpanter,

The link you had attached is getting failed now.

Can you please give the correct link again ?

I m in need of it now, thats why I m replyng to this a-bit old post when I got it while searching...

- Partha ( CLD until Oct 2027 🙂 )
0 件の賞賛
メッセージ7/8
4,108件の閲覧回数

Hi Partha, the link fails simply because I inserted it the wrong way Smiley Wink
Here is a valid link: https://www.ni.com/en/support/documentation/supplemental/06/using-the-labview-shared-variable.html

 
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
メッセージ8/8
4,105件の閲覧回数