LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best practice for implementing a "memory tag", as was called in LV7.1 & DSC, in LV8.0 with DSC?

Hi All,
 
I'm developing an HMI application with LV8.0 and DSC8.0, using OPC client/server architecture and what I need is reshaping some OPC tags that are subscribed by the hardware manufacturer's OPC server and re-publish them as new OPC tags. This was called "memory tags" in earlier versions of DSC module.
 
1- What is the standard way for doing this in LV8.0?
 
2- I guess it would be "Custom I/O servers", "Periodic" & "On Input Change". Is this true?
 
    If YES, how can I create such a server? Please don't say go and read manuals. I have read LV Help word by word on both periodic and on input change servers, but no success. Server VI will not run after changes of inputs (in case of On Input Change).
 
 
Any help is greatly appreciated.
 
0 Kudos
Message 1 of 15
(10,590 Views)

" Please don't say go and read manuals."

I have trouble just keeping up with the rease and upgrade notes!

Take a look at

Help

>>> Browse

>>> Toolkits and Modules

>>> Datalogging and Supervisory Control

>>> Alarms and Events

>>> DSC event Structure Demo

It demonstrates how to use dynamic events to detect changes from tags (shared variables).

It sure beats the old polling methods.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 15
(10,572 Views)
Hi Ben,
 
I was away from LV for some time. I remember your previous helps and appreciate your continuing support.
 
So you say the answer is event structure support VIs for DSC module. Actually this will return the problem one step back. I used to think that there must be something about "custom I/O servers".
 
Let me be more clear. The main problem can be classified as a "shared variable scaling", as I think, e.g. suppose we have 5 boolean tags and we are interested only in the number that is generated by placing these bits into an array. (TTFFT = 25 or FFTTT = 7  and so on) so it is ideal if we can build a new tag of double type that will be published by NI OPC Server, not original hardware manufacturer's OPC server.
 
Please tell me what is the suitable tool for solving this problem? "Dynamic Events" or "On Input Change Custom I/O Server" ?
 
When we select the tool, I promise to read and even memorize all Help notes Smiley Wink
 
Thanks a lot.
Soroush
 
 
0 Kudos
Message 3 of 15
(10,567 Views)

Hi Soroush,

 

I have exactly such a problem. I think the solution should be using "Custom VI-on input change" I/O server. I was using Memory tags in previous version of DSC but I wonder if there's no substitute for it in DSC 8.0. As "Custom VI-on input change" is explained in DSC help I used it instead of memory tags but seem it doesn't work like memory tags.

Then what is this concept usage? Using Dynamic Events Ben suggests needs programming, then here's no any memory tag substitute?

0 Kudos
Message 4 of 15
(10,531 Views)

Maryam wrote:

 

Then what is this concept usage? Using Dynamic Events Ben suggests needs programming, then here's no any memory tag substitute?

 
Hi Maryam,
 
I agree, thanks. what Ben suggests works, but needs a VI to be in run mode always and a ready-to-execute event structure as I think. "On Input change Custom I/O Server" as NI claims is a VI that automatically runs when some input changes, but I couldn't get it worked! Actually when I run the server VI manually it works, but this is not the promised case. The server VI is supposed to run itself.
 
Any help?
0 Kudos
Message 5 of 15
(10,527 Views)
Soroush,

You should not need to have a VI that is constantly running to accomplish the application you are trying to build. Actually the Custom I/O Server sounds like exactly what you need for your application. After testing this functionality with a piece of test code, the custom I/O server appears to accomplish the application you have proposed.

So, I was hoping you might be able to post back and let us know what happens when you run your custom I/O server? Do you receive an error or does the output value simply fail to update? How are you updating the input values of your I/O server and how are you monitoring the output? I should also mention that the library containing the I/O server must be deployed in order for the I/O server to work correctly.

If you would, please check these things and let us know if you are still having any trouble. I hope this helps! Thanks,

