Three state diagram.

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
You still have nodes with two output paths... Review your diagram and correct ALL the errors!
What do you think about below state diagram?

IMG_20200823_181601.jpg

Advance version

Task list

1) Monitor for fire
2) Monitor for room temperature range
3) Monitor for object detection
4) Start motor , wait, stop motor

Ideal state: Motor start for 1000ms and Motor stop for 1000 ms. repeat process

Event : When proximity sensor is high, stop motor

Event : When fire sensor detects fire , stop motor

Event : When room temperature is high than set temperature, stop motor

IMG_20200823_190732.jpg

@Papabravo
 
Last edited:

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
Are you talking about the first image, yes it is my fault that I have connected the arrow in the wrong direction. If you look at the second image, you will not see this mistake.

IMG_20200823_193316.jpg
 

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
No, I was talking about the second image. This one... And the mistake is still there.
I am sorry but I don't see any logical error.
I am checking current and next condition at every node

Do you mean it should be look like below?

IMG_20200823_202950.jpg
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087

JohnInTX

Joined Jun 26, 2012
4,787
I think what the others are trying to get you to understand is that you are showing a fundamental misunderstanding of state machine logic and what each state should represent. Take a look at your sketch in #31. The left hand state is MOTOR OFF. Fine. But the conditions to enter a state and the conditions to stay in that state must be the same. There can be one and ONLY one set of conditions true for each state (ignoring Moore and Mealy distinctions).

Look at that MOTOR OFF state. On the top of the diagram, you have an edge that takes you from MOTOR ON to MOTOR OFF when the sensor IS active BUT you want to stay in the MOTOR OFF state while the sensor is NOT active. According to that logic the sensor must be active AND inactive at the same time. That is not possible so your logic is faulty.

Things to keep in mind:
  • Each state represents one and ONLY one condition that the system can be in.
  • For a state diagram to be logically correct, each state can represent one and ONLY one set of actions to do and one and ONLY one set of conditions that cause it to wait in that state.
  • The actions that the state performs are listed inside the state circle.
  • The conditions that cause the system to stay in the state are itemized in the circular arrow that points back to the state circle.
  • When ANY of those conditions change, you leave the state via an edge (labeled arrow) to some other state. That edge is labeled with the condition that caused the transition. There should be a 1:1 correspondence between the number of conditions that keep the system in a state and the number of edges leaving the state.
  • Likewise, each arrow into a state represents some condition change from another state and is labeled as such. There are exceptions but a rule of thumb is that there is usually a 1:1 correspondence between the entry conditions to a state and the conditions listed in the circular 'while' arrow of the new state.
MotorStatesEXAMPLE.JPG
With that in mind, I would offer that the states of your system are not just MOTOR OFF and MOTOR ON because of the extra sensors and actions the new conditions that they cause i.e. a fault or alert condition that is independent of the motor. Yes, you want to do something with the motor when these go active but the state of the SYSTEM is no longer MOTOR OFF or MOTOR ON, it is FAULT.

One approach would be to have 3 states (at least):
  • If no faults, MOTOR OFF for some time then MOTOR ON
  • If no faults, MOTOR ON for some time then MOTOR OFF
  • If ANY faults, exit either of these states and go to a third FAULT state. That state turns the motor off as an action but that action is unrelated to the timed MOTOR OFF.
MotorStatesCONTROL.JPG

Hope that helps a bit.
Good luck!
 

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
View attachment 215535

Hope that helps a bit.
Good luck!
Thank you JohnInTX, I see a few similarities in your last diagram and my diagram in post#1. There is no doubt, Your diagram far better than my diagram. your diagram is very neat and clean. I appreciate you and all the members for help

My main question is that I want to create process state diagram for a real project. I want to learn how process state diagrams can be creates for a real project.

I searched on the internet. I looked at many places the description is only for States. I have not found any real example with states. I understand what are the states in theoretically and i understand what happens in each state's But when I want to apply understanding in real word I do not understand how to do

Papabravo shown me my problem that I am comparing two different things together.

My problem is that I am not able to choose a real example for myself that will help me understand a process state diagram. By the way I took some examples like led and , motor but as many suggested my examples are not suitable

I know that I do not have a well-defined problem statement to understand process state diagram.

