Subscribe: Measurement Studio for .NET Languages
http://forums.ni.com/rss/board?board.id=232
Preview: Measurement Studio for .NET Languages

Measurement Studio for .NET Languages topics



Measurement Studio for .NET Languages topics



Published: Mon, 25 Sep 2017 20:42:58 GMT2017-09-25T20:42:58Z

 



Getting the Temperature from TC001

Fri, 22 Sep 2017 16:18:56 GMT2017-09-22T16:18:56Z

I am trying to get the temperature from a thermocouple and display it on my main window. It works perfectly on my computer. The temperature updates every two seconds as it is supposed to. I had previously posted a question about required DLLs for this to work on the lab computers which do not have NI software installed. I was told I needed to install the NIDaq Runtime engine. I installed that but still got the error:

"System.IO.FileLoadException: A procedure imported by 'NationalInstruments.DAQmx.dll' could not be loaded."

The stack trace takes it back to the constructor where I call the "Watch Temperature" method which does the following.

 

                try
                {
                    TempScanner = new Thermocouple();
                    TempWorker = new BackgroundWorker();
                    TempWorker.WorkerReportsProgress = true;
                    TempWorker.WorkerSupportsCancellation = true;

                    TempWorker.DoWork += (s, e) =>
                    {
                        TempScanner.TempWorker = TempWorker;
                        TempScanner.MonitorTemp(ref watchTemp);
                    };

                    TempWorker.ProgressChanged += (s, e) =>
                    {
                        var t = e.UserState as Temperature;
                        this.Temperature = t.Temp;
                    };

                    TempWorker.RunWorkerCompleted += (s, e) =>
                    {
                        TempWorker = null;
                        TempScanner = null;
                    };

                    TempWorker.RunWorkerAsync();
                }

The critical parts of the thermocouple class are shown below.

 

        public Thermocouple()
        {
            //These are the default values.
            SecondsDelay = 2;
            MinimumTemp = -70;
            MaximumTemp = 200;
            List chnls = GetPhysicalChannels();

            PhysicalChannelName = chnls[0];
            string[] ary = chnls[0].Split('/');
            AssignedChannelName = ary[0];
            ThermocoupleType = AIThermocoupleType.J;
            tempChannel = tempTask.AIChannels.CreateThermocoupleChannel(
                        PhysicalChannelName, AssignedChannelName, MinimumTemp, MaximumTemp, ThermocoupleType, AITemperatureUnits.DegreesC);
            tempReader = new AnalogSingleChannelReader(tempTask.Stream);
        }

        public void MonitorTemp(ref bool watchTemp)
        {
            while (watchTemp)
            {
                if (!TempWorker.CancellationPending)
                {

                    Temperature t = new Temperature();
                    t.Temp = GetTemp();
                    TempWorker.ReportProgress(100, t);
                    t = null;
                    Thread.Sleep(milliseconds);
                }
                else
                {
                    tempReader = null;
                    tempChannel = null;
                    tempTask = null;
                }
            };
        }


The runtime engine I installed was NIDAQ1410f1Runtime.

 

 

As you can see it is not all that complex. There must be a simple solution to this problem.

 

Thank you




WPF Graph Label format for Double values

Wed, 20 Sep 2017 12:30:03 GMT2017-09-20T12:30:03Z

Hi @ll

 

I use wpf graph with autoscale functionality.

 

on my X-Axis I show double values which will be dispalayed as e. g. 869.52 ...889.53...869.64 etc.

 

when this values have more then 3 digits behind the point the scale shows sometimes:  8.69E2 etc (instead 869.564)...how can I avoid that ?

 

BR

KebMo

 




Task name conflicts with an existing task name.

Tue, 19 Sep 2017 16:31:33 GMT2017-09-19T16:31:33Z

When I am testing my code the temperature displays correctly and everything works as I expected. Then, after testing when I go back into code, specifically XAML, I get an error from my Thermocouple class saying that a task name conflicts with an existing task name. I can close the error and go about my business as usual. But it bothers me because I finalize that class when the program closes and call the Dispose method on the task.

 

        ~Thermocouple()
        {
            if(tempReader!=null)
                tempReader = null;
            if(tempChannel!=null)
                tempChannel=null;
            if(tempTask!=null)
                tempTask.Dispose();
        }

