LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating two timing loops for different excel logging


@Nemord wrote:

I have had trouble submitting the VI before but I will attach it below and please let me know if you can open it.


Thank you.  I apologize for "yelling" about the PNG -- I didn't recognize it as a Snippet (which usually has the LabVIEW Version in the upper right corner, missing here).  As it happens, I've been unable to safely install LabVIEW 2017 on my work and home PCs, but have managed to put it on a Test system that I can "borrow" using Remote Desktop, so I've been able to open your VI.

 

Here's what I think -- You need to Re-Design this Project with the idea of "Write (Some) Documentation First".  I'll get you started:

  • You want to collect data from (it's unclear to me from what -- two accelerometers simultaneously, two separate devices acquired semi-independently, unclear).
  • The DAQ parameters are:
    • N Channels (how many?)
    • Voltage Range (does this need to be a variable, or is it a Constant?)
    • Samples/Channel (again, fixed or variable?)
    • Sampling Rate (again, fixed or variable?)
  • As the data come in (as "chunks" whose size and rate of appearance are governed by the DAQ Parameters), we want to Process (describe briefly what you want to do).
    • Are there Data-Driven choices to be made (i.e. "Start saving data when I push a button", or "Save Data once a threshold value has been exceeded")?
    • Are there Parameters for doing the Processing?  Are they fixed or variable?  If variable, is it "legal" to change them mid-way through the Program?
  • Think about what Controls you must have on the Front Panel.  Resist the temptation to "let the user vary anything and everything" -- K.I.S.S. (Keep It Simply, Schor).  Think about the Boolean Controls you want.

I'm not sure I understand what your real needs are, as I don't have the answers to the questions I raised (above).  But what I think you'll need to develop is a multi-looped Parallel Processing system (not that difficult to do with LabVIEW) that has the following sub-sections:

  • User Interface Control.  This might be modelled as an Event-Driven Producer/Consumer Design, or a Queued Message Handler.
  • A QMH (driven by the Consumer of the UI Section) to manage Test Station 1 (starting, stopping, signalling, Parameter-setting).
  • A QMH to manage Test Station 2 (assuming they are independent).
  • The DAQ Acquisition (the DAQmx Read function) should immediately put its data on a Producer Queue and send it to another (Parallel) Loop for processing.

Notice we've got six parallel loops running -- a P/C (or QMH) pair for the UI, a pair for Station 1, and a pair for Station 2.

 

Now you need to learn how to "Encapsulate Function" and create lots (like at least 20-30) sub-VIs so that you can "hide the details" and have your Top-Level Code consist of little more than Structures (Loops, Case Statements), Queues (to tie loops together), Shift Registers (to hold variables needed for Loop "knowledge") and sub-VIs (that you write that "do the work").

 

Writing a sub-VI that has Error In, Error Out, up to 3 other inputs and up to 3 outputs (you can have more, but strive to K.I.S.S.) is much simpler, because you are taking known inputs, "doing something simple", and getting a (simple) output.

 

Whew!  A lot to digest, right?

 

Bob Schor 

Message 11 of 13
(338 Views)

Definitely a bit to digest but I'm sure will be very helpful to creating a better functioning VI. I wanted to try and answer some of the bullet points made while submitting a second VI of the two test stand VI. 

  •  I want to collect data from two accelerometers and input and output torque sensors located on the two test stands. Total of six data devices to be read by the Pxie 6363.
  • The DAQ parameters should be six channels.  The voltage Range should be 10V max -10V min. The Sampling for multiple channels on a 6363 is about 1Ms/s to be shared between 6 channels which 10 KHz per channel should fall far below. The sampling rate should be greater than twice the nyquist criterion for the accelerometers more research is needed to verify.
  • The data coming in from the accelerometers are briefly processed to take out the DC component the signal is riding on. It than passes through two filters to take out the 60 Hz AC component and a smoothing signal to smooth noise components. The torque sensors will need to be processed through a low-pass filter at 1 hz to see a DC component that relates to a mv/v conversion to Nm. I currently have the accelerometers saving data every 30 minutes because a test can take up to 48 hours of continuous running and a faster data log might be cumbersome in the long run. A trigger is set looking at the accelerometers data continuously to shut off the motor if a gear being tested breaks or has a vibration signature that sets off the controlled trigger level. should not be legal to change parameters midway through testing. 
  • Definitely wanting to simplify the front panel for end user control but I am not near that level yet. I will be thinking more on how to keep it simplified.
  • Right now the program is being handled by a simplified state machine at least for the motors. I will look into the pros and cons of both QMH or PC design. curently going through the nugget on encapsulation thank you for the info.

I haven't been able to digest everything just yet haha I am sure that will take a little while. What I have done is split my giant case structure into two to see if I could run one stand independently and start the next stand later on. The first portion works but as soon as the second case statement is true I lose both signals. I'm pretty sure it is a rookie mistake but I'm in the process of trying to figure out how to create less. Any way my VI with two cases is attached below. It is still large to look at until I break down portion into Sub VI's.

0 Kudos
Message 12 of 13
(329 Views)

Okay I have done a bit more experimenting and came up with a terrible fix... hopefully find out a better solution with help or just more research and looking at examples. Anyway I decided to use one daqmx create virtual channel, daqmx sample timer, and than created two daqmx reads set for analog 1D waveform Nchan Nsamp. Using a signal spliter I split the first daqmx read and leave the other signal split empty... than go to my other daqmx read and do the same. The daqmx read's are located in two seperate case structures like before but now no interference when I start the second test stand. 

0 Kudos
Message 13 of 13
(315 Views)