09-29-2014 12:36 PM
Can anyone explain to me on which criterion one would choose an event structure over a case structure in a state machine design?
Thank you,
Christian
Solved! Go to Solution.
09-29-2014 12:45 PM
Personally, I would say that putting an event structure within of a standard state machine would be the best plan if you were to go though that sort of route. I would usually use this as a UI case in my state machine that would do certain things when I did something on the front panel. Having an event structure instead of a case structure doesn't entirely make sense either since it gets away from the whole state machine design scheme.
09-29-2014 12:50 PM
Do you mean to say that an event structure is useful only if you control a lot of inputs from the front panel? And if otherwise, I should opt for a case structure? Thanks.
09-29-2014 01:00 PM
Do you have an example of what you are looking for? Are you talking about polling instead of using an event structure?
Assuming I am understanding the problem correctly, I tend to have an "Idle" state. In this state, I put an Event Structure. If I am just waiting for a user input, then the timeout is -1 (wait forever). If I am just checking something while I go through a sequence, then I set the timeout to something else that will limit the rate of my sequence.
09-29-2014 01:09 PM - edited 09-29-2014 01:19 PM
I basically have a program with ten different states, but all the inputs are set before I start running the program. Once the program is running, none of the set up needs to be changed. Here is a first (incomplete) attempt at the program.
09-29-2014 03:32 PM
So if you are not doing any user inputs, why would you use an event structure? I think I might be seeing where your original question is going.
Each state of your state machine should be a different case of a Case Structure. If you are looking for user inputs, use an Event Structure.
10-06-2014 02:59 PM
Thank you.
Another question. I am using subvi's in my state machine that display data in graphs and charts. The program runs okay, but the graphs and charts remain empty. What could the reason be?
10-06-2014 03:42 PM
@christianwos wrote:
Another question. I am using subvi's in my state machine that display data in graphs and charts. The program runs okay, but the graphs and charts remain empty. What could the reason be?
You probably need to attach your code.
10-06-2014 07:48 PM
Looking at what you've said, it doesn't sound like you would need an event structure. An event structure is meant to act on user events. If there aren't any user events, why would you want to act on them?
In terms of how it impacts the defintion of a state machine, it doesn't hurt the architecture in any way. State machines involve a finite number of states that interact with each other based on inputs. One of the most common examples is the traffic light. A car pulling up to the red light, an event, triggers a change in states that leads to the car's light turning green. When the car leaves, an event, the light returns to red. It's VERY common for a state machine to accept user input. In fact, the device you're using to post to these forums is a state machine. It acts almost entirely based on user input.
As far as your question, it's pretty difficult to say without seeing your code. If I had to guess, you're not sending data from the subVI to the main UI. As a result, the graphs on the subVIs are being updated but nothing passes that on to the UI. As a result, it looks like nothing is being updated. If you want more meaningful help, you probably want to attach your code.
10-06-2014 08:13 PM - edited 10-06-2014 08:18 PM
Thank you so much for your thorough explanation. I will post the code as soon as I get to work tomorrow morning.