18
1 Spacecraft Flight Software Design Patterns Discovery Michael Phillips – Lockheed Martin Fellow, R&D Principal Investigator Amy Mok – Lockheed Martin, R&D Technical Lead © 2013 Lockheed Martin Corporation. All Rights Reserved.

Spacecraft Flight Software Design Patterns Discoveryflightsoftware.jhuapl.edu/files/2013/talks/FSW-13-TALKS/SW_Design...Spacecraft Flight Software Design Patterns Discovery ... •

  • Upload
    vanngoc

  • View
    222

  • Download
    2

Embed Size (px)

Citation preview

1

Spacecraft Flight Software Design Patterns Discovery

Michael Phillips – Lockheed Martin Fellow, R&D Principal Investigator

Amy Mok – Lockheed Martin, R&D Technical Lead

© 2013 Lockheed Martin Corporation. All Rights Reserved.

2

Agenda

• Overview

– Business Case

– Introduction of the R&D Project

• COT Tools for Pattern Detection

– Diagrams

– Metrics

– Sample Usage

• Sample Results

• Obstacles & Challenges

• Summary

3

Business Case for SW Reference Designs

Observations 1. Software Estimates for NEW code have

significant growth from program proposal, through PDR/CDR, and to final implementation

2. Software Estimates for code reuse (Modified + Untouched) migrates rapidly from ReUse (100% untouched) to Modified to New during a program lifecycle

1. A significant portion of NEW Software developed on programs is very similar in design to other programs

2. Most NEW software (code) is preceded by a corresponding SW Design Activity

3. Programs are efficient at implementing SW to program-unique standards given a mature design

Reuse Mod New

Providing SW Development teams and individual SW Engineers with validated heritage reference designs for common capabilities will lead to improved productivity

Hypothesis

Identifying and proliferating Best Practice reference designs will lead to more commonality across our spacecraft FSW product lines and variants

4

Domain_Dependency_Model

Application_E xecutive_Dom _Pkg

«Logical»

Boar d_Suppor t_Package_Dom _Pkg

«Logical»

Com m and_And_Data_Handling_Dom _P kg

«Logical»

Com m unications_And_Tr acking_Dom _Pkg

«Logical»

CMT_CDH

CDH_CMT

Displays_And_Contr ols_Dom_P kg

«Logical»

Applicable only to crewed spacecraft

DAC_CDH

CDH_DAC

Guidance_Navigation_Contr ols_And_Pr opulsion_Dom _Pkg

«Logical»

GNC_CDH

CMT_GNC

Input_Output_Managem ent_Dom _Pkg

«Logical»

IOM_BS P

CDH_IOM

CMT_IOM

DA C_IOM

GNC_IOM

Utility_Libr ar y_Dom _Pkg

«Logical»

CDH_UTL

CMT_UTL

GNC_UTL

UTL_IOM

Oper ating_System _Dom _Pkg

«Logical»

APX_OPS BSP_OPS

IOM_OP S

Power _Managem ent_And_Distr ibution_Dom _Pkg

«Logical»

P MD_CDH

PMD_GNC

PMD_IOM

PMD_UTL

Ther mal_Managem ent_Dom_P kg

«Logical»

Becomes or includes environmental control

and life support for crewed spacecraft

THR_CDH

THR_GNC

THR_IOM

THR_UTL

Vehicle_System s_Management_Dom _P kg

«Logical»

V S M_CDH

VS M_IOM

VS M_UTL

CDH_V S M

CMT_V SM

DA C_V S M

GNC_VS M

PMD_VS M

THR_V SM

Platform Independent Model Layer

Platform Specific Model Layer

Payload_S cience_Dom_P kg

«Logical»

May be deployed as a unique software item

PLD_CDH

PLD_CMT

PLD_GNC

PLD_IOM

PLD_UTL

PLD_V SM

Task 3: Implement, Test, and Deliver TRL 4 FSW Modules

Task 2: Develop Best Practice SW Reference Designs

Task 1: FSW Design Commonality Discovery

