Quantcast
Channel: Measurement Studio for .NET Languages topics
Viewing all 1999 articles
Browse latest View live

Increase WaveFormGraph XRange according to a timestamp

$
0
0

I have a waveformGraph and I am plotting multiples values from a measurement. I wonder how can increase my range according to a timestamp value when a plotting multiple measurement.

I have been trying using following method

 

public void PlotYAppend(double[] yData, int startIndex, int length, TimeSpan increment);

 

 but it seems to be that the range is increasing according to the Range values of the XAXES and not according to my timestamp.

Any help ?

Thanks in advance


IntensityRangeAnnotation placement issue on the IntensityGraph

$
0
0

Hi,

 

I have a Intensity Graph, with a X/Y ranges of 2047/2047. I have a logic where i draw a rectangle on the graph.

Once I draw the rectangle on the graph, i add a IntensityRangeAnnotation to display a label on the graph. For eg: When I draw 3 rectangles, I name them as Subarray_1, Subarray_2, Subarray_3.

The issue i am facing here is when i draw a rectangle at the edges of the graph, the annotation is getting cut off and the label is not getting displayed properly. I am attaching the image of this. If you see Subarray_1, Subarray_2 are displayed properly and Subarray_3, Subarray_4, Subarray_5 rectangles annotation labels are getting cut off. Is there any way i can get the annotation to point downwards, as below?

 

But I can’t get the annotation to point downwards like:

                                                                                                \

                                                                                                  \

                                                                                                    \

                                                                                                      V

                                                                                                         Subarray_4

 

Below is the code, which i have been trying without success.

                    if (endY > 1800)

                    {

                        intensityRangeAnnotation.ArrowHeadAlignment = BoundsAlignment.TopLeft;

                        intensityRangeAnnotation.ArrowTailAlignment = BoundsAlignment.TopLeft;

                        Size size = new System.Drawing.Size(5,5);

                        intensityRangeAnnotation.ArrowTailSize = size;                       

                    } 

                    if (endX > 1800)

                    {

                        intensityRangeAnnotation.ArrowHeadAlignment = BoundsAlignment.TopLeft;

                        intensityRangeAnnotation.ArrowTailAlignment = BoundsAlignment.TopLeft;

                    }

                    intensityGraph1.Annotations.Add(intensityRangeAnnotation);

                }

AnalogReadCallback no longer called in c# voltage acquisition application with reference trigger

$
0
0

Hello

I'm writting a c# application using the DAQmx driver to do battery voltage measurements under different loads and load timespans. For that purpose I use a NI USB-6501 to control a testboard with the batterys and loads and a NI USB-6215 to acquire the voltage values previously to the loading and during the loading.

The acquiring is triggered by a reference trigger on the rising edge of the load control signal and the amount of samples is set such to acquire some single samples in previously to the trigger and during the whole load timespan.

The acquisition is mostly implemented according to the given example "AcqVoltageSamples_IntClkDigRef" and "ContAcqVoltageSamples_IntClk" with an AnalogReadCallback.

 

For some cycles (load and recovery) this works fine. But when I repeat them in the dimension of thousands suddenly the Analog Callback function is no longer called.

 

Is there a possibility to check the state of the task e.g. if it has aborted or do you now other possible problems concerning the callback.

 

Thanks in advance and best regards

Change Detection on single line don't work C#

$
0
0

Hi, 

I'm trying to developp an application to detect the change in a single line of my NI USB-6212.

My code is this:

 

// Create the task.
myTask = new Task();

// Create channel
string channelName = "Dev1/port0/line0";
myTask.DIChannels.CreateChannel(channelName, "", ChannelLineGrouping.OneChannelForEachLine);

// Configure digital change detection timing
myTask.Timing.ConfigureChangeDetection(channelName, channelName, SampleQuantityMode.ContinuousSamples, 1000);
myTask.SynchronizeCallbacks = true;
myTask.DigitalChangeDetection += MyTask_DigitalChangeDetection;

// Create the reader
myDigitalReader = new DigitalSingleChannelReader(myTask.Stream);

// Start the task
myTask.Start();

But when I run the code line: 

myTask.Timing.ConfigureChangeDetection(channelName, channelName, SampleQuantityMode.ContinuousSamples, 1000);

I  have this exception: 

Error=-200077

Message="Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property."

Property: NationalInstruments.DAQmx.Timing.SampleTimingType

Requested Value: NationalInstruments.DAQmx.SampleTimingType.ChangeDetection

Possible Values: NationalInstruments.DAQmx.SampleTimingType.OnDemand

Task Name: _unnamedTask<0>

Status Code: -200077

 

Does anyone have any idea what is the problem ?

 

