S A S D 발표 : 구태환
I n d e x SA Part 1. Statement of Purpose 2. System Context Diagram Event List 3. Data Flow Diagram Data Dictionary SD Part Structure Charts 1. Transform Analysis 2. Basic 3. Advanced 4. Module Definition Process Specification 4. Final State Machine
System Analysis S A
S A (1/18) Statement of Purpose System Context Diagram DFD FSM Statement of Purpose 입력센서 : Touch, Sound, Light, Ultrasonic Sensor 출력장치 : Speaker, Wheel(Motor A, C), Brake(Motor B), Display 로봇은기본적으로직선으로전진한다. 로봇이작동하는동안화면에는기본적으로 Working 을출력한다. 전방의센서를통해장애물을인식하며, 장애물을인식하면방향을바꾼다. 방향전환후다시이전속도로전진한다. Touch 센서를통해속도를조절할수있다. Light 센서를통해빛을감지해제동장치를작동여부를판별한다. 박수소리에맞춰 Thank you 소리를출력한다. 상세내용생략
S A (2/18) Statement of Purpose System Context Diagram DFD FSM System Context Diagram (1/2) Sensor Touch Sensor Input Sound Sensor Input Light Sensor Input Ultra Sonic Sensor Input NXT Controller Motor Info Speaker Motor Displayer
S A (3/18) Statement of Purpose System Context Diagram DFD FSM System Context Diagram (2/2) Event List Input / Output Event Description Touch sensor input Touch sensor 를통해사용자가버튼을눌렀는지에대한정보를나타낸다. Sound sensor input Sound sensor 를통해들어오는소리의정보를나타낸다. Light sensor input Light sensor 를통해들어오는밝기의정보를나타낸다. Ultra sonic sensor input Ultra sonic sensor 를통해들어오는사물과의거리정보를나타낸다. SpeakerInfo MotorInfo DisplayerInfo Speaker 가출력해야할 information 어떤모터가어떤방향과크기로동작하는지에대한 information Displayer 가출력해야할 information
S A (4/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (1/5) Level 0 Touch Sensor Speaker Sound Sensor Light Sensor NXT Controller 0 Motor Info Motor UltraSonic Sensor Tick Digital Clock Displayer
S A (5/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (1/5) Level 0 (Data Dictionary) Input / Output Event Description Format / Type Touch sensor input Touch sensor 를통해사용자가버튼을눌렀는지에대한정보를나타낸다. True / False, Interrupt Sound sensor input Sound sensor 를통해들어오는소리의정보를나타낸다. Int(0~100), Periodic Light sensor input Light sensor 를통해들어오는밝기의정보를나타낸다. Int(0~100), Periodic Ultra sonic sensor input Ultra sonic sensor 를통해들어오는사물과의거리정보를나타낸다. Int(0~255), Periodic SpeakerInfo Speaker 가출력해야할 information Night / Good morning / Thank you MotorInfo 어떤모터가어떤방향과크기로동작하는지에대한 information Motor((A, B, C), 방향, 속도 ) DisplayerInfo Displayer 가출력해야할 information Working / Sleeping
S A (6/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (2/5) Level 1 Touch & Number TSLU Detect 1 Sound Light Distance Control Unit 2 Tick Tick
S A (7/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (2/5) Level 3 (Data Dictionary) Input / Output Event Description Format / Type Touch & Number Touch Sensor Interface 를통해 Main Control 에게 Touch 여부및눌린횟수를알려준다. (True/False, Int), Periodic Sound Sound Sensor Interface 를통해 Main Control 에게소리의크기를알려준다. Int,(0~100) Periodic Light Light Sensor Interface 를통해 Main Control 에게빛의밝기를알려준다. Int(0~100), Periodic Distance Ultra Sonic Sensor Interface 를통해장애물과의거리를 Main Control 에게알려준다 Int(0~255), Periodic
S A (8/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (3/5) Level 2 Touch Sensor Interface 1.1 Speaker Interface 2.2 Speaker Info Tick Light Sensor Input Tick Sound Sensor Interface 1.2 Light Sensor Interface 1.3 Ultra Sonic Sensor Interface 1.4 Main Control 2.1 Tick Motor Command Motor Interface 2.3 Displayer Interface 2.4 Motor Info Displayer Info
S A (9/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (3/5) Level 2 (Event List) Input / Output Event Description Format / Type Speaker Command Motor Command Displayer Command Thank you : Sound 가 70 이상일때 Night : Light 가 40 이하이고, 5 초후의 Light 값이 40 이하일때 Good Morning : 로봇이멈췄다가 Light 가 40 이상일때 Move Forward : Light 가 40 이상, Distance 가 10 이상일때 Turn left : Light 가 40 이상, Distance 가 10 이하일때 Turn 180 : Turn left 이후 Turn Right : Turn 180 이후 IsBrake : Light 가 40 이하일때 / 40 이상일때 Working : 로봇이동작중일때 Sleeping : 로봇이동작하다가멈출때 Night / Good morning / Thank you ((A,TRUE,Speed),(C,TRUE,Speed)) ((A,TRUE,50),(C,FALSE,50)) ((A,TRUE,50),(C,FALSE,50)) ((A,FALSE,50),(C,TRUE,50)) (B,TRUE,100) / (B,FALSE,0) Working / Sleeping
S A (10/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (4/5) Level 3 Speed Tick Controller 2.1.1 Move Forward 2.1.2 Motor Command Turn Right 90 2.1.4 Turn Left 90 2.1.3 Turn 180 2.1.5 Motor Command Motor Command Motor Command IsBrake 2.1.6 Motor Command Sound Store IsSound 2.1.7 Sound Command Display Store IsDisplay 2.1.8 Display Command
S A (11/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (4/5) Level 3 (Data Dictionary) Input / Output Event Description Format / Type Speed DisplayStore SoundStore Speed 크기를저장할 Speed 변수가있다. Speed 변수는 Touch 의눌린횟수에따라 0.5 초마다홀수이면속도를 10 씩증가시키고짝수이면 10 씩감소시킨다. Speed 의최대값은 100, 최소값은 0 이다. Displayer 가출력하여야할소리정보를저장한다. IsDisplay 가 Controller 에의해 trigger 되면 DisplayStore 에있는화면출력정보를불러와그데이터를출력한다. Speaker 가출력하여야할소리정보를저장한다. IsSound 가 Controller 에의해 trigger 되면 SoundStore 에있는소리정보를불러와그데이터를출력한다. Int(0~100) Working, Sleeping Night / Good morning / Thank you
S A (12/18) Statement of Purpose System Context Diagram DFD FSM Data Flow Diagram (5/5) Final 1.1 [A] Speed 2.1.2 2.1.3 2.3 [A] 1.2 [P] 2.1.4 1.3 [P] 2.1.1 [C] 2.1.5 1.4 [P] A : ASynchronous P : Periodic C : Control Sound Store Display Store 2.1.8 2.1.7 2.4 [A] 2.1.6 2.2 [A]
S A (13/18) Statement of Purpose System Context Diagram DFD FSM 1.1 Touch Sensor Interface Prototype Process description Touch&Number TouchSensorInterface(Touch_sensor_input) Touch Sensor 에서 Touch sensor input 을받으면 Controller 에게 Touch 를통해눌렸는지에대한여부및 Number 를통해눌린횟수를알린다. Touch 는 true/false 로구분되며, Number 는 int 형이다. Sensor 가눌렸을때가 true, 떼었을때가 false 이다. 그리고눌린횟수마다 Number 는 1 씩자동적으로증가한다. 1.2 Sound Sensor Interface Prototype Process description int SoundSensorInterface(Sound_sensor_input) Sound Sensor 에서 10ms 주기로들어오는 Sound sensor input 을받으면 Controller 에게 Sound 를정수형으로보내어소리의크기를보내준다.. 1.3 Light Sensor Interface Prototype Process description int LightSensorInterface(Light_sensor_input) Light Sensor 에서 10ms 주기로들어오는 Light sensor input 을받으면 Controller 에게 Light 를정수형으로보내어빛의세기를보내준다. Process Specificiation(1/5)
S A (14/18) Statement of Purpose System Context Diagram DFD FSM 1. 4 Ultrasonic Sensor Interface Prototype Process description int UltrasonicSensorInterface(Ultrasonic_sensor_input) Ultrasonic sensor 에서 10ms 주기로들어오는장애물과의거리를나타내는 Ultrasonic sensor input 을받으면 Controller 에게장애물과의거리 Distance 를정수형으로보내준다. 2. 1. 2 Move Forward Prototype Process description MotorCommand MoveForward(bool) MotorCommand 데이터를보내어 Motor A,C 가작동할수있도록한다. Enable 시 Speed 값을불러와모터 A, C 에속도크기와방향에대한정보를반환한다. Disable 시 Motor A,C 에게모두속도를 0 을주어서모터를정지시킨다. Process Specificiation(2/5)
S A (15/18) Statement of Purpose System Context Diagram DFD FSM 2. 1. 3 Turn Left 90 Prototype Process description MotorCommand TurnLeft(bool) Trigger 이벤트가발생시수행되며 MotorCommand 데이터를보내어 50% 의속도로 Motor A 가 0.5 초간앞으로, Motor C 가 0.5 초간뒤로작동할수있도록한다. 2. 1. 4 Turn Right 90 Prototype Process description MotorCommand TurnRight(bool) Trigger 이벤트가발생시수행되며 MotorCommand 데이터를보내어 50% 의속도로 Motor A 가 0.5 초간뒤로, Motor C 가 0.5 초간앞으로작동할수있도록한다. 2. 1. 5 Turn 180 Prototype Process description MotorCommand Turn180(bool) Trigger 이벤트가발생시수행되며 MotorCommand 데이터를보내어 50% 의속도로 Motor A 가 1 초간앞으로, 50% 의속도로 Motor C 가 1 초간뒤로작동할수있도록한다. Process Specificiation(3/5)
S A (16/18) Statement of Purpose System Context Diagram DFD FSM 2. 1. 6 IsBrake Prototype Process description MotorCommand IsBrake(bool) Motor Command 데이터를보내어 Motor B 가작동할수있도록한다. Motor B 에게 enable 시속도 100 과방향 TRUE 를, disable 시속도 0 과역방향 FALSE 를전달한다. 2. 1. 7 IsSound Prototype Process description SoundCommand IsSound(bool) Trigger 이벤트가발생시수행되며 SoundStore 에저장된출력할소리정보값을불러와 SoundCommand 로보내준다. 2. 1. 8 IsDisplay Prototype DisplayCommand IsDisplay(bool) Process description Trigger 이벤트가발생시수행되며 DisplayStore 에저장된화면출력정보값을불러 DisplayCommand 로보내준다. Process Specificiation(4/5)
S A (17/18) Statement of Purpose System Context Diagram DFD FSM 2. 2 Speaker Interface Prototype SpeakerInfo SpeakerInterface(SpeakerCommand) Process description SpeakerCommand( Thank you, Night, Good Morning ) 를받아서 Speaker 에게 SpeakerInfo 소리를내게한다. 2. 3 Motor Interface Prototype MotorInfo MotorInterface(MotorCommand) Process description MotorCommand(Motor A B C, 방향, 속도 ) 를받아서 Motor 에게 MotorInfo 에해당하는동작을하게한다. 2. 4 Displayer Interface Prototype DisplayerInfo DisplayerInterface(DisplayerCommand) Process description DisplayerCommand( Working, Sleeping ) 를받아서 Displayer 에게 DisplayerInfo 화면을출력하게한다. Process Specificiation(5/5)
S A (18/18) Statement of Purpose System Context Diagram DFD FSM Idle /DisplayStore := Working,,Enable IsDisplay,Speed := 0, SoundStore Final State Machine Tick(0.5) [Light>=40&&Distance>10&&Touch=T &&number=odd] /Speed : -=10, DisplayStore := Working SoundStore := Thank you Tick(0.5) [Light>=40&&Distance>10&&Touch=T &&number=even] /Speed : +=10, DisplayStore := Working SoundStore := Thank you [Light>=40&&Distance>10&&Sound>=70] /Speed, DisplayStore := Working,SoundStore := Thank you, Trigger IsSpeak [Light>=40] /Disable IsBrake,Speed, DisplayStore,SoundStore Move Forward Brake Tick(0.5) [Light>=40&&Touch=T] /Speed : +=10,DisplayStore,SoundStore := Thank you [Light<40] /Enable IsBrake,Speed, DisplayStore,SoundStore [Light>=40 && Distance<=10] /Trigger Turn Left 90,Speed, DisplayStore, SoundStore Timeout (0.5) [Distance>10] /Speed, DisplayStore, SoundStore,Enable Move Forward Turn Left 90 Timeout (0.5) [Distance<=10] /Speed, DisplayStore, SoundStore,Trigger Turn 180 Turn 180 Timeout(5)[Light<40] /Speed,Disable Move Forward,DisplayStore := Sleeping,Enable IsDisplay,SoundStore := Night,Trigger IsSpeak,Disable IsBrake Stop [Light >=40] /Speed,Enable Move Forward,DisplayStore := Working,Enable IsDisplay,SoundStore := Good Morning,Trigger IsSpeak Timeout (1) [Distance<=10] /Speed, DisplayStore, SoundStore.Trigger Turn Right 90 Turn Right 90
System Design S D
S D (1/8) Structure Charts Transform Analysis Basic Advanced Transform Analysis Touch Sensor Interface 1.1 Speaker Interface 2.2 Speaker Info Tick Light Sensor Input Tick Sound Sensor Interface 1.2 Light Sensor Interface 1.3 Ultra Sonic Sensor Interface 1.4 Main Control 2.1 Tick Motor Command Motor Interface 2.3 Displayer Interface 2.4 Motor Info Displayer Info Afferent Flow (Input) Central Transformation (Control) Efferent Flow (Output)
S D (2/8) Basic Main Touch Sensor Interface Other Sensors Interface Touch& Number Controller Light Distance Sound Motor Command Display Command Sound Command Motor Interface Displayer Interface Speaker Interface
S D (3/8) Advanced Main Touch Sensor Interface Other Sensors Interface Touch& Number Controller Light Distance Sound Motor Command Display Command Sound Command Motor Interface Displayer Interface Speaker Interface
S D (4/8) Structure Charts Transform Analysis Basic Advanced Module Definition 식별된 Task 에대한모듈정의 (1/2) 프로세스선별기준 Moudule Task 01 Touch Sensor Interface 1.1 Asynchronous Touch Sensor Interface Task 02 Sound Sensor Interface 1.2 Light Sensor Interface 1.3 UltraSonic Sensor Interface 1.4 Periodic Other Sensors Interface Task 03 Controller 2.1.1 Move Forward 2.1.2 Turn Left 90 2.1.3 Turn Right 90 2.1.4 Turn 180 2.1.5 Is Brake 2.1.6 IsSound 2.1.7 IsDisplay 2.1.8 Control Controller
S D (5/8) Structure Charts Transform Analysis Basic Advanced Module Definition 식별된 Task 에대한모듈정의 (2/2) 프로세스선별기준 Moudule Task 04 Motor Interface 2.3 Asynchronous Motor Interface Task 05 Speaker Interface 2.2 Asynchronous Speaker Interface Task 06 Displayer Interface 2.4 Asynchronous Displayer Interface
S D (6/8) Structure Charts Transform Analysis Basic Advanced Module Definition Module Definition (1/3) 모듈 ID NXT_CM01 모듈명 Controller 모듈개요 인터페이스 Touch 센서와이외의 Sensor(Sound, Light, UltraSonic) 부터의입력값을이용해 Motor 와 Displayer 그리고 Speaker 를제어함 없음 프로그램구동시에실행 모듈 ID NXT_IM01 모듈명 Touch Sensor Interface 모듈개요 인터페이스 Toouch Sensor 로부터들어오는값을처리하여 Controller 로전달 Touch&Number TouchSensorInterface(Touch_sensor_input) - Touch Sensor Input 을받아 Touch Sensor 가눌렸는지에대한여부를 BOOL 값 ( 눌렸을때 True, 떼었을때 False) 및눌린횟수에대한정보값반환 모듈 ID NXT_IM02 모듈명 Other Sensors Interface 모듈개요 인터페이스 3 개의센서로부터들어오는값을처리하여 Controller 로전달 Sensor OtherSensorInterface(other_sensor_input) - 10ms 마다들어오는 3 개의 sensor 값을저장하여구조체로반환
S D (7/8) Structure Charts Transform Analysis Basic Advanced Module Definition Module Definition (2/3) 모듈 ID NXT_OM01 모듈명 Motor Interface 모듈개요 모터정보값을해당하는각 Motor 에전달 인터페이스 MotorInfo MotorInterface(MotorCommand) -MotorCommand(Motor A B C, 방향, 속도 ) 를받아서각 Motor (A, B, C) 에게 MotorInfo 동작을하게한다. 모듈 ID NXT_OM02 모듈명 Displayer Interface 모듈개요 인터페이스 화면출력정보값을 Diplayer 에게전달 DisplayerInfo DisplayerInterface(DisplayerCommand) -DisplayerCommand( Working, Sleeping ) 를받아서 Displayer 에게 DisplayerInfo 화면을출력하게한다.
S D (8/8) Structure Charts Transform Analysis Basic Advanced Module Definition Module Definition (3/3) 모듈 ID NXT_OM03 모듈명 Speaker Interface 모듈개요 소리출력정보값을 Speaker 에게전달 인터페이스 SpeakerInfo SpeakerInterface(SpeakerCommand) -SpeakerCommand( Thank you, Night, Good Morning ) 를받아서 Speaker 에게 SpeakerInfo 소리를내게한다.