Reference Designs for future SW product lines

using COTS tools for design pattern discovery

Discover Common Design Patterns across existing TRL9 Spacecraft Flight Software using COTS Tools. Implement, Test, and Deliver TRL 4 FSW Modules for FSW Reference Designs in a few domain areas commonly re-designed and re-implemented during programs.

What is a Design Pattern?

• A software pattern is a portion of a end product that is repeated or replicated in multiple SW products, where the software products may be modeling products and or source code products.

• Patterns are architected into software products and or introduced independently during software design when software engineers choose similar or identical solutions to implement similar functionality.

Unified Modeling Language

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

5

Types of Software Patterns

1. Architecture Patterns: – Patterns applied across all software domains

• “Base” classes used or extended by each domain

• Patterns for creating constants, parameters and variables

• Patterns for creating command and telemetry messages

• Patterns for creating initialization and processing threads

• Patterns for fault management

2. Functional Patterns: – Patterns identified within multiple software baselines

• Requirements common to multiple software designs

• Functionality common to multiple software designs

3. Logic and Algorithm Patterns: – Patterns identified within multiple software baselines

• Processing threads common to multiple software designs

• Algorithms common to multiple software designs

• Equations common to multiple software designs

4. Implementation Patterns : – Patterns applied within one or more software domain

• Modeling or coding solutions to implement logic, algorithms, and equations

• C++ Templates / Ada Generics

• Generalization & Extension

statechart_12

Process_Sensor_Inputs

Calculate_State_Of_Charge_Voltage_Current_Tem perature Calculate_State_Of_Charge_Amp_Hour_Integration Calculate_State_Of_Charge_Voltage

STP_1

[State_Calculat ion_Mode = VIT_Mode]

[State_Calculat ion_Mode = AHI_Mode]

[State_Calculat ion_Mode = V_Mode]

STP_2

STP_2

STP_2

Calculate_Bat tery_Charge_Rate

Charge_Batteries

STP_4

[Charge_Control_Mode = Auto_CCMode]

STP_3

[Charge_Control_Mode = Manual_CCMode]

Set_Manual_Bat tery_Charge_Rate

STP_3

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

void Operation_Name() … executable statements …

6

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

statechart_12

Process_Sensor_Inputs

Calculate_State_Of_Charge_Voltage_Current_Tem perature Calculate_State_Of_Charge_Amp_Hour_Integration Calculate_State_Of_Charge_Voltage

STP_1

[State_Calculat ion_Mode = VIT_Mode]

[State_Calculat ion_Mode = AHI_Mode]

[State_Calculat ion_Mode = V_Mode]

STP_2

STP_2

STP_2

Calculate_Bat tery_Charge_Rate

Charge_Batteries

STP_4

[Charge_Control_Mode = Auto_CCMode]

STP_3

[Charge_Control_Mode = Manual_CCMode]

Set_Manual_Bat tery_Charge_Rate

STP_3

Use Cases & 2013 Pilots

Reverse Engineering to Support Program Needs (Immediate)

Domain_Dependency_Model

Application_E xecutive_Dom _Pkg

«Logical»

Boar d_Suppor t_Package_Dom _Pkg

«Logical»

Com m and_And_Data_Handling_Dom _P kg

«Logical»

Com m unications_And_Tr acking_Dom _Pkg

«Logical»

CMT_CDH

CDH_CMT

Displays_And_Contr ols_Dom_P kg

«Logical»

Applicable only to crewed spacecraft

DAC_CDH

CDH_DAC

Guidance_Navigation_Contr ols_And_Pr opulsion_Dom _Pkg

«Logical»

GNC_CDH

CMT_GNC

Input_Output_Managem ent_Dom _Pkg

«Logical»

IOM_BS P

CDH_IOM

CMT_IOM

DA C_IOM

GNC_IOM

Utility_Libr ar y_Dom _Pkg

«Logical»

CDH_UTL

CMT_UTL

GNC_UTL

UTL_IOM

Oper ating_System _Dom _Pkg

«Logical»

APX_OPS BSP_OPS

