06-12-2014 11:35 AM - edited 06-12-2014 11:49 AM
A time loop does one processes at a time. While a while loop do more than one process simultaneously (depending on if machine has multiple core processor)?
Would it be possible to put a time loop inside a while loop on RT machine (specifically NI cRio-9076)? I want to do a state machine with event based timing (see attachment) or state with periodic timing (see attachment).
The state that contains the time loop will be used to acquire data. Thus it will be deterministic.
Can someone tell me if this is doable?
-Would I have to change the priority on the while loop to 100?
Thanks alot.
*Also i am using the RIO Scan Interface
06-12-2014 11:48 AM
You can, but I don't know what you are trying to gain.
How many samples are you reading in that state? How do you leave that state? What are you doing with the data? What does your state flow look like?
06-12-2014 01:15 PM
I set the scan engine to 1ms. So the time looped timing source will be set to, "Synchronize to Scan Engine." From my understanding this is the fastest the Rio scan interface can work before you have to go to FPGA programming.
ANSWER TO YOUR QUESTIONS:
The goal is to get x number of sample. Currently the number of sample is at 2000. But will definitively become smaller fixed number in the future. I am still figuring out how small the sample number can be so I can still get accurate data. The accurate data will decide if my unit under test pass or fail.
Right now, I just run the time loop until number of sample is reached. (See attachment).
I have not created the state machine yet. I wanted to see if it was possible. I will leave the state when x number of sample are reached. The data will then be analyzed to see it if pass or fail. The data will be sent to host machine so they can view it on a graph.
*****
Another concern I have is I am only reading one channel now. But in the future, depending on setup, I could be reading anyway from 8 to 20 channels at the same time.
06-12-2014 01:36 PM
Personally, I would just have a separate loop just for reading from the FPGA. You can configure that one to match the scan engine. This way you can constantly read the data on the Windows machine even when you are not running a test. I would use a queue to store the data to be sent over to the analysis/sate machine loop. Probably use a global variable to conditionally enqueue the data. Then in your state machine, you just check how many elements are in the queue. Once you have enough, tell the acquisition to stop sending you data and flush the queue data.
06-12-2014 01:58 PM - edited 06-12-2014 02:02 PM
Crossrulz,
I just started using controller couple weeks ago. I am not sure on the best architect to use yet.
I only want to acquire data (from module 1) when a new unit under test is place on the line. And I turn off digital output line to zero (module 2).
If I do it your way, wouldn’t I acquire data when there is nothing there? How would i know for sure it acquiring at the right time? Can you send me screen shot of VI templete you are thinking of ?
06-12-2014 02:14 PM
I just threw this together really quick to get the idea across. It is far from a good example.
06-12-2014 02:31 PM
Crossrulz,
Thanks!!! It help me see what you doing better.. Appererciate it.
and I got few more questions.
DAQmx functions are not allowed in the real time environment. But I think I could reply it will shared variable or something.
Since I am letting a deterministic loop (time loop) wait on non deterministic loop (while loop) wouldn’t that allow for jitter? Which in turn, will make the scan data inaccurate?
06-12-2014 06:09 PM
LIke I said, I threw it together really quick. I just used to DAQmx Read to be some sort of read operation. You will use the scan engine node instead.
The deterministic loop is not waiting for data from the undeterministic loop. Just reading a variable is not going to add jitter, at least not any more than the timed loop will account for.
06-13-2014 01:22 PM - edited 06-13-2014 01:26 PM
Crossrulz,
Thanks alot. Guess I am still a little confuse with what can go in deterministic loop and what cannot. I thought I should alway avoid share resources in deterministic loop.
I am out of the office for the next couple days. But I cannot wait to try it.
Thanks allot... I really appreciate it.