State Diagramm Sketch

Hello Guys again I am now trying another task and wanted to ask you if my state DIagram is correct?
A Venetian blind should be controlled with two push-buttons. If you press the up-button,
so the blind goes up. If the up button is pressed, the shutter is pressed
At the top, a beep will sound as a warning. When booting the up button
pressed again, the blind stops. If you press the down button,
so the blind changes direction and goes down. If the blind reaches the upper one
Endpoint, an up-button event will be sent.
The down button works with reverse logic and allows you to shut down
the jalouise.
Design a state diagram in UML notation, label the transitions
exactly according to the following scheme, entry / do or exit actions are not considered (!).
Event [condition] / action
Use only the following events, conditions and actions. Lead
Conditions only when they are really needed. Define only necessary states
to keep the implementation effort low.
Events: evHoch (the up-button was pressed)
evRunter (the down button was pressed)
Conditions: [above] (the blind is at the top)
[below] (the blind is at the bottom)
Actions: start up () (the blind is starting up)
shut down () (the blind is starting to move down)
stop () (the blind stops at the current position)
beep () (the blind will beep)

https://www.pic-upload.de/view-35494998/Bildschirmfoto2018-06-17um18.56.26.png.html
Some Ideas Guys ? Or is everything correct?
Is my Diagramm correct ?
Or does somebody see mistakes ?
You really need to think some more about your states. "Current Position" is not really a state. The reference to current position in your problem description describes what happens when you are moving and you perform a stop, so it's really more of an action / next state.

I don't want to do your homework for you, so I'll just say that I see 5 states in your system. The big-picture states for the Venetian blinds in your system are "moving" and "stopped". However, within those 2 conceptual states, there are additional flavors of the states (e.g. where are the blinds stopped?)

Once you list the all of the states of your system, figuring out the actions and next states associated with each event will be pretty easy.

Figure out what your states will be and post a list. When you understand what the states are, the rest will be much easier.



I think that I should erase current Position ?

But my other states are correct or not?

I am not sure ,if I should add another state ?
Its not my homework I am learning for my test
But my other states are correct or not?


Forget your diagram for a minute. Don't worry about what you have already done. Think about all of the possible states the the blinds can be in. At any moment in time, what can the blinds be doing?

By the way, I see in the problem description a "Conditions" field with values "above" and "below". In my mind, these should be part of the system's state, but that's not how the problem is worded. In this case, the system probably only has 3 states. (And only 1 state in your diagram matches one of these states.)

So do the following:

1. List the states that the Venetian blind can be in. Post your list here and I'll check it.
2. You have a complete list of (i) events [2 events], (ii) conditions [2 conditions listed, <nil> also seems appropriate], and (iii) actions [4 listed]. For each state, draw an arrow for each event (multiple if the condition matters) leaving the state, listing its actions and terminating in its next state.

Please don't jump to posting a new diagram. Programming is a discipline in which larger problems must be broken down into smaller ones. If you don't get a firm understanding of what the states in your system are, your transitions will be meaningless. For instance, your current diagram has conditions of upButtonPressed and downButtonPressed on the transitions, but those aren't conditions--they are events. The valid conditions are "above" and "below". Once you figure out what the states are, you can see how those conditions can be used in the transitions.


The states are complete up ,complete down and Stop.

I dont really know , if I need another state or which one?
The blinds can be moving or stopped. When moving, the blinds can either be moving up or moving down. When stopped, the blinds can be stopped at the top, stopped at the bottom, or stopped arbitrarily in the middle. Those are the original 5 states that I came up with.

However, the problem statement mentions 2 conditions: "above" and "below". These conditions allow the events to distinguish between the user pushing the button or the event being generated automatically when the top or bottom is reached.

So, based on that information, there is nothing distinguishing stopped at the top or bottom from stopped in the middle. So, the 3 states you list are actually the same state.

The states that I see are "Moving Up", "Moving Down" and "Stopped".

Now figure out what transitions come from each state. Consider all input and conditions at every state. For instance (not a complete list):
- When are the conditions "above" and "below" used? How are they injected into the state machine?
- If you are stopped and you get upButton pushed, what do you do? Does it matter what the conditition is?
- If you are moving up, what happens if you get a down button pushed? How about an up button pushed? Does it matter what the condition is?



When are the conditions "above" and "below" used? How are they injected into the state machine?
When I press the button up and button below.
- If you are stopped and you get upButton pushed, what do you do? Does it matter what the conditition is?
I think it goes up again when it stops and you press a Button
- If you are moving up, what happens if you get a down button pushed? How about an up button pushed? Does it matter what the condition is?

Its not written in the text.
The states are complete up ,complete down and Stop... right ?
The states are complete up ,complete down and Stop... right ?


Already answered in my previous post:
The states that I see are "Moving Up", "Moving Down" and "Stopped".

So, NO! Not complete up, complete down and stop.

Did you even read my post where I went through all that?

In the previous post I went through a fairly long discussion of how I got to the 3 states (moving up, moving down and stopped).

