07-30-2010 10:08 AM
Dear,
I am working on a test stand that will be used for fatigue tests for a suspension, chassis etc. De vehicle components will be charged by hydraulic cylinders. These hydraulic cylinders are controlled by an AO and DO module (NI9263 & NI9401). Feedback is given by load cells. These load cells are connected with AI module (NI9201).
When a cylinder reaches a certain force (certain amplitude load cell NI9201) the cylinders stops pulling and will make an outward movement. This signal is 0 when outgoing and 1 when certain force is reached. A green led starts to burn (signal is 1) when the force is reached. When the force is zero (close to zero) another signal is sent out. Another green led starts to burn. Now I want the cylinder to make an outgoing movement until the force is zero (close to zero).
The problem is that when the cylinder makes an outgoing movement and as soon the force is a little under the maximum force (signal green led is 0) the cylinder will immediately go back in. I want the cylinder to wait until the force is zero (signal is true for green led negative peak) and then go back in. I have tried to make several case structures but I didn't manage to make it work. Can you help me?
Kind regards,
Michael Tielemans
PS: see attached VI
Solved! Go to Solution.
08-02-2010 07:56 AM
Well you have gotten to where you are going to need a more complex programming style. I would look at the produce consumer arcetechure and state machine examples. You also need to get rid of the DAQ assistances and learn how to really program LabVIEW. You are going to start hitting wall with what you are currently trying.
08-02-2010 10:08 AM
Tell me about it. I was afraid I had to change everything. The problem is that I have little experience with LabVIEW. I'm just a rookie. Can you give me an example how to begin cleaning this ''mess'' up?
Regards,
Michael Tielemans
08-02-2010 03:12 PM
@T_Mike wrote:
Tell me about it. I was afraid I had to change everything. The problem is that I have little experience with LabVIEW. I'm just a rookie. Can you give me an example how to begin cleaning this ''mess'' up?
Regards,
Michael Tielemans
Take a look at the examples that ship with LabVIEW. If you look up Producer Comsumer you should see the examples there. Try to put something together and I will help from there. You need to at least try to do something. I will be happy to help once you have put a little effort into the change. I have a full time job and try to get on here as much as possible but I do not have the time at this moment to try and send code for you to look at.
Here is a thread where I helped someone put together something like this. Take a look at the evolution of the code and start with that.
http://forums.ni.com/t5/LabVIEW/There-must-be-a-better-way-of-doing-this/td-p/1165913
08-02-2010 03:33 PM
It would also help if you translated all the labels to English. Put comments inside your code to explain what you are doing. Also, put a delay, Wait(ms), inside the loop to avoid using 100% CPU time.
If you explain what the code does, we could suggest improvements.
08-03-2010 01:31 AM
Thanks guys,
I'm going to work right away.
Regards,
Michael
08-04-2010 03:41 AM
Guys,
I have cleaned up my VI, but I'm still struggling with rewriting the old VI. I'm trying to put the old VI into a producer/consumer design pattern (events), but I really don't know where to start. You said I have to get rid of the DAQ Assistants, but with what do I have to replace them?
aeastet: I also studied ''There must be a better way of doing this''. The signals of the load cells are the producer and the Analog Out & Digital Out signals to the valves of the hydraulic cylinders are the consumer. Do I have to write the signals of the load cells to an array? The data of the load cells also needs to be written to an Excel file and when a certain peak is reached a digital signal must be send out to the valves. I really need a little push in the right direction.
Regards,
Michael
08-04-2010 06:43 AM
aeastet: I also studied ''There must be a better way of doing this''. The signals of the load cells are the producer and the Analog Out & Digital Out signals to the valves of the hydraulic cylinders are the consumer. Do I have to write the signals of the load cells to an array? The data of the load cells also needs to be written to an Excel file and when a certain peak is reached a digital signal must be send out to the valves. I really need a little push in the right direction.
Regards,
Michael
You do not have to write these values to an array. It really depends on what you are looking to do with your data. You could also put the data into a graph, and event, a shift register (you will need to be careful with this option) and a queue just to name a few ways that you can handle the data.
I will try and take a look at your code a little later today and see what I can do to help.
08-04-2010 07:03 AM
The data of the load cells is used for controlling the valves of the hydraulic cylinders. A positive or negative peak in the data (this corresponds with an analog amplitude of the load cells) must prevend the cylinders of destroying certain components. With this data the cylinders will make either a starting or an outgoing motion (pull or push load). The data of the load cells also has to be written to an Excel file so that I can see what happened at what force.
Regards,
Michael
08-04-2010 08:50 AM
aeastet: I also had contact with a Dutch applications engineer from NI. He said that a producer/consumer pattern is not at it's place, because this pattern is commonly used for high speed data acquisition. My application is used for measuring certain values (forces) and sending out signals (analog and digital). He suggested to use a state machine pattern (I believe you mentioned that too). I'm going to determine the most important hardware inputs and outputs and front panel inputs. Then I'm going to 'build' my states:
initial state (determine parameters: cycles, force, delay)
open state (cylinder makes an outward movement)
close state (cylinder makes a pulling movement)
I will keep you up to date of the progress.
Regards,
Michael