Subscribe: Measurement Studio for .NET Languages
Added By: Feedage Forager Feedage Grade B rated
Language: English
code  data  datapoint  double  graph  measurement studio  net  new  public  rms  studio  tan delta  task  visual studio 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Measurement Studio for .NET Languages

Measurement Studio for .NET Languages topics

Measurement Studio for .NET Languages topics

Published: Mon, 23 Apr 2018 23:42:42 GMT2018-04-23T23:42:42Z


Intensity Graph Continious YAxis

Fri, 20 Apr 2018 11:16:57 GMT2018-04-20T11:16:57Z


We have an asynchronous method  that produces Frequency data and plotting then in a GraphControl.

We want to split window and show another Intensity graph with same data changing over time.

Our intensity graphs XAxis  is Frequency and YAxis is Time (TimeSpan or some round trip count) and color scale contains amplitude values.

 I found this question M18436. its similar to my request .

How do we configure this example code to scroll (flow) YAxis over time?


Best Regards,


How to stop finite output before all of the samples have been output by hardware?

Thu, 19 Apr 2018 22:31:00 GMT2018-04-19T22:31:00Z

Hello friends,


Let's consider a hypothetical situation where I have an application and in it I configure my analog output in finite sample quantity mode such that it is going to output 10000 samples out of analog output channel 0. The configuration could look something like the following...

private Task _task;
private AnalogSingleChannelWriter _writer;
private double[] _sampleArrayToOutput = new[] { /*10000 arbitrary values go here*/ }; _task = new Task("AnalogOutputTask"); _task.AOChannels.CreateVoltageChannel("Dev4/ao0", "ao0", -10, 10, AOVoltageUnits.Volts); _task.Timing.ConfigureSampleClock("", SamplingInfo.SampleRate, SampleClockActiveEdge.Rising,
SampleQuantityMode.FiniteSamples, 10000); _task.Control(TaskAction.Verify); _writer = new AnalogMultiChannelWriter(_task.Stream);

Then the code to start the analog output could look something like the following...

_writer.WriteWaveform(false, _sampleArrayToOutput);

Let's assume that it takes 2 seconds to complete the output of all 10000 samples. And let's say that 1 second after calling _task.Start() I want the hardware to immediately stop outputting samples out of analog output 0, even though it has not finished outputting all 10000 samples.


How can I achieve this?

WPF Intensity graph: axes changing at runtime and data types to binding

Mon, 16 Apr 2018 07:00:28 GMT2018-04-16T07:00:28Z

Hi , How can i change vertical axes of grah depending on time at runtime and which data types use to binding.

DACmx mock objects for unit testing in .net c#

Fri, 13 Apr 2018 12:07:43 GMT2018-04-13T12:07:43Z



Does there exists any c# DACmx mock objects that can be used for unit testing in .net c#?


Best Regards

DACmx Configuration Export/Import with C#

Fri, 13 Apr 2018 11:53:21 GMT2018-04-13T11:53:21Z



Is it posible to export/import DACmx configuration via  C# .net ?


Best Regards

Running method IviDCPwr.Create(DC_DeviceName) causes DriverClassCreationException

Fri, 13 Apr 2018 11:36:53 GMT2018-04-13T11:36:53Z

What a problem could it be (See subject)?


Variable "DC_DeviceName" == DC (logical name I created in MAX)


Message of exception is:

"IviSessionFactory: An instance of the specific driver referenced by the driver session name could not be created, or did not support the specified type.\r\nSpecific driver (software module): NationalInstruments.ModularInstruments.NIDCPower 14.1.0 Fx45\r\nClass name: NationalInstruments.ModularInstruments.NIDCPower.NIDCPower, NationalInstruments.ModularInstruments.NIDCPower.Fx45, Version=, Culture=neutral, PublicKeyToken=4FEBD62461BF11A4"


InnerException of  exception above is:

{"Unable to cast object of type \"NationalInstruments.ModularInstruments.NIDCPower.NIDCPower\" to type \"Ivi.Driver.IIviDriver\"."}


Logical name and driver session in MAX are properly (as it seems to me) configured.


Images of Max-settings and exception are attached as well.

Please, help.

Trouble Getting Started

Thu, 12 Apr 2018 04:49:59 GMT2018-04-12T04:49:59Z