Thank you in advance for your answers

 

XAxis (MayorDivisions GridLine) Fixed range on continuous measurement

$
0
0

I need to solve a problem similar to the one described  here.

 

I'm using a Waveformgraph and I have the Xaxes mode set as StripChart so when my data exceeds the visible range, it will move over. But I would like to keep the Mayor Divisions GridLine fixed, while the range of xaxis is moving on the graph, and the plot is continuously drawn.

xaxes.JPG

Axis labels not updated correctly on inactive TabItem

$
0
0

Hi all,

I have a problem regarding the labels of some graphs within a tab control:

I use the EngineeringValuePresenter from here and the hint on the <RangeLabeledDivisions/> from here to avoid the error relating to the frozen poperty. Thanks btw for the two topics, the EngineeringValuePresenter solves a lot of problems at once!

I have a set of graphs each set within one TabItem of a TabControl with each graph's DataSources set to an ObservableCollection<Point[]>.

When my displayed data change during runtime, the axis (numeric) labels of the graphs within the active TabItem are updated correctly, but the axis labels of the graphs within the inactive TabItem stay as they were before - only the display, because when I click on the max/min-values of the axis, the right values are there. I attached a screenshot of this behaviour for better understanding:

C.PNG

Only if I change e.g. the max-Value of the axis by adding another decimal place, the axis is updated correctly.

Did I miss to set any properties or is there another way to force each graph's axis to also update, when the according DataSource is changed?

Any hint would be appreciated, thank you.

Measurement Studio 8.0 And VS2017

$
0
0

I installed Measurement Studio 8.0 on my system running Visual Studio 2017 because I have a need to use the components it offers. Everything installed with no problems. I had to add the components to the toolbox manually but again everything went fine and the components showed up in the toolbox as you would expect. But when I place one of the components on the form, it does not display on the form, rather it is placed in the component tray and not on the form. Shouldn't these controls work on VS2017? I assumed they should because they are just a .NET component?

Does it matter what version of the framework I am using? I tried using the latest all the way down to 2.0.

 

As a side note, the controls are not visible when the application is run either.

 

Thank You,

Randy

500 MicroSecond Pulse

$
0
0

Hello everyone,

I am using NI usb-6003 and C# programming. I need to activate two digital line (p0/line0 and P0/line1) synchronously, and remain active 500 microsecond for the first one and 12 second for the other one. I couldn't do that with software because of the accuracy. I was wondering if anyone know how I can do it with the hardware using C#.


measurement studio run for VS2008 in XP operation system

$
0
0

Hi,

 

i have a PXI computer with XP operation system, it it possible for measurement studio run with visual studio 2008 in XP system?

 

many thanks in advance.

 

best regards

Possible to know the undo zoom/pan count

$
0
0

Whenever user performs zoom, pan or axis range changes on WPF graph, the actions are remembered by graph. Calling UndoZoomPan() will bring graph display to previous state. Is there a way to know the undo count, so undo zoom context menu item (user code) can be enabled or disabled accordingly?

Playback Skipping

$
0
0

I've written a playback system in C# that uses multi-threading to support a producer/consumer streaming architecture. The producer thread reads complex (IQ) samples from a RAID and passes them into a concurrent queue.  The consumer thread takes the data out of the queue and then writes it to the NI-5673 waveform buffer.

 

The issue I am having is that, once the RFSG has played the data that was initially loaded into the waveform buffer, the RF stream out of the module seems to increase rapidly.  I see this issue with both my own code and NI’s example called “ArbitraryWaveformStreaming.2010,” which is downloaded with RFSG-16 .NET 4.0 support.  I’ve come to this conclusion after recording a CW tone at a certain frequency for 10 seconds, then increasing the frequency by 100kHz.  I repeated this process for the entire recording of 2min at 5MHz bandwidth.  Given the amount of memory I chose to allocate for the waveform in the 5673, I calculated that it should take about 21 seconds for the initial waveform load to play.  During this time more data would have been added to the buffer so that no underflow could occur.  I observed that, at the end of the approx. 21 seconds indicating the end of the initial buffer load, the CW tones jumped in rapid succession to the final frequency that I had recorded.  Every tone was seen, but not for the expected 10 seconds. The recording then finished playing with the CW tone held at the final recorded frequency for the remaining ~90 seconds.  The NI example was slightly more behaved in that it did not make as many successive jumps, but play was still not smooth and still occurred for the first time after the initial buffer load had been played.

 

Any ideas as to why the skipping is occurring?

Interval mode hide the edge values

$
0
0

I have a graph whose Y axis shows the axis in multiples of 30, 60, or 90, etc. [project attached]
I use a dynamic interval mode by a converter.

