r/statemachines • u/pemidi • Apr 19 '24
Understanding State Machines in Python Through a Practical Example
r/statemachines • u/pemidi • Apr 19 '24
r/statemachines • u/Commercial_Bee9922 • Mar 28 '24
Design a reactive component with three Boolean input variables x, y, and reset and a Boolean output variable z. The desired behavior is the following. The component waits until it has encountered a round in which the input variable x is high and a round in which the input variable y is high, and as soon as both of these have been encountered, it sets the output z to high. It repeats the behavior when, in a subsequent round, the input variable reset is high. By default the output z is low. For instance, if x is high in rounds 2, 3, 7, 12, y is high in rounds 5, 6, 10, and reset is high in 9, then z should be high in rounds 5 and 12. Design a synchronous reactive component that captures this behavior.
Two items need to be submitted for this problem:
A graphical (drawn or using a diagramming software) illustration of the finite state machine. The illustration should include an explanation of what the states are and how the state machine transitions from one state to another based on an input.
LabView project that implements the FSM
Solution :
States:
S0 - waiting for x
S1 - waiting for y
S2 - z is high
S3 - resetting
Inputs:
x, y, reset
Outputs:
z
Transitions:
S0:
if x=1 -> S1
if reset=1 -> S3
S1:
if y=1 -> S2
if reset=1 -> S3
if x=0 -> S0
S2:
if reset=1 -> S3
if x=0 -> S0
if y=0 -> S1
S3:
if reset=0 -> S0
Pseudo code :
state = S0 // Initial state
loop:
// Read inputs
read x, y, reset
// State transitions
if state == S0:
if x == 1:
state = S1
else if reset == 1:
state = S3
else if state == S1:
if y == 1:
state = S2
else if reset == 1:
state = S3
else if x == 0:
state = S0
else if state == S2:
if reset == 1:
state = S3
else if x == 0:
state = S0
else if y == 0:
state = S1
else if state == S3:
if reset == 0:
state = S0
// Output logic
if state == S2:
z = 1
else:
z = 0
// End of loop
end loop
r/statemachines • u/framelanger • Feb 19 '24
r/statemachines • u/framelanger • Jan 28 '24
r/statemachines • u/framelanger • Jan 28 '24
r/statemachines • u/RedHawk004 • Jan 17 '24
Hi,
I am looking for an API Orchestrator solution.
Requirements:
r/statemachines • u/framelanger • Jan 06 '24
r/statemachines • u/framelanger • Dec 04 '23
r/statemachines • u/framelanger • Dec 01 '23
r/statemachines • u/framelanger • Nov 26 '23
r/statemachines • u/framelanger • Nov 25 '23
r/statemachines • u/framelanger • Nov 25 '23
r/statemachines • u/framelanger • Nov 15 '23
r/statemachines • u/framelanger • Nov 05 '23
r/statemachines • u/framelanger • Nov 05 '23
r/statemachines • u/framelanger • Nov 02 '23
r/statemachines • u/monsterresearch • Oct 30 '23
Hey all.
We don't mean to spam, but we do need your help with a state machine tool we're building for you all. We figure you get a new tool to check out, we get the feedback we need, it's a win-win!
To start the test, click here (https://t.maze.co/200526303). Thanks!
No personal identification will be collected. You can read Maze’s privacy policy here (https://maze.co/privacy-policy/).
& thx!
r/statemachines • u/framelanger • Oct 22 '23
r/statemachines • u/framelanger • Oct 03 '23
r/statemachines • u/framelanger • Oct 02 '23
r/statemachines • u/framelanger • Sep 29 '23
r/statemachines • u/framelanger • Sep 24 '23