I'm running into problems setting up what I would think should be a pretty straightforward configuration: running in Windows session 0 and automatically getting data at a specified interval from three channels on our Fluke 2625A. (Everything's easy when you know how.)


How far have I gotten? I'm barely out of the gate yet, if even that.


I've installed VS2013 into a VM so I can get all of what the MS2015 package has to offer. (I know we're supposed to be able to run different versions side-by-side, but I just don't trust it—especially not with a five-year-old IDE.) Once I get the driver wrapper code generated I'll copy that to my 2017 instance on my workstation and build out my Windows service from there. This is my current plan, anyway—I'm open to suggestions for improvement on this.


So I installed MS and NI-VISA, in that order, but I'm not sure what to do next. I'm not finding any code samples specific to my scenario. It seems I can do everything but what I want to do.


The driver for our device is here:


...but it's in source code form only. I'm highly proficient in VB.NET, but I'm absolutely lost when it comes to C/C++. Do I have to build this thing from source? I sure hope not. I wouldn't trust myself for a thousand dollars on that one.


How do all these pieces fit together? What advice would someone have for a stone-cold beginner?


Jeff Bowman
Fairbanks, Alaska


Instantiated a PXIe-2727 resistor module

Sat, 07 Apr 2018 01:17:21 GMT2018-04-07T01:17:21Z

I have a Pxie-2727 resistor module in our PXI system.  Based on NI documentation, I understood that the PXIe-2727 driver is resided in the NI switch library, so I wrote the following code to instantiated the 2727 resistor module. 

"NiResistorDriverInstance = new NISwitch(resourceName,
        SwitchDeviceTopology.Device2727Independent, simulate, resetDeviceOnConnection);"

But an Exception was through.

Ivi.Driver.ValueNotSupportedException: 'ModularInstruments.NISwitch: The specified topology string is invalid.

Topology: 2727/Independent

Status Code: -200198
Error Code: -1074118643'


Can some one help me?

Graph control plotting area stretching

Fri, 06 Apr 2018 10:39:33 GMT2018-04-06T10:39:33Z



We are using NationalInstrument.Controls.Graph from Measurement Studio 2015 in our C# WPF projects. And we just found that, after doing some zooming in, the right edge of the plot area stretches to the right in length. Is there a way to freeze the plot area in its size programmatically? Please find attached the before and after snapshots.


Thank you very much,



Migrate to .Net 4.7 NI assemblies unlicensed

Fri, 06 Apr 2018 10:09:26 GMT2018-04-06T10:09:26Z



We were developing projects targeting to .Net 4.6 using Measurement Studio 2015, and everything was working fine - the projects were built successfully with both Visual Studio 2017 and Jenkins( which uses MSBuild building the same solution files as VS2017). 


But as soon as we migrated our projects to .Net 4.7, Visual Studio 2017 build worked fine as usual but Jenkins build started popping up with 'NI assemblies unlicensed' error messages to all the NI assemblies that are referenced in the projects. The Visual Studio and Jenkins were building exactly the same solutions with exactly the same license file configurations. But why only Visual Studio worked? I was wondering if there are some NI license caching somewhere that Jenkins could probably looking for? If so, I can do a cleaning up of all the NI license caching so that Jenkins can pick up the right information? And after rolling back the pc to previous restore point, everything worked again.


I am not discussing about Jenkins build, but I would like to know if NI caches license information somewhere? Or how does NI do licensing during compile?


Thank you very much,

OxTS software team

System.DllNotFoundException: Unable to load DLL 'nianlys.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Wed, 04 Apr 2018 13:51:38 GMT2018-04-04T13:51:38Z



I have been trying to deploy my Winforms application on to a production machine. My target platform for all the projects is set to x86.

when using the intensity graph i get the below exception.


System.DllNotFoundException: Unable to load DLL 'nianlys.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at NationalInstruments.Analysis.Internal.s.d(Double[] A_0, IntPtr A_1, Double& A_2) at NationalInstruments.Analysis.Math.Statistics.Mean(Double[] inputData)
at KronosCameraTestApp.View.ImageDisplayPanel.getValueAtPoint(String name) at KronosCameraTestApp.View.ImageDisplayPanel.intensityGraph1_PlotAreaMouseUp(Object sender, MouseEventArgs e)



