Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NetworkVariableData does not have a value

Solved!
Go to solution

Hello

I am developing an C# application (.net framework 3.5) that uses network variable to communicate with a cRIO 9476 card.  I've set up a network variable
DO00 in Labview 2009 with the following properties


  Variable
      variable type:  Network Published
      data type:  Boolean
      Aliasing is enabled
          Bound to a project variable 'Test-cRIO\Mod1\DO0'
      Access Type is read/write

  Alarming
      Not enabled
  Description
      Not enabled
  Initial Value
      Not enabled
  Logging
      Not enabled
  Network
      No buffer
      is Single writer
  RT FIFO
      not enabled
  Scaling
      not enabled
  Security
      not enabled

My C# code is

        public DigitalOutputPort(string portAddress)
        {
            _portAddress = portAddress;
            _networkVariableSubscriber = new NetworkVariableSubscriber<bool>(_portAddress);
            _networkVariableSubscriber.DataUpdated += new EventHandler<DataUpdatedEventArgs<bool>>(_networkVariableSubscriber_DataUpdated);
            _networkVariableSubscriber.ConnectionBehavior = SubscriberConnectionBehavior.UpdateOnConnect;
            _networkVariableSubscriber.Connect();
            _portName = GetPortName(portAddress);
        }

the event handler looks like

        void _networkVariableSubscriber_DataUpdated(object sender, DataUpdatedEventArgs<bool> e)
        {
            _value = e.Data.GetValue();
            DOValueChangedEventArgs e1 = new DOValueChangedEventArgs(_value);
            OnDOValueChanged(e1);
        }


All of this works like a charm when the NI Variable Manager or the NI Distributed System Manger is running.  When
I stop those, the application fails in the event handler on the '_value = e.Data.GetValue()' statement with an error
that states "The NetworkVariableData does not have a value"

I've tried changing the location of the shared variable from the windows 7 system to the cRio and back, but it doesn't seem
to change anything.  I've also checked to ensure that the National Instruments Variable Engine service is running (it is).

 

I'm obviously missing something!

Ideas and suggestions on what I've missed are greatly appreciated

 

Thanks

0 Kudos
Message 1 of 5
(3,816 Views)
SteveB1-

What exactly do you mean, “running”?  Do you mean when the DSM is open and active, or running in the background? 

If you look at the processes running when it the DSM is “running” does anything else initialize? 

Has anyone else seen this?

Regards,

Mike S
NI AE
0 Kudos
Message 2 of 5
(3,792 Views)

Sorry for the delay in getting back..  It's been a bit snowy up here!

 

When i say it is running, DSM is open.  It doesn't seem to matter whether it is the currently executing application or not, just whether it is open and shows up in the task manager.

 

Thanks

 

Steve B

0 Kudos
Message 3 of 5
(3,755 Views)
Solution
Accepted by SteveB1
Steve B-

Keep that snow up where you are!  We don’t want it down here in Austn!

I would like for you to check a few things when your DSM isn’t running:

1. In your Task Manager, please look for “tagsrv.exe”.
2. Start>>Control Panel>>Administrative Tools>>Services.  Then look for National Instruments Variable Engine and check to see if it is “Started”.

Each of these controls your shared variable engine and will need to be running in order for your shared variables to run correctly.  Typically when you open the DSM, it will begin these Services automatically and that is why your shared variables work correctly when it is open.

Regards,

Mike S
NI AE
Message 4 of 5
(3,742 Views)

That was the problem.  The variable engine service had been set to manual!

 

Thank You

 

Steve B

0 Kudos
Message 5 of 5
(3,736 Views)