When the edge values are in multiples the graph is displayed well, but when they are not multiples they are not displayed.

For example, when the minimum is 10 and the maximum is 100, it is presented as follows:

 

Capture.PNG

 

I would like the edge values to be displayed anyway, and the values in the middle will relate to the rule.
In the example I would expect to be displayed 10 then 30 - 60 - 90 - 100.
How can I do this?

.NET DAQmx.dll seen as native in Unity3D

$
0
0

The purpose of the hardware here is to connect buttons, joystick, switches etc. to it and then to read it out by using the API and turning the channel values into parameters that can be used in de simulation. Basicly the point is to make a custom controller for unity3D. But i have the following problem with trying to use NI hardware as I/O.

 

If the NationalInstruments.DAQmx.dll gets imported into Unity3D it is recognized as a type Native .dll and not a .NET .dll which it should be. Because of this it wont be added to the references what results in the namespace name not existing.

 

Does anyone know if there is a way to resolve this?

 

Greetings,

 

Tekakato

Change X-Axis value for specific plot on demand?

$
0
0

Suppose I have two arrays of doubles to plot, plot1 has 1000 samples with sampling rate at 1KHz, while plot2 has same number of samples with sampling rate at 10KHz.  Two plots will share same X-Axis, and X-axis should show time based information. One way to convert X-Axis to be time based is to use ValueFormatter approach .

 

Snippet

protected override string FormatCore<TData>(TData value, ValuePresenterArgs args)
{    double dValue;    try    {        // Try to covert axis value to a double        dValue = Convert.ToDouble(value);        switch (AxisValueType)        {            case AxisValueTypeEnum.Time:                // Convert value to corresponding time                if (_deltaT > 0)                {                    dValue = _deltaT * dValue + _offsetT;                    return string.Format(EngineeringFormatInfo.Default, "{0:s2's'}", dValue);                }                else                {                    return base.FormatCore<TData>(value, args);                }

This works perfectly if there is only one plot or plots having same sampling rate. In the case mentioned above, only the later renderred plot will have right time info on x-axis. 

  1. first plot plot1, x-axis time range will be 0mS to 1s
  2. then plot plot2, x-axis time range now become 0mS to 100mS. This looks good for plot2, but wrong for plot1.

One way to address this is to use scatter plot to provide time based data. However, it seems that scatter plot  is mush slower. Are there any other solutions?

 

Thanks!

 

 

Network variable timestamp

$
0
0

Hello,

 

when I write Data with an NetworkVariableBufferedWriter with an sleep from 2ms I get the data with an NetworkVariableBufferedSubscriber with 5 identical timestamps. My variable has an buffer of 50. I am using Mesurementstudio 2015.

 

NetworkVariableBufferedWriter<bool> _bufferedWriter=newNetworkVariableBufferedWriter<bool>(NetworkVariableLocation);

intphase=0;

for (inti=0; i<10; i++)

{

 _bufferedWriter.WriteValue(phase%2==0?true : false);

 Thread.Sleep(2);

 phase++;

}

 I have also tried with an NetworkvariableWriter and set the FlushOnWrite property true but I got only every 10ms a new timestamp and 5 values have the same timestamp.

 

Best regards

 

Gerald

 


MultiPlotCursor value formatting in C# code

$
0
0

How to change MultiPlotCursor value format in C# code?

thanks

Theo

PXI 8464 .NET communication example

$
0
0

Hey,

 

I have a PXI 8464 communication function card, but I do not how can I control it to send or receive CAN message, is there any example or package file about CAN driver which can indicate it?

 

Thanks in advance

Mark Axis

$
0
0

Hi,Capture.PNG

I want cursor (or annotation or something else) that mark the area marked in yellow. 

I mean,The triangle will be on the scale (axis double) and not within the plot area, is there something similar? 

 

 

 

Deployement of .Net Application issues

$
0
0

Hello,

 

I'm using Measurement Studio 2015 in my Visual Studio 2013 .NET applications.

 

I've already used NationalInstrument.UI.WindowsForms with the Graphics, scattergraph,.... without problem.

 

But now I'm using the Analysis assembly.

 

When I deploy my software on other pc, I've an error on nianlys.dll missing. When I put this file in my exe folder, same error.

 

Can you help me please ?

 

Thank you.

Flow.

ni:Plot Label string format

$
0
0

Hello,

I'm trying to format string for some of my plots using the standard WPF...

This does nothing:

<ni:Plot Label="{Binding Path=PlotLabels[0], StringFormat={}{0}g}"/>

And this way doesn't compile:

ContentStringFormat

 Please let me know if it's possible.

Thank you!

Viewing all 1999 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>