The same application works fine in Debug and Release mode on my development machine, the issue happens when i build the Release mode of my application and the Setup project. On the deployed machine I see the dll NationalInstruments.Analysis.Enterprise.dll in the Program files folder. 


Note: I am using the Measurement Studio 2015 for Visual Studio 2013.


Attached are some of the pictures which may give you some insight. Please help us to resolve this asap.

Problem building setup VS2010

Tue, 03 Apr 2018 20:10:48 GMT2018-04-03T20:10:48Z

I am using MS (2015) in VS2010.  Solution compiles fine and runs fine on my machine.  I use a setup project to build the install package.  It has worked fine previously. 


Now when the install package is run, it get halfway through the install and then shows this error: Error writing to file: policy.15.1.NationalInstruments.Common.  The install does not complete. 


The only other related thing is that I have discovered in the VS warnings that for policy.15.0, policy.15.1 and policy.17.5 there is a warning that two or more objects have the same target location.  The problem is I can't find what is causing this or how to correct it. 


Has anyone else had a similar problem?



Help with publishing a program and running it on computers without MS

Mon, 02 Apr 2018 12:18:16 GMT2018-04-02T12:18:16Z

Hey, I'm fairly new at all this so please forgive/correct me if I say something wrong...


I was given a project at work where I inherited a bunch of code from 2014, as such I am working with Measurement Studio 2013 in VS 2013.


I'm having some problems with my work computer related to USB ports, so I'm trying to publish my program and get it going on a non-work computer to make sure that that is indeed the problem. However, when I publish it then try to install it on the other computer, I get an error saying:


"Unable to install or run the application. The application requires that assembly NationalInstruments.UI.WindowsForms Version be installed in the Global Assembly Cache (GAC) first."


Now, installing it and running it on my work computer is fine, since I do in fact have the National Instruments stuff installed. But the hope for this is that it can be installed and ran on computers that don't have Measurement Studio already installed.


So, what does this mean and how can I fix it?

TDMS AnalogWaveForm write C#

Thu, 29 Mar 2018 12:42:25 GMT2018-03-29T12:42:25Z

I try to start a tdms logging task in visual c#, but I don't know how. 

Reading values works fine.

I created the taks in the MAX-tool.

Can someone give me a short example?

I'm using Visual Studio 2017, NI-DAQmx.dll and a USB-6009.

Serial Communications Timeout exception

Tue, 20 Mar 2018 01:57:05 GMT2018-03-20T01:57:05Z

I apologize for "re-posting" this question, but I realized I had commented on a closed topic and found this community to be more appropriate to the subject. That being able to capture the read buffer for a serial communication read operation with a timeout exception being thrown. Please see the referenced post. Thanks in advance.

I want to write to a TDMS file and only save the changes if a certian condition is true

Thu, 22 Mar 2018 16:04:28 GMT2018-03-22T16:04:28Z

I am writing data to a TDMS file every 10ms.  I have Autosave set to false.  After some period of time I will know if I want to keep the data or not.  I thought I could call the Save method and all my changes would be saved to the file and if I simply closed the file then nothing would be saved.  However, I found that nothing is saved to my file regardless of weather I called Save prior to Close or not.  Any ideas?

 I suppose the other option is to turn AutoSave on and simply go back and delete the unwanted files.  But that seems inefficient.


Never mind, I found out the problem was in my code.  Imagine that!

Physical Channel Conversion to Real Units

Thu, 22 Mar 2018 09:43:34 GMT2018-03-22T09:43:34Z



I have a NI-6225 80 channel board in a PC using .net 4.0 and vs2010.


I'm looking into converting the voltage inputs into engineering units. I.e. 10V = 5000PSI. Will I need to create a conversion routine in c# or can I get this converted before I receive the data as part of the DAQ-Mx task.


I have seen no examples of this being done but i believe it is possible in LABView



Reading data from USB-4431 in raw ADC values with timestamps in C#

Tue, 20 Mar 2018 15:28:04 GMT2018-03-20T15:28:04Z

Currently I am using following method to read data from 1-4 channels:

taskReader = new Task("AI");
reader = new AnalogMultiChannelReader(taskReader.Stream);
taskReader.AIChannels.CreateVoltageChannel(devices, "Reader1", AITerminalConfiguration.Pseudodifferential, 0, 10, AIVoltageUnits.Volts);
taskReader.Timing.ConfigureSampleClock("", samplerate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, numberOfSamples);
reader.BeginReadMultiSample(numberOfSamples, readerCallback, taskReader);
ReadData = reader.EndReadMultiSample(ar);

