Implementation of Control Logic for (changing Torque) Gear Shift Using StateFlow.
AIM :-
Create the StateFlow for Gear shift and vary the Speed as Input and obtain the Output as Gear number in display.
OBJECTIVES :-
Make a Simulink chart for the “Gear Shift” logic as per below conditions:
Speed Range (kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 60 5
Give the speed input while simulation is running & display the gear number.
BLOCKS USED:-
1. Constant Block- For Power and Water supply.

2. Slider Gain - it is use to define the Speed slider at the time of running simulation.
3. Chart Block- to create control logic program.

4. Display Block - to display the output of state.

CAR GEAR SHIFTS:
A manual transmission (also known as a manual gear box; abbreviated as MT ) is a multi-speed transmission where gear change require the drive to select the gear by manually operating a gear stick and clutch (which is usually a foot pedal for car, or a hand lever for motorcycles).
Early automobile used sliding mesh manual transmission with up to three forward gear ratios. Since the 1950s, constant mesh manual transmission have become increasingly common place and the number of forward ration has increased to 5- speed and 6-speed manual transmission for current vehicles.
The alternative to a manual transmission is the automatic transmission; common type of transmission is the hydraulic automatic transmission (AT), automated manual transmission (AMT), dual –clutch transmission (DCT), and the continuously variable transmission (CVT).
Gear box is the 2nd element in the powertrain in ana automobile. It is use to change speed and torque of the vehicle accordingly to varity of road and load conditions. The transmission box changes the engine speed into torque when climbing heels as per requirement of the vehicle & hence it is also known as Torque converter.
Following are main function of the Gearbox:-
1. Provide the torque needed to move the vehicle under the vanety of road and load conditions and doing this by changing the gear ratio between Engine Crankshaft and Vehicle Drive wheel.
2. To Provide assistance to shift backward/reverse so that the vehicle moves in that direction.
3. To Help the vehicle to shift into neutral for starting the engine.
Working:-
In the gear box the tertiary counter shaft is mashed to clutch with the use of couple of gear so the counter shift is always in running condition. When the tertiary shaft is brought into contact with the main shaft by the mean of meashing gear the main shaft starts to rotate according to the gear ratio. When the Driver wants to change the gear he simply press the clutch pedal which disconnect the teritary shaft with the engine and connect tha main shaft with tertiary shaft by another gear ratio by the use of gear shift lever.

STEPWISE PROCEDURE :-

- Create a Chart box for defining the stateflow as per the given condition.
- If the speed is less than 0 or equals to 0 , the flow is Terminated and Gear 0 is Activated.at the Junction else 1 is carry forwarded.
- If the speed is greater than 0 and less than or equal to 15 , the flow isnactivated and Gear 1 is Activated.
- If the speed is greater than 15 and less than or equal to 25 , the flow isnactivated and Gear 1 is Activated.
- If the speed is greater than 25 and less than or equal to 40 , the flow isnactivated and Gear 1 is Activated.
- If the speed is greater than 40 and less than or equal to 60 , the flow isnactivated and Gear 1 is Activated.
- If the speed is greater than 60, the flow is terminated and Gear 5 is Activated.
CONTROL LOGIC STRUCTURE -

EXPLANATION:
- Here we have used “CHART BOX” to define the gear shift logic for the condition given above as per in objective.
- 1st we have define 5 states namely “Gear_1” “Gear_2” “Gear_3” “Gear_4” “Gear_5”. The
- Now to shift from one state to another we have defined the conditions of the speeds as mentioned above.
- We have also defined the value inside the state which represent that when the particular state is going ON it will display the value that is defined in it. This will help us to see that which gear is operating at particular speed.
- The Transition condition for gear shifty is decided as
Forward direction,
Speed > 15 Shift to G = 2
Speed > 25 Shift to G = 3
Speed > 40 Shift to G = 4
Speed > 60 Shift to G = 5 (When the speed is increasing from 0-60 kmph)
Similarly in reverse direction,
Speed < 60 Shift to G = 4
Speed < 40 Shift to G = 3
Speed < 25 Shift to G = 2
Speed < 15 Shift to G = 1 (When the speed is decreasing from 60-0 kmph)
Symbol panel -

Here, "Speed" is an Input condition and "G" is Output Condition.
FLOWCHART :-

- After event creation flow chart is generated using some blocks from the library and there connection are done as mention below.
- A constant Block is connected with slider gain block to provide initial input.
- Slider Gain Block is use to define the speed by sliding the guage as per desire to change the speed during simulation is running and it acts as input for speed.
- the output port (G) is connected with the display to indicate the current engaged Gear for current speed in the slider gain.
- If the scope was connected at the begining and at end of state flow chart process the Graph will be as follow.
Speed Vs GearShift.

RESULTS -
When the run time is kept as an infinite and the slider is made to slide for the speed then we can see the gear number (G) as 4, By changing the slider position the display alue will change simultaneously.

CONCLUSIONS:
- Thus, all objectives were achieved successfully.
- Similar concepts and approach can be adopt to create state flow for other systems