02-01-2008
11:03 AM
- last edited on
11-13-2024
12:11 PM
by
Content Cleaner
02-05-2008 11:52 AM
02-18-2008 01:23 PM
02-20-2008 12:00 AM
02-20-2008 09:13 AM
Hi Ben,
Actually the best choice in your case is to use the NetworkVariableDataSource
which was designed to work within an ASP.NET web page. It actually
encapsulates a NetworkVariableWriter and
NetworkVariableBufferedSubscriber. The NetworkVariableDataSource is very easy to use and we take care of any issue's that might arise when dealing with the ASP.NET page life cycle. Refer to the Using the Measurement Studio Network Variable Data Source in Web
Forms help topic in the NI Measurement Studio Help. We also have an exmaple pgoram located in the Documents and
Settings\All Users\Documents\National Instruments\MStudioVS2005\DotNET\Examples\NetworkVariable\Basic. This solution contains several network variable projects, one of which using the data source.
Hope this helps!
Best Regards,02-22-2008 09:30 AM
protected
void AutoRefresh1_Refresh(object sender, RefreshEventArgs e){
double data = (double)NetworkVariableDataSource1.Bindings[0].GetValue();
NumericEdit1.Value = data;
WaveformGraph1.PlotYAppend(data);
}
Lets say I'm writing to the network variable calling
NetworkVariableBufferedWriter
<double>.WriteValue( double data)once every 250 ms, and my AutoRefresh interval is 1 s; only 1 value / second is plotted on the WaveformGraph. Is there a buffer in NetworkVariableDataSource that can be flushed to the WaveformGraph in the AutoRefresh_refresh(object sender, RefreshEventArgs e) event handler? I'd like to flush a buffer to the WaveformGraph rather than plotting the most recent value. Using your Basic NetworkVariable example and calling
WaveformGraph1.BindingData = NetworkVariableDataSource1.Bindings[0].GetValue();
doesn't work for my application; I'm writing only one double value at a time to the NetworkVariable whereas the Basic example writes a double[] array to the NetworkVariable. In any case, this is a fairly minor issue and I appreciate your help in getting my Thin Client Monitoring application up and running. -Ben Gross, Purdue
02-22-2008 09:58 AM
03-05-2008 06:55 PM
03-06-2008 04:33 PM
Hi Ben,
I reviewed your ASP.NET application and your windows application and discovered
the problem which happens to be with your coding logic. If you run
through your ASP.NET logic by hand (which I recommend if you’re having trouble
visualizing how your ASP.NET app works), it’s easy to see why the knob is going
back to its previous state. Essentially, you are reading from the
"writer" variable in the statement
double
newKnobData = (double)NetworkVariableDataSource1.Bindings[0].GetValue();
which is only being updated in the knob1_AfterChangeValue event handler
in your windows application. When you compare this value to the current
knob value, it will always be different and thus you will execute the statement
of Knob1.Value
= newKnobData.
This in turn reverts your knobs value back to its previous state. Therefore
you need to add the statement of m_ampControlWriter.WriteValue(knob1.Value); in your m_ampControlReader_DataUpdated
event handler in your windows application. There is multiple ways you could
have debugged this problem either by hand logic, using Debug.WriteLines or even using Firebug if you are
using Firefox.
Another problem you were running into which you can't directly see because of
improper exception handling is that you have 2 writers writing to the same
variable which isn't allowed with implicit creation. Implicit variables always
have the single-writer restriction. This restriction would have been
caught if you were actually catching NetworkVariable exceptions. For
example, when you call the WriteValue method inside of your knob1_AfterChangeValue
event handler, if you were catching exceptions, you would have received an
exception that basically stated "A general access denied error
occurred". So the solution to this problem is to either not have
multiple writers or use explicit variable creation via using Variable Manager.
In my opinion I believe you should be catching those exceptions and not ignoring
them. So I definitely recommend you change this practice and
appropriately handle exceptions. Just my thoughts...
As a side note, we don't document this restriction and so I will make sure we
add this in the future.
Best Regards,
03-10-2008
09:36 AM
- last edited on
11-13-2024
12:12 PM
by
Content Cleaner
Hey,
Thanks for looking over my code and helping to get my ASP .NET Measurement Studio application up and running.
Now I'm trying to run the web application on a remote web server. According to Create Thin-Client Remote Monitoring and Control Applications webcast, the requirements are: IIS 5.0 or later, Windows 2000 / 2003 server and Windows XP Pro or Windows 2000, and .NET framework 1.1 or 2.0 . My web hosting service, www.hostmysite.com, easily meets all of these requirements (.NET framework 2.0, Windows 2003 Server). When I simply use Visual Studio 2005 to publish my ASP .NET web site, the site is precompiled and sent to the web server but the web server is unable to render the web page. I assume that its because the National Instruments assemblies do not exist on my web server. What's the best way around this situation?
-Ben Gross