So it reads certain amount of data, processes it, starts again, and repeats this as long as needed.


I have now two problems (I googled and searched this forum, but did not quite get the information):

First, how to do same as above but using raw ADC values instead of volts?

Found some information about AnalogWaveForm...


Second, is it possible to add timestamp to every sample sequence, [0] = "timestamp", [1] = ch0 adc value, [2] = ch1 adc value...

About this I got the impression that it would not be possible, but I should take the time from the BeginReadMultiSample and then calculate from it sample by sample.


Thanks in advance and apologies about possible newbie questions.


My software is not closing (freezing at screen)

Mon, 19 Mar 2018 14:49:23 GMT2018-03-19T14:49:23Z

I am struggling with a problem tha happens with only specific computers (i don't know the rule). When the user try to close the software it doesn't close and it still freezes at screen. The user have to close it by the task manager. Impressively, like a magic, when the folder name of the software is changed the problem stops, but when the computer is restarted its happens again. With the code below, i can reproduce the problem on one of the computeres where it happens.


Public Class Form1

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Lst() As String = DaqSystem.Local.Devices
    End Sub
End Class


Using Visual Studio 2010 and NI-DAQmx 16.0.0

Changing plotted data during runtime with DataPoint structure

Mon, 19 Mar 2018 09:31:50 GMT2018-03-19T09:31:50Z

Hi all, as mentioned before in this topic I use an ObservableCollection of DataPoints[] as DataSource of my Graph, which are implemented as follows:   namespace HansDataAnalyzer { [DataTypeDescriptor( typeof( DataPointDescriptor ) )] public struct DataPoint { public const int PropertyCount = 4; // ID, tan_delta, U_rms public int ID { get; set; } public double U_scaled { get; set; } public double tan_delta { get; set; }        public double I_rms { get; set; } public DataPoint(MeasurementValue value, double dividerFactor) : this() { this.ID = value.ID; this.U_scaled = value.U_rms * dividerFactor / 1000; //Anzeige in *10^(-3); this.tan_delta = value.tan_delta * 1000;            this.I_rms = value.I_rms; } } public struct DataPointDescriptor : IOpMultiDimensional { private static readonly ReadOnlyCollection _dimensionDataTypes = new ReadOnlyCollection( Enumerable.Repeat( typeof( double ), DataPoint.PropertyCount ).ToArray( ) ); public ReadOnlyCollection GetDimensionDataTypes( DataPoint value, Trait decomposeOption ) { throw new NotImplementedException( ); } public DataPoint GetDefaultValue( ) { return default( DataPoint ); } public IList DecomposeValues( Buffer values, Trait decomposeOption ) { int size = values.Size; double[] U_scaled = new double[size]; double[] tan_delta = new double[size]; int[] ID = new int[size];            double[] I_rms = new double[size]; for( int i = 0; i < size; ++i ) { DataPoint value = values[i]; U_scaled[i] = value.U_scaled; tan_delta[i] = value.tan_delta;                I_rms[i] = value.I_rms; ID[i] = value.ID; } return new IBuffer[] { // Dimensions rendered by graph are listed first. BufferPool.Default.GetBuffer(U_scaled, Unit.None), BufferPool.Default.GetBuffer(tan_delta, Unit.None), // Other values are saved by graph, and displayed by cursor. BufferPool.Default.GetBuffer(ID, Unit.None),                BufferPool.Default.GetBuffer(I_rms, Unit.None) }; } public Buffer ComposeValues( IList dimensionValues, Trait composeOption ) { throw new NotSupportedException( ); } } } As phansen recommended once, I could add more properties for the DataPoint structure. What I would like to do here:   Change the displayed data from U_scaled on x-axis and tan_delta on y-axis to e.g. U_scaled on x-axis and I_rms on y-axis. Is there a nice way to do this? Somehow change the order of returning the single data or...? As mentioned in the topic above, I still do not understand, where the graph "knows" from, which Property to actually put in the plot, when linked to a DataSource. Of course I could just add another ni:Graph and implement another DataPoint stru[...]