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

Data points look non-causal with time format

$
0
0

When plotting using the AnalogWaveformPlotOptions, if I use AnalogWaveformPlotDisplayMode.Time, the data appears as shown in the time.png attachment.  With the AnalogWaveformPlotDisplayMode.Samples format, the data looks fine (samples.png).  This is the only difference between the two plots.  Any ideas?


how to access ports in pxi-6512 in c#?

$
0
0

hello,

i install NI-DAQmx 9.7.5 and measurement studio

and i'm all new to this and i'm trying to access port.

if their any example code i would appriciate it.

 

Amir

problems deploying NationalInstruments.Analysis.Professional.dll in Web service (Exception from HRESULT: 0x80131417)

$
0
0

I am in the process of turning our desktop application into a web service.
The web hosting is done on a shared IIS server using ASP 3.5 and we do not have control to set the trust level of the server.

Our service application uses NationalInstruments.Analysis.Professional and when I try to send a request to the server I get the following response from the server:

 

Required permissions cannot be acquired.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[PolicyException: Required permissions cannot be acquired.]
   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +7613763
   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57

[FileLoadException: Could not load file or assembly 'NationalInstruments.Analysis.Professional, Version=9.1.35.204, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'NationalInstruments.Analysis.Professional, Version=9.1.35.204, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163
   System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53
   System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175
   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +51
   System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +8773398
   System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath) +10
   System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) +43
   System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +180
   System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +307
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

 

 

is it possible to enumerate local daqmx hosts

$
0
0

Using either NIMS or the daqmx object model, is it possible to enumerate local daqmx hosts?  (the same ones that would be listed in MAX?) I'm using VS2012 and measurement studio 2013.  I notice MAX used to have an API? Is the MAX API still exposed?  Thanks, Andy.  :smileyhappy:

wpf graph dot line type not working

$
0
0

When I set line type to dot, dash-dot, dash-dot-dot, I don't see any dots, only dashes. Graph is in vector mode. Solid lines are also working of course.

NI 9215 - voltage swing-out

$
0
0

Hi there

 

I'm fairly new to dealing with electronics, so please be patient with me.

 

I've bought a NI DAQ 9215 to read the voltage of two sources. The idea is to use voltage-two inputs in a .NET-program. The setup only requires to read the inputs every 3-5 seconds.

I have used the example-solution: AcqOneVoltageSample as boilerplate-code to test my setup (to see if I could read the inputs into a program).

 

It seems that the read-outs differ much from the expected results and alternate. I have used MAX to aquire read-outs and the phenomenon remains the same (see screenshot which is a read-out from a AAA-battery).

 

The read voltage alternates between zero and something near the expected value. Is there something wrong with my setup or am I missing a key-point in electronics theory?

 

Best regards

Frederik

Streaming to ASCII senteces

$
0
0

I am receiving an analog signal from a sensor (0 to 10 volts) and I need to convert this signal to a stream of ASCII senteces containing one of the fallowing discrete readings {1.0, 1.5, 2.0, 2.5, 3.0, 3.5 ... 20}; when the sensor reading vary between 0 and 10 volts.
 
The reason I need the data in ascii sentences is because I need to pick up each discreet value with my code. 
 
Can the Data Logger give me asscii sentences with the discreate values? Or, what other options I have?

Why does WPF Graph use 900+ MB memory when in ContinuousChart?

$
0
0

Why do the Scattergraph and the WPF Graph (MS2013) use so much memory when plotting large amounts of 1Hz data in ContinuousChart? (ex: memory increases 60MB every second up to ~800MB, then down and back up again).

 

I've attached a sample program that uses RASTER mode, Collapsed XAxis (similar to SuppressScaleLayout), 4 plots using ChartCollection<double, double> with 1,000,000 capacity. Application starts with 900K points on each plot, and we add new data at 1Hz. ContinuousChart adjuster adjusts range, which admittedly will require redisplay of entire graph, but only at 1Hz. I'm not concerned with the CPU usage, but this sample app grows to over 900MB of memory (particularly as x86 process, slightly better as AnyCPU).

 

We had a similar issue with the ScatterGraph control (on x86, we get OutOfMemoryException near ~1.6GB). Switching to x64 helps us, but we still support some x86 computers. I had hoped that the WPF graph wouldn't inherit this memory behavior.

