Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: State diagram, state table, etc.

  1. Jan 28, 2010 #1
    1. The problem statement, all variables and given/known data

    Hi everyone;

    I've got a problem to solve that involves three containers which should be filled with sand, each of them has a sensor attached at the same level, so if the amount of sand drops below that limit, it will be refilled. If all were empty, the refilling arm would first go to 1, then 2, and finally 3. Something like this:


    2. Relevant equations
    No equations.

    3. The attempt at a solution

    I'm not sure how many states are needed, I'm guessing at least 3 (probably 4: 1st empty, 2nd empty, 3rd empty, all full). Could anyone help me make a state table or state diagram to get things going? Also, would I be better off using a Moore or Mealy model? Anyone know of good resources dealing with similar problems? Help greatly appreciated.
  2. jcsd
  3. Jan 28, 2010 #2


    User Avatar

    Staff: Mentor

    Start with a truth table. There are 3 bins that can be empty (0) or full (1). Set up a counting on the left of the truth table -- how many lines does that give you? That tells you how many states you will have in your state diagram (well, unless you have a Reset state, but you probably won't in this problem).


  4. Jan 28, 2010 #3
    Thanks, maybe I wasn't too precise, the bins don't have to be filled in one cycle. One cycle involves refilling only one bin which narrows the amount of possible states down to 4 I guess. After refilling, the arm returns to the initial state and so on. There would have to be 4 outputs, converting to binary:

    00 - no action, stay in initial state
    01 - refill 1st
    10 - refill 2nd
    11 - refill 3rd

    Is that correct?
  5. Jan 28, 2010 #4
    How much information do you need to keep about your states? For example, one "state" can be 1 - full, 2 needs refill, 3 needs refill, filler is over bin 2. Is that a separate "state" as opposed to filler over bin 3.. what about both 2/3 needing refills, is that a separate state?
  6. Jan 28, 2010 #5
    I know what you mean, but that is not the case here. We don't have "general" states representing the signals from all the sensors at a time, each of them is treated seperately as a state. So state 1 - 1st is empty, state 2 - 2nd empty and so on.
  7. Jan 30, 2010 #6
    Is it possible that all states always reduce to one, no matter if I assume 4 or 8? Either I'm doing something wrong here or I don't know why. Can anyone help? Thanks.
  8. Jan 30, 2010 #7
    You can't reduce to one state. I don't even think it'd be considered a state machine at that point.

    Here's some pointers: You'll need to make a mealy machine, as the next state depends on the current state AND the inputs (sand level for each bin). Don't forget, you'll probably have a "get more sand" state, which will be called upon in between the filling of the containers.

    Simply draw the problem out. Start at the initial state, and branch off from there. What happens if you get a call for more sand? What if you're currently filling the first OR second container and the third one asks for sand?

    You should be able to simplify it down to 8 states; 4 seems insufficient.
  9. Jan 31, 2010 #8
    I guess the possible inputs have to be:

    [tex]\bar{X}\bar{Y}\bar{Z}[/tex] 000

    [tex]\bar{X}\bar{Y}Z[/tex] 001

    [tex]\bar{X}YZ[/tex] 011

    [tex]\bar{X}Y\bar{Z}[/tex] 010

    [tex]XY\bar{Z}[/tex] 110

    [tex]XYZ[/tex] 111

    [tex]X\bar{Y}Z[/tex] 101

    [tex]X\bar{Y}\bar{Z}[/tex] 100

    Thank you. Can't I just assume 5 states then?

    A - all full
    B - get sand
    C - 1st full (entry action: refill)
    D - 2nd full (entry action: refill)
    E - 3rd full (entry action: refill)

    Just a general sketch:


    Is that possible? In such a case the states probably won't reduce to one because of the intermediate state.

    EDIT: I suppose adding the "get sand" state requires one more output. I can't possibly have the same input/output combinations branching off to two different states. That just wouldn't make sense at all. Also some kind of output has to tell the system to take some sand first before refilling any of the containers. Whenever I start to think that I'm already there, something always pops up and makes my great theory fall into shambles...
    Last edited: Jan 31, 2010
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook