Quantcast
Channel: All LabVIEW posts
Viewing all 202769 articles
Browse latest View live

Re: HC-SR04 with Arduino and NI-USB

$
0
0

The vi you saved and posted has the communications port set to com1. Is this the same com port that is listed when using the arduino IDE serial monitor? You need to make sure that you select the com port where the arduino is. I would need to see the full description of the error. 

What version of LabVIEW? 2014?

What version of Arduino IDE?

Which Arduino are you using? (Uno R3, Mega, Nano etc.)

Which version of NI VISA are you using. (Open Measurement and Automation Explorer MAX and click on software to check)

 

So the code on the arduino works. The communication between the arduino and LabVIEW does not work. LabVIEW errors out at the configure serial port vi. There is some setting that is wrong there. 


Re: Collect Data from DAQ for user inputted time interval

$
0
0

Here is a simple case/example that works and does what I want it do inside a while loop. The issue is that I need the DAQ to be outside of both loops in order to effectively incorporate it into the main VI.

 

 

I will look into the NI Example Finder for a solution as well.

 

Thank you so much for your help!

Re: How to send email when vacuum reaches threshold

$
0
0

How exactly do I "set a flag"? I am new to this.

Re: Collect Data from DAQ for user inputted time interval

$
0
0

The issue is that I need the DAQ to be outside of both loops in order to effectively incorporate it into the main VI.

 

Also, the DAQ cannot be contained in a separate loop, as this would interfere with the rest of the program and its functions. 

 

Again, not sure what exactly you want. Usually I make separate loops so parts of the program can operate in parallel without interfering with each other. If the DAQ and parts of your other program are in the same loop they will run at whatever determines the rate, that is, the slowest part of your program. They may be depending on each other when they don't need to.

 

Suggestions, you will need to learn basic DAQmx functions, that is get rid of the Express VIs.

See

http://www.ni.com/product-documentation/2835/en/

 

Also learn how to communicate between loops using queues, user events, etc.

 

Check out the many tutorials available. For me, the examples in the example finder are usually a good source of inspiration.

 

Good luck.

 

mcduff

Re: How to send email when vacuum reaches threshold

$
0
0

Here is an example.

flag.png

Notice how the iterations keep counting but the emails sent only increments once for each time Pressure Low is true.

 

How to correctly plot FFT

$
0
0

Hi,

 

I am tasked with taking the FFT of a 1D array of 2310 points. The dt value between each individual point is .142 seconds. So i believe the sampling frequency is around 7.0422 Hz. I have been trying to format the frequency axis correctly, so that my graph will correctly display at which frequency my peak is at. I have taken the FFT in three different ways, each displayed in the VI attached.

 

The first way, the graph is labeled "Resitance FFT using dt". After taking the FFT of the data, i wire the output to a build waveform vi with the dt value set to .142. The results of this graph display that i have a peak somewhere between 0 and .15 Hz, which is what i am trying to achieve, but i believe this is incorrect because the x-axis has the same scale as the original data(time) and not frequency.

 

The second way, the graph is labeled "using df". The df value is .003048. I believe this method is the correct way to scale my frequency axis, but the results i receive give me a peak at a frequency from 0 to 0.0025hz. To check these results i decided to wire the output of my FFT to a filter with a low cut-off frequency of 0.01 hz and a high cut-off frequency of .5 hz, and then take the inv FFT. The results of this display a sinusoidal wave on the graph labeled "FFT->filter->inv FFT" which is exactly what the whole goal of this program was to achieve. What i cannot seem to wrap my head around is that my FFT plot labeled "using df" which I scaled using df has a peak at a frequency much lower than the  low cut-off frequency of my filter, so after i take the inv FFT of that data, nothing should appear since it should be filtered out. To me this suggests that the way i scaled the first FFT plot labeled "Resistance FFT using dt" is correct. Is there an explanation as to why i am obtaining these results?

 

Finally, the last way i displayed my FFT of the data was by simply wiring the output of the FFT vi to a waveform graph. This graph is labeled "no scaling", and i believe this FFT is incorrect because when you look at the x-axis the final point is at 2310, exactly the number of data points, so the x-axis is not scaled correctly at all.

 

So, what is the correct way to scale my frequency axis? Or does anyone know why i am obtaining these odd results and how to fix it? if i left something out of this post/ you need more info to help solve the probem, please let me know.

 

Any suggestions/corrections are much appreciated. Thanks for your time.  

Re: Separate VI instances for separate class instances

$
0
0

Kevin,

 

Could you post an example of how one does each of these steps. This is something that I have struggled with. And I'm in the process of changing my code to classes.

 

Just like you mentioned, I have several DAQ channels that I would like to loop over, but I need to maintain reentrant vi's which are specific for each channel. On top of that, the user at run time, can choose what channels they would like to sample. This sets up a situation where I have had to break the data into groups. Then I have created several case structures for all of the possible combinations of a channel type. I figured dynamic dispatch can take care of separating the groups of channels, but I still need reentrant vi's that are specific to each loop. Otherwise, I'm back to putting in case structures. The main point being that each channel is assigned to it's own reentrant vi.

 

Thanks,

Ben

Re: normalise array to values between 0 and 1?

$
0
0

Just remember that this code assumes that all values in the array are positive. If your signal fluctuates below zero this will not work.


Re: normalise array to values between 0 and 1?

$
0
0

sam.blades wrote:

Just remember that this code assumes that all values in the array are positive. If your signal fluctuates below zero this will not work.


This is a long (and old!) thread and we have absolutely no idea what you mean by "this code". For clarity, you need to quote relevant parts of the post you are replying to. (e.g. my code makes no assumption about sign).

