07-17-2009 04:19 PM
I have a problem in a flat sequence structure located on a program i'm doing.
The program is based on 4 while loops that are communicated using ocurrences.
The problem is in the loop labeled "Calculo parametros salida" in the transition between the 2nd frame and the 3rd frame. The value that might be assigned to the string variable
"string" it's never assigned, and, also, the control that it would be enabled, it's never turned visible.I've tried to use highlighting function while checking in run mode, and, effectively, the "flux" stops its movement when before arriving to the 3rd frame (the 3rd frame appears grayed).
My objective is show this message and to set visible the control "go control" in order to wait for the ocurrence that will be produced by the activation of the "go control" button, that will produce the first iteration on the "Calculo parametros salida" loop and the "uninhibition" of the 2nd loop named "control".
I don't understand why occurs this situation. I've probed substituting the 3rd frame: i've deleted the 3rd frame and i used an event structure, so that event structure would be associated to a static event (value change on some of the indicators that are located on the 2nd frame) but the sequence also doesn't work.
If you have any question about my explanation (i'm not an english speaker, sorry but my bad english), please: tell me.
If you're asked for some libraries, ignore the prompts, these files are not necessary to solve my problem.
Thanks.
Óscar R.
07-17-2009 07:52 PM
Let me begin by encouraging you to rewrite this as a State Machine, perhaps a Producer/Consumer architecture with a State Machine in the consumer loop. Your program seems to be relying on things happening in a defined sequence, and that what a State Machine was designed to do. (My favorite is the JKI State Machine. It would be worth your time to learn how to use it.)
Now, briefly:
07-17-2009 08:46 PM - edited 07-17-2009 08:55 PM
Because you have an infinite while loop in your 2nd frame. There is a small loop where you do an Interpolate 1-D array. You have a False constant wired to the stop terminal. That loop never ends. Since the loop never ends, the 2nd frame never finishes. Which means the 3rd frame never starts. Highlight execution should show that code is executing in that while loop.
I'd recommend running the code cleanup tool on your VI so that the wires lose their extra kinks and the various loops become more consolidated.
07-18-2009 02:44 AM - edited 07-18-2009 02:46 AM
Ravens already touched most crucial points. Still, I was wondering what the idea is behind the following code fragment 😮
07-18-2009 05:29 AM
07-18-2009 07:01 AM
jcarmody wrote:...what a State Machine was designed to do. (My favorite is the JKI State Machine. It would be worth your time to learn how to use it.)
I think that state machine has a major disadvantage
You have to type the full state name all the time
So a typo can easily disturb the whole sequence.
I think using a type def with all state names is a much be better way to keep all the state names.
So you only have to select an existing state name without typing it.
For the rest Open G tools are perfect, I use them all the time
I won't use this state machine but keep mine
07-19-2009 04:01 PM
Alain S wrote:So a typo can easily disturb the whole sequence.
Maybe for you, but I don't use typos in my code. I can't see why anyone would...