04-11-2012 09:05 AM
I am currently using labwindows cvi vs.8.1 and have been searching to see if there are such options and whether there are other possible alternatives.
At present, I have working code that is already being used in our labs. It works essentially as so: The user creates a sequence of commands that will produce voltage outputs through various lab instruments. As soon as the user runs the sequence within the graphical user interface, the entire sequence, which is a 2x2 array, is copied to the instruments' buffer and outputted as fast as possible.
We are mainly interested in implementing a conditional loop. That is, we don't necessarily want the entire array to be outputted. For example, during the middle of the output sequence, we find that we want to go back and redo part of the sequence instead of finishing the rest of it. An obvious solution would be to jump within the sequence to another position and continue from that point on. Any advice or alternatives would be highly appreciated!!
04-12-2012 04:46 AM
My first guess would be to use "Switch Case" to implement this feature. Each Command should have its own Case.
Best Regards!
Moritz M.
04-12-2012 05:17 AM - edited 04-12-2012 05:19 AM
Seems like this scenario could be well addressed with a state machine framework (I suppose this is what Moritz was referring to in his answer): in each state you decide what to execute next, whether the next state or the stop/cleanup state in case you want to end prematurely the process.
This tutorial explains this concept: although it is aimed to LabVIEW development environment, underlined concepts can be ported as-is to CVI. You will basically have a big loop with an embedded switch selector with a case for every state your machine will need. An alternative is to implement the whole paradigm inside a timer that replaces the outer loop.
04-13-2012 03:03 AM
Thank you very much for your (as well as Moritz's) timely reply! Unfortunately, I think there is some misunderstanding. We are familiar with the basics of a state machine but our problem is not with our logic, but rather with the hardware part.
This is what our picture looks like: We write our giant array to our card's small internal buffer as quickly as possible. And each index of the array is sent one by one to this small buffer. At some point during the output, (this is conditional, depending on whatever is going on in our experiment) we realize that we want to go back to an earlier point in this large array and output that to the card. We want to be able to jump or move the current write sample index, instead of continuing on outputting the remainder of the large array. I don't any idea how to do this, and whether it's possible in labwindows..
I hope this clarifies my question further, please let me know if you have further questions!
04-13-2012 03:21 AM
It is difficult to give suggestions without some details on the code and the transmission part. The way your application is realized (single- or multi-threaded; using RS232, TCP or other communications modes; timings on tests and user interaction expected) determines how to implement such feature.
Supposing this big transmission is realized within a loop that elaborates items sequentially, it is theoretically possible to add some checkings after each item is output and decide whether to go on or jump to another item depending on some condition, but this may have a notable impact on your throughput.
04-13-2012 07:08 AM
so the details are:
-multi-threaded application
-reactions are based on information sent by another independent program with communication being made via windows named pipe
-we have about 100ms total for reacting
-no user interaction, reactions are automated
thoughts??