Jump to content

Data analysis


Recommended Posts

Hi,

I'm new on this forum and I would need some help with a labview project.

What I need to do is acquire data (sinus form) and detect if absurd data (in this particular case, making the amplitude greater) is acquired and stop the machine if that's the case.

What would be the best way to do that? (Some existing VI express for that usage?)

I attached a screenshot of the acquisition loop.

All comments are welcome since I'm still learning.

Thank you!

post-24916-0-65035600-1307641134_thumb.p

Link to comment

Hi,

Firstly, I think you should clean up your code (a bit)

Secondly, if you just want to stop if the amplutude is too high you can use a threshold detector (already existing in LabVIEW) and a case structure.

Lastly, you have a problem with your stop condition (in the acquisition loop) and you do not handle errors while looping this may be a problem...

Hope this helps.

  • Like 1
Link to comment

Hi again,

The idea of the VI is to

1- Open

2- Let the user set informations

3- Open the solenoid valve and start acquisition

4- Stop acquisition and close the solenoid valve

5- Save informations and data to file

6- Let the VI run awaiting next command (being either: change informations and file path, start new acquisition, quit the program)

  • What should I do to be able to run the VI without using acquisition? just let it be in standby
  • When the VI runs it ask for the file path (1). How could I make it so that people have to browse for it whenever they want before beginning the acquisition.
  • I want the user to be able to enter different informations (string type), modify them, then click FIXER to set all the values (2). I get missing assignment to tunnel but what should I write in the False case?
  • What should I do with (3) if I want the time Heure de fin estimée to be updated while the variable detected frequency is updated within the loop?
  • If I use ContinuousSamples (4), is the number of samples any useful?
  • If I use multiple channels, lets say 2, are they both going to be displayed on the measurement (5) ? How can the values on the graph be cleared once the acquisition ends and data is saved to a file?
  • Is (6) a proper way to store data for further writing to (9) ? Else, what should I change?
  • Where should I put the start button (7) so that it starts the acquisition process?
  • I currently have three ways (8) to trigger the stop (number of cycles, threshold or manual). None take errors in the loop in consideration. How could I add that?
  • Here at (9), I need to add the acquisition data (numeric) along with the informations previously set (strings) (2) with to the exported file. Is append function the correct way to do that?
  • In the end case (10), I need to add an analog outpout of 5V DC. Should I use a waveform with 5V offset and no amplitude?
  • Is my usage of local variable correct in the while loop stop condition and in (3)?

Thank you so much in advance, all comments and suggestions are more than welcome!

post-24916-0-92417800-1307806892_thumb.p

Edited by lablc
Link to comment

Just glancing at the screenshot...

When the VI runs it ask for the file path (1). How could I make it so that people have to browse for it whenever they want before beginning the acquisition.

You can use the File Dialog VI.

If I use multiple channels, lets say 2, are they both going to be displayed on the measurement (5) ? How can the values on the graph be cleared once the acquisition ends and data is saved to a file?

All channels collected will show on the graph. The values can be cleared using a local variable or a property node.

Is (6) a proper way to store data for further writing to (9) ? Else, what should I change?

This will concatenate the two arrays, but only the current value. You would need to use a shift register to store that concatenation and then add to it on each loop. A better way may be to open the file to save and then keep writing to it during the acquisition (and may be the only way to do this in a long term DAQ).

Where should I put the start button (7) so that it starts the acquisition process?

Before you configure the DAQ, or at least before the DAQ start.

I currently have three ways (8) to trigger the stop (number of cycles, threshold or manual). None take errors in the loop in consideration. How could I add that?

Yes.

Is my usage of local variable correct in the while loop stop condition and in (3)?

No as the data flow has the stop set after the while loop has terminated and is not in a loop itself.

  • Like 1
Link to comment

I didn't examine the diagram in depth, but your requirements and questions suggest a "quick-and-dirty data acquisition vi" will not adequately meet your needs. Personally I'd refactor into a event-based producer/consumer design. Labview includes a "Producer/Consumer Design Pattern (Events)" template that is a good starting point. (File -> New... -> From Template -> Frameworks -> Design Patterns)

The template's consumer loop is set up as a simple message handler. At first glance it sounds like a state machine in the consumer loop will fit your needs better. I posted an example of how to implement a simple event based state machine here. Skip the Entry, Exit, or Transition actions if your state machine doesn't need them.

I strongly suggest sitting down with paper and pencil and creating state diagram that defines the core behavior you're looking for. It should include:

  1. States: Uninitialized, Standby, Acquiring, Exit, Error, etc. These five states are probably sufficient for this app. Add new states if needed.
  2. Transitions: Decide which transitions are valid and draw an arrow connecting the states. For example, it doesn't make sense to transition from the Uninitialized state directly to the Acquiring state.
  3. Triggers: Triggers are actions that cause a state transition. List the triggers next to the transitions.
  4. Guard Conditions: These are conditions that much be true for a transition to take place. Guard conditions are contained in square brackets following the trigger.