Re: build error: an input parameter is invalid

$
0
0

eHi,

When you prepare your build for .exe in your project, you can select the destination folder.

In that area, change it for a shorter path. I do not have LabVIEW in this PC. I cannot show you a picture.

Benoit

Re: executable doesn't run sub-panels

$
0
0

well you teach me nothing there...

As what I can see, if your vi is in a different executable, it is impossible to put this vi in a sub panel. so I create a "duplication" of this vi without the code and I apply the control and indicator property. the other solution I found is to exchange data trough VI server as well and then apply those to the vi in the sub panel.

Benoit

Analizing Cluster Array with elapsed time

$
0
0

Hi,

In my VI, i have to 10 valves and each valve has a "open status", "closed status", a "command to open" and a "command to close". Normaly my valve takes 3 seconds to be open after a request, so if the delay between a "command to open=True'' and the "status open= True" and "status close=False" (Yes, i have two sensors) is greater than 3 seconds i have an alarm.

In this example i am using 10 valves but normaly i have much more, so i am trying to treat the alarms in a way that i can easily increase or decrease the quantity of valves. My first approach was to make a cluster array and treat each index in a FOR loop, but i got stucked because of the time i have to wait before the alarm. Any sugestion??

i am sending an example of the vi with my unsuccessfully first approach. (i know that is not working)

thank you!!!

Re: HC-SR04 with Arduino and NI-USB

$
0
0

Hello, Mr. GovBob,

Thanks for your continuous help and guidelines. Yes, last time I have some communication problem with Arduino and LabView. I have attached a new picture of Error.

Answer of your questions:

1. I use LabView 2014

2. Arduino IDE 1.8.3

3. Arduino UNO

4. NI VISA Runtime 5.1.2

Re: HC-SR04 with Arduino and NI-USB

$
0
0

I don't want to use LINX.Because it creates problem to run other codes on the same device (i.e. Arduino UNO/MEGA). As I mentioned before, I will use this HC-SR04 code as a subVI in my main code.

Re: Analizing Cluster Array with elapsed time

$
0
0

Are all valves opened at once or is each on it's own schedule? What commands a valve to open or close? I guess it is not the operator, so the array of cluster should not be a control but an indicator.

 

All you need is a loop that checks all clusters and an array of tick counts to keep track of start time for each array element at regular intervals. Whenever the "cmd open" is true, time >3s and status open is false, throw an alarm. Do you also need an alarm if a valve takes too long to close?


Re: Scrolling of Frontpanel produces high CPU load and crashes COM-communication

$
0
0

Dear Ben,

not really.

I transmit a cluster of settings and a cluster of readings to my communication vi and receive it back. In the bottom is a case for refilling the Queue.

Maybe I should wait with the refreshing of the clusters on my frontpanel and only refresh it every 1-2 seconds.

 

best regards

Re: Scrolling of Frontpanel produces high CPU load and crashes COM-communication

$
0
0

Norbert_B wrote:

I think your bottleneck is the UI thread. Pllease verify that you run most code in other threads.

I am not sure about VISA in context of serial, but i think it shouldn't execute in the UI thread.

However, if it runs outside the UI thread, your application binds it to it.

 

In order to solve this, i recommend you to:

1. Move to producer/consumer design pattern rather than a simple event handler

2. Make sure to run as little code as possible in the UI thread


Dear Norbert,

actually I don't know about anything of what you just wrote. I never thought about UI threads. I will read up about this topic - maybe I can optimize my code.

to your #1: I have this - I atleast think i do. I have a producer(erzeuger) loop and a consumer loop (Verbraucher). Producer has an event handler. Consumer a case handler.

Best regards

Re: State machine program for multichannel multi sample input

$
0
0

Hi gregoryj,

             Actually i need to do this for xy graph same thing you've used for waveform chart in the vi you send me and also i need to do it for all the 16 graph for each and every channel i need same user selection window, if you go through the example.vi that i have uploaded here once again you can understand what i want and also i have attached one more model vi to understand what i want? i have used NI usb 6211 to acquire the signals here same like i want to do in the state machine program, so i want know what i have to do and dont's here?

 

Anyway, thanks in advance,

Regards,

Dinesh

Re: Scrolling of Frontpanel produces high CPU load and crashes COM-communication

$
0
0

I can see in your first laserloop.PNG file one property node (false constant assigned to a boolean beginning by "GasExc").

This might be a possible explanation. Property nodes use the UI thread. If the UI thread is busy with scrolling, the property node execution might be delayed (the UI and property node cannot be accessed at the same time).

For your complex application, you probably have already passed the point where you need to look into design patterns and general good practices (LabVIEW Core 2, 3, Advanced Architectures courses would help).

 

Just a few quick recommendations:

  • Avoid local and global variables, and assigning and reading values using property nodes.
  • Breakdown your application in several processes. Each process should have its own loop. Not all loops need to be in a single block diagram. You can use subVIs and/or spawn processes (which can be useful for assigning priorities).
  • Make one of these processes your UI process. This loop should only handle UI. If property nodes must be used, that's where they should be.
  • Use controls and indicators on your front panel only to receive inputs from the user and to provide information to the user. Use shift registers and queues to distribute those values where they are being used by your processes.
  • Communicate between loops using queues and back to the UI loop using User Events.

Good luck

Re: nonlinear state space equations

$
0
0

i don't know the important of this solver VI. it gives for example x,y,z that is unkown to us,,, than from that how we can find the state space or transfer function of that equation...

Viewing all 202769 articles
Browse latest View live


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