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

Measurement Studio Assembly Versions

$
0
0

My organization has multiple PXI systems and do collaborative development through visual studio's Team Foundation Server. Their system's reference the NationalInstruments.Analysis.Enterprise library version 15.0.45.49153 whereas my system only has 15.0.40.49153. This causes a compilation error when it can't find the 15.0.45.49153 version. Where can I install the newer version? I tried reinstalling measurement studio but it had no impact on the current version of NationalInstruments.Analysis.Enterprise. Any direction is greatly appreciated.


Calling .NET module from LabVIEW

$
0
0

Hi, 

I'm a beginner of LabVIEW.  

I straggled with calling .NET module from LabVIEW, but I couldn't.  I just wired create instance->method invoke->complete and the code became executable, but an error occurred when the wired program was executed.  (The module returned "E_FAIL")

I would like to call COM interfaces inside the module, but is it possible to call them?  I also tried to call COM interfaces directly inside the module by using "Library Function Calling Node", but I couldn't find the interfaces in the list of methods.  

I look forward to your reply.  

Thanks,

Hideki

common.dll deploy problem

$
0
0

Hi, all

 

I have a valid copy of Measurement Studio 2012, and I had no problem in the deployment of the software that developed for my users. However, since the Measurement Studio 2015 came out, all in sudden that the deployment process complains that "missing valid Measurement.Common.dll". I tried many ways to avoid this problem, one of the methods is to ask user to install Measurement Studio 2015 Evaluation copy, and then install the package that I developed. It seemed working for some users but not for others (under the Windows 7). Please tell me how to get around this problem. Thank you in advance.

