Tutorial state flow

Páginas: 19 (4702 palabras) Publicado: 6 de noviembre de 2010
Systems modelling with Stateflow 20/11/2006

Behaviour modelling with Stateflow/Simulink
The aim of this tutorial is: • To get insight into the usefulness of developing an executable specification, allowing questions such as the following ones to be answered: o Is the specification complete? o Is this behaviour really what I (and/or the person who ordered the system) want the system to do? •To get hands-on experience with the graphical modelling of state machines, being similar to programming, but performed on a higher abstraction level. We will use the Simulink add-on, Stateflow for these purposes. To illustrate how continuous time dynamics models can be simulated jointly with the logic of state machines. To illustrate that the logic part of a stateflow chart can be event- ortime-triggered.

• •

This document gives you an introduction to and overview of the work part of the tutorial. You will be exposed to the following tools: • • Simulink Stateflow

Stateflow is an interactive graphical design tool that works with Simulink to model and simulate event-driven systems, also called reactive systems. Event-driven systems transition from one operating mode to another inresponse to events and conditions. The corresponding systems are called discrete-event dynamic systems, as opposed to discretetime dynamic systems – the term used for sampled data systems. Discrete-event dynamic systems are often used to model logic for controlling a physical device such as a fan, motor, or pump. Event-driven systems can be modeled as finite-state machines. Finite-state machinesrepresent operating modes as states. For example, a house fan can have states such as High, Medium, Low, and Off. To construct finite-state machines, Stateflow provides graphical objects that you can drag and drop from a design palette to create state-transition charts in which a series of transitions directs a flow of logic from one state to another. In this tutorial, you will learn how to develop asimple model including a Stateflow chart in the Simulink environment. It is common for embedded systems to include lots of logic (modes of operation) together with control systems code. Using Stateflow and Simulink, it is possible to model these two aspects more conveniently (logic is more cumbersome to describe by only using Simulink). The tutorial will illustrate the process of creating,changing and debugging your model. Try to answer the questions posed as they will give you more insight into the environment. First quickly skim through the complete tutorial – then go to work!

1 4F1908 – Embedded Control Systems

Systems modelling with Stateflow 20/11/2006

1 The specification
This specification roughly corresponds to the behaviour of an electronically heated car seat. Theheating of the seat is controlled by a button which has three positions; {neutral, half, full}, see Figure 1. The button is always in the neutral position if is not pushed because of two springs. The left part of the button is marked with an H. If this part is pushed, this means that 50% heating should be applied to the seat. The right hand part of the button is marked with an F. If this part ispushed, the seat should by fully heated (100%).

H Spring

F Spring

If 50% heating is applied to the seat, pushing H once more should stop the heating, whereas pushing F should result in 100% heating. If 100% heating is applied to the seat, pushing F once more should stop the heating, whereas pushing H should result in 50% heating. Question: Consider the above specification – do you consider itto be complete? We will come back to this issue during the tutorial.

2 Introduction to Stateflow
What is a Stateflow chart? Figure 2 shows an example which models as a finite-state machine the logic required to shift gears in an automatic transmission system of a car.

2 4F1908 – Embedded Control Systems

Systems modelling with Stateflow 20/11/2006 Notice the following details in this...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Mold flow tutorial
  • Tutorial Introducción De Datos En Stata
  • Tutorial stata
  • Tren electrico state flow
  • Flow
  • Stata
  • flow

Conviértase en miembro formal de Buenas Tareas