If I have a well-defined problem or exercise, then I can concentrate on solving it. Could you help me in making a problem statement which will help me later in understanding the state process diagram? I am asking you because I tried my best, and gave two examples but as other suggested we need better example

Edit: This is not a school assignment Any kind of charts help to solve the problem, so I want to learn this as a learning exercise.
 
Last edited:

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
Try deriving a problem statement from my notes and the MOTOR CONTROL diagram above.
I have below idea in my head

Exercise : Complete each tasks as per their priorities

Task list

1) Monitor for fire- Priority 1
2) Monitor for fault- Priority 2
3) Start motor , wait, stop motor - Priority 3
4) Monitor for room temperature range- Priority 4

Ideal state: Motor start for 1000ms and Motor stop for 1000 ms. repeat process

Event : When fire sensor detects fire in room , Stop motor

Event : When proximity sensor detects any objects, stop motor

Event : When room temperature is high than set temperature, stop motor
 
Last edited:

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
Try deriving a problem statement from my notes and the MOTOR CONTROL diagram above.
It seems to me that to understand a process state diagram, I have to understand pre-emptive multitasking. I have read a few pages that have great information but the problem is that it only explained about multi tasking but there is no reference example given in links

https://en.m.wikipedia.org/wiki/Preemption_(computing)

https://en.m.wikipedia.org/wiki/Computer_multitasking

https://www.wikiwand.com/en/Preemption_(computing)

Preemptive multitasking for following tasks and events

Task list

1) Monitor for fire
2) Monitor for fault
3) Start motor , wait, stop motor
4) Monitor for room temperature rang

Ideal state: Motor start for 1000ms and Motor stop for 1000 ms. repeat process

Event : When fire sensor detects fire in room , Stop motor

Event : When proximity sensor detects any objects, stop motor

Event : When room temperature is high than set temperature, stop motor

Timer interrupt become too important to understand Premapatiwe multitasking. I have to set the time out for each tasks. When the time period will over task will switch

I have question , We have four tasks, how do we decide how much time out to set for which task?

We have to set the timeout of 1000 milli seconds for motor, but for the fire detection, temperature and faults detection, how much time out should be set?

Edit Right now it's only learning exersie, so I don't know the response time of particular device.
 
Last edited:

JohnInTX

Joined Jun 26, 2012
4,787
It seems to me that to understand a process state diagram, I have to understand pre-emptive multitasking.
No, you don't.
A state machine is simply one way to express and implement a set of logical processes. State machines are frequently used to implement multitasking but they are two separate things entirely. State machines can be implemented in hardware and non-multitasking software solutions too.
 

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
No, you don't.
A state machine is simply one way to express and implement a set of logical processes. State machines are frequently used to implement multitasking but they are two separate things entirely. State machines can be implemented in hardware and non-multitasking software solutions too.
OK, I've gone through some pre Preemptive multitasking pages as mentioned in previous post.

Suppose I have to complete all four tasks through Preemptive multitasking, then How to decide time out for each task. How much time should be allow for each task to run
 

JohnInTX

Joined Jun 26, 2012
4,787
OK, I've gone through some pre Preemptive multitasking pages as mentioned in previous post.
Suppose I have to complete all four tasks through Preemptive multitasking, then How to decide time out for each task. How much time should be allow for each task to run
No. You need to demonstrate that you can understand and express a process using a state diagram and/or flow chart before going off on yet another tangent. You haven't done that. In #35, I identified problems with your logic and showed one solution. In #38, you amplified your original system to include fault priorities. Great! But you haven't shown that you can put it all together and now you want to change the topic to something that is wholly unrelated.

You don't need to understand the details of preemptive multitasking to learn how to draw a simple state diagram.

Take the information in #35 and your logic description adding extra inputs in #38 and draw the state diagram. Until you can do that, you are wasting your time. Sorry to be blunt but that's pretty much the reality.

Good luck!
 

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
Take the information in #35 and your logic description adding extra inputs in #38 and draw the state diagram. Until you can do that, you are wasting your time. Sorry to be blunt but that's pretty much the reality.

Good luck!
I have already created a one state diagram
IMG_20200825_222619.jpg

I hope this describe the behavior of the system
 
Last edited:
Top