SlideShare a Scribd company logo
3
Most read
12
Most read
17
Most read
1
Stateflow Workshop for System Engineers
Roni Peer
Systems and Applications Engineer
Systematics, Ltd.
ronip@systematics.co.il
2
‫סיסטמטיקס‬–‫נציגת‬MathWorks‫בישראל‬
‫משווקת‬ ‫סיסטמטיקס‬,‫ותומכת‬ ‫מיישמת‬,‫הישראלי‬ ‫לשוק‬ ‫ייעודיים‬ ‫מחשוב‬ ‫בפתרונות‬.
‫קורסים‬ ‫מגוון‬,‫והכשרות‬ ‫הדרכות‬
‫וייעוץ‬ ‫הטמעה‬ ‫פרוייקטי‬
‫מרחוק‬ ‫ובסיוע‬ ‫הלקוח‬ ‫באתר‬ ‫מלאה‬ ‫טכנית‬ ‫תמיכה‬
‫הלקוח‬ ‫לצורכי‬ ‫המוצרים‬ ‫והתאמת‬ ‫מכירה‬ ‫לפני‬ ‫ייעוץ‬
ESRI, ENVI, NAVTEQ
eMap, GeoEye, LizardTech
SolidWorks
MathWorks Oracle Agile PLM
Open Text RightFax
3
Mechanical
Components
MCAD/
MCAE
Electrical
Components
EDA
INTEGRATION AND TEST
SPECIFICATIONS
DESIGN
RESEARCH REQUIREMENTS
Embedded
Software
C/C++
IMPLEMENTATION
Requirement Documents
• Difficult to analyze
• Difficult to manage as they change
Paper Specifications
• Easy to misinterpret
• Difficult to integrate with design
Physical Prototypes
• Incomplete and expensive
• Prevents rapid iteration
• No system-level testing
Manual Coding
• Time consuming
• Introduces defects and variance
• Difficult to reuse
Traditional Testing
• Design and integration issues found late
• Difficult to feed insights back into design
process
• Traceability
Embeddable
Algorithms
Algorithm
Design
Traditional Development
4
DESIGN
Embedded
Software
Control
Algorithms
Mechanical
Components
Electrical
Components
Model-Based Design- Describe the system dynamics
Model-Based Design uses
block diagrams to
mathematically model the
system behavior.
You design the way the system
should perform.
5
Model-Based Design- Design and test using simulation
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Requirements are linked to the
model.
Detail is added from specific
domains to refine the model.
Intellectual property and
engineering data are reused
from existing designs and CAE
tools, such as CAD, FEA, and
SPICE models.
Testing control algorithms
against requirements is done
by simulating the model.
RESEARCH REQUIREMENTS
6
REAL-TIME TESTING
Model-Based Design- Test and validate in real-time
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Automatically generate code
from the simulation model for
real-time testing of the control
algorithms.
RESEARCH REQUIREMENTS
Automatically generate code
from the simulation model for
real-time system simulation of
hardware for testing the real
microcontroller, FPGA, or PLC
MCU DSP FPGA ASIC
Structured
Text
VHDL,
Verilog
C, C++
PLC
7
INTEGRATION
IMPLEMENTATION
TEST&VERIFICATION
Model-Based Design- Implement embedded software
DESIGN
Environmental Models
Control Algorithms
Mechanical Electrical
Supervisory Logic
Automatically generate code
from the simulation model for
implementing directly on
production targets:
• Microcontrollers
• FPGAs
• PLC IDEs
RESEARCH REQUIREMENTS
MCU DSP FPGA ASIC
Structured
Text
VHDL,
Verilog
C, C++
PLC
8
 Provides a CAE solution for
multidomain system-level
development of embedded
controllers
 Uses a simulation model to
mathematically describe the system-
level behavior of complex equipment
 Automatically generates code from
the model to help you with real-time
testing and with implementation
 Lets you test continuously
throughout the development process
Model-Based Design Summary
Design
with
Simulation
Executable
Specifications
Continuous
Test and
Verification
Automatic
Code Generation
Models
9
What is Stateflow?
 Model and simulate decision
logic
 Develop mode-logic using
state machines and flow charts
 See how the logic behaves
with diagram animation and
integrated debugger
10
How does Stateflow work with Simulink?
Simulink is used to respond to
continuous changes in
dynamic systems.
Stateflow is used to respond to
instantaneous changes in
dynamic systems.
Real-world systems have to respond to both continuous and
instantaneous changes.
suspension dynamics
gear changes
propulsion system
liftoff stages
robot kinematics
operation modes
Use both Simulink and Stateflow so that you can
use the right tool for the right job.
11
What Can You Do with Stateflow® Software?
Truth table
State machineComplex decision flow
12
Why use Stateflow?
 Model modes of operation clearly