Getting the state diagram right will go a long ways towards simplifying the coding part of your application. Here's a quick example state diagram based on your requirements.

post-7603-0-69839300-1307988984_thumb.pn

  • Like 1
Link to comment

Hi everyone,

I worked on my VIs and I've made good progress! Thanks to all of you.

There is one primary function of my VI that I need to work on though. As I mentioned above, I need to be able to automatically stop the VI when a certain value is reached. The thing is, this value will be different every time I run the VI. Since the signal acquired is periodic, I was wondering how it could be possible to monitor it (from the beginning of the acquisition or from the last X loops) and trigger the stop if any anomaly is detected (amplitude jumps up or becomes close to zero for exemple).

Is there anything that could analyse the signal in that sort of way or do I have to manually set multiple relative thresholds?

Thank you biggrin.gif

Link to comment

Since the signal acquired is periodic, I was wondering how it could be possible to monitor it (from the beginning of the acquisition or from the last X loops) and trigger the stop if any anomaly is detected (amplitude jumps up or becomes close to zero for exemple).

This sounds like a circular buffer for looking at the last X loops.

Is there anything that could analyse the signal in that sort of way or do I have to manually set multiple relative thresholds?

A simple RMS might be sufficient, but it's unclear what anomaly you'd be looking for.

Tim

  • Like 1
Link to comment
  • 2 weeks later...

Thanks Tim!

I used a circular buffer as you proposed along with arma prediction to monitor the process.

I'll get back to you soon!

This sounds like a circular buffer for looking at the last X loops.

A simple RMS might be sufficient, but it's unclear what anomaly you'd be looking for.

Tim

Link to comment

Hi again,

This is what happens when I run the .exe of my vi.

Can someone tell me how to remove the grey parts around the main object? and how to auto-scale (up or down) the content of the vi to fit the screen (full view with any scrolling needed)?

Look at the screenshot: What I get is on the left and what I'd like is on the right

I tried to use Auto Adjust Front Panel Bounds.vi https://decibel.ni.c...t/docs/DOC-8643 by placing it in the main vi but I don't think it works.

I use LabVIEW 2010.

Thanks for your help!

post-24916-0-82834200-1310160641_thumb.j

Link to comment

Can someone tell me how to remove the grey parts around the main object?

Hi lablc,

To set the boundaries of your front panel, go to File -> VI Properties -> Window Size and adjust the Width and Height parameters. Then, go to your front panel window (when it's not running) and shrink it as much as you can. It should not let you shrink it past the settings you entered.

...and how to auto-scale (up or down) the content of the vi to fit the screen (full view with any scrolling needed)?

From my experience, auto-scaling front panels in LabVIEW rarely produces good results. I always set the boundaries of my front panel first (in your case you would need to find the parameters that cause the panel to fit the screen for your resolution) and then I start developing the UI accordingly.

LP.

  • Like 1
Link to comment

From my experience, auto-scaling front panels in LabVIEW rarely produces good results. I always set the boundaries of my front panel first (in your case you would need to find the parameters that cause the panel to fit the screen for your resolution) and then I start developing the UI accordingly.

Agreed. It seems to only work well when the only object in the pane is a graph or chart.

  • Like 1
Link to comment

From my experience, auto-scaling front panels in LabVIEW rarely produces good results. I always set the boundaries of my front panel first (in your case you would need to find the parameters that cause the panel to fit the screen for your resolution) and then I start developing the UI accordingly.

Splitters and panes are a big help in implementing resizable interfaces. Basically you use splitters to get one control per pane, and you can control how the splitters move as the window is resized (via right-click options on the splitters). Then if your controls have the "Size Object to Fit Pane" option checked, then they will resize reasonably well. The splitters can be resized to be very thin so they don't look as goofy.

It still takes some effort to get things working well, so don't do it unless you need to.

  • Like 2
Link to comment
  • 4 weeks later...

On another note,

I have to set-up an output signal.

My acquisition device outputs 4.096V @ 15 mA and I need to control a 24V solenoid valve which draws 167mA with 144 Ω.

Note: I have a 24V source and I need to open/close this valve once in 48 hours.

Can I only use a 5V relay for this task or do I risk any damage to the acquisition device? Should I go with a transistor then?

Any input would be greatly appreciated.

Thanks a lot.

Link to comment

Any input would be greatly appreciated.

Do a google search on computer controlled relay or look at the Andurino documentation for schematics on how to do what you describe. Connecting a TTL directly to a relay would be bad.

Tim

  • Like 1
Link to comment

My acquisition device outputs 4.096V @ 15 mA and I need to control a 24V solenoid valve which draws 167mA with 144 Ω.

Note: I have a 24V source and I need to open/close this valve once in 48 hours.

Can I only use a 5V relay for this task or do I risk any damage to the acquisition device? Should I go with a transistor then?

You should be able to us a 5V input SSR. Something like this Cyrdom CN024D05.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.