Is there something I should be doing to avoid this? It doesn't seem to affect anything, but if the task is still present after the program shuts down, then it could potentially be a problem. Suppose the user closes the program and immediately restarts it? Will there be a conflict?

 

Thanks




Error reporting and NiErServer.exe

Tue, 19 Sep 2017 14:20:22 GMT2017-09-19T14:20:22Z

Can anyone provide some insights into error reporting via NiErServer.exe?  I see this server is running in the background but I don’t know how to use it.

 

According to the documentation if an error does occur in my NI software a dialog pops up with an error report. Anyone tell me how I can access the error reports manually? Are they stored somewhere?

 

Second, my customer appears to have 2 NiErServer.exe running at the same time -

 

NiErServer.exe

NiErServer.exe *32

 

How is this possible and is this a problem?

 

Thanks

Damian

 

 




Migrating NI Controls from WinForms to WPF

Mon, 18 Sep 2017 15:45:49 GMT2017-09-18T15:45:49Z

HI,

 

I have a existing Winforms applications and many of the NI controls such as Scatter Graphs, WaveForm Graphs, Intensity Graphs etc have been utilized to build a engineering application. Currently I am working on the same project but I am tasked to rewrite the above project in WPF. 

I am not able to quite identify or match the properties of various NI graphs/controls that have been used in Winforms to that of WPF.

 

for eg: Caption property of Scatter Graph, I cannot find a similar property when I am using the equivalent Graph in WPF. Do we have any kind of documentation which helps me to understand or identify the equivalent properties of the graphs/controls from Winforms to that of WPF?

 




NI Connection network variable connection issue

Thu, 14 Sep 2017 19:12:04 GMT2017-09-14T19:12:04Z

Hi All,

I have c# application that connect to NI CFP device. Everything is exposed through Network variables under c# application. We are getting same error that happens randomly. Attached is the screenshoot below. At the first glance I thought we are loosing the network connection. But The network strength is high and doesn't seem to drop low. I would like to know, if there is any other point we are not considering. and how it cause that issue. And in the case it is network issue, what it is really causing the error?  

(image)

Please, we would appreciate your help.

Thank you




Reprocessing Point in Graph after Range Change

Wed, 13 Sep 2017 16:17:21 GMT2017-09-13T16:17:21Z

Hi,

 

I am plotting Point A on a graph by passing it in to the data source. Then I change Point A to Point B by replacing that data item in the graph with the new point. The vertical axis adjuster is set to fit loosely, so the range adjusts, then I swap out Point B for Point A. In my renderer, the first time Point A is being plotted, it shows up in the RenderGraphCore function as a percentage of the display window .3. Then, the second time I try passing in Point A, after the axis has adjusted, the percentage in RenderGraphCore is still .3. Does anyone know why the second processing of the point isn't taking into account the range change? 

 

Thanks,

Kelly




Movable legend in WPF

Tue, 12 Sep 2017 13:43:39 GMT2017-09-12T13:43:39Z

Hi all,

I would like to have the legend(s) of my graph(s) movable in a WPF project, in form of clicking and dragging it around on top of the graph control. From this topic, there is an example for WinForms, which does not work with WPF. What would be the 'best practice' to implement this? In my project, I have a several graph controls and their according legends placed together in one grid cell. I found some topics of dragging UIElements with the help of the Thumb class, but this works only with Canvas and I could not get any good solution with that. I would appreciate any help.

Thanks




DAQ 9205 does not reconnect after reboot

Tue, 12 Sep 2017 02:38:05 GMT2017-09-12T02:38:05Z

Using cDAQ-9184 with 9205 module

Set DAQ IP address to 192.168.1.20 and PC NIC to 192.168.1.11

 

REPRO STEPS

* Find 9205 via NI-MAX and set alias to DAQ1_Slot1

* Connect to it via C# code successfully and log data samples

* Reboot the PC leaving the 9184 and 9205 powered up

* Re run the same exact C# code

 

EXPECTED

* C# code connects to the device successfully as before

* Device shows up as connected in NI MAX

 

ACTUAL