ref: https://forums.ni.com/t5/Measurement-Studio-for-NET/Very-large-scattergraph-out-of-memory-exception/m-p/1830413/highlight/true#M11985

 

My only workaround has been pre-decimating the data and using smaller Point arrays (plotting down-sampled instead of "charting"). This helps, but our users zoom in and out of the data a lot, and we then have to re-sample the data every time the user zooms (something I'd hoped not to implement). Can we not use Charting with 4 x 1M points without accepting this memory pattern?

 

As a workaround, I'm exploring custom decimation in a derived PlotRenderer. because I'd like to leave the Graph.DataSource bound to a ObservableCollection or ChartCollection type where I can keep all 4 x 1M points.

 

Attached example is based on the Charting.2012 example from MS2013

 

PrivateBytes_PerfMon


Plotting millions of points in a .Net WaveformGraph/WaveformPlot

$
0
0

Hello,

 

I have an application I have written in C# using Measurement Studio and the WaveformGraph. The application deals with multiple data sets containing varying amounts of data. However, millions or tens of millions of points per data set are not uncommon. While I understand that displaying 10's of millions of points is kind of pointless (yes, that's a pun) since you can't really see them, I don't currently have a way around it. It is a requirement, however ridiculous, to plot some representation of all the data in a set. The amount of time required to plot so much data is very frustrating to my users.

 

I noticed this post addressing the issue to some extent. However, it is relatively old and I tried the implementation, which resulted in a 2-4 time improvement in display times (isolating the time it takes to plot and display the data only). This is good, but it's not a 10x improvement. I reimplemented the sub-sampling algorithm in the example to grab the minimum and maximum values within each pixel bin as well, which resulted in a much better plot (the example was definitely causing points to drop off the display that our users need to see).

 

This approach has several drawbacks. First, it is code I need to maintain that I feel like should be duplicating code that is somewhere in the WaveformPlot/WaveformGraph classes. Second, it obscures functionality built into the controls. For example, this only works with plotting lines. If the user wants to see points, this is very easy to do with the built in classes. It is not possible with this custom implementation (at least, not without a lot of work on my part). It also causes some weirdness with things like cursors since the plot line is drawn manually and there aren't actually any points being displayed by the plot. And finally, the 2-4x speed-up isn't really enough to justify the loss of features as described above.

 

So that's a lot of information, but I think it's necessary. My questions are:

 

1. It seems like this sort of thing should be done in the classes already. It must be done in some way. Am I just duplicating code?

2. Is there anyway to instruct the WaveformGraph or WaveformPlot to reduce it's fidelity or something in order to get faster plots?

3. Are there any better suggestions for handling such large amounts of data?

 

I have attached the modified example. It prints the amount of time required to plot (display only) each type of graph, allows changing the number of points displayed, the oversampling factor, and resizing the display. Thanks go out to the original poster for doing much of the work on this.

Problem installing

$
0
0

I'm having a problem installing Measurement Studio 2013. When I try to install, it only indicates "NI General Security Patch Q2 2013" is being installed. When it's done the program does not show up in the Start/All Programs menu. Note that I did have an evaluation copy of Measurement Studio 2012 installed before I uninstalled it prior to attempting to install the 2013 version.

App "Not Responding" with WPF Graph, GraphInteraction.Zoom, and cursors

$
0
0

I can't get WPF Graph (MS2013) to work with Cursors AND the Zoom GraphInteraction (zoom with mouse). The zoom rectangle redraws so slowly that app is unusable, sometimes even hanging for long enough to get the "(Not Responding)" title from windows. WPF is supposed to redraw at 60 fps, but I'm getting < 1 fps when I use more than a couple cursors. How can I use both mouse-zoom and ~100 cursors at the same time?

 

The attached csproj is based on the Charting example. I pre-load 4 plots with 900 data points each, and add 90 cursors and set the Graph DefaultInteraction to Zoom. When you try to mouse-zoom on a region, the zoom rectangle doesn't appear right away, and while holding left mouse down the rectangle redraws VERY slowly (< 1 fps), not usable.

 

I've tried switching to Raster and marking the Cursors as ReadOnly, but it doesn't help. I've considered implementing my own mouse zoom (app has a sample Resize control just to test performance of a simple one), but it feels silly to disable native zoom just to implement same. I'm actually having similar performance issues with mouse zoom rectangle (~ 5 fps redraw) without cursors, but this behavior is simpler to reproduce. In our application, we frequently plot 4 channel datasets with 500K points and 100+ read-only cursors.

 

Any tips / workarounds / advice would be really appreciated!!

-David

 

App not responding

 

 

DAQmx User Control-Assistant missing

$
0
0

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

how to interface tachometer in ni-daq 6323

$
0
0

I have NI-DAq 6323 with SCC 68, and i want to calculate frequency of a signal generated by tachometer. The signal is a simple square waveform of 0 and 7 volts. First thing i want to know how to interface that sensor with SCC and the how to program it to use as a tachometer. 

 

Thank you.

triaxial accelerometer

$
0
0

Hola, buenas tardes, requiero conectar un sensor triaxial 256A01 piezoelectronics, con el dispositivo ni ubs 6009, pero no tengo idea de como se conecta dicho sensor a la fuente poder, ya que trae varias conexiones y no para cual es cada una...gracias

Problem in graph with time axis in WPF

$
0
0

i'm new  to use measurement studio.

 

 

i used the rangeadjusters in examples, followed some posts in this discussion board ,and put some my own codes trying to make the graph having a time axis.

but now i'm stuck in a problem. here it's .

 

there is the coeds i added;

 

In xmal part:

 

<ni:Graph x:Name="graph" Margin="5,5,89,5">
   <ni:Graph.Plots>    

   

       <!-- To prevent the :P show up, i put space between the ':' and 'P'  -->


       <ni: Plot Name="p1" Tag="line1" Label="das">
           <ni:LinePlotRenderer Stroke="Red" StrokeDashCap="Round"/>
      </ni: Plot>
   <ni: Plot Name="p2" Label="ddda">
           <ni:LinePlotRenderer Stroke="Black"/>
    </ni: Plot>
    <ni: Plot Name="p3" Label="Xdda">
             <ni:LinePlotRenderer Stroke="BlueViolet" StrokeDashArray="1 4 1"/>
     </ni: Plot>

  </ni:Graph.Plots>
  <ni:Graph.Axes >
        <ni:AxisDateTime Orientation="Horizontal" >
            <ni:AxisDateTime.MajorDivisions>
                  <ni:RangeLabeledDivisions LabelPresenter="yy-mm-dd hh:mm:ss" />
             </ni:AxisDateTime.MajorDivisions>
       </ni:AxisDateTime>
  </ni: Graph.Axes>
</ni: Graph>

 

the C# codes putted in  OnPlotDataClicked

 

AnalogWaveform<double>[] waves ;
double[ , ] plotData = new double[3 ,DataCount];

for (int j = 0; j < 3; j++)
{

  for (int i = 0; i < DataCount; ++i)
  {
     double value = 1.2 * random.NextDouble() * Math.Sin(i * Math.PI * Math.PI / DataCount);

      plotData[j,i] = value;
   }
}

waves = AnalogWaveform<double>.FromArray2D(plotData);

for (int k = 0; k < 3; k++)
{

   WaveformTiming timing = WaveformTiming.CreateWithRegularInterval(new TimeSpan(0, 0, 0, 30), DateTime.Now);

   waves[k].Timing = timing;

}

graph.DataSource = waves;

 

the result

t1.jpg

 

 

but the result is not i want, the time axis show the wrong date at all. how to make it right. wait for your hlep, thanks a lot

 

 

 


How to distribute VISA components

$
0
0

I am working on an application which interfaces to different external equipment. I now have the task of integrating a device from Rigol which uses the NI-VISA. This is new to me - never heard of it before yesterday.

 

I have installed 'visa540_full.exe' and found the NationInstruments.Common & Visa dlls and was able to communicate with the Rigol equipment on my development PC.

 

I tried to deploy the application to a send PC after installing the NIVISARuntime but I'm getting the following error.

 

Could not load file or assembly 'NationalInstruments.Common,
Version=13.0.40.188, Culture=neutral, PublicKeyToken=dc6ad606294fc298' or one of
its dependencies. The located assembly's manifest definition does not match the
assembly reference. (Exception from HRESULT: 0x80131040)

 

I think I saw that the Version on my PC is 13.0.40.190 which I guess has something to do with the problem.

 

What is the proper way to proceed here? Are there different runtime versions? (could only find the one) Can I pack everything I need into my application? If so what do I need? Is there a list of dlls?

 

Thanks!

Paul

Read network variables on demand does not work in measurement studio 2013

$
0
0

I have a very big issue using Measurement Studio 2013 and Network Variables. Let me give you the setup first.

 

One of our products includes a cRIO/sbRIO that uses published network variables that can be read/written to to change settings or gather data. They're simple string/int32/doubles for the most part. We also use a frontend built in .NET 4 using Visual Studio 2010 with a few references to National Instruments DLL's, including the network variable assembly.

 

Just a few days ago, I uninstalled all my NI software and reinstalled from the 2013 DS2 disk in order to get LabView up to 2013. What a mistake that was. After updating all the references in the VS2010 project and setup project, rebuilding the setup and deploying it on to a product PC (which does not have NI software installed), I now suddenly cannot read or write to any network variables on the cRIO. The error I continuously get (after modifying some code to spit the error out) is:

 

"The network variable process was not found or is not responding"

 

I have not changed any of the backend code, which is pretty much made up of the following:

 

public cNetworkVariableString(string name, string location, double timeOut)
        {
            _timeOut = TimeSpan.FromSeconds(timeOut);
            _location = location;
            _name = name;
            try
            {
                _reader = new NetworkVariableReader<string>(_location);
                _writer = new NetworkVariableWriter<string>(_location);
                _writer.Connect(_timeOut);
                _reader.Disconnect();
                _writer.Disconnect();

                
                _error = false;
            }
            catch (Exception ex)
            {
                _error = true;
                _errorMessage = ex.Message;

            }



}

 

 

Anyone have any idea what could be the problem? FWIW, I kind of took over the role of programmer in the past year, so a lot of this is new to me and I'm hoping I'm simply overlooking something simple.

 

Thanks,

 

Mike

darshank

$
0
0

Hi Team,

I am not able to get the issue. I have licenced copy of NI Measurement Studio 2010 installed where I created an Installer but when I am trying to insatll on another machine where No Measurement Studio is insatllaed. I am getting below error while loading an application on that Machine:

 

System.BadImageFormatException: Could not load file or assembly 'NationalInstruments.UI.Styles3D, Version=9.0.35.292, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'NationalInstruments.UI.Styles3D, Version=9.0.35.292, Culture=neutral, PublicKeyToken=18cbae0f9955702a'
  

 

Can you please suggest what could be an issue?

Create a new AnalogWaveform variable with an irregular sample interval

$
0
0

Hi All,

 

I would like to sample some data at a low rate. Currently, I have a DaqTaskComponent which takes a single sample, and saves it into a global AnalogWaveform variable using .Append(). Here is a snippet of the code:

Public VoltageWaveform As NationalInstruments.AnalogWaveform(Of Double)

...

            ' Acquire some data from the DAQ:
            Dim acquiredData() As Double = DaqTaskComponent1.Read
            ' Create a variable to store the time stamp:
            Dim Times(0) As NationalInstruments.PrecisionDateTime
            ' Get the current time:
            Times(0) = PrecisionDateTime.Now
            
            ' Append the data to the analog waveform:
            VoltageWaveform.Append(DaqTaskComponent1.Read)           'This works
            VoltageWaveform.Append(DaqTaskComponent1.Read, Times)  'This does NOT work

            ' Plot the results:
            WaveformPlot1.PlotWaveform(Of Double)(VoltageWaveform)

 The line which is marked as "This does NOT work", fails because the "VoltageWaveform.Timing.SampleInterval = None". In order to use Append() in this way, SampleInterval must be "Irregular". However, .SampleInterval is a read only property.

 

Therefore my questions are:

1) is there any way to change the SampleInterval for an AnalogWaveform programatically?

2) Failing 1), is there a better way to implement what I am describing? I would like to add data as I see fit to an AnalogWaveform variable. Or is there another type of variable which would be more appropriate? I am only sampling at 0.5Hz or so. I would like to use an AnalogWaveform or equivalent variable to take advantage of the WPF features of Measurement Studio.

 

Thanks!

 

Damien

C# read status of digital output line

$
0
0

Hello

 

Is it possible to read the status of a digital output line with a PCI 6509 board.

When i set a output line and read it back the output switches off because it set to input.

 

 

with kind regards

Tonnie

Viewing all 2002 articles
Browse latest View live


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