with state machines in Stateflow
 Represent complex conditional and
event based logic with flow charts
in Stateflow
 Understand behavior of logic easily
with animation and integrated
debugger in Stateflow
 Test and Verify your design using
Model-Based Design tools before
implementation
13
Stateflow Example
14
Stateflow Review
 STATES represent modes of operation
– Exclusive States (OR)
– Parallel States (AND)
 TRANSITIONS represent paths between states
 Types of functions supported:
– Graphical
– MATLAB
– Simulink
– Truth Tables
15
State Labeling Syntax
State name (mandatory)
State actions (optional)
• entry – Executes upon entering the
state
• exit – Executes upon exiting the
state
• during – Executes when the state
starts out as active and remains
active (no transition occurs)
16
Transition Labeling Syntax
• Comments can be placed
anywhere
• All other sections must
remain in order shown
Enclosed in
/* */
Enclosed in
[ ]
Enclosed in
{ }
Preceded by
/
17
Superstates and Substates
Ungrouped
Grouped
Add states into
a parent state
Double-click border to group contents
of the superstate
18
Parallel State Charts
Failure determination
Mode logic
19
Model Coverage & Automatic Test Cases
 Execution analysis
– Based on the model structure
– Dynamic – data collected during
simulation
 Coverage results
– Displayed directly in the model
– Available in a separate html
report linked with the model
objects
 Supports:
– Simulink
– Stateflow
– MATLAB
Decision coverage
Condition coverage
MC/DC
Lookup table coverage
Signal range coverage
Supported coverage types
20
Summary
 Model-Based Design provides an efficient and smooth
solution to design, test and implement Systems
 State machines and flow charts in Stateflow clearly
represent logic
 With Model-Based Design, you continuously test to
check that the design meets requirements

More Related Content

PPT
PDF
Control system Lab record
PPT
Chapter 8 Root Locus Techniques
PPTX
UNIT 1 CSE NEW.PPTX
PDF
Analysis and Design of PID controller with control parameters in MATLAB and S...
PPTX
Root locus method
PDF
BEC 26 control-Systems_unit-I_pdf
PPT
Simulink
Control system Lab record
Chapter 8 Root Locus Techniques
UNIT 1 CSE NEW.PPTX
Analysis and Design of PID controller with control parameters in MATLAB and S...
Root locus method
BEC 26 control-Systems_unit-I_pdf
Simulink

What's hot (20)

PPT
PLC Basic
PPT
SIEMENS S7-300c.ppt
PDF
Automotive engineering design - Model Based Design
PPTX
Tinkercad Workshop PPT, Dept. of ECE.pptx
PDF
Programmable logic controller - Siemens S7-1200
DOCX
Plc notes
PPTX
ppt on PLC automation
PDF
DCS Or PLC
PPTX
PPT on INDUSTRIAL AUTOMATION, PLC, SCADA
DOCX
Hardware-Software Codesign
PPTX
Automation(plc&scada)
PDF
Microcontroller pic 16f877 architecture and basics
PPTX
Power point presentation on Industrial Automation
PPTX
Plc example presentation
PPTX
Industrial Automation
DOCX
simulink
PPTX
INDUSTRIAL AUTOMATION USING PLC
PPTX
Embedded c
PPTX
Troubleshooting in plc
PLC Basic
SIEMENS S7-300c.ppt
Automotive engineering design - Model Based Design
Tinkercad Workshop PPT, Dept. of ECE.pptx
Programmable logic controller - Siemens S7-1200
Plc notes
ppt on PLC automation
DCS Or PLC
PPT on INDUSTRIAL AUTOMATION, PLC, SCADA
Hardware-Software Codesign
Automation(plc&scada)
Microcontroller pic 16f877 architecture and basics
Power point presentation on Industrial Automation
Plc example presentation
Industrial Automation
simulink
INDUSTRIAL AUTOMATION USING PLC
Embedded c
Troubleshooting in plc
Ad

Similar to Simulink Stateflow workshop (20)