Think of it this way. You have some blinds that are stopped. You push the up button. What state are the blinds in now? Are they stopped? No. Are they complete down? No. Are they complete up? No. They are moving, specifially, moving up. That is their state. And if you press the up button again, they stop. Your states need to capture what the blinds are doing between inputs.

Just to better understand how the states and inputs work, consider blinds that are infinitely long in both directions (there is no stopping point at the top or bottom). Your state diagram would look like this (ignoring the output actions for now).


State          Input         Next State
--------------------------------------------
Stopped        up button     Moving Up
Stopped        down button   Moving Down 
Moving Up      up button     Stopped
Moving Up      down button   Moving Down
Moving Down    up button     Moving Up
Moving Down    down button   Stopped

That's how you need to look at the states in your state machine.



When are the conditions "above" and "below" used? How are they injected into the state machine?
When I press the button up and button below.

No. That's not what your problems description says.
Conditions: [above] (the blind is at the top)
[below] (the blind is at the bottom)

You pushing the buttons has no affect on the condition. The condition is generated when the blinds hit the top or bottom. You pushing the button causes them to move. They hit the top or bottom subsequent to your input.

Also from your problem description:
If the blind reaches the upper one
Endpoint, an up-button event will be sent.

So, the blinds will generate an up-button event internally (without you having to actually push the button) when the blinds reach the top. This is where the condition comes in. You will receive an up-button event with an "above" condition when the blinds reach the top.
Is my sketch now correct ?

No.

It's like you glance at my responses but don't try to understand them. Is there something I wrote that confuses you? Is there a language barrier perhaps? If you don't understand something, ask a follow up question. Don't just ignore what I wrote and do whatever you want.

- I gave you a list of 3 states (twice). You only have 2 in your diagram.

- I mentioned that the blinds would be moving, and then clarified that they would be moving up. You seemed to have stopped reading half way through the sentence.

- I gave you a state transition table for the whole thing except for hitting the top and bottom. [Hint--draw this out first and then add the "at the top" and "at the bottom" transitions to it.]

- I showed you that the problem description listed the 2 conditions you are supposed to use. You are using events (up button pressed, down button pressed) as conditions, but you are not using the conditions you were given in the problem description (above, below).

There is nothing more I can tell you that I haven't already told you. Except for giving you the answer (which I almost have with the state transition table), there's nothing else to write.

Read the problem description and understand it.

All of your transitions should be of the form Event [condition] / action. There are 2 given events and 2 given conditions (and "no condition" is also valid). You do seem to understand that upButtonPushed and downButtonPushed are the only 2 valid events. You don't seem to grasp that "above" or "below" are the only conditions that are allowed in the problem.

So, I have written as much as I will. Reread my previous posts. If you have specific questions I'll do my best to answer them, but I'm not going to comment on hastily-thrown-together diagrams any more.
Ok I ask you before I make a wrong sketch.

move and stop I have .
Which is the third State ?
Is the third state moving up?
You asked a specific question, so I will answer it.

move and stop I have .


No. "Move" is not one of the states.


Which is the third State ?
Is the third state moving up?


I've already listed the states 3 times. I'm not going to do it again.
Ah now I see it . I wrote complete down and so on .... That was wrong .
I will try again and then post again
Last edited on
Doug still there ?
Doug still there ?

Well, I generally don't respond on weekends. Too much to do with my family.


Now better ?

Well, you got your states correct. And you are using the correct events (evUp and evDown).

You still haven't read and understood the discussion about conditions.

All of your transitions should be of the form Event [condition] / action. ... You don't seem to grasp that "above" or "below" are the only conditions that are allowed in the problem.


Conditions of [downButton, upButt], [downButton, downBut], [upButton, upButton], etc. are wrong. The only words allowed inside the square brackets are [above] and [below]. Anything else is incorrect. Those are the allowed conditions.

A single transition should only have 1 event/condition/action on it. However, assuming that you meant for the outer arrows to each reflect 2 separate transitions, you made a mistake. If you are in the "Moving down" state and receive a "evDown" event, why would you ever transition to the "Moving Up" state? Same with receiving evUp in the Moving Up state.

Based on all of this, I feel you still don't quite grasp how state machines work.

Slow down. Draw the state diagram for the state transition table that I gave you last week. (3 states, 6 transitions, no conditions). Add the output actions. Remember, this state transition table assumes there is no top or bottom limit, so it will never hit the top or bottom. The beep is only generated when the blinds hit the top or bottom, so IN THIS EXAMPLE, you will not call beep(). Also, I will repeat that there are NO CONDITIONS in this simplified state machine, so you should not have [condition] on any of your transitions in your diagram for this simplified state machine.

If you don't understand how this simplified state machine operates, you won't understand how to add the top and bottom limits to it.

When you upload your simplified diagram, answer the following question: "Do you understand why each state/input combination leads to the associated output and subsequent new state?" If you don't understand a particular transition, tell me your concern, and we can see if we can explain it.

If you provide the simplified state diagram, I will help you understand how the top and bottom limits apply. If you give me another rehash of your guesses at a full state machine that has random conditions on the transitions, I won't bother responding any more. So, 3 states, 2 events, 6 transitions, no conditions, and output actions for the transitions. That's all--nothing else.
Topic archived. No new replies allowed.