Get Time Matrix - Data Acquiring using NI DAQmx and .NET (C#)

$
0
0

I need to acquire data using NI DAQ device and .NET (C# language).

 

I tried on Example: C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.5\Analog In\Measure Voltage\ContAcqVoltageSamples_IntClk_SWTrigger

It works!

But I only get the voltage data, but the time matrix (or time data) was not included.

I need the voltage and time data/matrix, so I can plot voltage vs time.

 

How can I get it?

 

Thank you!

Traditional NI-DAQ (nidaq32.dll) function How to change to nidaqmx (C #)

$
0
0

nStatus = GPCTR_Control(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_RESET);
nStatus = GPCTR_Set_Application(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_PULSE_TRAIN_GNR);
nStatus = Line_Change_Attribute(nDevice, NiDaq_Const.ND_PFI_39, NiDaq_Const.ND_LINE_FILTER, NiDaq_Const.ND_100_NANOSECONDS);
nStatus = GPCTR_Change_Parameter(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_SOURCE, NiDaq_Const.ND_PFI_39);
nStatus = GPCTR_Change_Parameter(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_COUNT_1, anValue1);
nStatus = GPCTR_Change_Parameter(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_COUNT_2, anValue2);
nStatus = Select_Signal(nDevice, NiDaq_Const.ND_GPCTR0_OUTPUT, NiDaq_Const.ND_GPCTR0_OUTPUT, NiDaq_Const.ND_LOW_TO_HIGH);
nStatus = GPCTR_Control(nDevice, NiDaq_Const.ND_COUNTER_0, NiDaq_Const.ND_PROGRAM);

 

How to change the above functions to nidaqmx
Does it work the same?

Unable to output waveform

$
0
0

Hello,

 

I am unable to output a simple waveform at a digital output port. Below is my code:

int numberOfSamples =10000;
DigitalWaveform wave = new DigitalWaveform(numberOfSamples, 1, DigitalState.ForceDown);
//Add a digital output channel
localTask.AddGlobalChannel(aChannelName);

//Task timings localTask.Timing.SampleTimingType = SampleTimingType.SampleClock; localTask.Timing.ConfigureSampleClock(string.Empty, 2000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples);

//Prepare samples. Half of them are low, rest half are high int i = 0; for (i = 0; i < numberOfSamples / 2; i++) wave.Signals[0].States[i] = DigitalState.ForceDown; for (; i < numberOfSamples; i++) wave.Signals[0].States[i] = DigitalState.ForceUp;
DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(localTask.Stream); writer.WriteWaveform(true, wave);

The above code shall give me one wave of 5 seconds with 2.5 seconds as low and 2.5 seconds as high. Unfortunately, I am not getting desired result.

 

Please tell me what I am doing incorrect.

 

Thanks and regards

Ricky

Read Digital-IN channels continuously and write Digital-OUT values sporadically (Status code: -201105)

$
0
0

Hello Friends

 

I have a NI 9403 device which I try to program in C#. It has 32 lines, which could be configurated for input or output separately.

 

First 0 - 15 lines are defined as input and 16 - 31 for output in separate tasks.DigiIn.JPGDigiOut.JPG

 

The simple task is, to read input channels continuesly in a thread and sporadically write values into output channels.

If I use tasks created in MAX, everything works fine, but only if they both are set to "1 Value (On Demand)". But as I tryed to create task in C# I recognized that required SampleQuantityMode = "1 Value (On Demand)" is not available! If I choose anything else for DigitalOut_Task, the software throws an error.


Resource requested by this task has already been reserved by a different task with conflicting settings.

Unreserve any other tasks using this device, or change their settings to be compatible with this task.

Task Name: Digital_Out_Task_16

Status Code: -201105

 

You can try it in MAX also:

1. Create Digital In Task for Line0 and set it to values available in SampleQuantityMode like ContinuousSamples or FiniteSamples

DI0.JPG
2. Create Digital Out Task for Line16 and set it to values available in SampleQuantityMode like ContinuousSamples or FiniteSamples

DO_16.JPG
PS: HardwareTimedSinglePoint seems not be supported by my card...

3. Try to execute tasks in MAX...


I try to fix it since 2 days, but cannot find any solution.... Why I cannot use "1 Value (On Demand)" in C# code?

 

I also attached my test program.

Missing palate

$
0
0

How to add micromanager.net palate to LabVIEW. its missing.

I have installed micromanager software.


Assembly "Ivi.Visa.Interop" under Windows10 not in GAC_32

$
0
0

Hello,

i tried to execute a ivi DotNet-DLL created with Windows 7 on a Windows 10 computer (with TestStand).

 

I didnt work, so i installed a compiler on the Windows10 computer.

Here i see that the problem is that the reference to "Ivi.Visa.Interop" cannot be found.

 

I checked on the Windows7-pc where this file should be and it says:
C:\windows\assembly\GAC_32\5.5.0.0.....\Ivi.Visa.Interop.dll

 

Back on the Windows10-pc i checked in explorer for this file but it is not there.

Only in directory C:\windows\assembly\GAC_64\5.5.0.0.....\Ivi.Visa.Interop.dll it can be found.

 

So i manually linked the compiler to this dll-directory and then the dll is running fine.

 

Question is now: Why is there no dll in the GAC32-assembly directory?

 

Installed software:

NI Visa 19.0

NI ICP 19.0 (Ivi compliance package)

 

Thanks for help

TDMS file on disk doesn't get updated with AutoSave set to true when appending data to channels

$
0
0

Hello friends,

I am developing a WPF application that needs to log data to TDMS files. I append data to channels in the TDMS file periodically. The TDMS file's AutoSave property is set to true upon creating it (although I'm pretty sure true is the default value of this property).

 

With the AutoSave property set to true, I would expect to see the file's size grow in windows explorer as my application runs and appends more data to it however, this is not what happens. In fact, the TDMS log files don't get updated until the application is gracefully shutdown. If I don't gracefully shutdown my application (clicking exit button in upper right hand corner) and I stop the debugger from visual studio, the TDMS log files remain at 0KB.

 

Why aren't my TDMS files getting saved to disk as my application runs, even though AutoSave is set to true?

 

Below is my class responsible for writing data to TDMS files. The WPF application calls one of the AppendData() overloads periodically. The CreateNewSegmentInLogFile() function is called once at application startup.

 

internal class TdmsFacade : ITdmsFacade
    {
        private string _latestChannelGroupName;
        private readonly TdmsFile _logFile;

        internal TdmsFacade(ITdmsData data, string filePath)
        {
            // Initialize various file options for accessing tdms files.
            var tdmsRwFileOptions = new TdmsFileOptions
            {
                Access = TdmsFileAccess.ReadWrite,
                FileFormat = TdmsFileFormat.Version20,
                BufferingDisabled = true
            };

            // Assign initial properties to log file & create it.
            _logFile = new TdmsFile(filePath, tdmsRwFileOptions)
            {
                Author = data.Author,
                Description = data.RootDescription,
                Title = data.Title,
                AutoSave = true
            };
        }

        public void AppendData(double[] samples, TdmsChannelEnum channelToLogTo)
        {
            // Get the channel group.
            var channelGroup = _logFile.GetChannelGroups()[_latestChannelGroupName];

            // Get the channels.
            var channels = channelGroup.GetChannels();

            // Append data to the channels.
            switch (channelToLogTo)
            {
                case TdmsChannelEnum.ChannelZero:
                    channels[0].AppendData(samples);
                    break;
                case TdmsChannelEnum.ChannelOne:
                    channels[1].AppendData(samples);
                    break;
                case TdmsChannelEnum.ChannelTwo:
                    channels[2].AppendData(samples);
                    break;
                case TdmsChannelEnum.ChannelThree:
                    channels[3].AppendData(samples);
                    break;
                default:
                    throw new InvalidOperationException("An invalid channel chosen to log to. A channel will be considered invalid if it is not utilized by the DAQ.");
            }
        }

        public void AppendData(double sample, TdmsChannelEnum channelToLogTo)
        {
            // Get the channel group.
            var channelGroup = _logFile.GetChannelGroups()[_latestChannelGroupName];

            // Get the channels.
            var channels = channelGroup.GetChannels();

            // Append data to the channels.
            switch (channelToLogTo)
            {
                case TdmsChannelEnum.ChannelZero:
                    channels[0].AppendData(sample);
                    break;
                case TdmsChannelEnum.ChannelOne:
                    channels[1].AppendData(sample);
                    break;
                case TdmsChannelEnum.ChannelTwo:
                    channels[2].AppendData(sample);
                    break;
                case TdmsChannelEnum.ChannelThree:
                    channels[3].AppendData(sample);
                    break;
                default:
                    throw new InvalidOperationException("An invalid channel chosen to log to. A channel will be considered invalid if it is not utilized by the DAQ.");
            }
        }

        public void CreateNewSegmentInLogFile(ITdmsData tdmsData)
        {
            // Add a new channel group.
            var now = new DateTimeProvider().GetDateAndTime();
            _latestChannelGroupName = now.ToString().Replace('/', '_').Replace(':', '_').Replace(' ', '_');
            var channelGroup = _logFile.AddChannelGroup(_latestChannelGroupName);
            foreach (var property in tdmsData.ChannelGroupProperties)
            {
                if (property.DataType.Equals(TdmsPropertyDataType.DateTime))
                {
                    property.Value = now;
                }

                channelGroup.AddProperty
                (
                    property.Name,
                    property.DataType,
                    property.Value
                );
            }

            // Add channels to the new channel group.
            foreach (var channelInfo in tdmsData.ChannelInformation)
            {
                var channel = channelGroup.AddChannel(channelInfo.ChannelName, channelInfo.DataType, channelInfo.ChannelDescription, channelInfo.UnitString);

                // Add the properties.
                foreach (var property in channelInfo.ChannelProperties)
                {
                    if (property.DataType.Equals(TdmsPropertyDataType.DateTime))
                    {
                        property.Value = new DateTimeProvider().GetDateAndTime();
                    }

                    channel.AddProperty(property.Name, property.DataType, property.Value);
                }
            }
        }
    }

TDMS Property DateTime Format

$
0
0

So I am trying to set a property in my TDMS file.

_waveformChannels[i].GetProperty("wf_start_time").SetValue<DateTime>( ... );

 I checked while debugging. The DateTime object I want to write has the correct timing information. After I Write it with the line above it gets corrupted. The "wf_start_time" field in the finished file is always 2 hours off. Also I would like to force a 24 hour format like

"MM.DD.yyyy HH:mm:ss.fff"

 

Right now I am out of options. I didnt find something about it in the docs.

 

Greetings

Rizardus

 

Programs developed with VISA.dll always crash in win10?

$
0
0

 

The same program works normally in win7, but often crashes in win10. At the beginning of the computer boot, the probability of crash is very high, and no error is reported. Then open the program several times before it works properly. It's not always wrong, just occasionally.
Programs generally crash after the "TextBox 1. Text" display device ID. It's strange that if "TextBox 1. Text" already shows the ID, the function is running out. But why did it crash?
The DEBUG mode of VS2017 is used. It won't crash.
VISA.dll is installed in Agilent IOlibrary. I use VB.NET, VS2017.

 

The code:

 

Declare Function viOpenDefaultRM Lib "VISA32.DLL" Alias "#141" (sesn As Long) As Long
Declare Function viGetDefaultRM Lib "VISA32.DLL" Alias "#128" (sesn As Long) As Long
Declare Function viFindRsrc Lib "VISA32.DLL" Alias "#129" (ByVal sesn As Long, ByVal expr As String, vi As Long, retCount As Long, ByVal desc As String) As Long
Declare Function viFindNext Lib "VISA32.DLL" Alias "#130" (ByVal vi As Long, ByVal desc As String) As Long

Declare Function viOpen Lib "VISA32.DLL" Alias "#131" (ByVal sesn As Long, ByVal viDesc As String, ByVal mode As Long, ByVal timeout As Long, vi As Long) As Long
Declare Function viClose Lib "VISA32.DLL" Alias "#132" (ByVal vi As Long) As Long

Declare Function viVSPrintf Lib "VISA32.DLL" Alias "#205" (ByVal vi As Long, ByVal Buffer As String, ByVal writeFmt As String, params As Long) As Long
Declare Function viVScanf Lib "VISA32.DLL" Alias "#272" (ByVal vi As Long, ByVal readFmt As String, params As String) As Long

 

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim status As Long
Dim defrm As Long
Dim vi As Long
Dim strRes As String
Dim strRes1 As String
Dim strRes2 As String
Dim actual As Long
status = viOpenDefaultRM(defrm) 


status = viOpen(defrm, "GPIB0::7::INSTR", 0, 0, vi)


status = viVPrintf(vi, "*IDN?" + vbCrLf, 0)


System.Threading.Thread.Sleep(10)'Increasing delay time reduces the probability of crash


status = viVScanf(vi, "%t", strRes) 

TextBox1.Text = strRes 

End Sub

 

 

 

 

 

With .NET Core?

$
0
0

In Microsoft's Build 2019, it said .NET Core is the future. So Measurement Studio will move to .NET Core or can be used in .NET Core?

Why can't "viFindRsrc" search all the instruments?

$
0
0

 

 

The problem is that the number of instrument lists is not the same as the number of instruments used by IO Control.
I can search for TCPIP0::K-E5052B-02402.lan::inst0::INSTR, but I cannot search for TCPIP0::192.168.1.253::inst0::INSTR

I can only search for seven. But IO Control can search 14.

 

The instrument address I searched for:

TCPIP0::KEYSIGH-FHPNKCU.lan::hislip0::INSTR
TCPIP0::KEYSIGH-FHPNKCU.lan::inst0::INSTR
TCPIP0::K-E5052B-02402.lan::inst0::INSTR
ASRL1::INSTR
ASRL2::INSTR
ASRL3::INSTR
ASRL8::INSTR

 

Instrument address found using official tools:

TCPIP0::192.168.1.253::inst0::INSTR

TCPIP0::192.168.1.82::inst0::INSTR

TCPIP0::192.168.3.3::hislip0::INSTR

TCPIP0::KEYSIGH-FHPNKCU.lan::hislip0::INSTR
TCPIP0::KEYSIGH-FHPNKCU.lan::inst0::INSTR

TCPIP0::KEYSIGH-FHPNKCU.lan::5025:沮丧表情OCKET
TCPIP0::K-E5052B-02402.lan::inst0::INSTR

TCPIP0::K-E5052B-02402.lan::5025:沮丧表情OCKET
ASRL1::INSTR
ASRL2::INSTR
ASRL3::INSTR
ASRL8::INSTR

TCPIP[board]::host address[::LAN device name][::INSTR]

TCPIP[board]::host address:吐舌表情ort:沮丧表情OCKET

 

 

 

the code:

 

Private Sub VI_BtnFIND_Click(sender As Object, e As EventArgs) Handles VI_BtnFIND.Click


viOpenDefaultRM(defrm)

 

Dim find_list As Integer
Dim retCnt As Integer
Dim instrDesc = New StringBuilder()

status = viFindRsrc(defrm, "?*INSTR", find_list, retCnt, instrDesc)

 

VI_lsbEXM.Items.Clear()
VI_lsbEXM.Items.Add(instrDesc.ToString)


If retCnt <> 0 Then

For i = 0 To retCnt - 2
status = viFindNext(find_list, instrDesc)
VI_lsbEXM.Items.Add(instrDesc.ToString)

Next

End If

 

status = viClose(defrm)


End Sub

Display real time data on Intensity Graph

$
0
0

I am using measurement studio 2015 WPF version. My requirement is to display real time data on a intensity graph . I used uint[,] to store the data and set datasource through binding. When I refresh the data , chart is flickering always .

1. How to avoid flickering effect while updating new data ?

2. what is the best way to display live data on a IntensityGraph ?

 

Thanks,

Rajeesh P

 


Aborting analog input task doing async reads not working

$
0
0

Hello friends,

 

I have a class called AnalogInputFacade that is responsible for continuously reading in an async fashion from analog input. It begins reading from analog input when the Start() function on the AnalogInputFacade class is called and it should stop reading from analog input when the Stop() function on the AnalogInputFacade class is called. The class under discussion and it's base class are shown below:

internal abstract class NiTaskFacade
{
    protected Task NiTask;

    internal abstract void Start();

    internal abstract void Stop();

    internal IObservable<TaskDoneEventArgs> WhenTaskDone => Observable
        .FromEventPattern<TaskDoneEventHandler, TaskDoneEventArgs>(
            handler => NiTask.Done += handler,
            handler => NiTask.Done -= handler)
        .Select(x => x.EventArgs);

    internal IObservable<EveryNSamplesWrittenEventArgs> WhenNSamplesWritten => Observable
        .FromEventPattern<EveryNSamplesWrittenEventHandler, EveryNSamplesWrittenEventArgs>(
            handler => NiTask.EveryNSamplesWritten += handler,
            handler => NiTask.EveryNSamplesWritten -= handler)
        .Select(e => e.EventArgs);
}

internal class AnalogInputFacade : NiTaskFacade
{
    private static readonly Lazy<AnalogInputFacade> LazyInstance = new Lazy<AnalogInputFacade>(() => new AnalogInputFacade());
    private readonly AnalogMultiChannelReader _reader;
    private readonly Queue<double[,]> _readSamples = new Queue<double[,]>();

    internal static AnalogInputFacade Instance => LazyInstance.Value;

    private AnalogInputFacade()
    {
        NiTask = new Task("AnalogInputTask");
        var hardwareInfo = HardwareInfo.Instance;
        NiTask.AIChannels.CreateVoltageChannel(hardwareInfo.AnalogInputModuleName + "/ai0", "ai0", (AITerminalConfiguration)(-1), HardwareInfo.ChannelVoltageMinimum, HardwareInfo.ChannelVoltageMaximum, AIVoltageUnits.Volts);
        NiTask.AIChannels.CreateVoltageChannel(hardwareInfo.AnalogInputModuleName + "/ai1", "ai1", (AITerminalConfiguration)(-1), HardwareInfo.ChannelVoltageMinimum, HardwareInfo.ChannelVoltageMaximum, AIVoltageUnits.Volts);
        NiTask.Timing.ConfigureSampleClock("", HardwareInfo.AnalogInputSamplingRate, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000);
        NiTask.ConfigureLogging("C:\\tmp\\analogInput.tdms", TdmsLoggingOperation.OpenOrCreate, LoggingMode.LogAndRead, "Group Name");
        NiTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/" + hardwareInfo.SecondDigitalIoModuleName + "/PFI0", DigitalEdgeStartTriggerEdge.Falling);
        NiTask.Control(TaskAction.Verify);
        _reader = new AnalogMultiChannelReader(NiTask.Stream);
    }

    internal override void Start()
    {
        _readSamples.Clear();
        NiTask.Start();
        _reader.BeginReadMultiSample(64, Callback, NiTask);
    }

    private void Callback(IAsyncResult ar)
    {
        double[,] readSamples;
        try
        {
            readSamples = _reader.EndReadMultiSample(ar);
        }
        catch (DaqException e)
        {
            Debug.WriteLine("Analog input read aborted.");
            Console.WriteLine(e);
            return;
        }
        
        _readSamples.Enqueue(readSamples);
        _reader.BeginReadMultiSample(64, Callback, NiTask);
    }

    internal override void Stop()
    {
        NiTask.Control(TaskAction.Abort);
        NiTask.Stop();
        NiTask.Control(TaskAction.Unreserve);
        Debug.WriteLine("Analog input task stopped.");
    }
}

Calling Start() for the first time works exactly as expected. Analog input is aquired properly & continuously. Calling Stop() is the problem. If I attempt to call Start() after calling Stop(), I get an error with the following exception:

NationalInstruments.DAQmx.DaqException
  HResult=0x80131501
  Message=Specified operation cannot be performed while the task is running.

Task Name: AnalogInputTask

Status Code: -200479

The task is not actually being stopped after the call to Stop(). I am aware that calling the stop function on a task does not terminate any pending read operations. The task will continue running until a timeout occurs or until all of it's pending operations complete. It is my understanding that calling NiTask.Control(TaskAction.Abort) should terminate any pending read operations on the task. However, this does not seem to actually be working.

 

I have found a workaround but, I do not like it because of the overhead it introduces. If I move the creation & configuring of the task to the beginning of the Start() function and call Dispose() on the task in the Stop() function, I am able to start & stop the analog input repeatedly without issue.

 

Am I doing something wrong here or is abort not doing it's job?

 

Thanks!

Why does stopping & disposing of task in TdmsContAcqVoltageSamples_IntClk_LogOnly example take so long (~500ms)?

$
0
0

Hello,

 

If I run the TdmsContAcqVoltageSamples_IntClk_LogOnly example under "National Instruments\NI-DAQ\Examples\DotNET4.5.1\Analog In\Measure Voltage" and I modify the stopButton_Click() function as follows and run the example:

            if(myTask != null)
            {
                var sw = new Stopwatch();
                sw.Start();

                // Dispose of the task
                myTask.Stop();
                myTask.Dispose();
                Debug.WriteLine("Stop & dispose time (ms): " + sw.ElapsedMilliseconds);
                myTask = null;
                stopButton.Enabled = false;
                startButton.Enabled = true;
            }

I am seeing the following print out:

Stop & dispose time (ms): 495

I am seeing similar (even higher) stop & dispose times in a custom application that uses a very similar analog input task. The lengthy time the stop and dispose operations take on an analog input task that is only logging is making it difficult for me to meet timing requirements in my application.

 

Why on earth does it take half a second to stop the analog input task and dispose of it? Is there any way I can improve the performance of these operations?

 

Thanks!

Tdms set AnalogWaveform x properties

$
0
0

I can't find a way to set the x axis name (wf_xname) for an analog waveform channel. The only way I found is not valid for the WaveformTiming with the RegularInterval option.

 

var opt = new TdmsAnalogWaveformWriteOptions {TimingAxisName = "time"};

 

It seems that the analog wfm properties are autogenerated at save by the tdms Library and then they are read-only. automaticproperties

code example:

var myTdmsWfmGrp = myTdmsFile.AddChannelGroup("ScopeShotsWfm");
myTdmsWfmGrp.WaveformLayout = tdmsWaveformLayout.NoTimeChannel;
var wfmData = AnalogWaveform<double>.FromArray1D(yData);
wfmData.PrecisionTiming = PrecisionWaveformTiming.CreateWithRegularInterval(PrecisionTimeSpan.FromMilliseconds(xData[1] - xData[0]),PrecisionDateTime.Now);
var myTdmsWfmCh = new TdmsChannel(scopeChannel, TdmsDataType.Double, "Voltage", "V");
 myTdmsWfmGrp.AddChannel(myTdmsWfmCh);
myTdmsWfmGrp.AppendAnalogWaveform<double>(myTdmsWfmCh, wfmData);
myTdmsFile.Save();

Nonlinear Fit with a Custom Function of Two Independent Variables

$
0
0

I am trying to use the NationalInstruments.Analysis.Enterprise assembly to do a fit of a custom, nonlinear function with two independent variables and five parameters. The function is:

 

Z = A + 1 / (1 / (X / 256 * B + 3 * C) + 1 / (Y / 1024 * D + 2 * E))

 

Where Z is the output, X and Y are the independent variables, and A, B, C, D, and E are the parameters I want to estimate. I also have best guess values for these parameters to minimize the iterations necessary for the least squares to converge if that is an option.

 

I see there is a CurveFit class but it looks like it only supports a single independent variable X with an output Y. Is there another class I'm not seeing that would support two independent variables? Or is there a way to use the least squares directly by creating my own cost function? Any help is greatly appreciated.

Measurement Studio 2019 extension for Visual Studio 2019 requires allowing synchronous autoload to be enabled

$
0
0

When installing Measurement Studio 2019 on a windows 7 machine and then running Visual Studio 2019 I was presented with a warning from Visual Studio that said : 

 

Visual Studio did not load one or more extensions that were using deprecated APIs.  

 

I was then given three options to click on (the numbers are mine) : 

 

1.) Allow synchronous autoload

2.) Manage performance

