Week - 4
AIM:
to make a simulink model using state -flow for given questions
SOLUTION 1:
THEORY:
1. a washing machine is a home appliance used to wash laundry. the term is mostly applied to machines that use water as opposed to dry cleaning or ultrasonic cleaners . the user adds laundry detergent ,which is sold in liquid or powder from ,to the wash water
2. the requirements to run the machine are the powder supply and water supply .and it performs the cleaning process of clothes by soaking ,washing ,rinsing, and drying ,and many more process
FOLLOWING IS THE SIMULATION MODEL FOR WASHING MACHINE APPLYING A GIVEN CONTROL LOGIC


. in the above model the simulation blocks used & their purpose are as follows:
1. constant- the constant block generates a real or complex constant value signal
2. stateflolwchart- stateflow provides a graphical launguage that includes state transition diagrams ,flowcharts ,state transtition tables,and truth tables.you can use stateflow to describe how matlab algorithms and simulink models react to input signals ,events and time-based conditions.
3.outport-provide an output port for a subsystem or model .
4.scope- display signals generaated during simulation
5.relational operator- applies the selected relational operator to the inputs and outputs the result
6. delay one step- delay input signal by a specified number of samples
7. stop simulation- stop simulation when input is noinzero
8. lamp-display a color that reflects an input value
9. rocker switch- set on /off value to tune parameters or variables
WORKING OF MODEL:
1. according to given control logic ,we need two inputs and signal output to complete the control logic.
2.the input signals are required for power and water supply and the output port is required to know the machine status
3. using constant block we provide the input signals ,since they are user interface the input signals are provided using the rocker switch block which is power supply switch and water supply switch
4. then for the machine to work according to the control logic sequences we use the state flow chart block ,where we build the control logic of the given sequences which acts upon their given inputs
5. now depending upon their inputs ,the control logic takes to transition from one state to another
6. the control logic is created in stateflowchart as shown below and works according to the given sequence

7. the control logic is built accordingly.
1. first we check the input of the power supply and display the signal according to the input.
2.then after 3sec of getting the power supply ,we move to the next state and check the water supply
3.after getting the power supply and water supply for 3 sec we make transition from the state of soaking where it also chects the power and water supply continously
4. after the soaking process is completed of 200sec it moves towards the washing process with 3 sec delay
5. then all soaking process states are acheived according to the given sequence and for each state transtion power and water supply are checked
8. from the control logic stateflowchart we collect the machine status as output
9. and according to outputs we display its process on the dashboard
10. after finishing the complete process ,we check it using the relational operator and then stops the simulation with 3sec delay
11. in the scope , we record the input and the machine status with time
RESULTS:
. FOLLOWING ARE THE RESULTS OF THE SIMULATION SEQUENTIALLY WITH TIME.
1. POWER SUPPLY


WATER SUPPLY:


SOAKING :




4.WASHING:




RINSING:




DRYING:




FINISH:



Q2
.SOLUTION 2:
.THEORY:
. a transmission is a machine in a power transmission system , which provides a controlled application of power . often the 5-speed transmission refers simply to the gearbox , that uses gears and gear trains to provide speed and torque conversations from a rotating power source to another device.

. FOLLOWING IS THE SIMULATION MODEL SOLVING THE GIVEN QUESTION:

IN THE ABOVE MODEL SIMULATION BLOCKS USED & THEIR PURPOSE ARE AS FOLLOWS:
1. constant- the constant block generates a real or complex value signal
2. slider gain- the slider gain block performs aa scalar gain that you can modify during simulation
3. stateflowchart- stateflow provides a graphical language that includes state transition diagrams ,flows charts,state transition tables ,and truth tables. you can see stateflow to describe how matlab algorithms and simulink models react to input signals ,events and time based conditions
4. scope- display signals generated during simulation
5. circular gauge- display an input value on a customized gauge
6. display- the display block shows the signal value as text
WORKING OF SUBSYSTEM MODEL:
1. the model is just a simple program of the control logic with the simple arithematic equation
2. we have 5-speed range and 5 gear system
3. according to the given system requirements ,we have built the control logic ,where it checks the speed and changes the gear according to it
4. following is the stateflowchart for provided gear system.

5. here we give the input speed while the simulation is running the stateflowchart runs the control logic and changes the gear according to the given speed input
6. we collect the output value from the chart
7. the two blocks circular gauge and display blocks represents the input speed the gear value according to it
8. after running the simulation we change the speed values using slider gain ,and then check its respective gear
9. we also use the scope block to record the speed input and then the gear output for the entire simulation
RESULT:
following is the simulation for the gear change according to the speed ,and the graph of it
