DAC 2009 Applying Use Cases

download DAC 2009 Applying Use Cases

of 21

Transcript of DAC 2009 Applying Use Cases

  • 8/6/2019 DAC 2009 Applying Use Cases

    1/21

    Applying Use Cases toApplying Use Cases toMicrocontroller Code DevelopmentMicrocontroller Code Development

    Chris GilbertChris Gilbert

    Cypress SemiconductorCypress Semiconductor

  • 8/6/2019 DAC 2009 Applying Use Cases

    2/21

    1

    AgendaAgenda Why Use CasesWhy Use Cases

    Microcontroller Project DevelopmentMicrocontroller Project Development Use Cases DefinedUse Cases Defined

    Use Cases CompositionUse Cases Composition

    General ExampleGeneral Example

    Embedded ExampleEmbedded Example

    ConclusionConclusion

  • 8/6/2019 DAC 2009 Applying Use Cases

    3/21

    2

    Why Use CasesWhy Use Cases Simple and extensible processSimple and extensible process

    Provide a methodical approach to requirementsProvide a methodical approach to requirements

    capture and definitioncapture and definition

    Clarify system, subsystem, and componentClarify system, subsystem, and componentresponsibilitiesresponsibilities

    Assist in decomposing the designAssist in decomposing the design

    Identify special conditions or error handlingIdentify special conditions or error handling

    Form the spring board from requirements toForm the spring board from requirements to

    verificationverification

    Applicable to objectApplicable to object --oriented and functionaloriented and functionaldevelopmentdevelopment

  • 8/6/2019 DAC 2009 Applying Use Cases

    4/21

    3

    Embedded Software DevelopmentLifecycleEmbedded Software DevelopmentLifecycle

    RequirementsRequirements

    Statement of w orkStatement of w ork Informal correspondence w ith the customerInformal correspondence w ith the customer

    System descriptionSystem description

    General and high levelGeneral and high level

    Design is an informal process that maps theDesign is an informal process that maps therequirements to a frameworkrequirements to a framework

    Functional ImplementationFunctional Implementation

    VerificationVerification

  • 8/6/2019 DAC 2009 Applying Use Cases

    5/21

    4

    Embedded Software CodeEmbedded Software Code FrameworkFramework

    Sequential flowSequential flow

    RealReal --time operating system (RTOS)time operating system (RTOS) Interrupt drivenInterrupt driven State machineState machine Master/slaveMaster/slave

    Functional ImplementationFunctional Implementation Small memory footprintSmall memory footprint Speed efficiency is often optimized due to relatively lowSpeed efficiency is often optimized due to relatively low

    speed devicesspeed devices Limited development tool capabilityLimited development tool capability C or assembly languageC or assembly language

  • 8/6/2019 DAC 2009 Applying Use Cases

    6/21

    5

    Use Case HistoryUse Case History BackgroundBackground

    IvarIvar Jacobson in 1985Jacobson in 1985

    Introduced in the ObjectIntroduced in the Object--Oriented SoftwareOriented SoftwareEngineering (OOSE) ProcessEngineering (OOSE) Process

    Primary element of the Unified SoftwarePrimary element of the Unified SoftwareDevelopment P rocessDevelopment P rocess

    Supported in Universal Model Language (UML)Supported in Universal Model Language (UML)

  • 8/6/2019 DAC 2009 Applying Use Cases

    7/21

    6

    Use Case DefinitionUse Case DefinitionBoochBooch, Jacobson,, Jacobson, RumbaughRumbaugh ,, The UnifiedThe Unified

    Software Development ProcessSoftware Development Process

    Specifies a sequence of actions, includingSpecifies a sequence of actions, includingvariants, that the system can perform and thatvariants, that the system can perform and thatyields an observable result of value to anyields an observable result of value to an

    actoractor

  • 8/6/2019 DAC 2009 Applying Use Cases

    8/21

  • 8/6/2019 DAC 2009 Applying Use Cases

    9/21

    8

    What a Use Case IsntWhat a Use Case Isnt Description of the internal structure of theDescription of the internal structure of the

    systemsystem

    Data structuresData structures Data baseData base

    Low level interfaceLow level interface

    Single event or messageSingle event or message

    Event or action internal to the system that isEvent or action internal to the system that isnot externally observable or does not producenot externally observable or does not produce

    a result external to the systema result external to the system

  • 8/6/2019 DAC 2009 Applying Use Cases

    10/21

    9

    Use Case CompositionUse Case Composition NameName

    Summarizes the usage of the system it modelsSummarizes the usage of the system it models

    Description or Sequence of StepsDescription or Sequence of Steps Description of goal to be achievedDescription of goal to be achieved Describe the sequence of interactions between theDescribe the sequence of interactions between the

    system and the actors that transpire from the inputsystem and the actors that transpire from the inputstimulus to the goalstimulus to the goal

    ActorsActors Object outside the system that interact w ith the systemObject outside the system that interact w ith the system

    AssumptionsAssumptions Assumptions, preconditions, and post condi tions requiredAssumptions, preconditions, and post condi tions required

    for the use case to executefor the use case to execute

  • 8/6/2019 DAC 2009 Applying Use Cases

    11/21

    10

    Use Case DescriptionUse Case Description Brief descriptionBrief description

    RelationshipsRelationships Relationship between the use case and actors or other useRelationship between the use case and actors or other use

    casescases

    Basic flowBasic flow

    Describe the sequence of interactions between the systemDescribe the sequence of interactions between the systemand the actors that transpire from the input stimulus to theand the actors that transpire from the input stimulus to thegoalgoal

    May include state charts, sequence diagrams, etc.May include state charts, sequence diagrams, etc.

    Alternat ive flowAlternat ive flow

    Special requirementsSpecial requirements QOS requirementsQOS requirements Requirements not naturally included in the flow descriptionRequirements not naturally included in the flow description

  • 8/6/2019 DAC 2009 Applying Use Cases

    12/21

    11

    ActorsActors DefinitionDefinition

    Represents what interacts w ith the systemRepresents what interacts w ith the system Any object outside the system under developmentAny object outside the system under development

    that has a significant interaction w ith the systemthat has a significant interaction w ith the system

    CharacteristicsCharacteristics One or more per use caseOne or more per use case

    Not necessarily involved in all use casesNot necessarily involved in all use cases ExamplesExamples

    Users, other systems, subsystems, hardware orUsers, other systems, subsystems, hardware orsoftware components, etc.software components, etc.

    Microcontroller peripherals such as A/ DMicrocontroller peripherals such as A/ Dconverter, serial interfaces, sensorsconverter, serial interfaces, sensors

    Hardw are components, LCD, push buttons,Hardw are components, LCD, push buttons,sensorssensors

  • 8/6/2019 DAC 2009 Applying Use Cases

    13/21

    12

    Carbon MonoxideMonitor System

    Test Button

    Sounder

    LED Display

    CO Sensor

    Carbon Monoxide Monitor Device

    Microcontroller

    Timers

    Nonvolatile

    Memory Calibration

    Jumper

    Actor ExampleActor Example

  • 8/6/2019 DAC 2009 Applying Use Cases

    14/21

    13

    Digital interface to the LED displayDigital interface to the LED display Display was defined as actorDisplay was defined as actor

    A/ D converter internal to microcontrollerA/ D converter internal to microcontroller

    Microcontroller interrupt controllerMicrocontroller interrupt controller

    Not ActorsNot Actors

  • 8/6/2019 DAC 2009 Applying Use Cases

    15/21

    14

    Identifying Use CasesIdentifying Use Cases List the primary capabilities of the system,List the primary capabilities of the system,

    then the actors, then identify specificthen the actors, then identify specific

    scenarios w ithin each use case.scenarios w ithin each use case. Identify the actors to the system and theirIdentify the actors to the system and their

    interactions, then group those into use cases.interactions, then group those into use cases.

    Begin w ith a system scenario, identify theBegin w ith a system scenario, identify theactors, and combine those into use cases.actors, and combine those into use cases.

  • 8/6/2019 DAC 2009 Applying Use Cases

    16/21

    15

    Carbon Monoxide Monitor SystemCarbon Monoxide Monitor System

    TimersTimers

    CO SensorCO Sensor

    LED DisplayLED Display

    SounderSounder

    Test ButtonTest Button NonvolatileNonvolatile

    MemoryMemory

    CalibrationCalibration

    JumperJumper

    Issue Alarm

    Monitor COLevel

    Report CO

    Level

    PerformUnit Test

    1

    1

    Use Case DiagramUse Case Diagram

    Calibrate

    Unit

  • 8/6/2019 DAC 2009 Applying Use Cases

    17/21

    16

    Use Case: Monitor CO LevelUse Case: Monitor CO Level Brief DescriptionBrief Description

    This use case is init iated periodically , measures the COThis use case is initiated periodically, measures the COsensor level, and computes the CO PPM value.sensor level, and computes the CO PPM value.

    Basic FlowBasic Flow This use case is initiated every 30 seconds.This use case is initiated every 30 seconds.

    The raw sensor voltage is measured.The raw sensor voltage is measured.

    A PPM value is computed based on the measured value.A PPM value is computed based on the measured value.

    The PPM value is averaged using a running average w ithThe PPM value is averaged using a running average w iththe last 3 readings.the last 3 readings.

    RequirementsRequirements The PPM value is limited to values between 0 to 999The PPM value is limited to values between 0 to 999

    inclusive.inclusive.

  • 8/6/2019 DAC 2009 Applying Use Cases

    18/21

    17

    Use Case: Perform Unit TestUse Case: Perform Unit Test Brief DescriptionBrief Description

    Perform a self test of the unit and issue the alarm if anPerform a self test of the unit and issue the alarm if anabnormal test is encountered.abnormal test is encountered.

    Basic FlowBasic Flow This use case is initiated w hen the test button is pressed.This use case is initiated w hen the test button is pressed. At a 2 second rate, the CO sensor is placed in test mode,At a 2 second rate, the CO sensor is placed in test mode,

    and the sensor is measured by including the Monitor COand the sensor is measured by including the Monitor COLevel use case.Level use case.

    Display the test CO level by including the Report CO LevelDisplay the test CO level by including the Report CO Level

    use case.use case. If the CO level is w ithin the test alarm w indow, issue the COIf the CO level is w ithin the test alarm w indow, issue the CO

    alarm by including the Issue Alarm use case.alarm by including the I ssue Alarm use case. If the CO level is outside the alarm threshold w indow, issueIf the CO level is outside the alarm threshold w indow, issue

    the trouble alarm by including the Issue Alarm use case.the trouble alarm by including the Issue Alarm use case.

    After 6 seconds of test, reset the unit if the CO alarm w asAfter 6 seconds of test, reset the unit if the CO alarm wasissued.issued.

  • 8/6/2019 DAC 2009 Applying Use Cases

    19/21

    18

    Use Case: Perform Unit TestUse Case: Perform Unit Test Alternate FlowAlternate Flow

    I f the calibration jumper is present, reset theIf the calibration jumper is present, reset the

    unit w ithout performing any unit tests.unit w ithout performing any unit tests. RequirementsRequirements

    The test alarm w indow lower and upper boundsThe test alarm w indow lower and upper boundsare 200 and 400 PPM , respectively.are 200 and 400 PPM , respectively.

  • 8/6/2019 DAC 2009 Applying Use Cases

    20/21

    19

    SummarySummaryUse casesUse cases

    Can be documented minimally, but effectivelyCan be documented minimally, but effectively

    A complete use case model can be documented onA complete use case model can be documented onindex cardsindex cards

    Suitable for customer reviewSuitable for customer review

    Capture functional requirementsCapture functional requirements Drive the system architectureDrive the system architecture

    Provide definition for designProvide definition for design

    Are a starting place for verificationAre a starting place for verification Assist in identifying unusual or unexpectedAssist in identifying unusual or unexpected

    aspects of the systemaspects of the system

  • 8/6/2019 DAC 2009 Applying Use Cases

    21/21

    20

    Questions andAnswersQuestions andAnswers