3.) Don't show this message for current extensions

 

After Selecting Option 1 I was told that Visual Studio needed to restart.

 

After restarting I was given another warning that said : 

 

One or more extensions were loaded using deprecated APIs.

I was then given three new options to click on (again the numbers are mine) : 

1.) Don't allow deprecated API used [Recommneded]

2.) Manage Performance

3.) Don't show this message for current extensions.

 

Selecting option 1 takes and restarting measurement studio takes you back to the first option screen described above.  Selecting option 3 makes the nag message go away and then the Measurement Studio extension under Extensions->Measruement Studio appears to behave as expected.

 

To see how Visual Studio is keeping track of this request from the menu select Extensions->Manage Extensions and select the text "Change your settings for Extensions" which is down under the left column.   You are then presented with the Options dialog with Extensions highlighted on the left.  All 6 checkboxes should be checked.  The last checkbox is for : 

 

Allow Synchronous autoload of extensions (Not recommended.  Requires restarting Microsoft Visual Studio.)

 

This is the one that when unchecked will not allow the Measurement Studio extension to behave properly.

 

Multiple things are going on here.  My first attempt at installing Measurement Studio 2019 did not allow me to see the Measurement Studio extension show up under Extensions at all.  There were no NI projects available when selecting File->New->Project.  To get things shook loose I did the following steps :

 

