Gear Shift Indicator using Stateflow
Aim:
Make a Simulink chart for the 'Gear shift' logic as per given conditions.
Conditions:
Speed Range(kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5
Components in Model:
- Chart
- Custom gauge
- Rocker Switch
- Display
- Slider
- Terminator
Model Explanation:
A chart was prepared which contained all the logical conditions related to speed ranges and respective gear ratios. Prior to that a base state was created and conditions for engine on and off was created. The chart takes a whole of 2 inputs, one the speed (linked to input variable x) and the other Kill Switch condition (linked to input variable ig). The control will only pass to the Gear_0 state if and only if the engine is on. The engine can be switched on and off through a rocker switch. The Engine Kill Switch (rocker switch) is linked to the variable named 'kill', while the Speedometer(Custom Gauge) and Slider is linked to variable named 'throttle'. The variables kill and throttle passes the values to ig and x respectively.
Logical conditions are defined with respect to the given speed ranges and the chart is prepared as shown below.
The chart takes speed and engine on/off condition as input and displays the corresponding gear position as output (wrt speed). The output signal from the chart is linked to a display so as to dsiplay different gear positions wrt to different speed ranges. The Custom gauge is also customised to show an economy and high speed warning region. The throttle value can be changed real time using the slider (linked to throttle variable).
Results:
Case 1: Kill Switch Off
Case 2: Kill Switch On. Speed 10 kmph
Case 3: Kill Switch On. Speed 20 kmph
Case 4: Kill Switch On. Speed 40 kmph
Case 5: Kill Switch On. Speed 50 kmph
Case 6: Kill Switch On. Speed 70 kmph