From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Please: Question about Labview Programming: Designing a Tension/Compression Program -- How can I accomplish something in the program

I am making a tension/compression program for a mechanical tester.  

 

As the load increases the sample is fractured or crushed.

 

 

I have a general question about the programming of these tasks.  

 

1. How would I have the program stop running after a sample is fractured and the load drops to 0 or to the starting load on the sample?  

 

2. I want to setup a botton in which I could have the stage return to the starting position after fracture occurs.  How can I program this with Labview?

 

 

Thanks, and if anyone could add some input into this I would greatly appreciate it.

 

Jerry

 

 

0 Kudos
Message 1 of 9
(2,763 Views)

Have all of your code run in a while loop.

For the boolean controlling the loop, wire:
Stop button OR Load==0.

 

Before the while loop starts, you can initialize the stage position at (0,0).

Cory K
0 Kudos
Message 2 of 9
(2,761 Views)

Be careful, the load may not drop to zero or the starting load.  I assume you are using something like a load cell to measure the load.  They may not return all the way to zero or to the initial load, but have some residual number after the test is over.

 

You may want to monitor and keep track of the peak value continuously.  Then if the load drops to some percentage of the peak (such as 20%, you may want to make it ajustable) you can assume that you have broken the part.

0 Kudos
Message 3 of 9
(2,758 Views)

In addition to Ravens Fan's comment you need to define what happens in "crush."  It is very likely that the load will remain high, although perhaps reduced.  You may need to look at displacement or some function of both displacement and load.  For either compression or tension you could monitor displacement/load for linearity.  When it becomes significantly non-linear (you decide what is significant), then the sample has changed from elastic deformation to plastic deformation.

 

Lynn 

0 Kudos
Message 4 of 9
(2,731 Views)

Thanks everyone for your input.

More questions...

 

Cory or anyone else who can answer this, 

 

Regarding your comment about the initialization before the while loop starts. 

 

 

So right now I have a while loop around my program... 

 

1. Can I have two loops (one with the actual initialization of the program...the actual test and the other where I use the stage controls to prepare my sample before the test?

 

Or would there be an easier way (such as an event structure) ?

I want to be able to control the stage and sample setup before I hit the actual "Start" test button. 

 

 

2. Is it possible to set it up whereas when I hit the start button on the program (not the start button in the toolbar) that it will 

 

reset the start position to zero...then when I push the "return to start position" button it will return to where ever it was zeroed out? 

 

What would be the best way to approach this and set it up?

 

 

Thanks again 

 

Jerry

0 Kudos
Message 5 of 9
(2,723 Views)

JSC81-

 

1. I would suggest using a case structure.  That way one case could be for your stage controls and another for preparing your sample.

 

2. You can use an invoke node to reinitialize to default value.  To set a control default value, simply RT click » Data Operations » Make Current value default (Invoke Node » "Reinitialize to Default")

 

Will that work for you?

 
Regards,

Mike S
NI AE
0 Kudos
Message 6 of 9
(2,700 Views)

Thanks George for your advice,

 

I am relatively new to Labview, have been using it for about a month now.  Did some reading and looking at examples but still need to get comfortable with it.  

 

Here are my thoughts,

Once I initialize the program I want

 

Case 1: Use the stage controls to set the sample

 

Case 2: Choose Tension or Compression and Enter Sample Dimensions and Test Criteria (Max Strain, max distance, rate, etc)

and then Hit start which would take that current stage position and make it the (starting or default position).  This position would change every test because each sample would have different size and shape.  Would this still be okay to set to default even though this will change every time?

 

1. When is it better to use Case structure vs Event Structure?  I am having a difficult time understanding when one is prefered over the other. 

 

 

Now here is my next question. 

2. By using Case Structure, each case will be its own unique situation.  Can they both be connected to the voltage input the load cell input and the stage motor so I have continuous readings from all of them?

The DAQ will continuously output readings so once I have initialized the program can I have continuous readings from each of those inputs when using Case Structure?

 

I hope this is clear, if not let me know and I will try to clarify.  

 

Thanks much,

Jerry

0 Kudos
Message 7 of 9
(2,677 Views)

Jerry,

 

Look at the Consumer/Producer Design Patterns in File >> New...  (Not New VI!) >> VI >> From Template >> Frameworks >> Design Patterns. 

 

You will probably use both Case structures and the Event structure.  The Event structure is useful to respond to things the user does, such as pushing buttons and entering data on the front panel.  (It can do many other things as well, but this will get you started). The Case structure in a while loop forms the basis of a state machine which is a powerful and flexible architecture for handling complex programs such as you are trying to put together.

 

You may want to put the DAQ in an independent parallel loop and pass the data from it to the main processing loop via a queue or Action Engine.

 

Well,  I just answered your questions by introducing several terms which may be new to you.  Searching the LV help and here on the Forum will give you a lot of information on these topics.

 

Lynn

0 Kudos
Message 8 of 9
(2,673 Views)

Its not really one structure OR the other.

You will need a combination of several structures, placed accordingly.

 

There are many many combinations of structures, which is where computer architects get involved.

Basically, outside of all loops, you can initialize everything. For every graph, indicator, etc, just wire a constant to it.

 

For the rest, I would recommend a 'state machine' architecture.

 

One state could be 'set stage control'

This could be in an event structure where every time the user changes the input for 'position',

you would run the appropriate code.

 

Another state could be 'collect data'

This could be where you do all your DAQ and data logging.

This would probably be in a while loop, with some boolean logic connected to the 'stop' terminal.

The logic would be what the people above were suggesting.

 

Edit : darn, i posted too slow

Message Edited by Cory K on 06-19-2009 11:53 AM
Cory K
0 Kudos
Message 9 of 9
(2,671 Views)