1.) I opened the package manager and clicked on the INSTALLED menu item.

2.) I then selected "Measurement Studio 2019 f1" and clicked the REMOVE button.  I believe I just clicked next a couple of times to finish the uninstall process.

3.) I then used the package manager BROWSE PRODUCTS->Programming Environments menu item and then selected "Measurement Studio and Drivers".

4.) I clicked on Install and the checkbox next to "Measurement Studio" was checked so I hit next or continue just to get that process started.  

5.) I then did a computer restart just to be safe even though I was never asked to do so.

 

I launched Visual Studio 2019 and selected Create a New Project. Then I searched for "Meas" and selected NI Window Forms Application (which was not available before I uninstalled and reinstalled Measurement Studio as described above). I chose the default name and clicked the Create button.  

 

I was immediately shut down with a hard error of :

"Can't get the service : National Instruments.Measurement Studio.Interfaces80.IMs Product" 

 

Pressing OK on this error put me back into the project wizard with the options of Back and Create.  Create took me to the same service error and Back allowed me to pick another project.  After I ran the above process of making sure that Visual Studio 2019 was allowing existing extensions to run using deprecated APIs and restarting Visual Studio 2019 I was able to complete the NI Windows Forms Application (Configure your new project) wizard as expected.

 

Viewing all 1999 articles
Browse latest View live


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