* C# code fails to connect

* Device shows up as dis-connected in NI MAX

 

RECOVERY

* Manually remove and then re-add the device using NI-MAX

* Now the code works

 

PROBLEM

This is an unacceptable situation. The PC is a headless device that needs to be able to recover in the case of power failure or other reboot cause.

 

What is causing this problem and is there a way to reconnect programmatically? Either in my C# code or some other automated tool?




cwShapeMinMaxRegion .Net Equivalent

Mon, 11 Sep 2017 15:01:31 GMT2017-09-11T15:01:31Z

Is there an equivalence of the shape type in vb6 named cwShapeMinMaxRegion ?




How do I add Items to a Legend in WPF

Sun, 10 Sep 2017 21:25:07 GMT2017-09-10T21:25:07Z

I have added a Grpah with three plots. Added a Legend and wanted to have 3 plots of the graph as the Items to my Legend. Is there any way I can add the Legend items at design time?

 

 

Seems Items is read only collection....




How to configure the Range property of IntensityGraph in WPF?

Fri, 08 Sep 2017 18:06:44 GMT2017-09-08T18:06:44Z

I am trying to configure the Range property of ColorScale in XAML for the IntensityGraph.

Is there any way I can do that? I am not seeing any Range property for ColorScale. Below is the sample XAML code which i have written. I am looking for a property where I can set the Range="0,65355" similar to what we have for the Intensity Graph  

 










Looking for ideas!

Thu, 07 Sep 2017 19:04:55 GMT2017-09-07T19:04:55Z

Hello,

 

On our manufacturing floor we have many consoles that contain Keithley Switch/DMM's. We use three different models of these instruments the 2700, 2750, and 3706A. The 2700 can contain up to three plugin switch modules, the 2750 can contain up to five plugin moduels, the 3706A can contain up to six plugin modules. 

 

Keithley provides a means to access the switch closure counts for each switch on each plugin module. This helps with preventive maintenance we can see if a card or relay is coming near its life expectancy. Currently we have two utilities one for the 2700/50 and one for the 3706A. Our technicians periodically go out and check each console that contain one of these instruments and notes the highest count returned for each plugin module in that switch mainframe.

 

I am looking to reduce the effort that is currently necessary to perform this activity on our floor. 

 

I would like to create an application that would reside on the PC in each of these consoles. This application would periodically query the switch mainfraim for the switch counts for each plugin module in that mainframe. This application would then report the max count from each module up to a server application that would package the information from all of the reporting consoles into a format that would allow the person looking at the data to easily discern which module in which console might be getting near it's end of life. The server application may also be able to send out an email to specified personel when a module max count crosses a defined threshold.

 

Any ideas are appreciated. If you have already created a system like this even more so.

 

Thank you in advance and have a great day! 




Does Measurement studio support the PCIe-7841

Wed, 06 Sep 2017 17:13:12 GMT2017-09-06T17:13:12Z

Hello, everyone.

I am going to use the PCIe-7841 in a project, and I already had a Labview program to drive this card. Currently, we plan to develop a .Net C# application to build a same applciation like the one in Labview. However, PCIe-7841 should have R series multifunction ROI device driver, but I cannot find this class library in the measurement studio. Before, we once used the NI-DAQmx, which is quite easy to be referenced in any C# program. Anyone could help us, plz, we are really clueless.




NIDCPower C#: How to flush the measurement buffer before fetching measurements?

Wed, 06 Sep 2017 16:14:00 GMT2017-09-06T16:14:00Z

I'm running into a problem where NIDCPower.Measurement.Fetch is returning stale data. How can I flush the measurement buffer?



Hardware failure with buffer generation

Tue, 05 Sep 2017 15:55:56 GMT2017-09-05T15:55:56Z

Hello,

 

I am using a client-server based tool to control the NI cards and having an external clock (Opal Kelly XEM3001) which is attached to a PXIe 6363 card, and I am getting the following error when trying to generate a simple sinusodial signal:

 

 Failed buffer generation due to exception: A hardware failure has occurred. The operation could not be completed as specified.

Task Name: Dev6 output task

