Stateflow    

Control Logic of the "fuel rate controller" Model

The single Stateflow chart that implements the entire control logic for the fuelsys model is shown in the following diagram:

The chart consists of six parallel states with dashed boundaries that represent concurrent modes of operation.

The four parallel states at the top of the diagram correspond to the four individual sensors. Each of these states has a substate that represents the functioning or failing status of that sensor. These substates are mutually exclusive. For example, if the throttle sensor fails then the lone active substate of the Throttle_Sensor_Mode state is throt_fail.

Transitions determine how states can change and can be guarded by conditions. For example, the active state can change from the throt_norm state to the throt_fail state when the measurement from the throttle sensor exceeds max_throt or is below min_throt.

The remaining two parallel states at the bottom consider the status of the four sensors simultaneously and determine the overall system operating mode. The Sens_Failure_Counter superstate acts as a store for the resultant number of sensor failures. This state is polled by the Fueling_Mode state that determines the fueling mode of the engine. If a single sensor fails, operation continues but the air/fuel mixture is richer to allow smoother running at the cost of higher emissions. If more than one sensor has failed, the engine shuts down as a safety measure, because the air/fuel ratio cannot be controlled reliably.

Although it is possible to run Stateflow charts asynchronously by injecting events from Simulink when required, the fueling control logic is polled synchronously at a rate of 100 Hz. Consequently, the sensors are checked every 1/100 second to see if they have changed status, and the fueling mode is adjusted accordingly.


  Overview of the "fuel rate controller" Model Simulating the "fuel rate controller" Model