Mike
0 Kudos
Message 6 of 15
(10,510 Views)
Mike,
 
Thanks for your post. I've uploaded a clear sample project.
 
Sequence as I think: When the Project is deployed, SreverVI_2.vi is loaded. When any of inputs to ServerVI_2.vi changes, this VI runs and upon completing its execution, we have the new value of "Variable". So the ServerVI_2.vi only runs when any of its inputs changes. 
 
Sequence that really happens: When I run the ServerVI_2.vi manually, "Variable" is updated with no problem, but ServerVI_2 seems not to run automatically.
 
I have also checked all the points mentioned in Help>> DSC Module>> DSC Module Concepts>> Using Servers>> Developing Custom VI Based IO Servers
 
Please see the code.
Thank you.
0 Kudos
Message 7 of 15
(10,503 Views)
I look at the proj file. There are some misunderstanding about the usage of custom IO Server - On  Input Change.
 
For the short solution, you can use the Custom IO Server - Periodic to poll the OPC value from PSP and transform into a double value. See the attached picture.
I modified the ServerVI_2.vi and add a loop with a polling rate. Then I replace the variable node with just a double indicator. Next I invoke the DSC Create Periodic Server wizard pick the VI and select to publish only the Variable indicator. Now I created a new IO server using the Periodic IO server I just created. If you run this the Server will read the PSP control values every x ms and put the value into the Variable data item at address (\\localhost\Custom IO Server\Custom VI - Periodic1\Variable) which you can view from the network. If you want logging on the value then create a variable and source it to the dataitem. Now I understand this is a polling solution, if you want the value only change when the 5 input boolean value changes, then you need to modify the VI to use the Event notification rather than PSP subscription.
 
Why the On Input Change does not work is because there is nothing writing to the input of the server. If you want to see the IO Server Run, create a variable and tell it to publish to the input of the On Input Change. When you change the variable value then the IO Server get runs, it does not get the value from the PSP binding automatically. 
 
 
0 Kudos
Message 8 of 15
(10,456 Views)

"For the short solution, you can use the Custom IO Server - Periodic to poll the OPC value from PSP and transform into a double value."

"Now I understand this is a polling solution"

----------------------------------------------------------------

I'm not looking for a polling solution. You edited the ServerVI_2 by placing a while loop. this is correct if perioding server is target, but LV help says that for creating an "on input change" server, the server VI must complete and finish its execution as soon as possible. even there is a hint that says NOT TO LEAVE ANY UNFINISHED WHILE  LOOPS !

----------------------------------------------------------------

"Why the On Input Change does not work is because there is nothing writing to the input of the server. If you want to see the IO Server Run, create a variable and tell it to publish to the input of the On Input Change"

---------------------------------------------------------------
 
I can not understand the above sentence. may you explain it a little more? Actually, I used to think that the ideal way to build a server VI is using shared variables as its inputs and outputs. This is why I placed ServerVI_1 in the previously uploaded project.
(shared variables that are bound to OPC tags as inputs - and - new shared variables that are acting as "memory tags" as outputs.)
bu LV doesn't accept the server vi with no inputs connected to its connector. so I had to place controls on the front panel and directly bind them to opc tags in ServerVI_2.
 
This discussion will end up successfully if someone claims that he/she has used On-Input change Custom IO server with no problem and explain us the procedure. Thanks in advance!Smiley Happy
 
Message 9 of 15
(10,430 Views)
Ok, So I have a working sample in 8.0.1 files.
Unzip the sample it have the following:
1. Glom5bool.vi ---- the base vi used for server creation.
2. I run the custom IO server on input change assistant on it and create a server.
3. I create the lvlib in there and add an instance of the server.
4. I created a basic usage VI. Which have 5 boolean control bound using PSP network item to the input of the IO Server directly and bound a numerical indicator to the IO Server output directly. When I run the VI the scaling/conversion calculation is done inside the server.

It shows how the server work.

Hopefully this helps.
Message 10 of 15
(10,405 Views)