Status Code: -50152
   at nNIMSSAIL100.StatusObserverT >.CheckWithName(StatusObserverT >* , tCaseInsensitiveBasicString\,_STL::allocator\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
   at nNIMSSAIL100.StatusObserverT >.Check(StatusObserverT >* )
   at nNIMSSAIL100.StatusObserverWrapperT >.Check(StatusObserverWrapperT >* )
   at nNIMSSAIL100.Write,class nNIMSSAIL100::AnalogWrite,double>(tTask* , Double* , UInt64 , UInt64 , UInt64 , Double , Boolean , Boolean , tScaledDataFormat , StatusObserverT >* )
   at nNINETAI2005100.Write2D,class nNIMSSAIL100::AnalogWrite,double,double,cli::array< ?? ::N ,2>^>(Task task, Double[,] buffer, UInt32 numChannels, UInt32 numSamples, UInt32 lines, Double timeout, Boolean autoStart, Boolean interleaved)
   at NationalInstruments.DAQmx.Internal.AnalogMultiChannelWriterImpl.WriteMultiSample(Boolean autoStart, Double[,] data)
   at AtticusServer.DaqMxTaskGenerator.createDaqMxTask(String deviceName, DeviceSettings deviceSettings, SequenceData sequence, SettingsData settings, Dictionary`2 usedDigitalChannels, Dictionary`2 usedAnalogChannels, ServerSettings serverSettings, Int64& expectedSamplesGenerated) in D:\Cicero\Cicero-Word-Generator-master\AtticusServer\ServerRuntime\DaqMxTaskGenerator.cs:line 724

Does anybody have an idea of what might be the cause of this problem?

 

 




Cursor position change after reset the data

Mon, 04 Sep 2017 10:16:21 GMT2017-09-04T10:16:21Z

I have 2 graphs with a cursors on each of them.

In addition, there is a button that changes the location of the markers (the same location for both markers) - "Init Cursors", and a button that reproduces the data - "Generate Data".

 

I have a problem with the following scenario:

 

Press the "Init Cursors" button - and then press the "Generate Data" button several times at one time the X values in the cursors are not equal even though both have the sa(image) me X values. 

 

I have come to the conclusion that changing the data causes a re-search of a point on the new plot for the cursor. And the search is not done by SearchDimensions.Horizontal.

Therefore, even when X values do not change but only Y values, the search can give a different point from the point that existed before.

 

Is it possible to determine that the search will always be done by SearchDimensions.Horizontal or to cancel the search that is being done in UI change?

 

[The project is attached].

 




Adding .NET NI-DMM and NI-SWITCH libraries to the same VS project causing circular reference

Sat, 02 Sep 2017 19:10:36 GMT2017-09-02T19:10:36Z

I need both NI-DMM and NI-SWITCH .NET libraries (NationalInstruments.ModularInstruments.NISwitch.Fx40 and NationalInstruments.ModularInstruments.NIDmm.Fx40)  for my project in VS 21015.  There is no problem under development environment but unable to run after deployment with the following messages: ======================================================= ...IDENTITIES Deployment Identity : WinFormApp.application, Version=1.0.0.23, Culture=neutral, PublicKeyToken=097a2721cb4640aa, processorArchitecture=amd64 Application Identity : WinFormApp.exe, Version=1.0.0.23, Culture=neutral, PublicKeyToken=097a2721cb4640aa, processorArchitecture=amd64, type=win32 APPLICATION SUMMARY * Installable application. ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of C:\public\WinFormApp.application resulted in exception. Following failure messages were detected: + Value does not fall within the expected range. COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected. WARNINGS There were no warnings during this operation. OPERATION PROGRESS STATUS * [9/2/2017 11:58:53 AM] : Activation of E:\Publish\WinFormApp.application has started. * [9/2/2017 11:58:53 AM] : Processing of deployment manifest has successfully completed. * [9/2/2017 11:58:53 AM] : Installation of the application has started. * [9/2/2017 11:58:53 AM] : Processing of application manifest has successfully completed. * [9/2/2017 11:58:56 AM] : Found compatible runtime version 4.0.30319. * [9/2/2017 11:58:56 AM] : Detecting dependent assembly Ivi.Driver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=A128C98F1D7717C1, processorArchitecture=msil using Ivi.Driver, Version=1.1.0.0, Culture=neutral, PublicKeyToken=a128c98f1d7717c1, processorArchitecture=msil. * [9/2/2017 11:58:56 AM] : Detecting dependent assembly Ivi.ConfigServer.Interop, Version=1.6.0.0, Culture=neutral, PublicKeyToken=A128C98F1D7717C1, processorArchitecture=amd64 using Ivi.ConfigServer.Interop, Version=1.6.0.0, Culture=neutral, PublicKeyToken=a128c98f1d7717c1, processorArchitecture=amd64. * [9/2/2017 11:58:56 AM] : Request of trust and detection of platform is complete. * [9/2/2017 11:58:58 AM] : Downloading of subscription dependencies is complete. * [9/2/2017 11:58:58 AM] : Commit of the downloaded application has started. * [9/2/2017 11:59:00 AM] : Installation of application has successfully completed. ERROR DETAILS Following errors were detected during this operation. * [9/2/2017 11:59:00 AM] System.ArgumentException - Value does not fall within the expected range. - Source: System.Deployment - Stack trace: at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation) at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter) at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, String activationParameter, Boolean useActivationParameter) at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, String activationParameter, Boolean useActivationParameter) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& [...]