PPTX
Innovate with confidence – Functional Verification of Embedded Algorithms
PDF
Project P erts2012
PDF
modelling-and-simulation-made-easy-with-simulink.pdf
PDF
Testing of Cyber-Physical Systems: Diversity-driven Strategies
PPT
The embedded systems Model
PDF
Presentation Verification & Validation
PDF
Introduction to Stateflow with Applications 1st Edition Steven T. Karris
PDF
Cyber Physical Systems – Collaborating Systems of Systems
PDF
teaching-chemical-engineering-with-matlab-simulink-and-tclab.pdf
PPTX
Model based design-Hardware in loop-software in loop
PDF
MIL_SIL.pdf
PDF
Making Model-Driven Verification Practical and Scalable: Experiences and Less...
PDF
MATLAB and Simulink for Communications System Design (Design Conference 2013)
PDF
The Art of Applied Engineering - An Overview
PDF
introduction-to-control-systDJKFNJKDSFJSD
PDF
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
PPTX
Tech Days 2015: Model Based Development with QGen
PDF
Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers
PDF
Introduction to Stateflow with Applications 1st Edition Steven T. Karris
PPT
Embedded system
Innovate with confidence – Functional Verification of Embedded Algorithms
Project P erts2012
modelling-and-simulation-made-easy-with-simulink.pdf
Testing of Cyber-Physical Systems: Diversity-driven Strategies
The embedded systems Model
Presentation Verification & Validation
Introduction to Stateflow with Applications 1st Edition Steven T. Karris
Cyber Physical Systems – Collaborating Systems of Systems
teaching-chemical-engineering-with-matlab-simulink-and-tclab.pdf
Model based design-Hardware in loop-software in loop
MIL_SIL.pdf
Making Model-Driven Verification Practical and Scalable: Experiences and Less...
MATLAB and Simulink for Communications System Design (Design Conference 2013)
The Art of Applied Engineering - An Overview
introduction-to-control-systDJKFNJKDSFJSD
Accelerating the Pace of Engineering Education with Simulation, Hardware and ...
Tech Days 2015: Model Based Development with QGen
Effective Test Suites for ! Mixed Discrete-Continuous Stateflow Controllers
Introduction to Stateflow with Applications 1st Edition Steven T. Karris
Embedded system
Ad

Recently uploaded (20)

PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPT
Project quality management in manufacturing
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
OOP with Java - Java Introduction (Basics)
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
additive manufacturing of ss316l using mig welding
PDF
composite construction of structures.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Project quality management in manufacturing
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
OOP with Java - Java Introduction (Basics)
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CH1 Production IntroductoryConcepts.pptx
additive manufacturing of ss316l using mig welding
composite construction of structures.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Foundation to blockchain - A guide to Blockchain Tech
bas. eng. economics group 4 presentation 1.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CYBER-CRIMES AND SECURITY A guide to understanding

