LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous generation

Hello,

Using Labview5 and traditional DAQs, I am trying to build a
  program  which can control and record three orthogonal principal stresses applied on a rectangular prismatic rock specimen (sigma1 for long axis, sigma2 and sigma3 for lateral axes) and strain in the direction parallel to sigma3 (epsilon 3).
During the loading, I want to let the program work for loading in the following process.
First, the loads applying the three principal stresses are raised simultaneously to the predetermined magnitudes. Then, while holding the sigma3 load constant, the sigma1 load is raised at a constant strain rate of epsilon3, and at same time, the sigma2 load is also raised continuously by the half magnitude of sigma1 increment so that increment of sigma1 = 2 * increment of sigma2.
To make this, the program is supposed to continuously read the current magnitude of sigma1 in voltage, calculate the increment of sigma1 after the onset of epsilon3 (and sigma1) increase in stress unit (MPa), divide it into half, convert it (in MPa) to value in voltage, sum the current voltage of sigma2 and the computed voltage increment of sigma2, and then output it to increase sigma2 in MPa to the expected magnitude.
 
The attached program which I am now working on is consisted of 4 main units. The left upper unit (within while loop) is for reading continuously all three stresses and epesilon3 in voltage through the experiment. The left lower unit within the case structure is to use the read current stress voltages, to compute the expected magnitude of sigma2, and then output the computed expected sigma2 using the continuous generation vi. The right upper unit (while loop) is only for increasing the three stresses to predetermined magnitudes at a constant rate during the first step of the loading path. The right lower unit (case structure) is for increasing sigma1 at constant rate of epsilon3 after the three stresses are reached to predetermined magnitudes, and this is in the second step of loading process.

Among these main 4 units, the three units (left upper, right upper and lower) are working right and I am sure that they are working well during an experiment in the way which I want; however, the left lower unit which is supposed to increase the sigma2 at specific rate is not working at all. It seems like that the output function (continuous generation vi) within the case structure is not sending any signal though the expected sigma2 is correctly calculated.

Therefore, my question is how I can modify the function (continuous generation vi) which is supposed to increase the sigma2 by following the sigma1 increase simultaneously.

 

Sincerely,

0 Kudos
Message 1 of 7
(3,273 Views)
 

Greetings Rock Lab,

Sounds like you have a pretty neat application!  Let me start off by saying that your version of LabVIEW is not officially supported...have you considered upgrading?  There is a significant amount of features that have been added up to our most recent launch of LabVIEW 8.2.1, including the project, shared variable, and support for DAQmx. 

That being said, however, I took a look at the code you posted and a couple things caught my eye.   First, there are several broken wires in this code...it will not even run in this state.  One of these broken wires is being fed into the AO Continuous Gen.vi that you mentioned was problematic.  This VI is looking for an input called "waveform data" with a type of "1-D array of waveform".  It looks like you are wiring a 1-D array of double into this input.  The first thing you'll want to do is fix the broken wires, and wire up a 1-D waveform array to the waveform data input of this VI. 

Hope that helps...

Regards,

Nicholas B, National Instruments

0 Kudos
Message 2 of 7
(3,240 Views)
Nicholas,

I suspect that your version of LV substituted some other VI for that generator. I am pretty sure that the waveform data type did not exist in LV 5.1. When I open his VI in LV8.20 I do not get any broken wires. The AO Continuous Gen.vi which came with my version of LV5.1 uses a 2D array of SGL for the waveform input, not the newer waveform datatype.

Lynn
Message 3 of 7
(3,233 Views)

I am a bit surprised your application actually works.

when you start the output or input application, normally DAQ cannot allow you to do the inverse operation. unless you define in advance input and output channels or you use different cards. unless you do a AI read followed AO write single point (or waveform), meaning not continuous and not timed together. but be aware that between each such operation there some time lag, and you wont be able to switch faster than few KHz.

you did a nice piece of program there, but you could improve on it by orders of magnitude, by updating your LV version. already the 6i and 6.1 are a huge leap forward.

But on this version, there are few thing you might want to try: initialisation - try to use local variables, where you can define in advance the inital value  by calling the local variable before other operations.

Sequences - make more profusion use of sequences, and in your case stacked sequence might be a good sol: in your case, you want to read, write, read, write, and in between use the info for calc what is the next write. if you do it properly i believe your question about the faulty unit will disapear by itself.

the formula node: put in the while loop will allow you to change rate online! might be usefull for you.

invisible controls: controls not to be touched can be set to be invisible, right-click on the terminal.

good luck

 

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
Message 4 of 7
(3,225 Views)
I would disagree with Gabi1 on a few points:

Sequence structures are almost never necessary and may make code more difficult to develop and maintain. Dataflow and state machines (case structure inside while loop) can do anything a sequence structure does and a lot more.

Local variables are prone to race conditions and make it difficult or impossible to follow what the program is doing. Use wires. Your code does not appear to exchange data among the loops so wires will work fine.

-----

I suggest you look up Rules to Wire By (search the Forums). These were developed by some very good LV programmers and are useful guides. Key points: use right to left wiring and dataflow. Keep diagram to the size of one screen. If it gets bigger than that, create subVIs or rethink how your program is structured.

Move the amp1..amp3 indicators outside the loop. Their values do not change inside the loop so there is no need to update them.

If loops are running in parallel as yours appear to be, each loop needs to have a delay to allow processor sharing. The upper left lop may hog the processor. Even a delay of 0 ms will force the sharing.

I cleaned up your diagram a bit and attached the result. At least one subVI was missing, so you may have to replace it. I did not create any subVIs for your program.

Lynn
Message 5 of 7
(3,218 Views)
Dear Nicholas, Lynn, and Gabi1;

First, I appreciate your rapid replies to my question. I didn't expetct to recieve so many replies.
I have been working, but I still can not get rid of the problem.

Making the question simple, I think the problem results from that in my program the continuous generation.vi in the case structure within the while loop does not start at same time as the recording of three principal stresses by the while loop begins. The continuous generation vi. is meant to start only after my pushing a blue button during while loop running.

Since the iteration terminal in the while loop is connected to the continuous generation vi., when I start the continuous generation vi. to increase sigma2 at some time after start recording (while loop), the iteration terminal, which is built in the continuous generation vi., would start from not zero (>0), and this let the vi. failed to configure the output operation.

However, to conduct a experiment in the way I want, I have to start these two operations separately, I mean I have to start the continuous generation vi. after starting the while loop. So, I am wondering is there any solution for that ?


Sincerely,
 

0 Kudos
Message 6 of 7
(3,198 Views)
Rather than using the iteration terminal, use a shift register and create your own "index." Initialize the shift register to zero (just like the Number of Scans Written to File at the top). Inside the True case connect the value to the iteration terminal of the continuous generation VI. Then increment the value and pass it to the right terminal of the shift register. Just pass it through the False case unchanged.

The value of this shift register will start at zero and remain at zero as long as the button stays false. The first time the button is pressed, the value passed to the continuous generation VI is zero. The next time it will be 1, then 2, ...

Lynn
Message 7 of 7
(3,181 Views)