Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Profile: Name: Using Finite State Machines From Concept to RealizationPlace: INPEDate: 2017-10-31 – 16h00 18h00 and 2017-11-07 – 15h30 18h00Target Audience: MSc/PhD Students
8:20 1
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Using Finite State Machines FromConcept to Realization
Christopher Shneider Cerqueira Ana Maria Ambrosio Claudio Kirner
Mission Simulation LabHICEE
Mission Simulation LabHICEEMotivation
•Complex systems are often reactive, i.e., they continuously respond to external and internal stimuli (events) and may have time constraints.
•When modelling such systems, the designer should be able to determine the system's behaviour, as well as its flow of control.
•System modelling methods must express this action semantics in a way that is both formal and intuitive.
08:20cscerqueira.com.br 3
Mission Simulation LabHICEE
Mission Simulation LabHICEEAutomata theory
• A deterministic finite automaton isrepresented formally by a 5-tuple<Q,Σ,δ,q0,F>, where:• Q is a finite set of states.
• Σ is a finite set of symbols, called thealphabet of the automaton.
• δ is the transition function, that is,δ: Q × Σ → Q.
• q0 is the start state, that is, the state ofthe automaton before any input hasbeen processed, where q0∈ Q.
• F is a set of states of Q (i.e. F⊆Q) calledaccept states.
08:20cscerqueira.com.br 4https://en.wikipedia.org/wiki/Automata_theory
Mission Simulation LabHICEE
Mission Simulation LabHICEEFinite-State Machine
• A finite-state machine (FSM)or finite-state automaton (FSA,plural: automata), finiteautomaton, or simply a statemachine, is a mathematicalmodel of computation. It isan abstract machine that can bein exactly one of a finite numberof states at any given time. TheFSM can change from one state toanother in response to someexternal inputs; the change fromone state to another is calleda transition. An FSM is defined bya list of its states, its initial state,and the conditions for eachtransition.
08:20cscerqueira.com.br 5
Current State
Input Next State Output
Lockedcoin Unlocked
Unlocks the turnstile so that the customer can push through.
push Locked None
Unlocked
coin Unlocked None
push LockedWhen the customer has pushed through, locks the turnstile.
https://en.wikipedia.org/wiki/Finite-state_machine
Mission Simulation LabHICEE
Mission Simulation LabHICEEMoore Machine
• The FSM uses only entry actions,i.e., output depends only on thestate. The advantage of the Mooremodel is a simplification of thebehaviour. Consider an elevatordoor. The state machine recognizestwo commands: "command_open"and "command_close", whichtrigger state changes. The entryaction (E:) in state "Opening" startsa motor opening the door, the entryaction in state "Closing" starts amotor in the other direction closingthe door. States "Opened" and"Closed" stop the motor when fullyopened or closed. They signal tothe outside world (e.g., to otherstate machines) the situation: "dooris open" or "door is closed"
08:20cscerqueira.com.br 6
Mission Simulation LabHICEE
Mission Simulation LabHICEEMealy Machine
• The FSM also uses input actions,i.e., output depends on input andstate. The use of a Mealy FSM leadsoften to a reduction of the numberof states. The example in Figureshows a Mealy FSM implementingthe same behaviour as in theMoore example. There are twoinput actions (I:): "start motor toclose the door if command_closearrives" and "start motor in theother direction to open the door ifcommand_open arrives". The"opening“ and "closing"intermediate states are not shown.
08:20cscerqueira.com.br 7
Mission Simulation LabHICEE
Mission Simulation LabHICEEWhere can we find FSMs!?
08:20cscerqueira.com.br 8Idealization / Realization Tests Operations
Mission Simulation LabHICEE
Mission Simulation LabHICEETools
08:20cscerqueira.com.br 9
• OPCat: • http://esml.iem.technion.ac.il
• Arcadia: • https://polarsys.org/capella/
• Enterprise Architect: • http://sparxsystems.com/products/ea/
• MatLab: • https://www.mathworks.com/downloads/
• Arduino: • https://www.arduino.cc
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20 10
MBSE – 20min ALFA – 20minOPM – 40minARCADIA – 50minCode – 10minMATLAB – 30minARDUINO– 10minWRAP-UP– 10min
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Model Based System Engineering ( MBSE)
08:20cscerqueira.com.br 11https://mediaex-server.larc.nasa.gov/Academy/Play/804f524f16c24fd2927a4eb9f01bdf831d
Mission Simulation LabHICEE
Mission Simulation LabHICEESystem Engineering
8:20 12
“Systems Engineering is an engineering discipline whose responsibility is creating and executing an interdisciplinary process to
ensure that the customer and stakeholder's needs are satisfied in a high quality, trustworthy, cost efficient and schedule compliant manner
throughout a system's entire life cycle.”
http://www.incose.org/AboutSE/WhatIsSE
Mission Simulation LabHICEE
Mission Simulation LabHICEEHow the magic happens?
8:20 13
Talk with Stks
Mission Simulation LabHICEE
Mission Simulation LabHICEEEngineered System or System Engineering
8:20 14
An engineered system is an open system of technical or
sociotechnical elements that exhibits emergent properties notexhibited by its individual elements. It is created by and forpeople; has a purpose, with multiple views; satisfies keystakeholders’ value propositions; has a life cycle and evolutiondynamics; has a boundary and an external environment; and ispart of a system-of-interest hierarchy.
Systems engineering is “an interdisciplinary approach and
means to enable the realization of successful (engineered)systems”. It focuses on holistically and concurrentlyunderstanding stakeholder needs; exploring opportunities;documenting requirements; and synthesizing, verifying,validating, and evolving solutions while considering the completeproblem, from system concept exploration through systemdisposal.
http://sebokwiki.org/wiki/Use_Case_0:_Systems_Engineering_Novices
Mission Simulation LabHICEE
Mission Simulation LabHICEEMBSE
8:20 15
“Model-Based Systems Engineering (MBSE) is a systems engineering methodology that focuses on
creating and exploiting domain models as the primary means of information exchange between
engineers, rather than on document-based information exchange.”
http://www.omgwiki.org/MBSE/doku.php
“the formalized application of modelling to support system requirements, design, analysis, verification and validation activities beginning inthe conceptual design phase and continuing throughout development and later life cycle phases. MBSE is part of a long-term trend towardmodel-centric approaches adopted by other engineering disciplines, including mechanical, electrical and software. In particular, MBSE isexpected to replace the document-centric approach that has been practiced by systems engineers in the past and to influence the futurepractice of systems engineering by being fully integrated into the definition of systems engineering processes.”
Mission Simulation LabHICEE
Mission Simulation LabHICEEModel (driven x based x centric x oriented)
• Driven: “models should be used to directly generate executable systems”
• Based: “uses models rather than documents as the data source for all activities throughout the product life cycle” “models are used to drive all aspects of the product lifecycle and that data is created once and reused by all downstream data consumers.”
• Centric: “is a focus entirely on development of information of and about the system – the model”
• Oriented: “ is a paradigm that does not differentiate between modelling and coding. This is referred to as model-code duality.”
08:20cscerqueira.com.br 16
http://onlinelibrary.wiley.com/doi/10.1002/spe.1155/abstract#spe1155-note-0001
http://www.3dcadworld.com/why-you-need-to-understand-model-based-engineering/
https://www.youtube.com/watch?v=VjGmNjg5cro
http://cruise.eecs.uottawa.ca/umple/
Mission Simulation LabHICEE
Mission Simulation LabHICEEModel (driven x based x centric x oriented)
08:20cscerqueira.com.br 17
Model Based
Model Driven
ModelOriented
Model Centric
Document Based“data-source”
“generation”
“focus”
“language”
Mission Simulation LabHICEE
Mission Simulation LabHICEEModels...
8:20 18
Engineering?
Modelling andauto-build?
Mission Simulation LabHICEE
Mission Simulation LabHICEEBenefits
8:20 19
http://www.eclipse.org/proposals/eclipse-mddi/
Mission Simulation LabHICEE
Mission Simulation LabHICEESame kernel step each activity of the Lifecycle
8:20 20
Mission Simulation LabHICEE
Mission Simulation LabHICEEV-MODEL
08:20cscerqueira.com.br 21
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20 22
time
det
ails
V – WaterfallYs – Prototype Cascade
cscerqueira.com.br
Equip
SubS
Sys
0 A B C D E F
Mission Simulation LabHICEE
Mission Simulation LabHICEEStill alive?
08:20cscerqueira.com.br
Mission Simulation LabHICEE
Mission Simulation LabHICEE
CASE: CUBESAT ALFA
08:20 24
Mission Simulation LabHICEE
Mission Simulation LabHICEEWhat is Alfa!?• 1st CubeSat Mission of CTEE Program
• CTEE – Capacitação Técnica em Engenharia Espacial
• Mission:• Validate Service Bus / Com Networks• Shielding / Error Recovery Experiments
• Current Status: • Finishing Documents to MDR
• Space Segment• OnBoard Computer• Telecomunications• Power Supply• Attitude (at least determination)• Structure• Experiments
• Ground Segment• Receive telemetries (housekeeping /
mission)• Send telecommands
08:20cscerqueira.com.br 25
https://gomspace.com
Mission Simulation LabHICEE
Mission Simulation LabHICEESimplified Timeline
08:20cscerqueira.com.br 26
Separation10min start
LEOP Housekeeping and Determination TM
Manouver& Ex. Release
TC
ExperimentTM
EOLPre-FlightTesting
LaunchOps
Mission Simulation LabHICEE
Mission Simulation LabHICEEList all possible CubeSat Events
08:20cscerqueira.com.br 27
Release Pin
10min LEOP timer
Charging/Antenna Release
Orientation Ok
Experiment Released ok
Receive Reset TC
Failure Occur
Failure Solved
Press Pin
Mission Simulation LabHICEE
Mission Simulation LabHICEESelect a few events to model
• ON
• OFF
Pin
• OFF
• OK
• FAILURE
Software
• NONE
• SERVICE
• PAYLOAD
• MANOUVER
• EOL
• END_HANDLE
Telecommand
08:20cscerqueira.com.br 28
2*3*6 = 36 states
All are possibles?All are feasibles?All should exist?All are achievables?
Mission Simulation LabHICEE
Mission Simulation LabHICEEStates
08:20cscerqueira.com.br 29
Failure
Pre-Lauch
Launch
LEOP
HandleServ. TC
HandleManouver
TC.
HandlePay. TC
Stand-By
EOL
Pin=off/cb=off
Pin=on/cb=start
SW=ok/cb=normal
SW=Fail/cb=checkSW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=ok/cb=normal
Tc=serv/cb=servHandle
Tc=aocs/cb=manHandle
Tc=serv/cb=servHandle
Tc=EOL/cb=eolHandle
Tc=endHandle|| timeout/cb=norm
Tc= endHandle|| timeout /cb=norm
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20 30
Events table:Pre-
FlightTesting
LaunchOps
LEOP Stand-by HandleService
TC
HandlePayload TC
HandleManouver
TC
EOL Failure
Pre-FlightTesting
x Pin = OFF
LaunchOps
x Pin = ON
LEOP x SW = OK SW = Failure
Stand-by x TC = serv
TC = pay TC = man TC = eol
SW = Failure
Handle Service TC
TC = endHandle|| timeout
x SW = Failure
Handle PayloadTC
TC = endHandle|| timeout
x SW = Failure
HandleManouver TC
TC = endHandle|| timeout
x SW = Failure
EOL x
Failure SW = OK x
Mission Simulation LabHICEE
Mission Simulation LabHICEE
OPM – ObjectProcess
Methodology
08:20 31
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEEPhase 0 – Concepts - OPM
• The Start
• What is OPM?!
• How to MEF?!
• Alfa Example
08:20cscerqueira.com.br 33
Mission Simulation LabHICEE
Mission Simulation LabHICEEThe start:
How do we explain ideas to each other?
•Grab a pen and piece of paper, or a chalk and blackboard
•Scribble shapes with names next to them
•While talking, run lines with or without arrows among the shapes
•Follow the reaction of the audience to see if idea is understood
•Answer questions, continue scribbling…
08:20 34
Mission Simulation LabHICEE
Mission Simulation LabHICEEThe start:
These “first” ideias Conceptual Modelling
•A systematic, formalized process of describing, specifying, designing or explaining ideas, systems, products or processes through a model
•Applicable to both:• Science – Studying what is known and what is missing to
satisfy human thirst for knowledge, and • Engineering – Designing systems to benefit humans,
based on sound scientific principles
•Science can be thought of as reverse engineering of nature
08:20 35
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM (Object-Process Methodology)
36
Prof. Dov Dori
Created in 2002
improving and showingit applicability
• A Single Diagram – Maps Behaviour and Structure• 2 Building Blocks and 10 basic relations• Designed to “Systemic View” and “Concept
Design”• Simulation Ready
• ~130 Pages standard• Published in late 2015• Intended to “Automation Systems and
Integration”• Has the “power” of a ISO seal.
Mission Simulation LabHICEE
Mission Simulation LabHICEE[Dori] Object-Process Theorem
Objects with states, processes andtheir relations among them constitutea necessary and sufficient universal
ontology to describe a system.
08:20cscerqueira.com.br 37
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEEThe start:
Theoretical Foundations
• Dual Channel Processing (visual and verbal)
• Limited Capacity – amount of human processing.
• Active Processing – learning occurs during active cognitive processing. (Simulation)
• Ontology: set of concepts for describing a domain
• Universal Ontology: a domain-independent set of concepts for describing systems.
08:20 38http://esml.iem.technion.ac.il/wp-content/uploads/2015/02/webinar_020915.pdf
Mission Simulation LabHICEE
Mission Simulation LabHICEE
• simple yet expressive, and
• intuitive yet formal
The Start:
08:20 39
Convert
Construct
Communicate
Concept
Models
fragmented knowledge intoexplicit and integratedknowledge
concise models
The model tostakeholders
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM’s only two building blocks:
08:20 40
Product
testing
not tested tested1. Objects with states2. Processes
All the other elements are relations between things, Expressed graphically as links
Mission Simulation LabHICEE
Mission Simulation LabHICEETwo simultaneous cognitive channels: visual-
OPD and textual-OPL
Diagram (OPD) Textual (OPL)
• Christopher is physical.Christopher knows OPM Theory.Christopher handles presenting.OPM consists of OPM Theory.presenting is physical.presenting consumes OPM Theory.presenting yields Presentation.
08:20cscerqueira.com.br 41
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEEMajors aspects of any system?
• Structure – the static aspect. What the system is made of. • Time-independent
• Behavior – the dynamic aspect. How the system changes over time.• Time-dependent
• Function – The utilitarian, subjective aspect.• Why is the system built?
• For whom is the system built?
• Who benefits from operating the system?
08:20 42
On
lyo
ne
Dia
gram
Typ
e
Mission Simulation LabHICEE
Mission Simulation LabHICEEStructural Links
08:20 43
StructuralRelational
Aggregation
Exhibition
Specialization
Instantiation
Mission Simulation LabHICEE
Mission Simulation LabHICEEBehaviour (Procedural Links)
08:20 44
Procedural
Transforming
• Consume
• Create
• Effect
Enabling
• Agent
• Instrument
Control
• Events
• Conditions
• Invocation
• Exceptions
Mission Simulation LabHICEE
Mission Simulation LabHICEEOther Mechanisms
Operators• Multiplicity
• Logical
Complexity
• Zoom-In – Zoom-Out
• Unfolding - Folding
• State expression –suppression
Simulation
08:20 45
“Models interrelation”
Mission Simulation LabHICEE
Mission Simulation LabHICEEExamples:
Object-Process Methodology and Its Application to the Visual Semantic Web
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 46
Mission Simulation LabHICEE
Mission Simulation LabHICEEBrief comparison: SysML and OPM
Feature SysML OPM
Theoretical Foundation UML; Object-Oriented Paradigm
Minimal Universal Ontology;Object-Process Theorem
Standard Documentationnumber of pages
1670 130
Standardization body OMG (2006) ISO (2015)
Number of diagram kinds 9 1
Graphic modality Yes Yes
Textual modality No Yes
Physical-Informatical Distinction No Yes
Systemic-Environmental Distinction
No Yes
08:20 47
Mission Simulation LabHICEE
Mission Simulation LabHICEEModelling Alfa’s State Behaviour
08:20cscerqueira.com.br 48
Mission Simulation LabHICEE
Mission Simulation LabHICEESimpler Example – Logics
08:20cscerqueira.com.br 49
p1 changes a from s1 to s2.
p2 changes a from s1 to s2.
Following path aa, p3 consumes s1 a.Following path bb, p3 consumes s2 a.p3 yields s3 a.
p4 changes a from s1 to s3.
Mission Simulation LabHICEE
Mission Simulation LabHICEESimpler Example – states of the water
08:20cscerqueira.com.br 50
Mission Simulation LabHICEE
Mission Simulation LabHICEEModelling Alfa’s State Behaviour
08:20cscerqueira.com.br 51
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 1/6
08:20cscerqueira.com.br 52https://www.research.ibm.com/haifa/info/ple/present/Dori-States-OPM-Statecharts.pdf
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 2/6
08:20cscerqueira.com.br 53
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 3/6
08:20cscerqueira.com.br 54
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 4/6
08:20cscerqueira.com.br 55
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 5/6
08:20cscerqueira.com.br 56
Mission Simulation LabHICEE
Mission Simulation LabHICEEOPM State Charts 6/6
08:20cscerqueira.com.br 57
Mission Simulation LabHICEE
Mission Simulation LabHICEEFormally
08:20 58
•OPM just turned to be a ISO standard. (15-Dec-2015)
•Already being looked by airspace companies ( EMBRAER / BOEING )
•Already being researched to Concurrent Engineering(Cambridge / INPE)• Knowledge Based Systems
•Simpler to implement than any UML/SysML specification.• Has direct compatibility with SysML models (back/forth) • Exports to Matlab (AUTOMATLAB)
•Dual Channel textual + visual • Extra third Channel simulation
• Personal touch:• More understandable than any UML-like to non-computer
specialists.End of Class 01
Mission Simulation LabHICEE
Mission Simulation LabHICEE
ARCADIA (SysML-Like)
08:20 59
Mission Simulation LabHICEE
Mission Simulation LabHICEEPhase 0/A – Concepts/Architecture - Arcadia
• What is?!
• How to MEF?!
• Alfa Example
08:20cscerqueira.com.br 60
Mission Simulation LabHICEE
Mission Simulation LabHICEEHistory of Object Oriented Modeling languages
08:20cscerqueira.com.br 61SysML 1.4
Mission Simulation LabHICEE
Mission Simulation LabHICEEUML – Unified Modelling Language
08:20cscerqueira.com.br 62
Mission Simulation LabHICEE
Mission Simulation LabHICEEAdaptation to Systemic Domain
08:20cscerqueira.com.br 63
Mission Simulation LabHICEE
Mission Simulation LabHICEESysML – System Modelling Language
08:20cscerqueira.com.br 64
Mission Simulation LabHICEE
Mission Simulation LabHICEESysML Diagram Branches
08:20cscerqueira.com.br 65
Mission Simulation LabHICEE
Mission Simulation LabHICEESysML
•Is a visual modelling language that provides•Semantics = meaning
•Notation = representation of meaning
•Is not•a methodology or a tool•SysML is methodology and tool independent
08:20cscerqueira.com.br 66http://www.omgsysml.org/INCOSE-OMGSysML-Tutorial-Final-090901.pdf
SysML
Mission Simulation LabHICEE
Mission Simulation LabHICEEPolarSys Proposal for MBSE
08:20cscerqueira.com.br 67
Mission Simulation LabHICEE
Mission Simulation LabHICEEArcadia / Capella
• Polarsys Group• Thales Alenia
• Phases 0 - C
• Capella is a layer above the Eclipse IDE, created using the Sirius and the Eclipse Modelling Framework (EMF)
• Diagrams: • operational
architecture,
• use cases,
• dataflow,
• architecture,
• logical,
• physical,
• tree,
• sequence,
• state,
• and classes 8:20 68https://www.polarsys.org/capella/
Mission Simulation LabHICEE
Mission Simulation LabHICEESystems Architecture Modeling with the Arcadia Method
A Practical Guide to Capella
08:20cscerqueira.com.br 69
ARCADIA - ARChitecture
Analysis and Design
Integrated Approach
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 70
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 71
Mission Simulation LabHICEE
Mission Simulation LabHICEEDiagram Examples
8:20 72
op
arc
log
tree
Mission Simulation LabHICEE
Mission Simulation LabHICEEMethodological Guidance
08:20cscerqueira.com.br 73
Define Stakeholder Needs and EnvironmentCapture and consolidate operational needs from stakeholders. Define what the users of the system have to accomplish Identify entities, actors, roles, activities, concepts
Formalize System RequirementsIdentify the boundary of the system, consolidate requirements. Define what the system has to accomplish for the users. Model functional dataflows and dynamic behaviour
Develop System Logical ArchitectureSee the system as a white box: define how the system will work so as to fulfill expectations Perform a first trade-off analysis
Develop System Physical ArchitectureHow the system will be developed and built Software vs. hardware allocation, specification of interfaces, deployment configurations, trade-off analysis
Formalize Component RequirementsManage industrial criteria and integration strategy: what is expected from each designer/sub-contractor. Specify requirements and interfaces of all configuration items
Mission Simulation LabHICEE
Mission Simulation LabHICEESpiral
08:20cscerqueira.com.br 74
ActorsEntitiesNeeds
Activities
Scenarios
MissionsCapabilities
Functions
ArchitectureFunctions
Components
SS
SS
Functions
Components
Operational Analysis
System Analysis
Logical Architecture
Physical Architecture
Modes & States
Arc
Architecture
Architecture
(Christopher)
Classes
Mission Simulation LabHICEE
Mission Simulation LabHICEESpiral
08:20cscerqueira.com.br 75
Operational Analysis
System Analysis
Logical Architecture
Physical Architecture
(Christopher)
Classes
[OEBD][OCB]
[OAB]
[OAIB] [OAS]
[OES]
[MB]
[MCB]
[SDFB]
[SAB]
[ES]
[FS]
[LFBD]
[LDFB]
[LCBD][LAB]
[ES]
[FS]
[M&S]
[PFBD]
[PDFB]
[PCBD][PAB]
[ES]
[FS]
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 76
Clock Radio Example
OperationalOAB - Entities and Activities
OEBD - Entities
System
SABs – Components, Functions and Exchanges
SDFBs – Functions and Exchanges
SM&S – Modes and States
SES – Entities Exchange Scenarios
SFC – Functional Chains
Logical
LABs – Components, Functions and Exchanges
LDFB – Data flows (functions and exchanges)
LFBD – Function Breakdown
LES – Exchange Scenarios
LFCD – Functional Chains...
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 77
1
Define Stakeholder Needs and EnvironmentCapture and consolidate operational needs from stakeholders. Define what the users of the system have to accomplish Identify entities, actors, roles, activities, concepts
2
Create Stkse needs
CreateActivities
CreateStates/Modes
DescribeEvents
Mission Simulation LabHICEE
Mission Simulation LabHICEEStates
08:20cscerqueira.com.br 78
Failure
Pre-Lauch
Launch
LEOP
HandleServ. TC
HandleManouver
TC.
HandlePay. TC
Stand-By
EOL
Pin=off/cb=off
Pin=on/cb=start
SW=ok/cb=normal
SW=Fail/cb=checkSW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=ok/cb=normal
Tc=serv/cb=servHandle
Tc=aocs/cb=manHandle
Tc=serv/cb=servHandle
Tc=EOL/cb=eolHandle
Tc=endHandle|| timeout/cb=norm
Tc= endHandle|| timeout /cb=norm
Mission Simulation LabHICEE
Mission Simulation LabHICEE
08:20cscerqueira.com.br 79
1
3
4
Formalize System RequirementsIdentify the boundary of the system, consolidate requirements. Define what the system has to accomplish for the users. Model functional dataflows and dynamic behaviour
Import fromOp. Analysis
Create the System and Allocate
functions
CreateStates/Modes
DescribeEvents
Mission Simulation LabHICEE
Mission Simulation LabHICEECapella Ecosystem
08:20cscerqueira.com.br 80
Mission Simulation LabHICEE
Mission Simulation LabHICEE
In Software Code
08:20 81
Mission Simulation LabHICEE
Mission Simulation LabHICEEPhase C – Code
• What is?!
• How to MEF?!
• Alfa Example
• Beyond...
08:20cscerqueira.com.br 82
Mission Simulation LabHICEE
Mission Simulation LabHICEEModel a Behaviour
08:20cscerqueira.com.br 83
http://gameprogrammingpatterns.com/state.html
Mission Simulation LabHICEE
Mission Simulation LabHICEEEnum and
Switch approach
08:20cscerqueira.com.br 84
enum State { STATE_STANDING, STATE_JUMPING, STATE_DUCKING, STATE_DIVING };
void Heroine::handleInput(Input input) {
switch (state_) {
case STATE_STANDING:
if (input == PRESS_B) { state_ = STATE_JUMPING;
yVelocity_ = JUMP_VELOCITY; setGraphics(IMAGE_JUMP);
} else if (input == PRESS_DOWN) {
state_ = STATE_DUCKING; setGraphics(IMAGE_DUCK);
} break;
case STATE_JUMPING:
if (input == PRESS_DOWN) {
state_ = STATE_DIVING; setGraphics(IMAGE_DIVE);
} break;
case STATE_DUCKING:
if (input == RELEASE_DOWN) {
state_ = STATE_STANDING; setGraphics(IMAGE_STAND);
} break;
}}
Mission Simulation LabHICEE
Mission Simulation LabHICEEObjects
08:20cscerqueira.com.br 85
class Heroine {
public:
virtual void handleInput(Input input);
virtual void update();
// Other methods...
private:
HeroineState* state_;
};
Mission Simulation LabHICEE
Mission Simulation LabHICEEState Design Pattern
08:20cscerqueira.com.br 86
Mission Simulation LabHICEE
Mission Simulation LabHICEEState Design Pattern
08:20cscerqueira.com.br 87
class Class Model
Heroine
+ handleInput(Input) :void
HeroineState
+ handleInput(Input) :void
+ update() :void
+ handleInput(Heroin&, Input) :HeroineState*
Ducking
+ handleInput(Input) :void
+ update() :void
+ handleInput(Heroin&, Input) :HeroineState*
Standing
+ handleInput(Input) :void
+ update() :void
+ handleInput(Heroin&, Input) :HeroineState*
Jumping
+ handleInput(Input) :void
+ update() :void
+ handleInput(Heroin&, Input) :HeroineState*
Div ing
+ handleInput(Input) :void
+ update() :void
+ handleInput(Heroin&, Input) :HeroineState*
Mission Simulation LabHICEE
Mission Simulation LabHICEETo control multiple things...
Concurrent StateCharts
08:20cscerqueira.com.br 88http://www.ni.com/tutorial/6194/en/
Mission Simulation LabHICEE
Mission Simulation LabHICEEStates and Concurrent FSMs
08:20cscerqueira.com.br 89
Alfa
Abstract SW State
Abstract Stateof something
....
HandServ
StandBy
HandPay
HandMan
HandEOL
Failure
Concurrent FSMs
Init
Mission Simulation LabHICEE
Mission Simulation LabHICEEBioSystems / Nano / Additive / IoT
8:20 90
Mission Simulation LabHICEE
Mission Simulation LabHICEENew motto
08:20cscerqueira.com.br 91
Mission Simulation LabHICEE
Mission Simulation LabHICEE
CTEE 9208:20
Mission Simulation LabHICEE
Mission Simulation LabHICEE
MATLAB / Simulink
08:20 93
Mission Simulation LabHICEE
Mission Simulation LabHICEEPhase B/C – Digital Design – Matlab/Simulink
• What is?!
• What is possible to model?!
• How to MEF?!
• Alfa Example
08:20cscerqueira.com.br 94
Mission Simulation LabHICEE
Mission Simulation LabHICEESimulink
• Modeling/designing dynamic systems (including nonlinear dynamics)
• Modeling/designing control systems (including nonlinear controllers and plants)
• Signal processing design/simulation
• Simulink runs under Matlab. First start Matlab, then type “simulink” at the Matlab prompt.
08:20cscerqueira.com.br 95http://emerald.tufts.edu/~rwhite07/PRESENTATIONS_REPORTS/simulink.pdfhttps://pt.slideshare.net/christophercerqueira/prj32christopher-aula-14-controle
Mission Simulation LabHICEE
Mission Simulation LabHICEEExample
• Ramp with control
• Wave with filter
• Subsystem all
08:20cscerqueira.com.br 96
Mission Simulation LabHICEE
Mission Simulation LabHICEEState flow
• sf_seqrec
08:20cscerqueira.com.br 97
Mission Simulation LabHICEE
Mission Simulation LabHICEESignal Source
08:20cscerqueira.com.br 98
Mission Simulation LabHICEE
Mission Simulation LabHICEEMoore
08:20cscerqueira.com.br 99
1121211213
Mission Simulation LabHICEE
Mission Simulation LabHICEEMealy
08:20cscerqueira.com.br 100
1121211213
Mission Simulation LabHICEE
Mission Simulation LabHICEEComparing
08:20cscerqueira.com.br 101
1121211213
Mission Simulation LabHICEE
Mission Simulation LabHICEEStates
08:20cscerqueira.com.br 102
Failure
Pre-Lauch
Launch
LEOP
HandleServ. TC
HandleManouver
TC.
HandlePay. TC
Stand-By
EOL
Pin=off/cb=off
Pin=on/cb=start
SW=ok/cb=normal
SW=Fail/cb=checkSW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=Fail/cb=check
SW=ok/cb=normal
Tc=serv/cb=servHandle
Tc=aocs/cb=manHandle
Tc=serv/cb=servHandle
Tc=EOL/cb=eolHandle
Tc=endHandle|| timeout/cb=norm
Tc= endHandle|| timeout /cb=norm
Mission Simulation LabHICEE
Mission Simulation LabHICEEWhich is done inside the SUD
08:20cscerqueira.com.br 103
HandServ
HandPay
HandMan
HandEOL
Failure
InitPin
TCsTMs
StandBy
Mission Simulation LabHICEE
Mission Simulation LabHICEEAlfa’s FSM in Matlab
08:20cscerqueira.com.br 104
Mission Simulation LabHICEE
Mission Simulation LabHICEESimulating
08:20cscerqueira.com.br 105
Mission Simulation LabHICEE
Mission Simulation LabHICEE
ARDUINO
08:20 106
Mission Simulation LabHICEE
Mission Simulation LabHICEEPhase C – Automatic Realization
• What is?!
• What is possible to model?!
• How to MEF?!
• Alfa Example
08:20cscerqueira.com.br 107
Mission Simulation LabHICEE
Mission Simulation LabHICEEARDUINO
08:20cscerqueira.com.br
Mission Simulation LabHICEE
Mission Simulation LabHICEEShields
08:20cscerqueira.com.brhttp://www.telecom.uff.br/pet/petws/downloads/tutoriais/arduino/Tut_Arduino.pdf
Mission Simulation LabHICEE
Mission Simulation LabHICEETesting
• Generate pulse
• Stop blinking via INPUT state pin
08:20cscerqueira.com.br 110
Mission Simulation LabHICEE
Mission Simulation LabHICEEExposing interfaces (stimuli/response) HW
08:20cscerqueira.com.br 111
Pin
TCsTMs
D2 – Pin
D3 – TC01D4 – TC02D5 – TC03D6 – TC04D7 – TC05D8 – TC06D9 – TC07
Blink pattern pin 13State -1 – failure : fastState 0 – init : offState 1 – stand : onState 2 – serv : oneState 3 – pay : twoState 4 – man : threeState 5 – eol : four
Mission Simulation LabHICEE
Mission Simulation LabHICEEExposing interfaces
08:20cscerqueira.com.br 112
Mission Simulation LabHICEE
Mission Simulation LabHICEEMicroprocessor x Microcontroller x Application
Processor
“only process”
dedicated task
generic
“Complete sollution toindustry”
Complete computationalarchitecture (memory, IOs)
Industry and automation
“Complete sollutionto enduser”
Complete computationalarchitecture(memory, IOs)
End user apps
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
Mission Simulation LabHICEE
WRAP-UP
08:20cscerqueira.com.br 115