IOM_OP S

Power _Managem ent_And_Distr ibution_Dom _Pkg

«Logical»

P MD_CDH

PMD_GNC

PMD_IOM

PMD_UTL

Ther mal_Managem ent_Dom_P kg

«Logical»

Becomes or includes environmental control

and life support for crewed spacecraft

THR_CDH

THR_GNC

THR_IOM

THR_UTL

Vehicle_System s_Management_Dom _P kg

«Logical»

V S M_CDH

VS M_IOM

VS M_UTL

CDH_V S M

CMT_V SM

DA C_V S M

GNC_VS M

PMD_VS M

THR_V SM

Platform Independent Model Layer

Platform Specific Model Layer

Payload_S cience_Dom_P kg

«Logical»

May be deployed as a unique software item

PLD_CDH

PLD_CMT

PLD_GNC

PLD_IOM

PLD_UTL

PLD_V SM

SWE Central Function for Enterprise Commonality

Modular Common Designs

Program A Next Generation Program A Code Reverse-Engineered Design

Future Program A

Future Program B

Future Program C

Future Program D

The R&D return is achieved through shorter software development cycle and increase of design reuse (i.e., commonality)

FSW Domains

Software Documents/Model

Code Reverse-Engineered Design

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

7

Tools Selected to aid in Pattern Detection Tool Name Vendor

Axivion Bauhaus Suite Axivion

Together Borland

Imagix 4D Imagix

LDRA Testbed LDRA Software Technology

McCabe IQ McCabe Software

C/C++ Test Parasoft

Ptidej FOSS

Sotoarc / Sotograph Hello2morrow

UMLStudio Pragsoft

Understand SciTools

Visual Paradigm Visual Paradigm

Rhapsody IBM

8

Tool Capabilities Matrix Pattern

Detection Reverse Engineered

Diagrams Reverse

Engineering Metrics

Supported Languages

Arc

hit

ectu

re

Dat

a

Stru

ctu

res

Arc

hit

ectu

re

Cla

ss

Beh

avio

r

Dep

end

ency

Fun

ctio

n

Cal

ls

Cla

sse

s

Stru

ctu

res

Met

ho

ds

Ob

ject

O

rien

ted

Co

mp

lexi

ty

Oth

er

AD

A

C

C+

+

Together X X X X X X X

Imagix4D X X X X X X X X X X X X

LDRA X X X X X X X X

McCabe IQ X X X X X X X X X X X X

C/C++ Test X X X X X

UMLStudio X X X X X X X

Ptidej X X X X X

Sotoarc / Sotograph X X X X X X X

Understand X X X X X X X X X X

Visual Paradigm X X X X X X X X

Rhapsody X X X X X X

9

Reverse-Engineered Diagrams

Architecture Class

Logic Dependency

Function Call Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

10

Metrics Extracted from Code

Metrics Show: • Indication of which code baselines

should be used to develop the reference design

• Quantitative differences between the multiple code baselines

• Assurance of the quality of the

reference design that will be distributed

Some Examples: • Complexity (Cyclomatic, Essential,

Halstead) • Difficulty in understanding,

implementing, and testing decision logic

• (Lack of) Cohesion • How related the functions and

functionality of a module are. • Coupling

• Degree to which each module relies on other modules

• Depth of Inheritance • How deeply modules inherit

from each other • SLOC

• Amount of code necessary to implement functionality

• Many more…

11

End-To-End Process

Inputs: - Source Code - Models - Requirements - CDRL Documentation - Other Documentation

Source Code Analysis Tool Suite

All Patterns Identified

Preferred Coded Patterns

Preferred Modeled Patterns

CM’ed Pattern Product Pkgs.

Implement Patterns

Discover Patterns

Evaluate Patterns

Deploy Patterns

Select Tools

Use Metrics: Characterize individual patterns Use Trade Study Tool: To compare different patterns for the same functions

12

Sample Detailed Design – Class Diagrams Detailed Design Reverse Engineered Design

