Table of Contents
Modeling Software with Finite State Machines: A Practical Approach
Part I - The Problems of Software
1. Evolution of Software Development
- Introduction
- Programming Languages
- A Little History, BASIC Catastrophe, C++, PLC, Script or Macro Notations, There Are Many Languages
- Methods
- Basic Knowledge, Specifying or Not? CASE Tools, UML, Agile Methods, Behavior Modeling
- Development Tools
- Recommended Reading
2. The Price of Weakness
- Software Development Costs
- Programming as a Hobby, Small Software Projects, Large Software Projects, Hardness of Software, Ease of Creating New Macro Languages, Do We Need So Many Programming Languages? The Specifics of Programming Languages, The Specifics of a Software Project, Software Is Expensive
- Maintenance Costs
- Software Errors, Software Changes, In Code We Trust, The Costs of Software Errors
- The Programmers’ World
- A Programmer in a Project, The Software Project Leader
- Examples of Disasters
- Recommended Reading
3. Software as Engineering?
- Methods
- Fascination with Graphics, Visual Basic Chaos, Object-Oriented Design Illusion, UML Illusion, Formal Methods, CASE Tools — Value for Money? Programming or Specification Languages?
- Development Cycle
- Prototyping, Specification, Software Development Steps, Software Documentation, Testing and Debugging, Maintenance and Support, Human Factors, Summary
- Education Requirements
- Who Is a Programmer? Education as the Basis of Skill, Missing Skill — Examples
- Conclusions
- Recommended Reading
Part II - Finite State Machines
4. Introduction, Definitions, and Notation
- Finite State Machine
- State Machine Models and Presentations
- Transition Matrix, State Transition Diagram, Outputs (Actions), Moore and Mealy Model, State Transition Table, Example
- Recommended Reading
5. Hardware Applications
- Introduction
- Limited to Boolean Signals, Design Example — Traffic Light Control, EPROM-Based Implementations, FPLA- or CPLD-Based Implementations, Conclusions, Recommended Reading
6. Software Specific
- Introduction
- Data and Control Flow
- Any Class of Signal May “Contain” the Control Value
- Digital Input Command Input Numerical Input Parameter Data Processing Result Timer State Machine External and Internal Signals What about Outputs? Digital Output Command Output Numerical Output Data Processing Output Timer Summary
- Event Driven Software
- Event as a Control Signal
- State Machine or Combinational System?
- Models of a Finite State Machine
- Application-Based State Machine Models State Machine Execution Models
- Coding as a Universal Solution
- Table-Driven Software to Reduce Coding Effort
- Limits of the Coded Solutions
- Recommended Reading
7. Misunderstandings about FSM
- Historical Background
- Software Systems
- Event-Driven Model Parser Problem State Explosion Signal Lifetime State Machine Size Interface between State Machines
- A Flowchart Is Not a State Machine
- Flowchart Example What Is a Flowchart For?
- Inventions
- Conclusions
- Recommended Reading
8. Designing a State Machine
- A State Machine Models Behavior
- Mealy or Moore Models
- Actions (Entry, Input, Exit, Transition)
- Defining States
- Acknowledgment Principle (Busy and Done States)
- The Role of a Timer
- Error States and Alarms
- Completeness of the Design
- Hiding Control Information
- Example — Pedestrian Traffic Lights
- The Requirements The Specification The Specification Must Be Understandable
- Example — Pressure Supervision
- The Requirements The Specification The Output Function The State Transition Diagram
- Conclusions
9. Systems of State Machines
- Mastering Complexity
- The Partitioning Criteria
- The Communication Interface among State Machines
- The Handshaking Rule
- The (Hierarchical) Structure of the Control System
- Design Procedure
- Locality of the Control Problems Up-Down or Bottom-Up Design Deadlocks Loops Sins Design Rules
- Example — Pumps Supervision System
- Task Definition The First Approach The Second Trial The Ultimate Solution
- Example — Traffic Light Control
- Task Definition “Obvious” Solution The Ultimate Control Light TrafficLight Flash System for Two-Track Railway Summary
- Conclusions
- Implementation Designing a State Machine Designing a System of State Machines
Part III - StateWORKS: Principles and Practice
10. StateWORKS
- Virtual Environment and Vfsm
- The StateWORKS Development Environment
- Positive Logic Algebra The Vfsm Execution Model Objects State Machine Defines Object Control Values Signal Lifetime Behavior Specification System Specification
- The StateWORKS Execution Environment
- RTDB-Based Runtime System Output Function I/O Handler User Interface
- Recommended Reading
11. Digital Input and Output
- A Digital Input Has Three Control Values
- Example
- Setting and Clearing the Boolean Output Are Two Different Actions
- DI and DO Properties
- Recommended Reading
12. Other Inputs
- Input Data (DAT)
- Control Values Example Properties
- Getting the Control Value (SWIP)
- Actions Control Values Example Properties
- NI Object as an Extension of DAT Type
- Control Values Properties
- PAR Object as a Specific Variant of DAT Type
- Control Values Properties
- Strings (STR) as a Specific Variant of SWIP
- Actions Control Values Example Properties
- Recommended Reading
13. Other Outputs
- Output Data (NO)
- Actions Example Properties
- Output Demultiplexer (TAB)
- Actions Example
- Alarms (AL)
- Actions Properties Example
- Recommended Reading
14. Counters
- A Simple Counter (CNT)
- Actions Control Values Example Properties
- An Event Counter (ECNT)
- Example Properties
- A Timer (TI)
- Properties
- An Up/Down Counter (UDC)
- Actions Control Values Properties Example
- Recommended Reading
15. VFSM and Its Interfaces
- Virtual Finite State Machine Interfaces
- A Virtual Finite State Machine (VFSM)
- Hiding Specification Details
- A Command (CMD)
- Properties
- An Interface to I/O Handler (UNIT)
- An Interface to a User-Written Function (OFUN)
- Example Properties
- Just XDA
- Memory for OFUN Internal Value as a Control Value
- Recommended Reading
16. Debugging Vfsm
- Testing Vfsm Application
- System Consistency
- Trace
- Debugging Mode (VFSM)
- Command Files
- Service Mode
- The Role of Documentation
17. What Is StateWORKS?
- Compared with Specification Methods
- Compared with Agile Methods
- Application Areas
- Recommended Reading
- Appendix A. Case Studies
- Appendix B. Microwave Oven Control — Use of StateWORKS Development Tools
- Appendix C. Control — Hierarchical System of State Machines
- Appendix D. Dining Philosophers Problem Example
- Appendix E. Going Beyond the Limitations of IEC 61131-3
- Appendix F. Traffic Light Control — Design of the Hardware Solution
- Appendix G. Coding Finite State Machine — Vending Machine Counter Example
- Appendix H. IOD File of the StandardUnit
- Appendix I. StateWORKS Projects
- Appendix J. Vending Machine Counter Project
- Appendix K. Pedestrian Traffic Light Project
- Appendix L. Pumps Supervision Project
- Appendix M. Output Function CalcLimits()
- Appendix N. Traffic Light Project
- Appendix O. DI_DO Project
- Appendix P. Other_Inputs Project
- Appendix Q. Other_Outputs Project
- Appendix R. Counters Project
- Appendix S. Attributes of RTDB Objects
- Appendix T. StateWORKS Tools and Components
- Index