Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx User Control-Assistant missing

Hello,

 

I'm trying to follow the example from the Getting Started with Measurement Studio (VS2010), creating a Measurement Studio NI-DAQmx Application.

 

I added my Task to a fresh c# WPF application and the next step should be using the DAQmx User Control-Assistant to add the graph to my GUI, except theres no such assistant :manindifferent: 


Those are all the options I get offered by MeasurementStudio 

NI ASK.PNG

 

Im using VS2010, Developer Suit with MS 2012

0 Kudos
Message 1 of 7
(6,148 Views)

As of Measurement Studio 2013, the DAQmx GUI generator is only available for Windows Forms. You can use the NI DAQ Windows Application project template to see the kind of code that is generated.


In general, the GUI generator adds a graph and a button to an empty form, add makes the appropriate call to the DAQ component in the button click handler. To adapt this for WPF, simply assign the resulting data to the DataSource of a WPF graph, rather than calling one of the Plot___ methods exposed by the Windows Forms graphs.

~ Paul H
0 Kudos
Message 2 of 7
(6,133 Views)

Hello,

 

I did exactly what you suggested, but I still have a little problem.

 

I have my DaqTask.mxb and MainWindow

I bound the graph.DataSource to AnalogWaveform data - (declared it public to access it from my MainWindow file)

Then I StartReading() from my instance of DaqTaskComponent.

 

That code runs (not so) fine, its way to demanding to the CPU.

Normally I would use a thread or timer to funnel the data , but how is this accomplished with WPF and DataBinding?

 

Some example would be appreciated

 

Thanks

0 Kudos
Message 3 of 7
(6,116 Views)

From your description it sounds like you have a task configured to acquire continuously, and are saving the new waveform from the data event to a public property named data, with a graph using DataSource="{Binding data}" or a similar binding.


If that is the case, then the only requirement should be that the data property raises a change notification when it is updated (either by using a dependency property, or implementing INotifyPropertyChanged, or some other other binding source supported by WPF).

~ Paul H
0 Kudos
Message 4 of 7
(6,111 Views)

Followed your advice but the CPU consumption is still thru the roof, task manager says 50-60%

Running the MXB file in my solution takes maybe 2%

 

Can you take a look on whats the cause of this? 

0 Kudos
Message 5 of 7
(6,101 Views)

When I only display 4 of my 16 channels the graph runs fairly smooth (15% cpu usage)

8ch still possible, but 30%

12ch 40-45%, "lagging" graph

16ch 60% but whole window gets unresponsive

 

there a approx. 10 data refreshes per second with the standard setting of 100 samples per channel 

 

There must be some way to optimize this Smiley Frustrated

0 Kudos
Message 6 of 7
(6,088 Views)

From your code, it looks like you are already using many of the settings from the Optimizing the WPF Graphs topic. When I run the application you attached last time, I do not experience any slow down (it remains responsive using about 30% of my CPU with all 16 channels on a simulated device). I would recommend using a profiler to narrow down where the slowdown occurs.

~ Paul H
0 Kudos
Message 7 of 7
(6,083 Views)