understanding complex logic with stateflow video -凯发k8网页登录
a fuel control system is a critical component of an engine. ensuring the engine operates reliably requires a controller that is tolerant to sensor failures. designing such a controller involves keeping track of multiple sensor states and determining the fuel mode based on which or how many sensors have failed.
stateflow® has graphical programming features that will help you model interconnected and complex logic in a clear and concise manner. its visual tools provide a powerful way to understand the behavior of complex systems. with the help of a dashboard, you can interact with the model during simulation to see how it responds to different inputs without having to first set up an input signal, letting you quickly build an intuition for the behavior of your system.
stateflow highlights states in blue during execution to show which ones are active, making it easy to track sequences of decisions. changing the speed lets you pay closer attention to the details as you follow along. data syntax highlighting colors variables in the chart according to their functional role. at a glance, you can tell which variables are inputs, outputs, or local data, improving clarity and traceability.
stateflow provides powerful tools for modelling complex logic. this video will show you how to use its visual programming features to better understand the behavior of your system.
this chart models the logic for fault detection and handling of a fuel rate control system and can be divided into three parts. the four parallel subcharts at the top keep track of the state of each individual sensor; the superstate in the middle counts how many of the sensors have failed; and the superstate at the bottom determines the fuel mode of the system based on which sensors have failed. the complexity in this chart comes from the interdependence of these parallel states and their respective child states.
this dashboard can be used to control the fail state for each of the sensors, as well as the engine speed. interacting with the panel during simulation is a great way to explore the logic of the system.
to access this model, follow the first link below this video or execute this command in the matlab command window.
while the model is running, stateflow displays the chart execution by highlighting in blue the active states and executed transitions. by default, this is shown very quickly. change the execution speed in the debug tab for a more detailed look.
state highlighting provides immediate feedback to actions taken in the model and allows you to follow the logic as the simulation progresses.
the algorithm in this chart uses the number of failed sensors to determine the operating mode of the fuel system. now that all sensors are working, the mixture runs lean and the ‘fuel_mode’ symbol is set to ‘low’.
when one of the sensors fails, the failure counter moves to ‘one’, making the ‘fueling mode’ superstate transition from ‘normal’ to ‘single failure’ and the mixture now runs rich. you can verify this by hovering your mouse over any instance of the ‘fuel_mode’ symbol. failing another sensor increases the failure counter, resulting in the ‘fueling mode’ superstate taking another transition. this disables fuel injection, and the engine is shut down.
there is another state that also leads to fuel injection being disabled: ‘overspeed’. how would you get there?
the transition going into ‘overspeed’ compares two symbols. for more clarity on their role in the chart, enable data syntax highlighting, which gives a different font color to each type of symbol. now it is easy to tell that ‘es_i’ is an input to the chart, and ‘max_speed’ is a model parameter.
to get to ‘overspeed’, first remove all failures to start from normal operation. the transition going into ‘overspeed’ checks if the input speed is above the maximum. increasing the speed in the dashboard gives the desired result.
this fuel rate control system shows how stateflow can model complex and interconnected logic in a clear and condensed manner. its visual tools provide a powerful way to understand complex systems.
for more information on modelling and understanding logic with stateflow, visit the ‘get started’ page linked below.
related products
learn more
featured product
stateflow
up next:
related videos:
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 mathworks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- (español)
- (english)
- (english)
欧洲
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
亚太
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)