11-28-2008 02:54 PM
Hi all,
I am facing a paculiar problem with Shared Variables. I have an application in which shared variables are used for data communication.
One of the application requirement is to retain the variable values eventhough PC is rebooted or started after crashing.
As per the my understanding, the variable values will retain eventhough the PC is rebooted. But here i can observe a paculiar problem like some library variables are retaing the values while some others not. I enabled logging for all the variables.
I tried many ways. like logging enabled, logging disabled, changing variable names, changing process names etc... But i am not getting a consistent behaviour.
I hope some you can help me in solving this issue.. "How Can i retain the Shared Variable Values after PC rebooting"
Thanks and Regards,
Mir
12-01-2008 09:54 AM
Hi Blackperl,
Thanks for the post and I hope your well.
What do you mean by not getting consistent behaviour.. this will all depend on excatly when the crash happens i.e. before the write or after.
Surely a better method would be to log the data to a file during the reboot...
I beleived the value read back
will be the default value for the shared variable's data type.
The LabVIEW DSC 8.0 module adds more functionality to the shared variable, including initial values and alarms.
If you enable an initial value on a shared variable, when the variable
engine comes back on-line it will default to this value. Setting a bad
status alarm for the shared variable is also a good way of handling
this type of event. Additionally, if you are using a LabVIEW Real-Time
target such as Compact RIO or Compact FieldPoint, it is appropriate to
consider hosting the shared variable engine on the real-time target.
These devices have watch-dog capabilities and are typically the
hardware controlling the critical pieces of an application. Most
Windows or PC-based targets do not have these fail-safes.
I guess, if you could explain to me again that would be great. From my point of view, if I have a cRIO and a Windows PC. If the windows PC crashes, the cRIO will still update its shared variables. Then once the PC has started up its own shared variable engine, and the bindings are loaded, it will once again continue to update its copies of the variables.
Please let me know what you think,
Kind Regards,
James.
01-05-2009 02:47 AM
Hi, I have also the same wishes. I would like to have the option to retain last value from the shared variable engine.
I have a number och hardware related shared variables. With them thera are no problem. They will be read again. But I also have some parameters stored in shared variables. I could ofcause use a textfile for these settings but there are some advantages to use shared variables. If I use shared variables I get automatic logging of parameter changes.I can configure it so that I can see the parameter changesin the event list. I also think that the shared variable database is a more secure storage than a textfile.
I can see the options to reinitialize values to predefined start values. But is there a way to read values from the engine and use them to initialize the shared variables?
01-05-2009 03:17 AM
Hi StenK and Blackperl,
Thanks for your posts and I hope your well - Happy New Year and all.
The last known good value of all your variables should be automatically saved when the system is shutdown. When you next start, the value should be initialized to this last known good value. This feature is available w/o LabVIEW DSC.
If it is configuration data your trying to pass between log off /shutdown then can you not use a VI to generate/load an ini file?
Please let me know what you think,
01-05-2009 03:44 AM
Hi, And thanks for your answer.
I'm not sure what you actually mean. You write:
The last known good value of all your variables should be automatically saved when the system is shutdown. When you next start, the value should be initialized to this last known good value. This feature is available w/o LabVIEW DSC.
This is exact what I want but when I restart my computer the values are (No Known Value). Is there some configuration that I have missed. Or is this feature not avalable because I have LabView DSC?
If the above not is working I can write it down to an ini file. Do you know a way to loop through all shared variables and save / read them to/from an ini or xml file?
01-05-2009 04:04 AM
Hi Stenk,
Thanks for the reply.
If you have two vi's, one which writes to the shared variable location and one that reads. Start the reader and then the writer. It performs as expected. Now if you stop the writting vi the reader continues to read the last value stored at that location 'last good value'. This still works if you rebot the machine, you'll see the shared variable still reads the previous value.
In LabVIEW 8.6 Distributed System Manager, if have a variable with a value of 45, and after rebot the value remains.
Can you try this example and let me know what you think,
01-05-2009 06:53 AM
01-06-2009 03:32 AM
Hi StenK,
Thanks for the reply and I hope your well today.
Could you please explain/detail the steps your are currently taking? and maybe include some example code. I am pretty sure the method your looking for is in the nature of the variables after reboot.
Thanks,
01-07-2009 04:37 AM
Hi, and thanks for taking your time to help me out.
I made a new tiny project containing two vis and one shared variable. One vi that continuously is writing to the shared variable and one vi that reads the shared variable.
When I run both of them everyting works fine and if I stop both vi's and closes Labview and then restarts labview and starts the reder vi, it reads the last good value.
But if I also restart my computer it reads 0 and in distributed system manager it says no known value.
I attach the files. Just tell me if you want some more files.
Thanks
Sten