05-21-2014 08:45 AM - edited 05-21-2014 08:46 AM
Hi, I studied on a new vi which is capable of acquisition, control, and monitoring processes simultaneously. I prepared one in which state machine structure is utilized, but in this way, some control buttons (for example, stop button) that I want them to response immediately does not response. They wait for the loop timing. I know using event structure is a way but I am confused about using it. How can I adapt event structure to my code that is attached (looking the main vi is enough). And also, I am open comments about the program developments since I am not a professional user of labview. Thanks in advance.
05-21-2014 09:22 AM
Please try not to be offended I'm going to try to be brief and give you some pointers.
On the plus side you seem to have a fair grasp of dataflow and there isn't much wrong with your understanding of what a state machine is. I won't give you too many points for "Style" though! Those bloated block diagrams really could use some work.
Look into the online training on "Producer Consumer (Events) pattern. You are correct that that would be a better framework for your users.
05-21-2014 11:57 AM
thank your advices Jeff 🙂
Actually, I use project, I just save as llb to put my codes here regarding it is better.
About documentatio, you are right. I generally do not use it because for now only I used and prepared it. I have a notebook for explainations on my own, but, I will the required explanations in the block diagrams in the future that I will be convenient.
Yes, I have doubt about daqmx tasks for input and outputs. Thank you so much. I will separate these tasks.
I just prepared it and I have not tested it with devices yet. As you said, this code seems to me bloated too, that's why I asked advices 🙂
I have different versions of this vi based on producer/consumer but they put the data in a queue. I want it to acquire and analyze immediately. And they are a little complicated for me. I have to work on these a lot.
I appreciated you. If you want to give advices later, I will be open them all. Thank you again.
05-21-2014 12:15 PM
newbieeng wrote:
I have different versions of this vi based on producer/consumer but they put the data in a queue. I want it to acquire and analyze immediately. And they are a little complicated for me. I have to work on these a lot.
Then you acquire, but the data in a queue, dequeue and analyze in your parallel loop. This will result in faster acquire and analyze than doing it serially. Trust me, I know from a lot of experience.
Producer/Consumer (just in case you haven't read the document on Producer/Consumer)
05-21-2014 12:38 PM
I have already coded one but I am not sure that it works that I desired. I attached it (A.MAIN PROGRAM_v2 is the main vi). I will try to code a new one again. Thx.
05-21-2014 12:49 PM
Its unfortunate that you do not have LabVIEW 2013 since the project templates can be very good starting points to set up some of these projects. However! the documantation is available and the developer walkthroughs can really clairify how the patterns work.
05-21-2014 12:58 PM
Your problem is that you have a data dependency between the two loops (2 wires going from producer loop to the consumer loop). You need to change your queue data type to include this data with the sample data (hint: use a cluster). That will remove the data dependency and allow the two loops to run at the same time.
05-21-2014 02:18 PM
There is two data coming from the producer loop to the consumer onw which are time and second data. I used it to record exact date and time of acquired data. I thought that if I used time function at consumer loop it does record the analysis time in order to exact time of acquired data. Do you mean that with data dependency?
05-21-2014 03:15 PM
I prepared this producer/consumer vi once upon a time but I do not remember whether it works or not. Could you take a look at that one and give me advices on it? Did I do it in the right way?