Redistributing NI-DAQmx with a Visual Studio C# project

Fri, 01 Sep 2017 16:23:41 GMT2017-09-01T16:23:41Z

I am not sure where this post should be since I am rather confused about the NI software products.  I don't use Labview and I don't use Measurement Studio.

 

I am using NI-DAQmx with a custom software application created in Visual Studio 2015 using C# (.net 4.5).  I've installed the drivers and NI development tools on the same PC as VS and everything works fine.  When I install the application on another PC that doesn't have VS it doesn't work because I get an error that the DLLs aren't loading.  I have included  the two DLL files NationalInstruments.DAQmx.dll and NationalInstruments.Common.dll in the project and they get copied to the target PC.  What am I missing?

 

Does NI require a special, separate installation of the DLLs so they get registered?  If so, what installer should I be using so I don't install all of the development stuff on a target PC?

 

What about drivers?  I am using the 9217 temperature module and the 9171 single slot USB chassis.

 

Thanks.




Problem with DaqMx

Thu, 31 Aug 2017 09:42:42 GMT2017-08-31T09:42:42Z

Hello,

 

This is clearly not my field of specialty and I am not even sure I am posting in the right section. I am a physicist using NI cards to generate ouput for an experiment my team is working on. I am using Cicero Word Generator to control the cards, when I run the program I get the following error:

 

 

" System.BadImageFormatException: Could not load file or assembly 'NationalInstruments.DAQmx, Version=9.3.35.219, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'NationalInstruments.DAQmx, Version=9.3.35.219, Culture=neutral, PublicKeyToken=18cbae0f9955702a'
at AtticusServer.ServerSettings..ctor()
at AtticusServer.AtticusServer.Main() in C:\Users\Aviv Keshet\Documents\Software\Cicero-Word-Generator\AtticusServer\AtticusServer.cs:line 67

 

In the installation guide the creator of this tool says:

 

 

At a minimum, you will need to have working versions of the National Instruments DAQmx, VISA, and 488.2 driver libraries. These are required not just on the output hardware computer, but also on any computers running the Cicero user interface client. The latest bundle of these can be downloaded at http://www.ni.com/drivers/ . Almost all Cicero errors and exceptions are caused by not having the correct or latest version of the driver libraries installed (greater than or equal to the version that Cicero was compiled against), causing the .NET runtime to be unable to resolve various library references.

Important note : When installing all 3 of the above driver libraries using the downloaded installer, chose a “Custom” installation rather than a “Typical” one. Ensure wherever possible that  .NET Framework Language support is enabled for all versions of the .NET Framework (at the time of this writing, 2.0, 3.5. 4.0; Cicero is built around Framework version 3.5, but at some future point it is possible that this will migrate to 4.0).

 

I am running on a Windows 7 x64 machine, I have MAX 17 which is correctly detecting the cards, and I have NI DAQ 16. 

 

I hope I could find help with you guys.