Simulink Stateflow workshop

  • 1. 1 Stateflow Workshop for System Engineers Roni Peer Systems and Applications Engineer Systematics, Ltd. ronip@systematics.co.il
  • 2. 2 ‫סיסטמטיקס‬–‫נציגת‬MathWorks‫בישראל‬ ‫משווקת‬ ‫סיסטמטיקס‬,‫ותומכת‬ ‫מיישמת‬,‫הישראלי‬ ‫לשוק‬ ‫ייעודיים‬ ‫מחשוב‬ ‫בפתרונות‬. ‫קורסים‬ ‫מגוון‬,‫והכשרות‬ ‫הדרכות‬ ‫וייעוץ‬ ‫הטמעה‬ ‫פרוייקטי‬ ‫מרחוק‬ ‫ובסיוע‬ ‫הלקוח‬ ‫באתר‬ ‫מלאה‬ ‫טכנית‬ ‫תמיכה‬ ‫הלקוח‬ ‫לצורכי‬ ‫המוצרים‬ ‫והתאמת‬ ‫מכירה‬ ‫לפני‬ ‫ייעוץ‬ ESRI, ENVI, NAVTEQ eMap, GeoEye, LizardTech SolidWorks MathWorks Oracle Agile PLM Open Text RightFax
  • 3. 3 Mechanical Components MCAD/ MCAE Electrical Components EDA INTEGRATION AND TEST SPECIFICATIONS DESIGN RESEARCH REQUIREMENTS Embedded Software C/C++ IMPLEMENTATION Requirement Documents • Difficult to analyze • Difficult to manage as they change Paper Specifications • Easy to misinterpret • Difficult to integrate with design Physical Prototypes • Incomplete and expensive • Prevents rapid iteration • No system-level testing Manual Coding • Time consuming • Introduces defects and variance • Difficult to reuse Traditional Testing • Design and integration issues found late • Difficult to feed insights back into design process • Traceability Embeddable Algorithms Algorithm Design Traditional Development
  • 4. 4 DESIGN Embedded Software Control Algorithms Mechanical Components Electrical Components Model-Based Design- Describe the system dynamics Model-Based Design uses block diagrams to mathematically model the system behavior. You design the way the system should perform.
  • 5. 5 Model-Based Design- Design and test using simulation DESIGN Environmental Models Control Algorithms Mechanical Electrical Supervisory Logic Requirements are linked to the model. Detail is added from specific domains to refine the model. Intellectual property and engineering data are reused from existing designs and CAE tools, such as CAD, FEA, and SPICE models. Testing control algorithms against requirements is done by simulating the model. RESEARCH REQUIREMENTS
  • 6. 6 REAL-TIME TESTING Model-Based Design- Test and validate in real-time DESIGN Environmental Models Control Algorithms Mechanical Electrical Supervisory Logic Automatically generate code from the simulation model for real-time testing of the control algorithms. RESEARCH REQUIREMENTS Automatically generate code from the simulation model for real-time system simulation of hardware for testing the real microcontroller, FPGA, or PLC MCU DSP FPGA ASIC Structured Text VHDL, Verilog C, C++ PLC
  • 7. 7 INTEGRATION IMPLEMENTATION TEST&VERIFICATION Model-Based Design- Implement embedded software DESIGN Environmental Models Control Algorithms Mechanical Electrical Supervisory Logic Automatically generate code from the simulation model for implementing directly on production targets: • Microcontrollers • FPGAs • PLC IDEs RESEARCH REQUIREMENTS MCU DSP FPGA ASIC Structured Text VHDL, Verilog C, C++ PLC
  • 8. 8  Provides a CAE solution for multidomain system-level development of embedded controllers  Uses a simulation model to mathematically describe the system- level behavior of complex equipment  Automatically generates code from the model to help you with real-time testing and with implementation  Lets you test continuously throughout the development process Model-Based Design Summary Design with Simulation Executable Specifications Continuous Test and Verification Automatic Code Generation Models
  • 9. 9 What is Stateflow?  Model and simulate decision logic  Develop mode-logic using state machines and flow charts  See how the logic behaves with diagram animation and integrated debugger
  • 10. 10 How does Stateflow work with Simulink? Simulink is used to respond to continuous changes in dynamic systems. Stateflow is used to respond to instantaneous changes in dynamic systems. Real-world systems have to respond to both continuous and instantaneous changes. suspension dynamics gear changes propulsion system liftoff stages robot kinematics operation modes Use both Simulink and Stateflow so that you can use the right tool for the right job.
  • 11. 11 What Can You Do with Stateflow® Software? Truth table State machineComplex decision flow
  • 12. 12 Why use Stateflow?  Model modes of operation clearly with state machines in Stateflow  Represent complex conditional and event based logic with flow charts in Stateflow  Understand behavior of logic easily with animation and integrated debugger in Stateflow  Test and Verify your design using Model-Based Design tools before implementation
  • 14. 14 Stateflow Review  STATES represent modes of operation – Exclusive States (OR) – Parallel States (AND)  TRANSITIONS represent paths between states  Types of functions supported: – Graphical – MATLAB – Simulink – Truth Tables
  • 15. 15 State Labeling Syntax State name (mandatory) State actions (optional) • entry – Executes upon entering the state • exit – Executes upon exiting the state • during – Executes when the state starts out as active and remains active (no transition occurs)
  • 16. 16 Transition Labeling Syntax • Comments can be placed anywhere • All other sections must remain in order shown Enclosed in /* */ Enclosed in [ ] Enclosed in { } Preceded by /
  • 17. 17 Superstates and Substates Ungrouped Grouped Add states into a parent state Double-click border to group contents of the superstate
  • 18. 18 Parallel State Charts Failure determination Mode logic
  • 19. 19 Model Coverage & Automatic Test Cases  Execution analysis – Based on the model structure – Dynamic – data collected during simulation  Coverage results – Displayed directly in the model – Available in a separate html report linked with the model objects  Supports: – Simulink – Stateflow – MATLAB Decision coverage Condition coverage MC/DC Lookup table coverage Signal range coverage Supported coverage types
  • 20. 20 Summary  Model-Based Design provides an efficient and smooth solution to design, test and implement Systems  State machines and flow charts in Stateflow clearly represent logic  With Model-Based Design, you continuously test to check that the design meets requirements