Presentation is loading. Please wait.

Presentation is loading. Please wait.

Evaluation in Engineering Design Process Modeling and FSM

Similar presentations


Presentation on theme: "Evaluation in Engineering Design Process Modeling and FSM"— Presentation transcript:

1 Evaluation in Engineering Design Process Modeling and FSM
Yinong Chen 11/10/2018

2 The Engineering Design Process
Define Problem and requirement Research Define Alternative solutions Modeling Analysis Simulation Prototyping Final Selection Implementation and testing

3 Roadmap: Modeling and FSM
1 Engineering Models Finite State Machine (FSM) Mode 2 3 FSM Application: Vending Machine 4 Different Maze Navigation Algorithms in FSM 11/10/2018

4 Mathematical Models for Engineering
Mathematical Models: Based on logical and quantitative relationships among model components. Deterministic Models: Predictable behavior, always give the same answer each time we run the model. Graph Model Truth table for ALU design Finite State Machine for circuit design and software design Stochastic Models: Element of chance built into model different unpredictable answer each time we run the model Coin flipping experiment Monte Carlo Model Reliability model of computer hardware and software 11/10/2018

5 Deterministic Model: Finite State Machine (FSM)
A truth table specifies the input – output relations of a system, but it does not have states (memory); Many systems need to have states, so that they can complete the computation in a number of steps. A FSM has a finite number of states and transitions between those states: Transitions occur because of inputs Output can be given in any state

6 Model For a Stateless Vending Machine
For a given input, it gives an output immediately Parameters: coins and products Range of values for each parameter: Coins: 1, 5, 10, 25 Products : sicker, candy, pencil, and marker Constraints/Relationships/Solution: Coins Penny (1) Nickel (5) Dime (10) Quarter Products Sicker candy pencil marker 11/10/2018

7 A Stateless Vending Machine
VPL Implementation: No variable is used 11/10/2018

8 Why does a coin-operated washing machine take all coins at the same time?
11/10/2018

9 A four-way intersection has red/green traffic lights that are
controlled with timers. Traffic can only move in one direction at a time: NS or EW. W E S

10 A four-way intersection has red/green traffic lights that are
controlled with timers. Traffic can only move in one direction at a time: NS or EW. W E S traffic light controller block diagram

11 A four-way intersection has
red/green traffic lights that are controlled with timers. Traffic can only move in one direction at a time: NS or EW. W E S timer expired EW green NS red EW red NS green We can show this graphically with a state diagram. timer expired

12 timer expired or emergency signal
A Finite-State Machine (FSM) is a model of the discrete dynamics of a system that has a finite number of discrete states. Transitions between states are caused by events, such as: - the expiration of a timer - a change in a sensor state diagram EW green NS red EW red NS green timer expired or emergency signal state table current state event next state EW grn/NS rd timer exp EW rd/NS grn

13 The Traffic Lights by Canary Wharf Tower, East London
11/10/2018

14 Finite-State Machines are often used to design
control systems... When button pressed: If state==open then close Else open Open Close

15 Finite-State Machines are often used to design
control systems... A garage door opening system If the door is closed and I press the button (touch sensor), the door begins to move up. When it reaches the top, the door activates a limit switch (touch sensor) and stops. If the door is open and I press the button, the door begins to move down. When it reaches the bottom, the door activates another limit switch and stops.

16 Finite-State Machines are often used to design control systems...
A garage door opening system block diagram button garage door controller motor door limit switch ...we want to design the controller...

17 Finite-State Machines are often used to design control systems...
A garage door opening system states - door closed - door open - door closing - door opening events - button press - limit switch touched (closing finished or opening finished)

18 Finite-State Machines are often used to design
control systems... button pressed door closed door opening stopped button pressed limit tripped limit tripped door closing door open button pressed

19 Finite-State Machines are often used to design
control systems... button pressed button pressed door closed door opening opening stopped button pressed limit tripped limit tripped button pressed closing stopped door closing door open button pressed button pressed

20 Example: FSM Vending Machine
Takes quarters and dollars only Maximum deposit is $1 (or four quarters) Sodas cost $0.75 Possible Inputs (Events): Deposit quarter (25) Deposit dollar (100) Push button to get soda (soda) Push button to get money returned (ret) States: 0, 25, 50, 75, 100, and state transits on input

21 Example 3: FSM Vending Machine
soda 25 50 quarter quarter quarter return 75 Start quarter dolllar 100 Deposit quarter Deposit dollar Push button to get soda (soda) Push button to return money (ret)

22 FSM With Additional Memory (Variable)
If (Sum>75) Sum = Sum – 75 release soda If Sum < 75, do nothing quarter dollar soda > 0 dollar quarter If (Sum== 75) release soda Sum = Sum + 25 Sum = Sum + 100 return 11/10/2018

23 Example: FSM Vending Machine
11/10/2018

24 The Project... An autonomous mobile robot
must navigate through a maze. An on-line navigation problem: solving a maze from the inside. An on-line algorithm receives its input gradually rather than all at once. It must make decisions based on this partial input.

25 DistanceMeasured < 400
FSM of Robot in a Maze DistanceMeasured < 400 rightFinished Start Forward Turning Right Turned Right RightDistance  DistanceMeasured DistanceMeasured >= rightDistance Turning Left resum180Finished leftFinished Resume 180 Turned Left DistanceMeasured < rightDistance 11/10/2018

26 Greedy Algorithm based on the First Working Solution
DistanceMeasured < 400 Turning Left Turned leftFinished Spin 180 DistanceMeasured < 800 DistanceMeasured >= 800 Spin180 Finished Start Forward 11/10/2018

27 Right-Wall-Following Algorithm
Variable BaseDistance = Ultrasonic sensor measure; The robot repeats all the following steps in a loop, until the touch sensor is pressed; Robot moves forward; Robot keeps measures the right side-distance in certain interval, and it compares the newly measured distance with the distance stored in variable BaseDistance . If the distance measured is less than BaseDistance - 5, the robot turns one degree left, and then returns to step 2; If the distance measured is greater than BaseDistance + 5, turns one degree right, and then returns to step 2; If the distance measured greater than BaseDistance + 200, turns 90 degree right, and then returns to step 2; Touch sensor is pressed; robot moves backward 0.5 rotations, and then turns left 90 degree; Return to step 2.

28 Right-Wall-Following Algorithm
Forward a bit then turn Turning Right90 DistanceMeasured > BaseDistance + 400 Turned Right rightFinished Turning Left90 Turned Left leftFinished Touch-Sensor Touched Backward then turn Left 1 degree Right 1 degree Forward DistanceMeasured < BaseDistance - 5 DistanceMeasured > BaseDistance + 5 11/10/2018 Start

29 Wall-Following Diagram in VPL
11/10/2018

30 FSM for Hard-Coded Turns using Touch Sensor
Backward before turning Left Finished Left Finished Touched Touched FW 1 Turning Left90 Turned Left 1 FW 2 Turning Left90 Turned Left 2 Turned Right 2 Turning Right 90 FW 4 Turned Right 1 Turning Right 90 FW 3 Right Finished Touched Right Finished Touched FW 5 Backward before turning 11/10/2018

31 FSM to model robot navigation (the ‘right-then-left’ algo)
do something ! Forward dist < 400mm Turning Right 90 timer exp Turned Right measure distance dist_left >= dist_right Turning Left 180 or timer exp timer exp Turning right 180 measure distance Turned Left dist_left < dist_right

32 Implementation of the ‘right-then-left’ FSM


Download ppt "Evaluation in Engineering Design Process Modeling and FSM"

Similar presentations


Ads by Google