End User Artifacts: SW Architecture Diagrams - Differences between planned and actual can be discovered providing users with correct design for review and implementation

Domain Class Diagram

Logical_Architecture_Domain«Software_Domain»

Attributes

Command_Buffer:int

Status_Log:int

Domain_Global_Variable_1:int

Domain_Global_Variable_2:int

Domain_Global_Variable_3:int

Operations

Domain_Unique_Processing_Thread_1():void

Initialize():void

Process_Command():void

Health_And_Status():void

Domain_Unique_Processing_Thread_2():void

Domain_Unique_Processing_Thread_3():void

Tags

ABR:RhpString

Developer_Organization:Organization_Enum

Domain_Specific_Language:Domain_Specific_Language_Enum

Maximum_Rate_Group:Hz_Enum

MDA_Layer:Model_Driven_Architecture_Enum

Minimum_Rate_Group:Hz_Enum

NUM:RhpInteger

Percent_Modified_Development:Percent

Percent_New_Development:Percent

Percent_Reuse_Development:Percent

Domain_Command

Command_1 Command_2 Command_3

Domain_Component_11 1

Domain_Component_21 1

Class Name 1 + attributes + operations

Class Name 2 + attributes + operations

Class Split Apart

Class Name 4 + attributes + operations

Class Name 3 + attributes + operations

Composition

Class Name 4 + attributes + operations

Class Name 5 + attributes + operations

Class Name 6 + attributes + operations

Class Name 7 + attributes + operations

Generalization

13

Sample Detailed Design – Behavior Diagrams Detailed Design Reverse Engineered Design

End User Artifacts: SW Logic/Algorithm Diagrams - Represents actual, detailed, unambiguous, and straightforward views of the software design

loop

Class 1 Class 2

………

alt

opt

14

Sample Requirement Traceability

• SRS0001 – FSW shall …

• SRS0002 – FSW shall …

• SRS0003 – FSW shall …

End User Artifacts: Mapping to SW Requirements – Ability to easily map requirements to design, allowing program to determine new, modified, or reuse of SW design

15

Program Usage of Functionalities statechart_12

Process_Sensor_Inputs

Calculate_State_Of_Charge_Voltage_Current_Tem perature Calculate_State_Of_Charge_Amp_Hour_Integration Calculate_State_Of_Charge_Voltage

STP_1

[State_Calculat ion_Mode = VIT_Mode]

[State_Calculat ion_Mode = AHI_Mode]

[State_Calculat ion_Mode = V_Mode]

STP_2

STP_2

STP_2

Calculate_Bat tery_Charge_Rate

Charge_Batteries

STP_4

[Charge_Control_Mode = Auto_CCMode]

STP_3

[Charge_Control_Mode = Manual_CCMode]

Set_Manual_Bat tery_Charge_Rate

STP_3

Program A

Program B

Program C

Functionalities that most programs had implemented represent critical functions Functionalities that only a few programs had implemented represent mission-

unique functions

16

Obstacles & Challenges

• Usually difficult to obtain FSW and FSW Design Artifacts from

heritage programs

– Each program has their own process, priorities, time table, and restrictions

• Creating common designs can be tedious (the tools help greatly,

but it’s still a manual process)

• Program-specific design decisions must be filtered out from the

common design

• Lots of interest for derived designs of a single heritage program, but

need more interest in the designs derived from multiple heritage

programs

• Comparing different designs can be subjective and difficult as each

design has different capabilities

17

Summary

• We believe there is significant room to improve the productivity of

the Flight Software Team by leveraging design reuse from existing

programs

• COTS tools have a tremendous capability to efficiently reverse-

engineer both software design and metrics that can augment

program design artifacts

– These tools have limitations that require both processes and manual effort to

effectively use the artifacts produced by the tools

– In some cases, the reverse-engineered design is more factual than the existing

design artifacts, since it was derived for the actual implementation, not the

planned implementation

• Providing reference design information to both individual

contributors for specific SW domains, as well FSW technical leads

and managers, needs to be organizationally institutionalized in order

to effectively improve productivity on programs

18