10-07-2010 01:26 PM
Can anyone suggest any comprehensive tutorials on the master-slave framework? I found only one on the NI website, with a synchloops example, but it is not entirely helpful in explaining the stacked sequence structures and notifier operations
10-07-2010 01:33 PM
If you are refering to this article, that is not a stacked sequence structure.
The upper while loop is called a "state machine".
It will continue through "states" in a precise order.
At the end of each state, it tells the while loop what state to enter for the next iteration.
I have not been able to find a comprehensive tutorial for this architecture.
However, feel free to give it a shot, and post back if you get hung up anywhere.
There are a ton of people on the forums that can modify your code and help you along the way.
10-07-2010 01:53 PM
Thanks a lot. well, I am not entirely sure if the master-slave framework is the way to go or not...but I was advised so. Anyway, the set up of my program is as follows:
1. I have an NI-ENET 9213 thermocouple reader, and I am reading the temperature from one of its channels at a user-controlled rate, and logging the data to a measurement file.
2. I also have a boolean push button on the front panel, which allows me to control whether or not I actually want to read from the channel.
3. Everytime I turn the button back on after it was turned off, the write to measurement file should start logging to a new file (which is configured using the write to measurement VI).
The setup apparently is pretty simple, but the problem is that since I have a wait function controlling my loop for reading data, wired to the "rate of acquisition" control, therefore, if I turn the boolean button on and off during that wait time, the VI doesn't recognize the change, and so doesn't generate new files accordingly. So I was advised by an applications engineer, that I could use a master-slave architecture, where the master would control the boolean change, and notify a slave to generate the next file in the series, while another slave would acquire data at the user-controlled rate, and take in the filename in which to log the data to, from the first slave. But I am having some trouble making everything synchronize. Could someone please look at my code and help me with it? Other suggestions to implement what I just mentioned would also be welcome.
Sorry for such a massive question.
10-07-2010 01:55 PM
Hi, I send you an easy example using notifiers, based on the Master/Slave Design Pattern. Best regards,
Jorge N.
10-07-2010 02:09 PM
Thanks so much, that was pretty basic and helpful. Could you also look at my code please if you can..because i have two slave loops, and I am not sure how to synchronize them.
Thanks again.
10-07-2010 02:33 PM
Hi, please could you post your VI for 8.6 version?
Jorge N.
10-07-2010 02:38 PM
Here you go...thanks a lot for looking at it.
10-07-2010 03:48 PM
Hi,
I changed a little bit your VI according to the example I sent you earlier.
You need a Timer in your master loop to count the time between acquisitions.
Using only one slave, you could have both loops you desire: "ChannelControl" and "Time". Time loop is triggered each time you reach the time between acquisitions, and ChannelControl is triggered each time you press the Button. You'll see you have more options when you use a string as an input for the notifiers. Also, I think you'll have to add a few delays around to avoid use all the CPU memory.
I hope this helps you. Please clean the diagram, it's a little messy 😛
Best Regards,
Jorge N
10-07-2010 04:13 PM
Thanks so very much...I really appreciate all the help. Mmmm...I still had a small doubt though...why does the data not get graphed? This has been a constant trouble for me...I couldn't get the data to graph, although I am just wiring an indicator to the output the DAQmx Read VI, and displaying it ont he front panel as a waveform graph. Do you have any idea about this problem?
Thanks again for all the modifications.
10-08-2010 06:17 AM
@sharmishtha wrote:
Thanks so very much...I really appreciate all the help. Mmmm...I still had a small doubt though...why does the data not get graphed? This has been a constant trouble for me...I couldn't get the data to graph, although I am just wiring an indicator to the output the DAQmx Read VI, and displaying it ont he front panel as a waveform graph. Do you have any idea about this problem?
Thanks again for all the modifications.
The DAQmx Read returns back one value.
You are graphing correctly, but you are only graphing one point.
You want to pass in an array of that point as well as all the previous ones.
There are two ways to do this:
1) Switch your "waveform graph" to a "waveform chart".
Charts have histories, so they 'remember' the previous points and will store an array of your data that way.
2) Using your waveform graph, you need to create an array.
In your data aquisition loop, you need to use a shift register to add your current point to an array of the other points.
Please see the modified version of your VI attached.